|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 class block_participants extends block_list { 00004 function init() { 00005 $this->title = get_string('pluginname', 'block_participants'); 00006 } 00007 00008 function get_content() { 00009 00010 global $CFG, $OUTPUT; 00011 00012 if (empty($this->instance)) { 00013 $this->content = ''; 00014 return $this->content; 00015 } 00016 00017 $this->content = new stdClass(); 00018 $this->content->items = array(); 00019 $this->content->icons = array(); 00020 $this->content->footer = ''; 00021 00023 $currentcontext = $this->page->context; 00024 00025 if ($this->page->course->id == SITEID) { 00026 if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) { 00027 $this->content = ''; 00028 return $this->content; 00029 } 00030 } else { 00031 if (!has_capability('moodle/course:viewparticipants', $currentcontext)) { 00032 $this->content = ''; 00033 return $this->content; 00034 } 00035 } 00036 $icon = '<img src="'.$OUTPUT->pix_url('i/users') . '" class="icon" alt="" /> '; 00037 $this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'. 00038 $CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.$icon.get_string('participants').'</a>'; 00039 00040 return $this->content; 00041 } 00042 00043 // my moodle can only have SITEID and it's redundant here, so take it away 00044 function applicable_formats() { 00045 return array('all' => true, 'my' => false, 'tag' => false); 00046 } 00047 00048 } 00049 00050