MDL-63660 tool_dataprivacy: Increase expected export file size
[moodle.git] / mod / book / mod_form.php
blobd47d746e67cee23d4babaa44515408dc0970f340
1 <?php
2 // This file is part of Moodle - http://moodle.org/
3 //
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 /**
18 * Instance add/edit form
20 * @package mod_book
21 * @copyright 2004-2011 Petr Skoda {@link http://skodak.org}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') || die;
27 require_once(__DIR__.'/locallib.php');
28 require_once($CFG->dirroot.'/course/moodleform_mod.php');
30 class mod_book_mod_form extends moodleform_mod {
32 function definition() {
33 global $CFG;
35 $mform = $this->_form;
37 $config = get_config('book');
39 $mform->addElement('header', 'general', get_string('general', 'form'));
41 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
42 if (!empty($CFG->formatstringstriptags)) {
43 $mform->setType('name', PARAM_TEXT);
44 } else {
45 $mform->setType('name', PARAM_CLEANHTML);
47 $mform->addRule('name', null, 'required', null, 'client');
48 $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
49 $this->standard_intro_elements(get_string('moduleintro'));
51 // Appearance.
52 $mform->addElement('header', 'appearancehdr', get_string('appearance'));
54 $alloptions = book_get_numbering_types();
55 $allowed = explode(',', $config->numberingoptions);
56 $options = array();
57 foreach ($allowed as $type) {
58 if (isset($alloptions[$type])) {
59 $options[$type] = $alloptions[$type];
62 if ($this->current->instance) {
63 if (!isset($options[$this->current->numbering])) {
64 if (isset($alloptions[$this->current->numbering])) {
65 $options[$this->current->numbering] = $alloptions[$this->current->numbering];
69 $mform->addElement('select', 'numbering', get_string('numbering', 'book'), $options);
70 $mform->addHelpButton('numbering', 'numbering', 'mod_book');
71 $mform->setDefault('numbering', $config->numbering);
73 $alloptions = book_get_nav_types();
74 $allowed = explode(',', $config->navoptions);
75 $options = array();
76 foreach ($allowed as $type) {
77 if (isset($alloptions[$type])) {
78 $options[$type] = $alloptions[$type];
81 if ($this->current->instance) {
82 if (!isset($options[$this->current->navstyle])) {
83 if (isset($alloptions[$this->current->navstyle])) {
84 $options[$this->current->navstyle] = $alloptions[$this->current->navstyle];
88 $mform->addElement('select', 'navstyle', get_string('navstyle', 'book'), $options);
89 $mform->addHelpButton('navstyle', 'navstyle', 'mod_book');
90 $mform->setDefault('navstyle', $config->navstyle);
92 $mform->addElement('checkbox', 'customtitles', get_string('customtitles', 'book'));
93 $mform->addHelpButton('customtitles', 'customtitles', 'mod_book');
94 $mform->setDefault('customtitles', 0);
96 $this->standard_coursemodule_elements();
98 $this->add_action_buttons();