Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/wiki/editcomments.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 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);
00039 $action = optional_param('action', '', PARAM_ACTION);
00040 $commentid = optional_param('commentid', 0, PARAM_INT);
00041 
00042 if (!$page = wiki_get_page($pageid)) {
00043     print_error('incorrectpageid', 'wiki');
00044 }
00045 if (!$subwiki = wiki_get_subwiki($page->subwikiid)) {
00046     print_error('incorrectsubwikiid', 'wiki');
00047 }
00048 if (!$cm = get_coursemodule_from_instance("wiki", $subwiki->wikiid)) {
00049     print_error('invalidcoursemodule');
00050 }
00051 $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
00052 if (!$wiki = wiki_get_wiki($subwiki->wikiid)) {
00053     print_error('incorrectwikiid', 'wiki');
00054 }
00055 require_login($course->id, true, $cm);
00056 
00057 $editcomments = new page_wiki_editcomment($wiki, $subwiki, $cm);
00058 $comment = new stdClass();
00059 if ($action == 'edit') {
00060     if (!$comment = $DB->get_record('comments', array('id' => $commentid))) {
00061         print_error('invalidcomment');
00062     }
00063 }
00064 
00065 $editcomments->set_page($page);
00066 $editcomments->set_action($action, $comment);
00067 
00068 $editcomments->print_header();
00069 $editcomments->print_content();
00070 $editcomments->print_footer();
 All Data Structures Namespaces Files Functions Variables Enumerations