Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/wiki/diff.php
Go to the documentation of this file.
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 
00036 require_once($CFG->dirroot . '/mod/wiki/lib.php');
00037 require_once($CFG->dirroot . '/mod/wiki/locallib.php');
00038 require_once($CFG->dirroot . '/mod/wiki/pagelib.php');
00039 
00040 require_once($CFG->dirroot . '/mod/wiki/diff/difflib.php');
00041 require_once($CFG->dirroot . '/mod/wiki/diff/diff_nwiki.php');
00042 
00043 $pageid = required_param('pageid', PARAM_TEXT);
00044 $compare = required_param('compare', PARAM_INT);
00045 $comparewith = required_param('comparewith', PARAM_INT);
00046 
00047 if (!$page = wiki_get_page($pageid)) {
00048     print_error('incorrectpageid', 'wiki');
00049 }
00050 
00051 if (!$subwiki = wiki_get_subwiki($page->subwikiid)) {
00052     print_error('incorrectsubwikiid', 'wiki');
00053 }
00054 
00055 if (!$wiki = wiki_get_wiki($subwiki->wikiid)) {
00056     print_error('incorrectwikiid', 'wiki');
00057 }
00058 
00059 if (!$cm = get_coursemodule_from_instance('wiki', $wiki->id)) {
00060     print_error('invalidcoursemodule');
00061 }
00062 
00063 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
00064 
00065 if ($compare >= $comparewith) {
00066     print_error("A page version can only be compared with an older version.");
00067 }
00068 
00069 require_login($course->id, true, $cm);
00070 add_to_log($course->id, "wiki", "diff", "diff.php?id=$cm->id", "$wiki->id");
00071 
00072 $wikipage = new page_wiki_diff($wiki, $subwiki, $cm);
00073 
00074 $wikipage->set_page($page);
00075 $wikipage->set_comparison($compare, $comparewith);
00076 
00077 $wikipage->print_header();
00078 
00079 $wikipage->print_content();
00080 
00081 $wikipage->print_footer();
 All Data Structures Namespaces Files Functions Variables Enumerations