3 class block_participants extends block_list {
5 $this->title = get_string('people');
6 $this->version = 2007101509;
9 function get_content() {
13 if (empty($this->instance)) {
15 return $this->content;
18 $this->content = new object();
19 $this->content->items = array();
20 $this->content->icons = array();
21 $this->content->footer = '';
23 /// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
24 $currentcontext = $this->page->context;
26 if ($this->page->course->id == SITEID) {
27 if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
29 return $this->content;
32 if (!has_capability('moodle/course:viewparticipants', $currentcontext)) {
34 return $this->content;
38 $this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'.
39 $CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.get_string('participants').'</a>';
40 $this->content->icons[] = '<img src="'.$OUTPUT->pix_url('i/users') . '" class="icon" alt="" />';
42 return $this->content;
45 // my moodle can only have SITEID and it's redundant here, so take it away
46 function applicable_formats() {
47 return array('all' => true, 'my' => false, 'tag' => false);