Merge branch 'MDL-65606-36' of https://github.com/Chocolate-lightning/moodle into MOODLE_36_STABLE

This commit is contained in:
Jun Pataleta
2019-05-27 16:27:09 +08:00
3 changed files with 24 additions and 2 deletions
+18
View File
@@ -71,5 +71,23 @@ function xmldb_data_upgrade($oldversion) {
// Automatically generated Moodle v3.6.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2018120301) {
$columns = $DB->get_columns('data');
$oldclass = "mod-data-default-template ##approvalstatus##";
$newclass = "mod-data-default-template ##approvalstatusclass##";
// Update existing classes.
$DB->replace_all_text('data', $columns['singletemplate'], $oldclass, $newclass);
$DB->replace_all_text('data', $columns['listtemplate'], $oldclass, $newclass);
$DB->replace_all_text('data', $columns['addtemplate'], $oldclass, $newclass);
$DB->replace_all_text('data', $columns['rsstemplate'], $oldclass, $newclass);
$DB->replace_all_text('data', $columns['asearchtemplate'], $oldclass, $newclass);
// Data savepoint reached.
upgrade_mod_savepoint(true, 2018120301, 'data');
}
return true;
}
+5 -1
View File
@@ -608,7 +608,7 @@ function data_generate_default_template(&$data, $template, $recordid=0, $form=fa
if ($fields = $DB->get_records('data_fields', array('dataid'=>$data->id), 'id')) {
$table = new html_table();
$table->attributes['class'] = 'mod-data-default-template ##approvalstatus##';
$table->attributes['class'] = 'mod-data-default-template ##approvalstatusclass##';
$table->colclasses = array('template-field', 'template-token');
$table->data = array();
foreach ($fields as $field) {
@@ -1507,12 +1507,16 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r
}
$patterns[] = '##approvalstatus##';
$patterns[] = '##approvalstatusclass##';
if (!$data->approval) {
$replacement[] = '';
$replacement[] = '';
} else if ($record->approved) {
$replacement[] = get_string('approved', 'data');
$replacement[] = 'approved';
} else {
$replacement[] = get_string('notapproved', 'data');
$replacement[] = 'notapproved';
}
$patterns[]='##comments##';
+1 -1
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2018120300; // The current module version (Date: YYYYMMDDXX)
$plugin->version = 2018120301; // The current module version (Date: YYYYMMDDXX)
$plugin->requires = 2018112800; // Requires this Moodle version
$plugin->component = 'mod_data'; // Full name of the plugin (used for diagnostics)
$plugin->cron = 0;