[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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:manage', $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 int $groupid (optional) The current groupid. 78 */ 79 public function __construct($courseid, $gpr, $context, $itemtype, $itemid, $groupid=null) { 80 parent::__construct($courseid, $gpr, $context); 81 82 $screenclass = "\\gradereport_singleview\\local\\screen\\$itemtype}"; 83 84 $this->screen = new $screenclass($courseid, $itemid, $groupid); 85 86 // Load custom or predifined js. 87 $this->screen->js(); 88 89 $base = '/grade/report/singleview/index.php'; 90 91 $idparams = array('id' => $courseid); 92 93 $this->baseurl = new moodle_url($base, $idparams); 94 95 $this->pbarurl = new moodle_url($base, $idparams + array( 96 'item' => $itemtype, 97 'itemid' => $itemid 98 )); 99 100 $this->setup_groups(); 101 } 102 103 /** 104 * Build the html for the screen. 105 * @return string HTML to display 106 */ 107 public function output() { 108 global $OUTPUT; 109 return $OUTPUT->box($this->screen->html()); 110 } 111 } 112
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |