Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 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 * The gradebook simple view - initial view to select your search options 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 namespace gradereport_singleview\local\screen; 26 27 use gradereport_singleview; 28 use moodle_url; 29 30 defined('MOODLE_INTERNAL') || die; 31 32 /** 33 * The gradebook simple view - initial view to select your search options 34 * 35 * @deprecated since Moodle 4.3 36 * @package gradereport_singleview 37 * @copyright 2014 Moodle Pty Ltd (http://moodle.com) 38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 39 */ 40 class select extends screen { 41 42 /** @var \stdClass course data. */ 43 public $item; 44 45 /** 46 * Initialise this screen 47 * 48 * @deprecated since Moodle 4.3 49 * @param bool $selfitemisempty Has an item been selected (will be false) 50 */ 51 public function init($selfitemisempty = false) { 52 global $DB; 53 54 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 55 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 56 57 $roleids = explode(',', get_config('moodle', 'gradebookroles')); 58 59 $this->items = []; 60 foreach ($roleids as $roleid) { 61 // Keeping the first user appearance. 62 $this->items = $this->items + get_role_users( 63 $roleid, $this->context, false, '', 64 'u.id, u.lastname, u.firstname', null, $this->groupid, 65 $this->perpage * $this->page, $this->perpage 66 ); 67 } 68 $this->item = $DB->get_record('course', ['id' => $this->courseid]); 69 } 70 71 /** 72 * Get the type of items on this screen, not valid so return false. 73 * 74 * @deprecated since Moodle 4.3 75 * @return string|null 76 */ 77 public function item_type(): ?string { 78 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 79 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 80 81 return false; 82 } 83 84 /** 85 * Return the HTML for the page. 86 * 87 * @deprecated since Moodle 4.3 88 * @return string 89 */ 90 public function html(): string { 91 global $OUTPUT, $COURSE; 92 93 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 94 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 95 96 if ($this->itemid === null) { 97 $userlink = new \moodle_url('/grade/report/singleview/index.php', ['id' => $COURSE->id, 'item' => 'user_select']); 98 $gradelink = new \moodle_url('/grade/report/singleview/index.php', ['id' => $COURSE->id, 'item' => 'grade_select']); 99 $context = [ 100 'courseid' => $COURSE->id, 101 'imglink' => $OUTPUT->image_url('zero_state', 'gradereport_singleview'), 102 'userzerolink' => $userlink->out(false), 103 'userselectactive' => false, 104 'gradezerolink' => $gradelink->out(false), 105 'gradeselectactive' => false, 106 'displaylabel' => false 107 ]; 108 return $OUTPUT->render_from_template('gradereport_singleview/zero_state', $context); 109 } 110 111 $html = ''; 112 113 $types = gradereport_singleview\report\singleview::valid_screens(); 114 115 foreach ($types as $type) { 116 $classname = "gradereport_singleview\\local\\screen\\{$type}"; 117 118 $screen = new $classname($this->courseid, null, $this->groupid); 119 120 if (!$screen instanceof selectable_items) { 121 continue; 122 } 123 124 $options = $screen->options(); 125 126 if (empty($options)) { 127 continue; 128 } 129 130 $params = [ 131 'id' => $this->courseid, 132 'item' => $screen->item_type(), 133 'group' => $this->groupid 134 ]; 135 136 $url = new moodle_url('/grade/report/singleview/index.php', $params); 137 138 $select = new \single_select($url, 'itemid', $options, '', ['' => $screen->select_label()]); 139 $select->set_label($screen->select_label(), ['class' => 'accesshide']); 140 $html .= $OUTPUT->render($select); 141 } 142 $html = $OUTPUT->container($html, 'selectitems'); 143 144 if (empty($html)) { 145 $OUTPUT->notification(get_string('noscreens', 'gradereport_singleview')); 146 } 147 148 return $html; 149 } 150 151 /** 152 * Should we show the next prev selector? 153 * 154 * @deprecated since Moodle 4.3 155 * @return bool 156 */ 157 public function supports_next_prev(): bool { 158 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 159 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 160 161 return false; 162 } 163 164 /** 165 * Should we show the base singlereport group selector? 166 * 167 * @deprecated since Moodle 4.3 168 * @return bool 169 */ 170 public function display_group_selector(): bool { 171 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 172 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 173 174 if ($this->itemid === null) { 175 return false; 176 } 177 return true; 178 } 179 180 /** 181 * Get the heading for the screen. 182 * 183 * @deprecated since Moodle 4.3 184 * @return string 185 */ 186 public function heading(): string { 187 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 188 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 189 190 return ' '; 191 } 192 193 /** 194 * Does this screen support paging? 195 * 196 * @deprecated since Moodle 4.3 197 * @return bool 198 */ 199 public function supports_paging(): bool { 200 debugging('The function ' . __FUNCTION__ . '() is deprecated as part of the deprecation process of the ' . 201 '\gradereport_singleview\local\screen\select class which is no longer used.', DEBUG_DEVELOPER); 202 203 return false; 204 } 205 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body