MDL-29893 Fixing issues with password generation function
[moodle.git] / blocks / mentees / block_mentees.php
blob45d9463cf7bae49cb52aa759846f98705032542c
1 <?php
3 class block_mentees extends block_base {
5 function init() {
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() {
18 return true;
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
31 WHERE ra.userid = ?
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.'&amp;course='.SITEID.'">'.fullname($usercontext).'</a></li>';
40 $this->content->text .= '</ul>';
43 $this->content->footer = '';
45 return $this->content;