MDL-50720 mod_data: Highlight non-approved entries
This commit is contained in:
@@ -31,6 +31,7 @@ $string['addtemplate'] = 'Add template';
|
||||
$string['advancedsearch'] = 'Advanced search';
|
||||
$string['allowcomments'] = 'Allow comments on entries';
|
||||
$string['alttext'] = 'Alternative text';
|
||||
$string['approvalstatus'] = 'Approval status';
|
||||
$string['approve'] = 'Approve';
|
||||
$string['approved'] = 'Approved';
|
||||
$string['areacontent'] = 'Fields';
|
||||
|
||||
+10
-1
@@ -552,7 +552,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';
|
||||
$table->attributes['class'] = 'mod-data-default-template ##approvalstatus##';
|
||||
$table->colclasses = array('template-field', 'template-token');
|
||||
$table->data = array();
|
||||
foreach ($fields as $field) {
|
||||
@@ -1327,6 +1327,15 @@ function data_print_template($template, $records, $data, $search='', $page=0, $r
|
||||
$replacement[] = '';
|
||||
}
|
||||
|
||||
$patterns[] = '##approvalstatus##';
|
||||
if (!$data->approval) {
|
||||
$replacement[] = '';
|
||||
} else if ($record->approved) {
|
||||
$replacement[] = 'approved';
|
||||
} else {
|
||||
$replacement[] = 'notapproved';
|
||||
}
|
||||
|
||||
$patterns[]='##comments##';
|
||||
if (($template == 'listtemplate') && ($data->comments)) {
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
.mod-data-default-template .template-token {text-align:left;}
|
||||
.mod-data-default-template .controls {text-align:center;}
|
||||
.mod-data-default-template searchcontrols {text-align:right;}
|
||||
.mod-data-default-template.notapproved {background-color:#FFCCCC;}
|
||||
#page-mod-data-templates td.save_template,
|
||||
#page-mod-data-templates .template_heading {
|
||||
text-align:center;
|
||||
|
||||
@@ -277,6 +277,7 @@ if ($mode != 'csstemplate' and $mode != 'jstemplate') {
|
||||
echo '<option value="##timemodified##">'.get_string('timemodified', 'data'). ' - ##timemodified##</option>';
|
||||
echo '<option value="##user##">' .get_string('user'). ' - ##user##</option>';
|
||||
echo '<option value="##userpicture##">' . get_string('userpic') . ' - ##userpicture##</option>';
|
||||
echo '<option value="##approvalstatus##">' .get_string('approvalstatus', 'data'). ' - ##approvalstatus##</option>';
|
||||
if ($mode != 'singletemplate') {
|
||||
// more points to single template - not useable there
|
||||
echo '<option value="##comments##">' .get_string('comments', 'data'). ' - ##comments##</option>';
|
||||
|
||||
Reference in New Issue
Block a user