0f3fe4b6 |
1 | <?PHP //$Id$ |
2 | |
3 | class 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; |
8 | $this->version = 2004041800; |
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 | |
26 | $this->content->items[]='<a title="'.get_string('listofallpeople').'" href="../user/index.php?id='.$this->course->id.'">'.get_string('participants').'</a>'; |
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)) { |
31 | $this->content->items[]='<a title="'.$strgroups.'" href="groups.php?id='.$this->course->id.'">'.$strgroups.'</a>'; |
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)) { |
36 | $this->content->items[]='<a title="'.$strgroupmy.'" href="group.php?id='.$this->course->id.'">'.$strgroupmy.'</a>'; |
37 | $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/group.gif" height="16" width="16" alt="">'; |
38 | } |
39 | } |
40 | |
41 | $fullname = fullname($USER, true); |
42 | $editmyprofile = '<a title="'.$fullname.'" href="../user/edit.php?id='.$USER->id.'&course='.$this->course->id.'">'.get_string('editmyprofile').'</a>'; |
43 | if ($USER->description) { |
44 | $this->content->items[]= $editmyprofile; |
45 | } else { |
46 | $this->content->items[]= $editmyprofile." <blink>*</blink>"; |
47 | } |
48 | $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" height="16" width="16" alt="">'; |
49 | |
50 | return $this->content; |
51 | } |
52 | } |
53 | |
54 | ?> |