modification for new features
[moodle.git] / blocks / participants / block_participants.php
CommitLineData
0f3fe4b6 1<?PHP //$Id$
2
3class CourseBlock_participants extends MoodleBlock {
4 function CourseBlock_participants ($course) {
5 $this->title = get_string('people');
6 $this->content_type = BLOCK_TYPE_LIST;
7 $this->course = $course;
89adb174 8 $this->version = 2004052600;
0f3fe4b6 9 }
10
11 function get_content() {
12 global $USER, $CFG;
13
14 if($this->content !== NULL) {
15 return $this->content;
16 }
17
18 $this->content = New object;
19 $this->content->items = array();
20 $this->content->icons = array();
21 $this->content->footer = '';
22
23 $strgroups = get_string('groups');
24 $strgroupmy = get_string('groupmy');
25
c4f8793e 26 $this->content->items[]='<a title="'.get_string('listofallpeople').'" href="'.$CFG->wwwroot.'/user/index.php?id='.$this->course->id.'">'.get_string('participants').'</a>';
0f3fe4b6 27 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/users.gif" height="16" width="16" alt="">';
28
29 if ($this->course->groupmode or !$this->course->groupmodeforce) {
30 if ($this->course->groupmode == VISIBLEGROUPS or isteacheredit($this->course->id)) {
c4f8793e 31 $this->content->items[]='<a title="'.$strgroups.'" href="'.$CFG->wwwroot.'/course/groups.php?id='.$this->course->id.'">'.$strgroups.'</a>';
0f3fe4b6 32 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/group.gif" height="16" width="16" alt="">';
33 } else if ($this->course->groupmode == SEPARATEGROUPS and $this->course->groupmodeforce) {
34 // Show nothing
35 } else if ($currentgroup = get_current_group($this->course->id)) {
c4f8793e 36 $this->content->items[]='<a title="'.$strgroupmy.'" href="'.$CFG->wwwroot.'/course/group.php?id='.$this->course->id.'">'.$strgroupmy.'</a>';
0f3fe4b6 37 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/group.gif" height="16" width="16" alt="">';
38 }
39 }
40
5132e606 41 if (!empty($USER->id)) {
89adb174 42 $fullname = fullname($USER, true);
c4f8793e 43 $editmyprofile = '<a title="'.$fullname.'" href="'.$CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.$this->course->id.'">'.get_string('editmyprofile').'</a>';
89adb174 44 if ($USER->description) {
45 $this->content->items[]= $editmyprofile;
46 } else {
47 $this->content->items[]= $editmyprofile." <blink>*</blink>";
48 }
49 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="">';
0f3fe4b6 50 }
0f3fe4b6 51
52 return $this->content;
53 }
54}
55
56?>