[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/blocks/activity_modules/ -> block_activity_modules.php (source)

   1  <?php //$Id: block_activity_modules.php,v 1.15.2.3 2008/03/03 11:41:01 moodler Exp $
   2  
   3  class block_activity_modules extends block_list {
   4      function init() {
   5          $this->title = get_string('activities');
   6          $this->version = 2007101509;
   7      }
   8  
   9      function get_content() {
  10          global $CFG, $COURSE;
  11  
  12          if($this->content !== NULL) {
  13              return $this->content;
  14          }
  15  
  16          $this->content = new stdClass;
  17          $this->content->items = array();
  18          $this->content->icons = array();
  19          $this->content->footer = '';
  20  
  21          if ($COURSE->id == $this->instance->pageid) {
  22              $course = $COURSE;
  23          } else {
  24              $course = get_record('course', 'id', $this->instance->pageid);
  25          }
  26  
  27          require_once($CFG->dirroot.'/course/lib.php');
  28  
  29          $modinfo = get_fast_modinfo($course);
  30          $modfullnames = array();
  31  
  32          foreach($modinfo->cms as $cm) {
  33              if (!$cm->uservisible) {
  34                  continue;
  35              }
  36              $modfullnames[$cm->modname] = $cm->modplural;
  37          }
  38  
  39          asort($modfullnames, SORT_LOCALE_STRING);
  40  
  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="" />';
  45              }
  46          }
  47  
  48          return $this->content;
  49      }
  50  
  51      function applicable_formats() {
  52          return array('all' => true, 'mod' => false, 'my' => false, 'admin' => false,
  53                       'tag' => false);
  54      }
  55  }
  56  
  57  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7