|
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 00034 if (!defined('MOODLE_INTERNAL')) { 00035 die('Direct access to this script is forbidden.'); 00036 } 00037 00038 require_once('moodleform_mod.php'); 00039 require_once($CFG->dirroot . '/mod/wiki/locallib.php'); 00040 require_once($CFG->dirroot . '/lib/datalib.php'); 00041 00042 class mod_wiki_mod_form extends moodleform_mod { 00043 00044 function definition() { 00045 00046 global $COURSE; 00047 $mform =& $this->_form; 00048 00049 //------------------------------------------------------------------------------- 00051 $mform->addElement('header', 'general', get_string('general', 'form')); 00053 $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64')); 00054 $mform->setType('name', PARAM_TEXT); 00055 $mform->addRule('name', null, 'required', null, 'client'); 00057 // $mform->addElement('htmleditor', 'intro', get_string('wikiintro', 'wiki')); 00058 // $mform->setType('intro', PARAM_RAW); 00059 // $mform->addRule('intro', get_string('required'), 'required', null, 'client'); 00060 // 00061 // $mform->addElement('format', 'introformat', get_string('format')); 00062 $this->add_intro_editor(true, get_string('wikiintro', 'wiki')); 00063 //------------------------------------------------------------------------------- 00066 00067 $mform->addElement('header', 'wikifieldset', get_string('wikisettings', 'wiki')); 00068 00069 $attr = array('size' => '20'); 00070 if (!empty($this->_instance)) { 00071 $attr['disabled'] = 'disabled'; 00072 } else { 00073 $attr['value'] = get_string('firstpagetitle', 'wiki'); 00074 } 00075 00076 $mform->addElement('text', 'firstpagetitle', get_string('firstpagetitle', 'wiki'), $attr); 00077 $mform->addHelpButton('firstpagetitle', 'firstpagetitle', 'wiki'); 00078 00079 if (empty($this->_instance)) { 00080 $mform->addRule('firstpagetitle', null, 'required', null, 'client'); 00081 } 00082 00083 $wikimodeoptions = array ('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki')); 00084 // don't allow to change wiki type once is set 00085 $wikitype_attr = array(); 00086 if (!empty($this->_instance)) { 00087 $wikitype_attr['disabled'] = 'disabled'; 00088 } 00089 $mform->addElement('select', 'wikimode', get_string('wikimode', 'wiki'), $wikimodeoptions, $wikitype_attr); 00090 $mform->addHelpButton('wikimode', 'wikimode', 'wiki'); 00091 00092 $formats = wiki_get_formats(); 00093 $editoroptions = array(); 00094 foreach ($formats as $format) { 00095 $editoroptions[$format] = get_string($format, 'wiki'); 00096 } 00097 $mform->addElement('select', 'defaultformat', get_string('defaultformat', 'wiki'), $editoroptions); 00098 $mform->addHelpButton('defaultformat', 'defaultformat', 'wiki'); 00099 $mform->addElement('checkbox', 'forceformat', get_string('forceformat', 'wiki')); 00100 $mform->addHelpButton('forceformat', 'forceformat', 'wiki'); 00101 00102 //------------------------------------------------------------------------------- 00103 // add standard elements, common to all modules 00104 $this->standard_coursemodule_elements(); 00105 //------------------------------------------------------------------------------- 00106 // add standard buttons, common to all modules 00107 $this->add_action_buttons(); 00108 00109 } 00110 }