diff --git a/grade/report/history/classes/filter_form.php b/grade/report/history/classes/filter_form.php index 21f26c66330..0e51229338f 100644 --- a/grade/report/history/classes/filter_form.php +++ b/grade/report/history/classes/filter_form.php @@ -55,7 +55,7 @@ class filter_form extends \moodleform { $mform->addElement('static', 'userselect', get_string('selectusers', 'gradereport_history'), $userbutton); $mform->addElement('static', 'selectednames', get_string('selectedusers', 'gradereport_history'), $names); - $mform->addElement('select', 'itemid', get_string('gradeitem', 'gradereport_history'), $itemids); + $mform->addElement('select', 'itemid', get_string('gradeitem', 'grades'), $itemids); $mform->setType('itemid', PARAM_INT); $mform->addElement('select', 'grader', get_string('grader', 'gradereport_history'), $graders); diff --git a/grade/report/history/classes/output/renderer.php b/grade/report/history/classes/output/renderer.php index 515a95c0fe1..384822a4ffc 100644 --- a/grade/report/history/classes/output/renderer.php +++ b/grade/report/history/classes/output/renderer.php @@ -45,7 +45,7 @@ class renderer extends \plugin_renderer_base { * * @return string HTML to display */ - public function render_user_button(user_button $button) { + protected function render_user_button(user_button $button) { $attributes = array('type' => 'button', 'class' => 'selectortrigger', 'value' => $button->label, diff --git a/grade/report/history/classes/output/tablelog.php b/grade/report/history/classes/output/tablelog.php index 370076acd5b..0132406522e 100644 --- a/grade/report/history/classes/output/tablelog.php +++ b/grade/report/history/classes/output/tablelog.php @@ -123,7 +123,7 @@ class tablelog extends \table_sql implements \renderable { // Set table configs. $this->collapsible(true); - $this->sortable(true); + $this->sortable(true, 'timemodified', SORT_DESC); $this->pageable(true); $this->no_sorting('grader'); } @@ -151,13 +151,13 @@ class tablelog extends \table_sql implements \renderable { // Add remaining headers. $cols = array_merge($cols, array( - 'itemname' => get_string('gradeitem', 'gradereport_history'), + 'itemname' => get_string('gradeitem', 'grades'), 'prevgrade' => get_string('gradeold', 'gradereport_history'), 'finalgrade' => get_string('gradenew', 'gradereport_history'), 'grader' => get_string('grader', 'gradereport_history'), 'source' => get_string('source', 'gradereport_history'), - 'overridden' => get_string('overridden', 'gradereport_history'), - 'locked' => get_string('locked', 'gradereport_history'), + 'overridden' => get_string('overridden', 'grades'), + 'locked' => get_string('locked', 'grades'), 'excluded' => get_string('excluded', 'gradereport_history'), 'feedback' => get_string('feedbacktext', 'gradereport_history') ) @@ -231,7 +231,7 @@ class tablelog extends \table_sql implements \renderable { * @return string HTML to display */ public function col_overridden(\stdClass $history) { - return $history->overridden ? get_string('yes', 'gradereport_history') : get_string('no', 'gradereport_history'); + return $history->overridden ? get_string('yes') : get_string('no'); } /** @@ -242,7 +242,7 @@ class tablelog extends \table_sql implements \renderable { * @return string HTML to display */ public function col_locked(\stdClass $history) { - return $history->locked ? get_string('yes', 'gradereport_history') : get_string('no', 'gradereport_history'); + return $history->locked ? get_string('yes') : get_string('no'); } /** @@ -253,7 +253,7 @@ class tablelog extends \table_sql implements \renderable { * @return string HTML to display */ public function col_excluded(\stdClass $history) { - return $history->excluded ? get_string('yesshort', 'gradereport_history') : get_string('noshort', 'gradereport_history'); + return $history->excluded ? get_string('yes') : get_string('no'); } /** diff --git a/grade/report/history/db/access.php b/grade/report/history/db/access.php index 9800850a20e..0d1bd5d3560 100644 --- a/grade/report/history/db/access.php +++ b/grade/report/history/db/access.php @@ -35,6 +35,7 @@ $capabilities = array( 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, 'manager' => CAP_ALLOW - ) + ), + 'clonepermissionsfrom' => 'gradereport/grader:view' ) ); diff --git a/grade/report/history/lang/en/gradereport_history.php b/grade/report/history/lang/en/gradereport_history.php index 5ac645bc9f0..651df2543ef 100644 --- a/grade/report/history/lang/en/gradereport_history.php +++ b/grade/report/history/lang/en/gradereport_history.php @@ -36,7 +36,6 @@ $string['foundoneuser'] = '1 user found'; $string['foundnusers'] = '{$a} users found'; $string['feedbacktext'] = 'Feedback text'; $string['finishselectingusers'] = 'Finish selecting users'; -$string['gradeitem'] = 'Grade item'; $string['gradenew'] = 'Revised grade'; $string['gradeold'] = 'Original grade'; $string['grader'] = 'Grader'; @@ -44,9 +43,6 @@ $string['history:view'] = 'View the grade history'; $string['historyperpage'] = 'History entries per page'; $string['historyperpage_help'] = 'This setting determines the number of history entries displayed per page in the history report.'; $string['loadmoreusers'] = 'Load more users...'; -$string['locked'] = 'Locked'; -$string['noshort'] = 'N'; -$string['overridden'] = 'Overridden'; $string['pluginname'] = 'Grade history'; $string['preferences'] = 'Grade history preferences'; $string['revisedonly'] = 'Revised grades only'; @@ -59,4 +55,3 @@ $string['selectedusers'] = 'Selected users'; $string['source'] = 'Source'; $string['useractivitygrade'] = '{$a} grade'; $string['useractivityfeedback'] = '{$a} feedback'; -$string['yesshort'] = 'Y'; diff --git a/grade/report/history/settings.php b/grade/report/history/settings.php index 51b20d66fb9..c841c805713 100644 --- a/grade/report/history/settings.php +++ b/grade/report/history/settings.php @@ -27,7 +27,10 @@ defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { // Add settings for this module to the $settings object (it's already defined). - $settings->add(new admin_setting_configtext('grade_report_historyperpage', get_string('historyperpage', 'gradereport_history'), - get_string('historyperpage_help', 'gradereport_history'), 50)); + $settings->add(new admin_setting_configtext('grade_report_historyperpage', + new lang_string('historyperpage', 'gradereport_history'), + new lang_string('historyperpage_help', 'gradereport_history'), + 50 + )); } diff --git a/grade/report/history/tests/report_test.php b/grade/report/history/tests/report_test.php index 1d39bba8f34..7a3959d2a4a 100644 --- a/grade/report/history/tests/report_test.php +++ b/grade/report/history/tests/report_test.php @@ -115,7 +115,7 @@ class gradereport_history_report_testcase extends advanced_testcase { $grades['c2m2u1f'] = $this->create_grade_history(array('itemid' => $gi->id, 'userid' => $u1->id, 'timemodified' => $now + 70, 'finalgrade' => 25)); // Not revised. - // TODO MDL-46737 Handle deleted/non-existing grade items. + // TODO MDL-46736 Handle deleted/non-existing grade items. // Histories with missing grade items, considered as deleted. // $grades['c2x1u5'] = $this->create_grade_history($giparams + array('itemid' => -1, 'userid' => $u5->id, 'courseid' => $c1->id)); // $grades['c2x2u5'] = $this->create_grade_history($giparams + array('itemid' => 999999, 'userid' => $u5->id, 'courseid' => $c1->id)); diff --git a/grade/report/history/users_ajax.php b/grade/report/history/users_ajax.php index f092357c839..387a1aab186 100644 --- a/grade/report/history/users_ajax.php +++ b/grade/report/history/users_ajax.php @@ -45,7 +45,6 @@ require_capability('moodle/grade:viewall', $context); $outcome = new stdClass(); $outcome->success = true; -$outcome->response = new stdClass(); $outcome->error = ''; $users = \gradereport_history\helper::get_users($context, $search, $page, 25); @@ -71,4 +70,6 @@ foreach ($users as $user) { $outcome->success = true; +echo $OUTPUT->header(); echo json_encode($outcome); +echo $OUTPUT->footer(); diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index e45f6235311..69a706ae060 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -1034,7 +1034,7 @@ class core_plugin_manager { ), 'gradereport' => array( - 'grader', 'outcomes', 'overview', 'user' + 'grader', 'history', 'outcomes', 'overview', 'user' ), 'gradingform' => array(