Differences Between: [Versions 400 and 402] [Versions 400 and 403]
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 lib class for singleview functionality. 19 * 20 * @package gradereport_singleview 21 * @copyright 2014 Moodle Pty Ltd (http://moodle.com) 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die; 26 27 require_once($CFG->dirroot . '/grade/report/lib.php'); 28 29 /** 30 * This class is the main class that must be implemented by a grade report plugin. 31 * 32 * @package gradereport_singleview 33 * @copyright 2014 Moodle Pty Ltd (http://moodle.com) 34 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 35 */ 36 class gradereport_singleview extends grade_report { 37 38 /** 39 * Return the list of valid screens, used to validate the input. 40 * 41 * @return array List of screens. 42 */ 43 public static function valid_screens() { 44 // This is a list of all the known classes representing a screen in this plugin. 45 return array('user', 'select', 'grade'); 46 } 47 48 /** 49 * Process data from a form submission. Delegated to the current screen. 50 * 51 * @param array $data The data from the form 52 * @return array List of warnings 53 */ 54 public function process_data($data) { 55 if (has_capability('moodle/grade:edit', $this->context)) { 56 return $this->screen->process($data); 57 } 58 } 59 60 /** 61 * Unused - abstract function declared in the parent class. 62 * 63 * @param string $target 64 * @param string $action 65 */ 66 public function process_action($target, $action) { 67 } 68 69 /** 70 * Constructor for this report. Creates the appropriate screen class based on itemtype. 71 * 72 * @param int $courseid The course id. 73 * @param object $gpr grade plugin return tracking object 74 * @param context_course $context 75 * @param string $itemtype Should be user, select or grade 76 * @param int $itemid The id of the user or grade item 77 * @param string $unused Used to be group id but that was removed and this is now unused. 78 */ 79 public function __construct($courseid, $gpr, $context, $itemtype, $itemid, $unused = null) { 80 parent::__construct($courseid, $gpr, $context); 81 82 $base = '/grade/report/singleview/index.php'; 83 84 $idparams = array('id' => $courseid); 85 86 $this->baseurl = new moodle_url($base, $idparams); 87 88 $this->pbarurl = new moodle_url($base, $idparams + array( 89 'item' => $itemtype, 90 'itemid' => $itemid 91 )); 92 93 // The setup_group method is used to validate group mode and permissions and define the currentgroup value. 94 $this->setup_groups(); 95 96 $screenclass = "\\gradereport_singleview\\local\\screen\\$itemtype}"; 97 98 $this->screen = new $screenclass($courseid, $itemid, $this->currentgroup); 99 100 // Load custom or predifined js. 101 $this->screen->js(); 102 } 103 104 /** 105 * Build the html for the screen. 106 * @return string HTML to display 107 */ 108 public function output() { 109 global $OUTPUT; 110 return $OUTPUT->container($this->screen->html(), 'reporttable'); 111 } 112 } 113
title
Description
Body
title
Description
Body
title
Description
Body
title
Body