Merge branch 'w16_MDL-27220_m20_tagprofile' of git://github.com/skodak/moodle into...
[moodle.git] / mod / data / mod_form.php
blobc5f7120630684ff8614238ed0108e19aff48797b
1 <?php
2 if (!defined('MOODLE_INTERNAL')) {
3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
6 require_once ($CFG->dirroot.'/course/moodleform_mod.php');
8 class mod_data_mod_form extends moodleform_mod {
10 function definition() {
11 global $CFG, $DB;
13 $mform =& $this->_form;
15 //-------------------------------------------------------------------------------
16 $mform->addElement('header', 'general', get_string('general', 'form'));
18 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
19 if (!empty($CFG->formatstringstriptags)) {
20 $mform->setType('name', PARAM_TEXT);
21 } else {
22 $mform->setType('name', PARAM_CLEANHTML);
24 $mform->addRule('name', null, 'required', null, 'client');
26 $this->add_intro_editor(true, get_string('intro', 'data'));
28 $mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true));
30 $mform->addElement('date_selector', 'timeavailableto', get_string('availabletodate', 'data'), array('optional'=>true));
32 $mform->addElement('date_selector', 'timeviewfrom', get_string('viewfromdate', 'data'), array('optional'=>true));
34 $mform->addElement('date_selector', 'timeviewto', get_string('viewtodate', 'data'), array('optional'=>true));
37 $countoptions = array(0=>get_string('none'))+
38 (array_combine(range(1, DATA_MAX_ENTRIES),//keys
39 range(1, DATA_MAX_ENTRIES)));//values
40 $mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions);
41 $mform->addHelpButton('requiredentries', 'requiredentries', 'data');
43 $mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions);
44 $mform->addHelpButton('requiredentriestoview', 'requiredentriestoview', 'data');
46 $mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions);
47 $mform->addHelpButton('maxentries', 'maxentries', 'data');
49 $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
50 $mform->addElement('select', 'comments', get_string('comments', 'data'), $ynoptions);
52 $mform->addElement('select', 'approval', get_string('requireapproval', 'data'), $ynoptions);
53 $mform->addHelpButton('approval', 'requireapproval', 'data');
55 if($CFG->enablerssfeeds && $CFG->data_enablerssfeeds){
56 $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions);
59 $this->standard_grading_coursemodule_elements();
61 $this->standard_coursemodule_elements();
63 //-------------------------------------------------------------------------------
64 // buttons
65 $this->add_action_buttons();
68 function data_preprocessing(&$default_values){
69 parent::data_preprocessing($default_values);