[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 if (!defined('MOODLE_INTERNAL')) { 3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page 4 } 5 6 require_once ($CFG->dirroot.'/course/moodleform_mod.php'); 7 8 class mod_data_mod_form extends moodleform_mod { 9 10 function definition() { 11 global $CFG, $DB; 12 13 $mform =& $this->_form; 14 15 //------------------------------------------------------------------------------- 16 $mform->addElement('header', 'general', get_string('general', 'form')); 17 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); 23 } 24 $mform->addRule('name', null, 'required', null, 'client'); 25 $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client'); 26 27 $this->add_intro_editor(true, get_string('intro', 'data')); 28 29 // ---------------------------------------------------------------------- 30 $mform->addElement('header', 'entrieshdr', get_string('entries', 'data')); 31 32 $mform->addElement('selectyesno', 'approval', get_string('requireapproval', 'data')); 33 $mform->addHelpButton('approval', 'requireapproval', 'data'); 34 35 $mform->addElement('selectyesno', 'comments', get_string('allowcomments', 'data')); 36 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'); 42 43 $mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions); 44 $mform->addHelpButton('requiredentriestoview', 'requiredentriestoview', 'data'); 45 46 $mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions); 47 $mform->addHelpButton('maxentries', 'maxentries', 'data'); 48 49 // ---------------------------------------------------------------------- 50 $mform->addElement('header', 'availibilityhdr', get_string('availability')); 51 52 $mform->addElement('date_time_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), 53 array('optional' => true)); 54 55 $mform->addElement('date_time_selector', 'timeavailableto', get_string('availabletodate', 'data'), 56 array('optional' => true)); 57 58 $mform->addElement('date_time_selector', 'timeviewfrom', get_string('viewfromdate', 'data'), 59 array('optional' => true)); 60 61 $mform->addElement('date_time_selector', 'timeviewto', get_string('viewtodate', 'data'), 62 array('optional' => true)); 63 64 // ---------------------------------------------------------------------- 65 if ($CFG->enablerssfeeds && $CFG->data_enablerssfeeds) { 66 $mform->addElement('header', 'rsshdr', get_string('rss')); 67 $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions); 68 } 69 70 $this->standard_grading_coursemodule_elements(); 71 72 $this->standard_coursemodule_elements(); 73 74 //------------------------------------------------------------------------------- 75 // buttons 76 $this->add_action_buttons(); 77 } 78 79 function data_preprocessing(&$default_values){ 80 parent::data_preprocessing($default_values); 81 } 82 83 } 84
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |