See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * This file contains the Activity modules block. 19 * 20 * @package block_activity_modules 21 * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com) 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 defined('MOODLE_INTERNAL') || die(); 26 require_once($CFG->libdir . '/filelib.php'); 27 28 class block_activity_modules extends block_list { 29 function init() { 30 $this->title = get_string('pluginname', 'block_activity_modules'); 31 } 32 33 function get_content() { 34 global $CFG, $DB, $OUTPUT; 35 36 if($this->content !== NULL) { 37 return $this->content; 38 } 39 40 $this->content = new stdClass; 41 $this->content->items = array(); 42 $this->content->icons = array(); 43 $this->content->footer = ''; 44 45 $course = $this->page->course; 46 47 require_once($CFG->dirroot.'/course/lib.php'); 48 49 $modinfo = get_fast_modinfo($course); 50 $modfullnames = array(); 51 52 $archetypes = array(); 53 54 foreach($modinfo->cms as $cm) { 55 // Exclude activities that aren't visible or have no view link (e.g. label). Account for folder being displayed inline. 56 if (!$cm->uservisible || (!$cm->has_view() && strcmp($cm->modname, 'folder') !== 0)) { 57 continue; 58 } 59 if (array_key_exists($cm->modname, $modfullnames)) { 60 continue; 61 } 62 if (!array_key_exists($cm->modname, $archetypes)) { 63 $archetypes[$cm->modname] = plugin_supports('mod', $cm->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER); 64 } 65 if ($archetypes[$cm->modname] == MOD_ARCHETYPE_RESOURCE) { 66 if (!array_key_exists('resources', $modfullnames)) { 67 $modfullnames['resources'] = get_string('resources'); 68 } 69 } else { 70 $modfullnames[$cm->modname] = $cm->modplural; 71 } 72 } 73 74 core_collator::asort($modfullnames); 75 76 foreach ($modfullnames as $modname => $modfullname) { 77 if ($modname === 'resources') { 78 $icon = $OUTPUT->pix_icon('monologo', '', 'mod_page', array('class' => 'icon')); 79 $this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$icon.$modfullname.'</a>'; 80 } else { 81 $icon = $OUTPUT->image_icon('monologo', get_string('pluginname', $modname), $modname); 82 $this->content->items[] = '<a href="'.$CFG->wwwroot.'/mod/'.$modname.'/index.php?id='.$course->id.'">'.$icon.$modfullname.'</a>'; 83 } 84 } 85 86 return $this->content; 87 } 88 89 /** 90 * Returns the role that best describes this blocks contents. 91 * 92 * This returns 'navigation' as the blocks contents is a list of links to activities and resources. 93 * 94 * @return string 'navigation' 95 */ 96 public function get_aria_role() { 97 return 'navigation'; 98 } 99 100 function applicable_formats() { 101 return array('all' => true, 'mod' => false, 'my' => false, 'admin' => false, 102 'tag' => false); 103 } 104 } 105 106
title
Description
Body
title
Description
Body
title
Description
Body
title
Body