[ 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 * 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 * @package gradereport_singleview 36 * @copyright 2014 Moodle Pty Ltd (http://moodle.com) 37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 38 */ 39 class select extends screen { 40 41 /** 42 * Initialise this screen 43 * 44 * @param bool $selfitemisempty Has an item been selected (will be false) 45 */ 46 public function init($selfitemisempty = false) { 47 global $DB; 48 49 $roleids = explode(',', get_config('moodle', 'gradebookroles')); 50 51 $this->items = get_role_users( 52 $roleids, $this->context, false, '', 53 'u.id, u.lastname, u.firstname', null, $this->groupid, 54 $this->perpage * $this->page, $this->perpage 55 ); 56 $this->item = $DB->get_record('course', array('id' => $this->courseid)); 57 } 58 59 /** 60 * Get the type of items on this screen, not valid so return false. 61 * 62 * @return bool 63 */ 64 public function item_type() { 65 return false; 66 } 67 68 /** 69 * Return the HTML for the page. 70 * 71 * @return string 72 */ 73 public function html() { 74 global $OUTPUT; 75 76 $html = ''; 77 78 $types = gradereport_singleview::valid_screens(); 79 80 foreach ($types as $type) { 81 $classname = "gradereport_singleview\\local\\screen\\$type}"; 82 83 $screen = new $classname($this->courseid, null, $this->groupid); 84 85 if (!$screen instanceof selectable_items) { 86 continue; 87 } 88 89 $options = $screen->options(); 90 91 if (empty($options)) { 92 continue; 93 } 94 95 $params = array( 96 'id' => $this->courseid, 97 'item' => $screen->item_type(), 98 'group' => $this->groupid 99 ); 100 101 $url = new moodle_url('/grade/report/singleview/index.php', $params); 102 103 $select = new \single_select($url, 'itemid', $options); 104 $select->set_label($screen->description()); 105 $html .= $OUTPUT->render($select); 106 } 107 108 if (empty($html)) { 109 $OUTPUT->notification(get_string('noscreens', 'gradereport_singleview')); 110 } 111 112 return $html; 113 } 114 115 /** 116 * Should we show the next prev selector? 117 * @return bool 118 */ 119 public function supports_next_prev() { 120 return false; 121 } 122 }
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 |