Skip to content

Commit

Permalink
MDL-32300 quiz manual grading report: also do some other cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Apr 5, 2012
1 parent d42b8ac commit 7e3ac96
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mod/quiz/report/grading/gradingsettings_form.php
Expand Up @@ -53,7 +53,7 @@ public function __construct($hidden, $counts, $shownames, $showidnumbers) {
}

protected function definition() {
$mform =& $this->_form;
$mform = $this->_form;

$mform->addElement('header', 'options', get_string('options', 'quiz_grading'));

Expand Down
1 change: 1 addition & 0 deletions mod/quiz/report/grading/lang/en/quiz_grading.php
Expand Up @@ -64,6 +64,7 @@
$string['hideautomaticallygraded'] = 'Hide questions that have been graded automatically';
$string['inprogress'] = 'In progress';
$string['noquestionsfound'] = 'No manually graded questions found';
$string['nothingfound'] = 'Nothing to display';
$string['options'] = 'Options';
$string['orderattempts'] = 'Order attempts';
$string['pluginname'] = 'Manual grading';
Expand Down
22 changes: 14 additions & 8 deletions mod/quiz/report/grading/report.php
Expand Up @@ -45,8 +45,6 @@ class quiz_grading_report extends quiz_default_report {

protected $viewoptions = array();
protected $questions;
protected $currentgroup;
protected $users;
protected $cm;
protected $quiz;
protected $context;
Expand Down Expand Up @@ -168,11 +166,19 @@ protected function get_qubaids_condition() {
quiza.timefinish <> 0";
$params = array('mangrquizid' => $this->cm->instance);

if ($this->currentgroup) {
list($usql, $uparam) = $DB->get_in_or_equal(array_keys($this->users),
SQL_PARAMS_NAMED, 'mangru');
$where .= ' AND quiza.userid ' . $usql;
$params += $uparam;
$currentgroup = groups_get_activity_group($this->cm, true);
if ($currentgroup) {
$users = get_users_by_capability($this->context,
array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), 'u.id, u.id', '', '', '',
$currentgroup, '', false);
if (empty($users)) {
$where .= ' AND quiza.userid = 0';
} else {
list($usql, $uparam) = $DB->get_in_or_equal(array_keys($users),
SQL_PARAMS_NAMED, 'mangru');
$where .= ' AND quiza.userid ' . $usql;
$params += $uparam;
}
}

return new qubaid_join('{quiz_attempts} quiza', 'quiza.uniqueid', $where, $params);
Expand Down Expand Up @@ -308,7 +314,7 @@ protected function display_index($includeauto) {
}

if (empty($data)) {
echo $OUTPUT->heading(get_string('noquestionsfound', 'quiz_grading'));
echo $OUTPUT->heading(get_string('nothingfound', 'quiz_grading'));
return;
}

Expand Down

0 comments on commit 7e3ac96

Please sign in to comment.