|
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 00034 require_once('../../config.php'); 00035 require_once('lib.php'); 00036 00037 $id = required_param('id', PARAM_INT); // course 00038 $PAGE->set_url('/mod/wiki/index.php', array('id' => $id)); 00039 00040 if (!$course = $DB->get_record('course', array('id' => $id))) { 00041 print_error('invalidcourseid'); 00042 } 00043 00044 require_login($course->id, true); 00045 $PAGE->set_pagelayout('incourse'); 00046 $context = get_context_instance(CONTEXT_COURSE, $course->id); 00047 00048 add_to_log($course->id, 'wiki', 'view all', "index.php?id=$course->id", ""); 00049 00051 $strwikis = get_string("modulenameplural", "wiki"); 00052 $strwiki = get_string("modulename", "wiki"); 00053 00055 $PAGE->navbar->add($strwikis, "index.php?id=$course->id"); 00056 $PAGE->set_title($strwikis); 00057 $PAGE->set_heading($course->fullname); 00058 echo $OUTPUT->header(); 00059 00061 if (!$wikis = get_all_instances_in_course("wiki", $course)) { 00062 notice("There are no wikis", "../../course/view.php?id=$course->id"); 00063 die; 00064 } 00065 00066 $usesections = course_format_uses_sections($course->format); 00067 if ($usesections) { 00068 $sections = get_all_sections($course->id); 00069 } 00070 00072 00073 $timenow = time(); 00074 $strsectionname = get_string('sectionname', 'format_' . $course->format); 00075 $strname = get_string("name"); 00076 $table = new html_table(); 00077 00078 if ($usesections) { 00079 $table->head = array($strsectionname, $strname); 00080 } else { 00081 $table->head = array($strname); 00082 } 00083 00084 foreach ($wikis as $wiki) { 00085 $linkcss = null; 00086 if (!$wiki->visible) { 00087 $linkcss = array('class' => 'dimmed'); 00088 } 00089 $link = html_writer::link(new moodle_url('/mod/wiki/view.php', array('id' => $wiki->coursemodule)), $wiki->name, $linkcss); 00090 00091 if ($usesections) { 00092 $table->data[] = array(get_section_name($course, $sections[$wiki->section]), $link); 00093 } else { 00094 $table->data[] = array($link); 00095 } 00096 } 00097 00098 echo html_writer::table($table); 00099 00101 echo $OUTPUT->footer();