3 class block_mentees
extends block_base
{
6 $this->title
= get_string('pluginname', 'block_mentees');
9 function applicable_formats() {
10 return array('all' => true, 'tag' => false);
13 function specialization() {
14 $this->title
= isset($this->config
->title
) ?
$this->config
->title
: get_string('newmenteesblock', 'block_mentees');
17 function instance_allow_multiple() {
21 function get_content() {
22 global $CFG, $USER, $DB;
24 if ($this->content
!== NULL) {
25 return $this->content
;
28 // get all the mentees, i.e. users you have a direct assignment to
29 if ($usercontexts = $DB->get_records_sql("SELECT c.instanceid, c.instanceid, u.firstname, u.lastname
30 FROM {role_assignments} ra, {context} c, {user} u
32 AND ra.contextid = c.id
33 AND c.instanceid = u.id
34 AND c.contextlevel = ".CONTEXT_USER
, array($USER->id
))) {
36 $this->content
->text
= '<ul>';
37 foreach ($usercontexts as $usercontext) {
38 $this->content
->text
.= '<li><a href="'.$CFG->wwwroot
.'/user/view.php?id='.$usercontext->instanceid
.'&course='.SITEID
.'">'.fullname($usercontext).'</a></li>';
40 $this->content
->text
.= '</ul>';
43 $this->content
->footer
= '';
45 return $this->content
;