|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 require('../../config.php'); 00028 00029 $id = required_param('id', PARAM_INT); // course id 00030 00031 $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); 00032 00033 require_course_login($course, true); 00034 $PAGE->set_pagelayout('incourse'); 00035 00036 add_to_log($course->id, 'imscp', 'view all', "index.php?id=$course->id", ''); 00037 00038 $strimscp = get_string('modulename', 'imscp'); 00039 $strimscps = get_string('modulenameplural', 'imscp'); 00040 $strsectionname = get_string('sectionname', 'format_'.$course->format); 00041 $strname = get_string('name'); 00042 $strintro = get_string('moduleintro'); 00043 $strlastmodified = get_string('lastmodified'); 00044 00045 $PAGE->set_url('/mod/imscp/index.php', array('id' => $course->id)); 00046 $PAGE->set_title($course->shortname.': '.$strimscps); 00047 $PAGE->set_heading($course->fullname); 00048 $PAGE->navbar->add($strimscps); 00049 echo $OUTPUT->header(); 00050 00051 if (!$imscps = get_all_instances_in_course('imscp', $course)) { 00052 notice(get_string('thereareno', 'moodle', $strimscps), "$CFG->wwwroot/course/view.php?id=$course->id"); 00053 exit; 00054 } 00055 00056 $usesections = course_format_uses_sections($course->format); 00057 if ($usesections) { 00058 $sections = get_all_sections($course->id); 00059 } 00060 00061 $table = new html_table(); 00062 $table->attributes['class'] = 'generaltable mod_index'; 00063 00064 if ($usesections) { 00065 $table->head = array ($strsectionname, $strname, $strintro); 00066 $table->align = array ('center', 'left', 'left'); 00067 } else { 00068 $table->head = array ($strlastmodified, $strname, $strintro); 00069 $table->align = array ('left', 'left', 'left'); 00070 } 00071 00072 $modinfo = get_fast_modinfo($course); 00073 $currentsection = ''; 00074 foreach ($imscps as $imscp) { 00075 $cm = $modinfo->cms[$imscp->coursemodule]; 00076 if ($usesections) { 00077 $printsection = ''; 00078 if ($imscp->section !== $currentsection) { 00079 if ($imscp->section) { 00080 $printsection = get_section_name($course, $sections[$imscp->section]); 00081 } 00082 if ($currentsection !== '') { 00083 $table->data[] = 'hr'; 00084 } 00085 $currentsection = $imscp->section; 00086 } 00087 } else { 00088 $printsection = '<span class="smallinfo">'.userdate($imscp->timemodified)."</span>"; 00089 } 00090 00091 $class = $imscp->visible ? '' : 'class="dimmed"'; // hidden modules are dimmed 00092 $table->data[] = array ( 00093 $printsection, 00094 "<a $class href=\"view.php?id=$cm->id\">".format_string($imscp->name)."</a>", 00095 format_module_intro('imscp', $imscp, $cm->id)); 00096 } 00097 00098 echo html_writer::table($table); 00099 00100 echo $OUTPUT->footer();