[ Index ] |
PHP Cross Reference of Unnamed Project |
[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 * Participants block 19 * 20 * @package block_participants 21 * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 class block_participants extends block_list { 26 function init() { 27 $this->title = get_string('pluginname', 'block_participants'); 28 } 29 30 function get_content() { 31 32 global $CFG, $OUTPUT; 33 34 if (empty($this->instance)) { 35 $this->content = ''; 36 return $this->content; 37 } 38 39 $this->content = new stdClass(); 40 $this->content->items = array(); 41 $this->content->icons = array(); 42 $this->content->footer = ''; 43 44 // user/index.php expect course context, so get one if page has module context. 45 $currentcontext = $this->page->context->get_course_context(false); 46 47 if (empty($currentcontext)) { 48 $this->content = ''; 49 return $this->content; 50 } else if ($this->page->course->id == SITEID) { 51 if (!has_capability('moodle/site:viewparticipants', context_system::instance())) { 52 $this->content = ''; 53 return $this->content; 54 } 55 } else { 56 if (!has_capability('moodle/course:viewparticipants', $currentcontext)) { 57 $this->content = ''; 58 return $this->content; 59 } 60 } 61 62 $icon = '<img src="'.$OUTPUT->pix_url('i/users') . '" class="icon" alt="" />'; 63 $this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'. 64 $CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.$icon.get_string('participants').'</a>'; 65 66 return $this->content; 67 } 68 69 // my moodle can only have SITEID and it's redundant here, so take it away 70 function applicable_formats() { 71 return array('all' => true, 'my' => false, 'tag' => false); 72 } 73 74 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |