-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_form.php
62 lines (50 loc) · 2.67 KB
/
mod_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* The main lessonplan configuration form
*
* It uses the standard core Moodle formslib. For more info about them, please
* visit: http://docs.moodle.org/en/Development:lib/formslib.php
*
* @package mod_lessonplan
* @copyright 2011 Luis-Ramon Lopez Lopez
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero GPL 3
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/course/moodleform_mod.php');
class mod_lessonplan_mod_form extends moodleform_mod {
function definition() {
global $COURSE;
$mform =& $this->_form;
//-------------------------------------------------------------------------------
/// Adding the "general" fieldset, where all the common settings are showed
$mform->addElement('header', 'general', get_string('general', 'form'));
/// Adding the standard "name" field
$mform->addElement('text', 'name', get_string('name')/*get_string('lessonplanname', 'lessonplan')*/, array('size'=>'64'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
$mform->setType('name', PARAM_CLEAN);
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addHelpButton('name', 'lessonplanname', 'lessonplan');
/// Adding the standard "intro" and "introformat" fields
$this->add_intro_editor();
/*
//-------------------------------------------------------------------------------
/// Adding the rest of lessonplan settings, spreeading all them into this fieldset
/// or adding more fieldsets ('header' elements) if needed for better logic
$mform->addElement('static', 'label1', 'lessonplansetting1', 'Your lessonplan fields go here. Replace me!');
$mform->addElement('header', 'lessonplanfieldset', get_string('lessonplanfieldset', 'lessonplan'));
$mform->addElement('static', 'label2', 'lessonplansetting2', 'Your lessonplan fields go here. Replace me!');*/
/// Adding the "shared" checkbox
$mform->addElement('advcheckbox', 'shared', null, get_string('shared', 'lessonplan'), array( 'group' => 1 ));
//$mform->addRule('shared', null, 'required', null, 'client');
//-------------------------------------------------------------------------------
// add standard elements, common to all modules
$this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
// add standard buttons, common to all modules
$this->add_action_buttons();
}
}