See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * List of file folders in course 20 * 21 * @package mod_folder 22 * @copyright 2009 onwards Martin Dougiamas (http://dougiamas.com) 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 require('../../config.php'); 27 28 $id = required_param('id', PARAM_INT); // course id 29 30 $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); 31 32 require_course_login($course, true); 33 $PAGE->set_pagelayout('incourse'); 34 35 $params = array( 36 'context' => context_course::instance($course->id) 37 ); 38 $event = \mod_folder\event\course_module_instance_list_viewed::create($params); 39 $event->add_record_snapshot('course', $course); 40 $event->trigger(); 41 42 $strfolder = get_string('modulename', 'folder'); 43 $strfolders = get_string('modulenameplural', 'folder'); 44 $strname = get_string('name'); 45 $strintro = get_string('moduleintro'); 46 $strlastmodified = get_string('lastmodified'); 47 48 $PAGE->set_url('/mod/folder/index.php', array('id' => $course->id)); 49 $PAGE->set_title($course->shortname.': '.$strfolders); 50 $PAGE->set_heading($course->fullname); 51 $PAGE->set_secondary_active_tab('coursehome'); 52 $PAGE->navbar->add($strfolders); 53 echo $OUTPUT->header(); 54 if (!$PAGE->has_secondary_navigation()) { 55 echo $OUTPUT->heading($strfolders); 56 } 57 58 if (!$folders = get_all_instances_in_course('folder', $course)) { 59 notice(get_string('thereareno', 'moodle', $strfolders), "$CFG->wwwroot/course/view.php?id=$course->id"); 60 exit; 61 } 62 63 $usesections = course_format_uses_sections($course->format); 64 65 $table = new html_table(); 66 $table->attributes['class'] = 'generaltable mod_index'; 67 68 if ($usesections) { 69 $strsectionname = get_string('sectionname', 'format_'.$course->format); 70 $table->head = array ($strsectionname, $strname, $strintro); 71 $table->align = array ('center', 'left', 'left'); 72 } else { 73 $table->head = array ($strlastmodified, $strname, $strintro); 74 $table->align = array ('left', 'left', 'left'); 75 } 76 77 $modinfo = get_fast_modinfo($course); 78 $currentsection = ''; 79 foreach ($folders as $folder) { 80 $cm = $modinfo->cms[$folder->coursemodule]; 81 if ($usesections) { 82 $printsection = ''; 83 if ($folder->section !== $currentsection) { 84 if ($folder->section) { 85 $printsection = get_section_name($course, $folder->section); 86 } 87 if ($currentsection !== '') { 88 $table->data[] = 'hr'; 89 } 90 $currentsection = $folder->section; 91 } 92 } else { 93 $printsection = '<span class="smallinfo">'.userdate($folder->timemodified)."</span>"; 94 } 95 96 $class = $folder->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed 97 $table->data[] = array ( 98 $printsection, 99 "<a $class href=\"view.php?id=$cm->id\">".format_string($folder->name)."</a>", 100 format_module_intro('folder', $folder, $cm->id)); 101 } 102 103 echo html_writer::table($table); 104 105 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body