|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00033 require_once('../../config.php'); 00034 require_once($CFG->dirroot . '/mod/wiki/lib.php'); 00035 require_once($CFG->dirroot . '/mod/wiki/locallib.php'); 00036 require_once($CFG->dirroot . '/mod/wiki/pagelib.php'); 00037 00038 $pageid = required_param('pageid', PARAM_INT); // Page ID 00039 00040 if (!$page = wiki_get_page($pageid)) { 00041 print_error('incorrectpageid', 'wiki'); 00042 } 00043 if (!$subwiki = wiki_get_subwiki($page->subwikiid)) { 00044 print_error('incorrectsubwikiid', 'wiki'); 00045 } 00046 if (!$cm = get_coursemodule_from_instance("wiki", $subwiki->wikiid)) { 00047 print_error('invalidcoursemodule'); 00048 } 00049 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); 00050 if (!$wiki = wiki_get_wiki($subwiki->wikiid)) { 00051 print_error('incorrectwikiid', 'wiki'); 00052 } 00053 00054 require_login($course->id, true, $cm); 00055 00056 $context = get_context_instance(CONTEXT_MODULE, $cm->id); 00057 require_capability('mod/wiki:viewpage', $context); 00058 00059 add_to_log($course->id, "wiki", "view", "prettyview.php?pageid=$pageid", "$wiki->id"); 00060 00061 $wikipage = new page_wiki_prettyview($wiki, $subwiki, $cm); 00062 00063 $wikipage->set_page($page); 00064 00065 $wikipage->print_header(); 00066 $wikipage->print_content(); 00067 $wikipage->print_footer();