3 class block_activity_modules
extends block_list
{
5 $this->title
= get_string('activities');
6 $this->version
= 2006011300;
9 function get_content() {
12 // TODO: FIX: HACK: (any other tags I should add? :P)
13 // Hacker's improvised caching scheme: avoid fetching the mod
14 // data from db if the course format has already fetched them
15 if(!isset($GLOBALS['modnamesplural']) ||
!isset($GLOBALS['modnamesused'])) {
16 require_once($CFG->dirroot
.'/course/lib.php');
17 if (!empty($this->instance
)) {
18 get_all_mods($this->instance
->pageid
, $mods, $modnames, $modnamesplural, $modnamesused);
22 $modnamesplural = $GLOBALS['modnamesplural'];
23 $modnamesused = $GLOBALS['modnamesused'];
26 if($this->content
!== NULL) {
27 return $this->content
;
30 $this->content
= new stdClass
;
31 $this->content
->items
= array();
32 $this->content
->icons
= array();
33 $this->content
->footer
= '';
35 if (isset($modnamesused) && $modnamesused) {
36 foreach ($modnamesused as $modname => $modfullname) {
37 if ($modname != 'label') {
38 $this->content
->items
[] = '<a href="'.$CFG->wwwroot
.'/mod/'.$modname.'/index.php?id='.$this->instance
->pageid
.'">'.$modnamesplural[$modname].'</a>';
39 $this->content
->icons
[] = '<img src="'.$CFG->modpixpath
.'/'.$modname.'/icon.gif" class="icon" alt="" />';
44 return $this->content
;
47 function applicable_formats() {
48 return array('all' => true, 'mod' => false, 'my' => false, 'admin' => false);