Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * Base class for quiz report plugins. 19 * 20 * @package mod_quiz 21 * @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com} 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 29 /** 30 * Base class for quiz report plugins. 31 * 32 * Doesn't do anything on it's own -- it needs to be extended. 33 * This class displays quiz reports. Because it is called from 34 * within /mod/quiz/report.php you can assume that the page header 35 * and footer are taken care of. 36 * 37 * This file can refer to itself as report.php to pass variables 38 * to itself - all these will also be globally available. You must 39 * pass "id=$cm->id" or q=$quiz->id", and "mode=reportname". 40 * 41 * @copyright 1999 onwards Martin Dougiamas and others {@link http://moodle.com} 42 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 43 */ 44 abstract class quiz_default_report { 45 const NO_GROUPS_ALLOWED = -2; 46 47 /** 48 * Override this function to displays the report. 49 * @param $cm the course-module for this quiz. 50 * @param $course the coures we are in. 51 * @param $quiz this quiz. 52 */ 53 public abstract function display($cm, $course, $quiz); 54 55 /** 56 * Initialise some parts of $PAGE and start output. 57 * 58 * @param object $cm the course_module information. 59 * @param object $coures the course settings. 60 * @param object $quiz the quiz settings. 61 * @param string $reportmode the report name. 62 */ 63 public function print_header_and_tabs($cm, $course, $quiz, $reportmode = 'overview') { 64 global $PAGE, $OUTPUT, $CFG; 65 66 // Print the page header. 67 $PAGE->set_title($quiz->name); 68 $PAGE->set_heading($course->fullname); 69 echo $OUTPUT->header(); 70 $context = context_module::instance($cm->id); 71 echo $OUTPUT->heading(format_string($quiz->name, true, array('context' => $context))); 72 if (!empty($CFG->enableplagiarism)) { 73 require_once($CFG->libdir . '/plagiarismlib.php'); 74 echo plagiarism_update_status($course, $cm); 75 } 76 } 77 78 /** 79 * Get the current group for the user user looking at the report. 80 * 81 * @param object $cm the course_module information. 82 * @param object $coures the course settings. 83 * @param context $context the quiz context. 84 * @return int the current group id, if applicable. 0 for all users, 85 * NO_GROUPS_ALLOWED if the user cannot see any group. 86 */ 87 public function get_current_group($cm, $course, $context) { 88 $groupmode = groups_get_activity_groupmode($cm, $course); 89 $currentgroup = groups_get_activity_group($cm, true); 90 91 if ($groupmode == SEPARATEGROUPS && !$currentgroup && !has_capability('moodle/site:accessallgroups', $context)) { 92 $currentgroup = self::NO_GROUPS_ALLOWED; 93 } 94 95 return $currentgroup; 96 } 97 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body