2009-11-01 12:00:47 +00:00
|
|
|
<?php
|
2004-04-18 23:20:53 +00:00
|
|
|
|
2005-03-02 19:22:26 +00:00
|
|
|
class block_participants extends block_list {
|
2004-10-19 21:04:28 +00:00
|
|
|
function init() {
|
2010-04-11 11:33:39 +00:00
|
|
|
$this->title = get_string('pluginname', 'block_participants');
|
2004-04-18 23:20:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function get_content() {
|
2007-03-05 20:13:16 +00:00
|
|
|
|
2009-07-02 10:53:31 +00:00
|
|
|
global $CFG, $OUTPUT;
|
2007-03-05 20:13:16 +00:00
|
|
|
|
|
|
|
if (empty($this->instance)) {
|
|
|
|
$this->content = '';
|
|
|
|
return $this->content;
|
|
|
|
}
|
|
|
|
|
2010-09-21 08:10:17 +00:00
|
|
|
$this->content = new stdClass();
|
2007-10-02 03:37:30 +00:00
|
|
|
$this->content->items = array();
|
|
|
|
$this->content->icons = array();
|
|
|
|
$this->content->footer = '';
|
2009-05-06 09:15:33 +00:00
|
|
|
|
2008-01-30 16:43:19 +00:00
|
|
|
/// MDL-13252 Always get the course context or else the context may be incorrect in the user/index.php
|
2009-05-06 09:15:33 +00:00
|
|
|
$currentcontext = $this->page->context;
|
|
|
|
|
2009-05-06 09:28:26 +00:00
|
|
|
if ($this->page->course->id == SITEID) {
|
2007-10-02 03:37:30 +00:00
|
|
|
if (!has_capability('moodle/site:viewparticipants', get_context_instance(CONTEXT_SYSTEM))) {
|
|
|
|
$this->content = '';
|
|
|
|
return $this->content;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!has_capability('moodle/course:viewparticipants', $currentcontext)) {
|
|
|
|
$this->content = '';
|
|
|
|
return $this->content;
|
|
|
|
}
|
2004-04-18 23:20:53 +00:00
|
|
|
}
|
2010-08-20 06:29:22 +00:00
|
|
|
$icon = '<img src="'.$OUTPUT->pix_url('i/users') . '" class="icon" alt="" /> ';
|
2007-03-05 20:13:16 +00:00
|
|
|
$this->content->items[] = '<a title="'.get_string('listofallpeople').'" href="'.
|
2010-08-20 06:29:22 +00:00
|
|
|
$CFG->wwwroot.'/user/index.php?contextid='.$currentcontext->id.'">'.$icon.get_string('participants').'</a>';
|
2004-04-18 23:20:53 +00:00
|
|
|
|
|
|
|
return $this->content;
|
|
|
|
}
|
2007-03-05 20:13:16 +00:00
|
|
|
|
2005-08-16 00:25:39 +00:00
|
|
|
// my moodle can only have SITEID and it's redundant here, so take it away
|
|
|
|
function applicable_formats() {
|
2007-08-10 09:33:21 +00:00
|
|
|
return array('all' => true, 'my' => false, 'tag' => false);
|
2005-08-16 00:25:39 +00:00
|
|
|
}
|
2005-10-28 04:11:17 +00:00
|
|
|
|
2004-04-18 23:20:53 +00:00
|
|
|
}
|
|
|
|
|
2009-11-01 12:00:47 +00:00
|
|
|
|