Skip to content

Commit

Permalink
Course certificate addon support added.
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanna-lmsace committed Apr 4, 2024
1 parent 21326fb commit dffb270
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion classes/local/data_grid/field/attribute/date_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class date_attribute extends abstract_field_attribute {
*/
public function transform_data($data, \stdClass $record) {
if (is_numeric($data) && $data > 0) {
return userdate($data, get_string('strftimedatefullshort'));
$format = $this->get_option('format') ?: get_string('strftimedatefullshort');
return userdate($data, $format);
}

return null;
Expand Down
5 changes: 5 additions & 0 deletions classes/local/data_grid/field/attribute/widget_attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ public function transform_data($data, \stdClass $record) {
global $PAGE, $DB;
$widget = $this->get_option('widget');
$method = $this->get_option('method');
$callback = $this->get_option('callback');
if ($widget && $method) {
if (method_exists($widget, $method)) {
$data = $widget->$method($record);
}
}

if ($callback) {
$data = $callback($record, $data);
}

return $data;
}
}
4 changes: 3 additions & 1 deletion lang/en/block_dash.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,4 +788,6 @@
$string['programbg'] = "Enrol Program image";
$string['programbg_desc'] = "";


// Course certificate datasource strings.
$string['downloadcertificate'] = 'Download certificate';
$string['certificatecodelinked'] = 'Code linked';

0 comments on commit dffb270

Please sign in to comment.