Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/help.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 
00029 define('NO_MOODLE_COOKIES', true);
00030 
00031 require_once(dirname(__FILE__) . '/config.php');
00032 
00033 $identifier = required_param('identifier', PARAM_STRINGID);
00034 $component  = required_param('component', PARAM_COMPONENT);
00035 $lang       = required_param('lang', PARAM_LANG); // TODO: maybe split into separate scripts
00036 $ajax       = optional_param('ajax', 0, PARAM_BOOL);
00037 
00038 if (!$lang) {
00039     $lang = 'en';
00040 }
00041 $SESSION->lang = $lang; // does not actually modify session because we do not use cookies here
00042 
00043 $sm = get_string_manager();
00044 
00045 $PAGE->set_url('/help.php');
00046 $PAGE->set_pagelayout('popup');
00047 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
00048 
00049 if ($ajax) {
00050     @header('Content-Type: text/plain; charset=utf-8');
00051 } else {
00052     echo $OUTPUT->header();
00053 }
00054 
00055 if (!$sm->string_exists($identifier.'_help', $component)) {
00056     // strings on-diskc cache may be dirty - try to rebuild it and check again
00057     $sm->load_component_strings($component, current_language(), true);
00058 }
00059 
00060 if ($sm->string_exists($identifier.'_help', $component)) {
00061     $options = new stdClass();
00062     $options->trusted = false;
00063     $options->noclean = false;
00064     $options->smiley = false;
00065     $options->filter = false;
00066     $options->para = true;
00067     $options->newlines = false;
00068     $options->overflowdiv = !$ajax;
00069 
00070     echo $OUTPUT->heading(format_string(get_string($identifier, $component)), 1, 'helpheading');
00071     // Should be simple wiki only MDL-21695
00072     echo format_text(get_string($identifier.'_help', $component), FORMAT_MARKDOWN, $options);
00073 
00074     if ($sm->string_exists($identifier.'_link', $component)) {  // Link to further info in Moodle docs
00075         $link = get_string($identifier.'_link', $component);
00076         $linktext = get_string('morehelp');
00077         echo '<div class="helpdoclink">'.$OUTPUT->doc_link($link, $linktext).'</div>';
00078     }
00079 
00080 } else {
00081     echo "<p><strong>TODO</strong>: missing help string [{$identifier}_help, $component]</p>";
00082 }
00083 
00084 if (!$ajax) {
00085     echo $OUTPUT->footer();
00086 }
 All Data Structures Namespaces Files Functions Variables Enumerations