MDL-38590 data: Reformat settings form
[moodle.git] / mod / data / mod_form.php
CommitLineData
6403e679 1<?php
bfebaf64
MD
2if (!defined('MOODLE_INTERNAL')) {
3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
4}
5
23a7718b 6require_once ($CFG->dirroot.'/course/moodleform_mod.php');
e24b7f85 7
f07b9627 8class mod_data_mod_form extends moodleform_mod {
6403e679 9
aab98aaf 10 function definition() {
c18269c7 11 global $CFG, $DB;
6403e679 12
13534ef7 13 $mform =& $this->_form;
6403e679 14
15//-------------------------------------------------------------------------------
16 $mform->addElement('header', 'general', get_string('general', 'form'));
17
26de8d35 18 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
8eb1d25f 19 if (!empty($CFG->formatstringstriptags)) {
20 $mform->setType('name', PARAM_TEXT);
21 } else {
b8ea3041 22 $mform->setType('name', PARAM_CLEANHTML);
8eb1d25f 23 }
aab98aaf 24 $mform->addRule('name', null, 'required', null, 'client');
6403e679 25
b4950d96 26 $this->add_intro_editor(true, get_string('intro', 'data'));
6403e679 27
8783e17b
FM
28 // ----------------------------------------------------------------------
29 $mform->addElement('header', 'entrieshdr', get_string('entries', 'data'));
46e648b6 30
8783e17b
FM
31 $mform->addElement('selectyesno', 'approval', get_string('requireapproval', 'data'));
32 $mform->addHelpButton('approval', 'requireapproval', 'data');
6403e679 33
8783e17b 34 $mform->addElement('selectyesno', 'comments', get_string('allowcomments', 'data'));
6403e679 35
13534ef7 36 $countoptions = array(0=>get_string('none'))+
8783e17b
FM
37 (array_combine(range(1, DATA_MAX_ENTRIES), // Keys.
38 range(1, DATA_MAX_ENTRIES))); // Values.
6403e679 39 $mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions);
7719b4db 40 $mform->addHelpButton('requiredentries', 'requiredentries', 'data');
6403e679 41
42 $mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions);
7719b4db 43 $mform->addHelpButton('requiredentriestoview', 'requiredentriestoview', 'data');
6403e679 44
45 $mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions);
7719b4db 46 $mform->addHelpButton('maxentries', 'maxentries', 'data');
6403e679 47
8783e17b
FM
48 // ----------------------------------------------------------------------
49 $mform->addElement('header', 'availibilityhdr', get_string('availability'));
6403e679 50
8783e17b
FM
51 $mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));
52
53 $mform->addElement('date_selector', 'timeavailableto', get_string('availabletodate', 'data'), array('optional'=>true));
54
55 $mform->addElement('date_selector', 'timeviewfrom', get_string('viewfromdate', 'data'), array('optional'=>true));
56
57 $mform->addElement('date_selector', 'timeviewto', get_string('viewtodate', 'data'), array('optional'=>true));
6403e679 58
8783e17b
FM
59 // ----------------------------------------------------------------------
60 if ($CFG->enablerssfeeds && $CFG->data_enablerssfeeds) {
61 $mform->addElement('header', 'rsshdr', get_string('rss'));
4282d047 62 $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions);
63 }
6403e679 64
16306628 65 $this->standard_grading_coursemodule_elements();
6403e679 66
42f103be 67 $this->standard_coursemodule_elements();
6403e679 68
a23f0aaf 69//-------------------------------------------------------------------------------
70 // buttons
71 $this->add_action_buttons();
aab98aaf 72 }
6403e679 73
c3cec421 74 function data_preprocessing(&$default_values){
55d95d90 75 parent::data_preprocessing($default_values);
c3cec421 76 }
6403e679 77
6403e679 78}
1adbd2c3 79