Index: mod/quiz/view.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/view.php,v retrieving revision 1.151 diff -u -r1.151 view.php --- mod/quiz/view.php 25 Sep 2008 06:40:53 -0000 1.151 +++ mod/quiz/view.php 31 Oct 2008 06:21:01 -0000 @@ -108,7 +108,7 @@ print_box_end(); /// Show number of attempts summary to those who can view reports. - if (has_capability('mod/quiz:viewreports', $context)) { + if (quiz_report_has_view_capability($context)) { if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm)) { echo '
' . $strattemptnum . "
\n"; Index: mod/quiz/reviewquestion.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/reviewquestion.php,v retrieving revision 1.31 diff -u -r1.31 reviewquestion.php --- mod/quiz/reviewquestion.php 18 Sep 2008 07:39:10 -0000 1.31 +++ mod/quiz/reviewquestion.php 31 Oct 2008 06:21:00 -0000 @@ -21,7 +21,7 @@ require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm()); /// Permissions checks for normal users who do not have quiz:viewreports capability. - if (!$attemptobj->has_capability('mod/quiz:viewreports')) { + if (!$attemptobj->quiz_report_has_view_capability()) { /// Can't review during the attempt - send them back to the attempt page. if (!$attemptobj->is_finished()) { notify(get_string('cannotreviewopen', 'quiz')); @@ -85,7 +85,7 @@ $attemptobj->get_question($questionid)->name) . ''; /// Other attempts at the quiz. - if ($attemptobj->has_capability('mod/quiz:viewreports')) { + if ($attemptobj->quiz_report_has_view_capability()) { $attemptlist = $attemptobj->links_to_other_attempts( 'reviewquestion.php?attempt=' . $attemptobj->get_attemptid() . '&question=' . $questionid); Index: mod/quiz/comment.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/comment.php,v retrieving revision 1.14 diff -u -r1.14 comment.php --- mod/quiz/comment.php 18 Sep 2008 07:39:10 -0000 1.14 +++ mod/quiz/comment.php 31 Oct 2008 06:20:57 -0000 @@ -22,7 +22,7 @@ /// Check login and permissions. require_login($attemptobj->get_courseid(), false, $attemptobj->get_cm()); - $attemptobj->require_capability('mod/quiz:grade'); + $attemptobj->require_capability('quizreport/grading:view'); /// Load the questions and states. $questionids = array($questionid); Index: mod/quiz/index.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/index.php,v retrieving revision 1.59 diff -u -r1.59 index.php --- mod/quiz/index.php 10 Jun 2008 06:27:38 -0000 1.59 +++ mod/quiz/index.php 31 Oct 2008 06:20:57 -0000 @@ -55,7 +55,7 @@ $showing = 'scores'; // default - if (has_capability('mod/quiz:viewreports', $coursecontext)) { + if (quiz_report_has_view_capability($coursecontext)) { array_push($headings, get_string('attempts', 'quiz')); array_push($align, 'left'); $showing = 'stats'; Index: mod/quiz/lib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/lib.php,v retrieving revision 1.319 diff -u -r1.319 lib.php --- mod/quiz/lib.php 23 Sep 2008 07:18:15 -0000 1.319 +++ mod/quiz/lib.php 31 Oct 2008 06:20:58 -0000 @@ -661,10 +661,9 @@ $cm_context = get_context_instance(CONTEXT_MODULE, $cm->id); - $grader = has_capability('moodle/grade:viewall', $cm_context); $accessallgroups = has_capability('moodle/site:accessallgroups', $cm_context); $viewfullnames = has_capability('moodle/site:viewfullnames', $cm_context); - $grader = has_capability('mod/quiz:grade', $cm_context); + $grader = has_capability('quizreport/grading:view', $cm_context); $groupmode = groups_get_activity_groupmode($cm, $course); if (is_null($modinfo->groups)) { @@ -1154,7 +1153,7 @@ if ($attempt->userid == $USER->id) { return true; // access granted if the current user has permission to grade quizzes in this course - } else if (has_capability('mod/quiz:viewreports', $context) || has_capability('mod/quiz:grade', $context)) { + } else if (has_capability('quizreport/grading:view', $context)) { return true; } @@ -1194,7 +1193,7 @@ /// Now provide more information depending on the uers's role. $context = get_context_instance(CONTEXT_MODULE, $quiz->coursemodule); - if (has_capability('mod/quiz:viewreports', $context)) { + if (quiz_report_has_view_capability($context)) { /// For teacher-like people, show a summary of the number of student attempts. // The $quiz objects returned by get_all_instances_in_course have the necessary $cm // fields set to make the following call work. @@ -1272,13 +1271,23 @@ default: return null; } } - +function quiz_report_caps($viewonly=false){ + global $DB; + if ($viewonly){ + $like = 'quizreport/%:view'; + } else { + $like = 'quizreport/%'; + } + return $DB->get_records_select_menu('capabilities', "name LIKE ?", array($like), '', 'id, name'); +} /** * @return array all other caps used in module */ function quiz_get_extra_capabilities() { $caps = question_get_all_capabilities(); $caps[] = 'moodle/site:accessallgroups'; + + $caps = array_merge($caps, quiz_report_caps()); return $caps; } Index: mod/quiz/locallib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/locallib.php,v retrieving revision 1.162 diff -u -r1.162 locallib.php --- mod/quiz/locallib.php 26 Sep 2008 05:57:55 -0000 1.162 +++ mod/quiz/locallib.php 31 Oct 2008 06:20:58 -0000 @@ -820,12 +820,12 @@ } // Show a link to the comment box only for closed attempts - if ($attempt->timefinish && has_capability('mod/quiz:grade', $context)) { + if ($attempt->timefinish && has_capability('quizreport/grading:view', $context)) { $options->questioncommentlink = '/mod/quiz/comment.php'; } // Whether to display a response history. - $canviewreports = has_capability('mod/quiz:viewreports', $context); + $canviewreports = quiz_report_has_view_capability($context); $options->history = ($canviewreports && !$attempt->preview) ? 'all' : 'graded'; if ($canviewreports && has_capability('moodle/grade:viewhidden', $context) && !$attempt->preview) { @@ -1100,4 +1100,51 @@ } print_error($errorcode, 'quiz', $CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz, $a); } + +function quiz_report_has_view_capability($context, $returnany=true){ + global $DB; + // Standard reports we want to show first. + //order the reports tab in descending order of displayorder + $reportrs = $DB->get_recordset('quiz_report', null, 'displayorder DESC', 'id, name'); + + $reportlist = array(); + foreach ($reportrs as $key => $rs) { + $reportlist[]='quizreport/'.$rs->name.':view'; + } + + $viewcaps = quiz_report_caps(true); + //add any other reports on the end + foreach ($viewcaps as $report) { + if (!in_array($report, $reportlist)) { + $reportlist[]=$report; + } + } + $reportswithperm = array(); + while ($cap = array_shift($reportlist)){ + if (has_capability($cap, $context)){ + if (preg_match('|^quizreport/(.*):view$|', $cap, $matches)){ + if ($returnany){ + return $matches[1]; + } else { + $reportswithperm[] = $matches[1]; + } + } + } + } + if (!$reportswithperm){ + return false; + } else { + return $reportswithperm; + } +} +function quiz_report_require_view_capability($context){ + global $CFG, $COURSE; + if (!$return = quiz_report_has_view_capability($context)){ + $a = get_string('reportviewany', 'quiz'); + $errorlink = $CFG->wwwroot.'/course/view.php?id='.$COURSE->id; + print_error('nopermissions', '', $errorlink, $a); + } else { + return $return; + } +} ?> Index: mod/quiz/tabs.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/tabs.php,v retrieving revision 1.32 diff -u -r1.32 tabs.php --- mod/quiz/tabs.php 29 Jul 2008 11:53:31 -0000 1.32 +++ mod/quiz/tabs.php 31 Oct 2008 06:21:00 -0000 @@ -35,7 +35,8 @@ if (has_capability('mod/quiz:view', $context)) { $row[] = new tabobject('info', "$CFG->wwwroot/mod/quiz/view.php?id=$cm->id", get_string('info', 'quiz')); } -if (has_capability('mod/quiz:viewreports', $context)) { +$reportlist = quiz_report_has_view_capability($context, false); +if ($reportlist) { $row[] = new tabobject('reports', "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id", get_string('results', 'quiz')); } if (has_capability('mod/quiz:preview', $context)) { @@ -54,38 +55,13 @@ if ($currenttab == 'reports' and isset($mode)) { $activated[] = 'reports'; - // Standard reports we want to show first. - $reportrs = $DB->get_recordset('quiz_report', null, 'displayorder DESC', 'id, name'); - // Reports that are restricted by capability. - $reportrestrictions = array( - 'regrade' => 'mod/quiz:grade', - 'grading' => 'mod/quiz:grade' - ); - $reportdirs = get_list_of_plugins("mod/quiz/report"); - //order the reports tab in descending order of displayorder - $reportlist = array(); - foreach ($reportrs as $key => $rs) { - if (in_array($rs->name, $reportdirs)) { - $reportlist[]=$rs->name; - } - } - - //add any other reports on the end - foreach ($reportdirs as $report) { - if (!in_array($report, $reportlist)) { - $reportlist[]=$report; - } - } - $row = array(); $currenttab = ''; foreach ($reportlist as $report) { - if (!isset($reportrestrictions[$report]) || has_capability($reportrestrictions[$report], $context)) { - $row[] = new tabobject($report, "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id&mode=$report", - get_string($report, 'quiz_'.$report)); - if ($report == $mode) { - $currenttab = $report; - } + $row[] = new tabobject($report, "$CFG->wwwroot/mod/quiz/report.php?q=$quiz->id&mode=$report", + get_string($report, 'quiz_'.$report)); + if ($report == $mode) { + $currenttab = $report; } } $tabs[] = $row; Index: mod/quiz/grade.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/grade.php,v retrieving revision 1.4 diff -u -r1.4 grade.php --- mod/quiz/grade.php 10 Jun 2008 06:27:38 -0000 1.4 +++ mod/quiz/grade.php 31 Oct 2008 06:20:57 -0000 @@ -1,6 +1,7 @@ dirroot . '/mod/quiz/locallib.php'); $id = required_param('id', PARAM_INT); // Course module ID @@ -18,7 +19,7 @@ require_login($course->id, false, $cm); - if (has_capability('mod/quiz:viewreports', get_context_instance(CONTEXT_MODULE, $cm->id))) { + if (quiz_report_has_view_capability(get_context_instance(CONTEXT_MODULE, $cm->id))) { redirect('report.php?id='.$cm->id); } else { redirect('view.php?id='.$cm->id); Index: mod/quiz/review.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/review.php,v retrieving revision 1.83 diff -u -r1.83 review.php --- mod/quiz/review.php 26 Sep 2008 10:49:31 -0000 1.83 +++ mod/quiz/review.php 31 Oct 2008 06:21:00 -0000 @@ -24,7 +24,7 @@ $options = $attemptobj->get_review_options(); /// Permissions checks for normal users who do not have quiz:viewreports capability. - if (!$attemptobj->has_capability('mod/quiz:viewreports')) { + if (!$attemptobj->quiz_report_has_view_capability()) { /// Can't review during the attempt - send them back to the attempt page. if (!$attemptobj->is_finished()) { redirect($attemptobj->attempt_url(0, $page)); @@ -142,7 +142,7 @@ $CFG->wwwroot . '/user/view.php?id=' . $student->id . '&course=' . $attemptobj->get_courseid() . '">' . fullname($student, true) . ''; } - if ($attemptobj->has_capability('mod/quiz:viewreports')) { + if ($attemptobj->quiz_report_has_view_capability()) { $attemptlist = $attemptobj->links_to_other_attempts($attemptobj->review_url(0, $page, $showall)); if ($attemptlist) { $rows[] = '' . get_string('attempts', 'quiz') . Index: mod/quiz/attemptlib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/attemptlib.php,v retrieving revision 1.29 diff -u -r1.29 attemptlib.php --- mod/quiz/attemptlib.php 23 Sep 2008 07:18:15 -0000 1.29 +++ mod/quiz/attemptlib.php 31 Oct 2008 06:20:56 -0000 @@ -233,6 +233,14 @@ return require_capability($capability, $this->context, $userid, $doanything); } + /** + * Wrapper round the quiz_report_has_view_capability function that + * automatically passes in the quiz context. + */ + public function quiz_report_has_view_capability($returnany=true){ + return quiz_report_has_view_capability($this->context, $returnany); + } + // URLs related to this attempt ======================================================== /** * @return string the URL of this quiz's view page. @@ -482,7 +490,7 @@ /** * Is this a student dealing with their own attempt/teacher previewing, - * or someone with 'mod/quiz:viewreports' reviewing someone elses attempt. + * or someone with 'quizreport/*:view' reviewing someone elses attempt. * * @return boolean whether this situation should be treated as someone looking at their own * attempt. The distinction normally only matters when an attempt is being reviewed. Index: mod/quiz/report.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/report.php,v retrieving revision 1.50 diff -u -r1.50 report.php --- mod/quiz/report.php 24 Jun 2008 08:59:29 -0000 1.50 +++ mod/quiz/report.php 31 Oct 2008 06:21:00 -0000 @@ -9,7 +9,7 @@ $id = optional_param('id',0,PARAM_INT); // Course Module ID, or $q = optional_param('q',0,PARAM_INT); // quiz ID - $mode = optional_param('mode', 'overview', PARAM_ALPHA); // Report mode + $mode = optional_param('mode', '', PARAM_ALPHA); // Report mode if ($id) { if (! $cm = get_coursemodule_from_id('quiz', $id)) { @@ -38,7 +38,11 @@ require_login($course, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); - require_capability('mod/quiz:viewreports', $context); + if (!$mode){ + $mode = quiz_report_require_view_capability($context); + } else { + require_capability("quizreport/$mode:view", $context); + } // if no questions have been set up yet redirect to edit.php if (!$quiz->questions and has_capability('mod/quiz:manage', $context)) { Index: lang/en_utf8/quiz_responses.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz_responses.php,v retrieving revision 1.8 diff -u -r1.8 quiz_responses.php --- lang/en_utf8/quiz_responses.php 25 Sep 2008 01:55:40 -0000 1.8 +++ lang/en_utf8/quiz_responses.php 31 Oct 2008 06:20:47 -0000 @@ -5,6 +5,8 @@ $string['pagesize'] = 'Page Size'; $string['reportresponses'] = 'Responses'; $string['responses'] = 'Responses'; +$string['responses:view'] = 'Manual grading'; +$string['responses:componentname'] = 'Quiz responses report'; $string['responsesreport'] = 'Responses report'; $string['responsesdownload'] = 'Responses download'; ?> Index: lang/en_utf8/quiz_statistics.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz_statistics.php,v retrieving revision 1.16 diff -u -r1.16 quiz_statistics.php --- lang/en_utf8/quiz_statistics.php 11 Sep 2008 12:48:09 -0000 1.16 +++ lang/en_utf8/quiz_statistics.php 31 Oct 2008 06:20:47 -0000 @@ -3,6 +3,8 @@ $string['statistics'] = 'Statistics'; +$string['statistics:view'] = 'View statistics report'; +$string['statistics:componentname'] = 'Quiz statistics report'; $string['statisticsreport'] = 'Statistics report'; $string['calculatefrom'] = 'Calculate statistics from'; Index: lang/en_utf8/quiz.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz.php,v retrieving revision 1.113 diff -u -r1.113 quiz.php --- lang/en_utf8/quiz.php 25 Sep 2008 08:22:00 -0000 1.113 +++ lang/en_utf8/quiz.php 31 Oct 2008 06:20:47 -0000 @@ -544,6 +544,7 @@ $string['reportresponses'] = 'Detailed responses'; $string['reports'] = 'Reports'; $string['reportsimplestat'] = 'Simple statistics'; +$string['reportviewany'] = 'View any quiz report'; $string['requirepassword'] = 'Require password'; $string['requirepasswordmessage'] = 'To attempt this quiz you need to know the quiz password'; $string['requiresubnet'] = 'Require network address'; Index: lang/en_utf8/quiz_overview.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz_overview.php,v retrieving revision 1.18 diff -u -r1.18 quiz_overview.php --- lang/en_utf8/quiz_overview.php 12 Sep 2008 08:33:40 -0000 1.18 +++ lang/en_utf8/quiz_overview.php 31 Oct 2008 06:20:47 -0000 @@ -24,6 +24,8 @@ $string['optnoattemptsonly'] = '$a who have not attempted the quiz'; $string['optonlygradedattempts'] = 'that are graded for each user ($a)'; $string['optonlyregradedattempts'] = 'that have been regraded / are marked as needing regrading'; +$string['overview:view'] = 'View grades report'; +$string['overview:componentname'] = 'Quiz grades report'; $string['overview'] = 'Grades'; $string['overviewreport'] = 'Grades report'; $string['overviewdownload'] = 'Overview download'; Index: lang/en_utf8/quiz_grading.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz_grading.php,v retrieving revision 1.9 diff -u -r1.9 quiz_grading.php --- lang/en_utf8/quiz_grading.php 25 Sep 2008 08:22:00 -0000 1.9 +++ lang/en_utf8/quiz_grading.php 31 Oct 2008 06:20:47 -0000 @@ -7,6 +7,8 @@ $string['invalidquestionid'] = 'Gradeable question with id $a not found'; $string['invalidattemptid'] = 'No such attempt ID exists'; $string['grading'] = 'Manual grading'; +$string['grading:view'] = 'Manual grading'; +$string['grading:componentname'] = 'Quiz manual grading report'; $string['gradingreport'] = 'Manual grading report'; $string['gradeall'] = 'Grade all $a attempts'; $string['graded'] = '(graded)'; Index: mod/quiz/report/overview/overview_table.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/report/overview/overview_table.php,v retrieving revision 1.15 diff -u -r1.15 overview_table.php --- mod/quiz/report/overview/overview_table.php 24 Sep 2008 10:22:57 -0000 1.15 +++ mod/quiz/report/overview/overview_table.php 31 Oct 2008 06:21:02 -0000 @@ -94,7 +94,7 @@ echo ''. get_string('selectnone', 'quiz').' '; echo '  '; - if (has_capability('mod/quiz:grade', $this->context)){ + if (has_capability('quizreport/overview:regrade', $this->context)){ echo ''; } echo ''; @@ -317,12 +317,12 @@ } } $this->gradedstatesbyattempt = quiz_get_newgraded_states($attemptids, true, 'qs.id, qs.grade, qs.event, qs.question, qs.attempt'); - if (has_capability('mod/quiz:grade', $this->context)){ + if (has_capability('quizreport/overview:regrade', $this->context)){ $this->regradedqs = quiz_get_regraded_qs($attemptids); } } else { $this->gradedstatesbyattempt = quiz_get_newgraded_states($this->sql, true, 'qs.id, qs.grade, qs.event, qs.question, qs.attempt'); - if (has_capability('mod/quiz:grade', $this->context)){ + if (has_capability('quizreport/overview:regrade', $this->context)){ $this->regradedqs = quiz_get_regraded_qs($this->sql); } } Index: mod/quiz/report/overview/overviewgraph.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/report/overview/overviewgraph.php,v retrieving revision 1.8 diff -u -r1.8 overviewgraph.php --- mod/quiz/report/overview/overviewgraph.php 15 Aug 2008 09:59:55 -0000 1.8 +++ mod/quiz/report/overview/overviewgraph.php 31 Oct 2008 06:21:02 -0000 @@ -27,7 +27,7 @@ $group = false; $groupusers = array(); } -require_capability('mod/quiz:viewreports', $modcontext); +require_capability('quizreport/overview:view', $modcontext); $line = new graph(800,600); $line->parameter['title'] = ''; Index: mod/quiz/report/overview/report.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/report/overview/report.php,v retrieving revision 1.160 diff -u -r1.160 report.php --- mod/quiz/report/overview/report.php 23 Sep 2008 07:18:16 -0000 1.160 +++ mod/quiz/report/overview/report.php 31 Oct 2008 06:21:03 -0000 @@ -278,7 +278,7 @@ $headers = array(); if (!$table->is_downloading()) { //do not print notices when downloading //regrade buttons - if (has_capability('mod/quiz:grade', $this->context)){ + if (has_capability('quizreport/overview:regrade', $this->context)){ $countregradeneeded = $this->count_regrade_all_needed($quiz, $groupstudents); if ($currentgroup){ $a= new object(); @@ -359,7 +359,7 @@ $headers[] = $header; } } - if (!$table->is_downloading() && has_capability('mod/quiz:grade', $this->context) && $regradedattempts){ + if (!$table->is_downloading() && has_capability('quizreport/overview:regrade', $this->context) && $regradedattempts){ $columns[] = 'regraded'; $headers[] = get_string('regrade', 'quiz_overview'); } @@ -424,10 +424,7 @@ */ function regrade_all($dry, $quiz, $groupstudents){ global $DB; - if (!has_capability('mod/quiz:grade', $this->context)) { - notify(get_string('regradenotallowed', 'quiz')); - return true; - } + require_capability('quizreport/overview:regrade', $this->context); // Fetch all attempts if ($groupstudents){ list($usql, $params) = $DB->get_in_or_equal($groupstudents); @@ -507,10 +504,7 @@ } function regrade_all_needed($quiz, $groupstudents){ global $DB; - if (!has_capability('mod/quiz:grade', $this->context)) { - notify(get_string('regradenotallowed', 'quiz')); - return; - } + require_capability('quizreport/overview:regrade', $this->context); // Fetch all attempts that need regrading if ($groupstudents){ list($usql, $params) = $DB->get_in_or_equal($groupstudents); @@ -636,7 +630,7 @@ } function regrade_selected_attempts($quiz, $attemptids, $groupstudents){ global $DB; - require_capability('mod/quiz:grade', $this->context); + require_capability('quizreport/overview:regrade', $this->context); if ($groupstudents){ list($usql, $params) = $DB->get_in_or_equal($groupstudents); $where = "qa.userid $usql AND "; Index: mod/quiz/report/overview/overviewsettings_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/report/overview/overviewsettings_form.php,v retrieving revision 1.9 diff -u -r1.9 overviewsettings_form.php --- mod/quiz/report/overview/overviewsettings_form.php 12 Sep 2008 08:33:40 -0000 1.9 +++ mod/quiz/report/overview/overviewsettings_form.php 31 Oct 2008 06:21:02 -0000 @@ -37,7 +37,7 @@ $gm = ''.quiz_get_grading_option_name($this->_customdata['quiz']->grademethod).''; $showattemptsgrp[] =& $mform->createElement('advcheckbox', 'qmfilter', get_string('showattempts', 'quiz_overview'), get_string('optonlygradedattempts', 'quiz_overview', $gm), null, array(0,1)); } - if (has_capability('mod/quiz:grade', $this->_customdata['context'])){ + if (has_capability('quizreport/overview:regrade', $this->_customdata['context'])){ $showattemptsgrp[] =& $mform->createElement('advcheckbox', 'regradefilter', get_string('showattempts', 'quiz_overview'), get_string('optonlyregradedattempts', 'quiz_overview'), null, array(0,1)); } if ($showattemptsgrp){ Index: mod/quiz/report/overview/version.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/quiz/report/overview/version.php,v retrieving revision 1.1 diff -u -r1.1 version.php --- mod/quiz/report/overview/version.php 11 Jul 2008 07:27:14 -0000 1.1 +++ mod/quiz/report/overview/version.php 31 Oct 2008 06:21:03 -0000 @@ -5,6 +5,6 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$plugin->version = 2008062700; // The (date) version of this module +$plugin->version = 2008103000; // The (date) version of this module ?> Index: question/type/questiontype.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/questiontype.php,v retrieving revision 1.106 diff -u -r1.106 questiontype.php --- question/type/questiontype.php 21 Oct 2008 06:22:16 -0000 1.106 +++ question/type/questiontype.php 31 Oct 2008 06:21:05 -0000 @@ -927,7 +927,7 @@ $comment = $state->manualcomment; $commentlink = ''; - if (isset($options->questioncommentlink) && $context && has_capability('mod/quiz:grade', $context)) { + if (isset($options->questioncommentlink) && $context && has_capability('quizreport/grading:view', $context)) { $strcomment = get_string('commentorgrade', 'quiz'); $question_to_comment = isset($question->randomquestionid) ? $question->randomquestionid : $question->id; $commentlink = '