|
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 00024 require_once('../../config.php'); 00025 require_once($CFG->dirroot . '/mod/wiki/lib.php'); 00026 require_once($CFG->dirroot . '/mod/wiki/locallib.php'); 00027 require_once($CFG->dirroot . '/mod/wiki/pagelib.php'); 00028 00029 $search = optional_param('searchstring', null, PARAM_ALPHANUMEXT); 00030 $courseid = optional_param('courseid', 0, PARAM_INT); 00031 $searchcontent = optional_param('searchwikicontent', 0, PARAM_INT); 00032 $cmid = optional_param('cmid', 0, PARAM_INT); 00033 00034 if (!$course = $DB->get_record('course', array('id' => $courseid))) { 00035 print_error('invalidcourseid'); 00036 } 00037 if (!$cm = get_coursemodule_from_id('wiki', $cmid)) { 00038 print_error('invalidcoursemodule'); 00039 } 00040 00041 require_login($course, true, $cm); 00042 00043 // @TODO: Fix call to wiki_get_subwiki_by_group 00044 if (!$gid = groups_get_activity_group($cm)) { 00045 $gid = 0; 00046 } 00047 if (!$subwiki = wiki_get_subwiki_by_group($cm->instance, $gid)) { 00048 return false; 00049 } 00050 if (!$wiki = wiki_get_wiki($subwiki->wikiid)) { 00051 print_error('incorrectwikiid', 'wiki'); 00052 } 00053 00054 $wikipage = new page_wiki_search($wiki, $subwiki, $cm); 00055 00056 $wikipage->set_search_string($search, $searchcontent); 00057 00058 $wikipage->set_title(get_string('search')); 00059 00060 $wikipage->print_header(); 00061 00062 $wikipage->print_content(); 00063 00064 $wikipage->print_footer();