See Release Notes
Long Term Support Release
1 <?php 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /** 19 * This file defines de main wiki configuration form 20 * 21 * @package mod_wiki 22 * @copyright 2009 Marc Alier, Jordi Piguillem marc.alier@upc.edu 23 * @copyright 2009 Universitat Politecnica de Catalunya http://www.upc.edu 24 * 25 * @author Jordi Piguillem 26 * @author Marc Alier 27 * @author David Jimenez 28 * @author Josep Arus 29 * @author Kenneth Riba 30 * 31 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 32 */ 33 34 if (!defined('MOODLE_INTERNAL')) { 35 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page 36 } 37 38 require_once($CFG->dirroot . '/course/moodleform_mod.php'); 39 require_once($CFG->dirroot . '/mod/wiki/locallib.php'); 40 require_once($CFG->dirroot . '/lib/datalib.php'); 41 42 class mod_wiki_mod_form extends moodleform_mod { 43 44 protected function definition() { 45 $mform = $this->_form; 46 $required = get_string('required'); 47 48 //------------------------------------------------------------------------------- 49 // Adding the "general" fieldset, where all the common settings are shown. 50 $mform->addElement('header', 'general', get_string('general', 'form')); 51 52 // Adding the standard "name" field. 53 $mform->addElement('text', 'name', get_string('wikiname', 'wiki'), array('size' => '64')); 54 $mform->setType('name', PARAM_TEXT); 55 $mform->addRule('name', $required, 'required', null, 'client'); 56 $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); 57 // Adding the optional "intro" and "introformat" pair of fields 58 $this->standard_intro_elements(get_string('wikiintro', 'wiki')); 59 60 $wikimodeoptions = array ('collaborative' => get_string('wikimodecollaborative', 'wiki'), 'individual' => get_string('wikimodeindividual', 'wiki')); 61 // Don't allow changes to the wiki type once it is set. 62 $wikitype_attr = array(); 63 if (!empty($this->_instance)) { 64 $wikitype_attr['disabled'] = 'disabled'; 65 } 66 $mform->addElement('select', 'wikimode', get_string('wikimode', 'wiki'), $wikimodeoptions, $wikitype_attr); 67 $mform->addHelpButton('wikimode', 'wikimode', 'wiki'); 68 69 $attr = array('size' => '20'); 70 if (!empty($this->_instance)) { 71 $attr['disabled'] = 'disabled'; 72 } 73 $mform->addElement('text', 'firstpagetitle', get_string('firstpagetitle', 'wiki'), $attr); 74 $mform->addHelpButton('firstpagetitle', 'firstpagetitle', 'wiki'); 75 $mform->setType('firstpagetitle', PARAM_TEXT); 76 if (empty($this->_instance)) { 77 $mform->addRule('firstpagetitle', $required, 'required', null, 'client'); 78 } 79 80 // Format. 81 $mform->addElement('header', 'wikifieldset', get_string('format')); 82 83 $formats = wiki_get_formats(); 84 $editoroptions = array(); 85 foreach ($formats as $format) { 86 $editoroptions[$format] = get_string($format, 'wiki'); 87 } 88 $mform->addElement('select', 'defaultformat', get_string('defaultformat', 'wiki'), $editoroptions); 89 $mform->addHelpButton('defaultformat', 'defaultformat', 'wiki'); 90 91 $mform->addElement('checkbox', 'forceformat', get_string('forceformat', 'wiki')); 92 $mform->addHelpButton('forceformat', 'forceformat', 'wiki'); 93 94 //------------------------------------------------------------------------------- 95 // Add standard elements, common to all modules. 96 $this->standard_coursemodule_elements(); 97 //------------------------------------------------------------------------------- 98 // Add standard buttons, common to all modules. 99 $this->add_action_buttons(); 100 101 } 102 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body