Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / blocks / activity_modules / block_activity_modules.php
blob14e9239d1be825dab2e1b78f779941930ac4ec73
1 <?php //$Id$
3 class block_activity_modules extends block_list {
4 function init() {
5 $this->title = get_string('activities');
6 $this->version = 2007101509;
9 function get_content() {
10 global $CFG, $COURSE;
12 if($this->content !== NULL) {
13 return $this->content;
16 $this->content = new stdClass;
17 $this->content->items = array();
18 $this->content->icons = array();
19 $this->content->footer = '';
21 if ($COURSE->id == $this->instance->pageid) {
22 $course = $COURSE;
23 } else {
24 $course = get_record('course', 'id', $this->instance->pageid);
27 require_once($CFG->dirroot.'/course/lib.php');
29 $modinfo = get_fast_modinfo($course);
30 $modfullnames = array();
32 foreach($modinfo->cms as $cm) {
33 if (!$cm->uservisible) {
34 continue;
36 $modfullnames[$cm->modname] = $cm->modplural;
39 asort($modfullnames, SORT_LOCALE_STRING);
41 foreach ($modfullnames as $modname => $modfullname) {
42 if ($modname != 'label') {
43 $this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$this->instance->pageid.'">'.$modfullname.'</a>';
44 $this->content->icons[] = '<img src="'.$CFG->modpixpath.'/'.$modname.'/icon.gif" class="icon" alt="" />';
48 return $this->content;
51 function applicable_formats() {
52 return array('all' => true, 'mod' => false, 'my' => false, 'admin' => false,
53 'tag' => false);