MDL-46191 gradereport_history: Final clean up for integration

This commit is contained in:
Frederic Massart 2014-08-25 14:52:06 +08:00
parent 5bd36407af
commit 07f827acd4
9 changed files with 20 additions and 20 deletions

View File

@ -55,7 +55,7 @@ class filter_form extends \moodleform {
$mform->addElement('static', 'userselect', get_string('selectusers', 'gradereport_history'), $userbutton); $mform->addElement('static', 'userselect', get_string('selectusers', 'gradereport_history'), $userbutton);
$mform->addElement('static', 'selectednames', get_string('selectedusers', 'gradereport_history'), $names); $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->setType('itemid', PARAM_INT);
$mform->addElement('select', 'grader', get_string('grader', 'gradereport_history'), $graders); $mform->addElement('select', 'grader', get_string('grader', 'gradereport_history'), $graders);

View File

@ -45,7 +45,7 @@ class renderer extends \plugin_renderer_base {
* *
* @return string HTML to display * @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', $attributes = array('type' => 'button',
'class' => 'selectortrigger', 'class' => 'selectortrigger',
'value' => $button->label, 'value' => $button->label,

View File

@ -123,7 +123,7 @@ class tablelog extends \table_sql implements \renderable {
// Set table configs. // Set table configs.
$this->collapsible(true); $this->collapsible(true);
$this->sortable(true); $this->sortable(true, 'timemodified', SORT_DESC);
$this->pageable(true); $this->pageable(true);
$this->no_sorting('grader'); $this->no_sorting('grader');
} }
@ -151,13 +151,13 @@ class tablelog extends \table_sql implements \renderable {
// Add remaining headers. // Add remaining headers.
$cols = array_merge($cols, array( $cols = array_merge($cols, array(
'itemname' => get_string('gradeitem', 'gradereport_history'), 'itemname' => get_string('gradeitem', 'grades'),
'prevgrade' => get_string('gradeold', 'gradereport_history'), 'prevgrade' => get_string('gradeold', 'gradereport_history'),
'finalgrade' => get_string('gradenew', 'gradereport_history'), 'finalgrade' => get_string('gradenew', 'gradereport_history'),
'grader' => get_string('grader', 'gradereport_history'), 'grader' => get_string('grader', 'gradereport_history'),
'source' => get_string('source', 'gradereport_history'), 'source' => get_string('source', 'gradereport_history'),
'overridden' => get_string('overridden', 'gradereport_history'), 'overridden' => get_string('overridden', 'grades'),
'locked' => get_string('locked', 'gradereport_history'), 'locked' => get_string('locked', 'grades'),
'excluded' => get_string('excluded', 'gradereport_history'), 'excluded' => get_string('excluded', 'gradereport_history'),
'feedback' => get_string('feedbacktext', 'gradereport_history') 'feedback' => get_string('feedbacktext', 'gradereport_history')
) )
@ -231,7 +231,7 @@ class tablelog extends \table_sql implements \renderable {
* @return string HTML to display * @return string HTML to display
*/ */
public function col_overridden(\stdClass $history) { 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 * @return string HTML to display
*/ */
public function col_locked(\stdClass $history) { 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 * @return string HTML to display
*/ */
public function col_excluded(\stdClass $history) { 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');
} }
/** /**

View File

@ -35,6 +35,7 @@ $capabilities = array(
'teacher' => CAP_ALLOW, 'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW 'manager' => CAP_ALLOW
) ),
'clonepermissionsfrom' => 'gradereport/grader:view'
) )
); );

View File

@ -36,7 +36,6 @@ $string['foundoneuser'] = '1 user found';
$string['foundnusers'] = '{$a} users found'; $string['foundnusers'] = '{$a} users found';
$string['feedbacktext'] = 'Feedback text'; $string['feedbacktext'] = 'Feedback text';
$string['finishselectingusers'] = 'Finish selecting users'; $string['finishselectingusers'] = 'Finish selecting users';
$string['gradeitem'] = 'Grade item';
$string['gradenew'] = 'Revised grade'; $string['gradenew'] = 'Revised grade';
$string['gradeold'] = 'Original grade'; $string['gradeold'] = 'Original grade';
$string['grader'] = 'Grader'; $string['grader'] = 'Grader';
@ -44,9 +43,6 @@ $string['history:view'] = 'View the grade history';
$string['historyperpage'] = 'History entries per page'; $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['historyperpage_help'] = 'This setting determines the number of history entries displayed per page in the history report.';
$string['loadmoreusers'] = 'Load more users...'; $string['loadmoreusers'] = 'Load more users...';
$string['locked'] = 'Locked';
$string['noshort'] = 'N';
$string['overridden'] = 'Overridden';
$string['pluginname'] = 'Grade history'; $string['pluginname'] = 'Grade history';
$string['preferences'] = 'Grade history preferences'; $string['preferences'] = 'Grade history preferences';
$string['revisedonly'] = 'Revised grades only'; $string['revisedonly'] = 'Revised grades only';
@ -59,4 +55,3 @@ $string['selectedusers'] = 'Selected users';
$string['source'] = 'Source'; $string['source'] = 'Source';
$string['useractivitygrade'] = '{$a} grade'; $string['useractivitygrade'] = '{$a} grade';
$string['useractivityfeedback'] = '{$a} feedback'; $string['useractivityfeedback'] = '{$a} feedback';
$string['yesshort'] = 'Y';

View File

@ -27,7 +27,10 @@ defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) { if ($ADMIN->fulltree) {
// Add settings for this module to the $settings object (it's already defined). // 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'), $settings->add(new admin_setting_configtext('grade_report_historyperpage',
get_string('historyperpage_help', 'gradereport_history'), 50)); new lang_string('historyperpage', 'gradereport_history'),
new lang_string('historyperpage_help', 'gradereport_history'),
50
));
} }

View File

@ -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, $grades['c2m2u1f'] = $this->create_grade_history(array('itemid' => $gi->id, 'userid' => $u1->id,
'timemodified' => $now + 70, 'finalgrade' => 25)); // Not revised. '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. // 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['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)); // $grades['c2x2u5'] = $this->create_grade_history($giparams + array('itemid' => 999999, 'userid' => $u5->id, 'courseid' => $c1->id));

View File

@ -45,7 +45,6 @@ require_capability('moodle/grade:viewall', $context);
$outcome = new stdClass(); $outcome = new stdClass();
$outcome->success = true; $outcome->success = true;
$outcome->response = new stdClass();
$outcome->error = ''; $outcome->error = '';
$users = \gradereport_history\helper::get_users($context, $search, $page, 25); $users = \gradereport_history\helper::get_users($context, $search, $page, 25);
@ -71,4 +70,6 @@ foreach ($users as $user) {
$outcome->success = true; $outcome->success = true;
echo $OUTPUT->header();
echo json_encode($outcome); echo json_encode($outcome);
echo $OUTPUT->footer();

View File

@ -1034,7 +1034,7 @@ class core_plugin_manager {
), ),
'gradereport' => array( 'gradereport' => array(
'grader', 'outcomes', 'overview', 'user' 'grader', 'history', 'outcomes', 'overview', 'user'
), ),
'gradingform' => array( 'gradingform' => array(