| [ Index ] |
PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008] |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ($CFG->dirroot.'/course/moodleform_mod.php'); 3 4 class mod_data_mod_form extends moodleform_mod { 5 6 function definition() { 7 8 global $CFG; 9 $mform =& $this->_form; 10 11 //------------------------------------------------------------------------------- 12 $mform->addElement('header', 'general', get_string('general', 'form')); 13 14 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64')); 15 if (!empty($CFG->formatstringstriptags)) { 16 $mform->setType('name', PARAM_TEXT); 17 } else { 18 $mform->setType('name', PARAM_CLEAN); 19 } 20 $mform->addRule('name', null, 'required', null, 'client'); 21 22 $mform->addElement('htmleditor', 'intro', get_string('intro', 'data')); 23 $mform->setType('intro', PARAM_RAW); 24 $mform->addRule('intro', null, 'required', null, 'client'); 25 $mform->setHelpButton('intro', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton'); 26 27 $mform->addElement('date_selector', 'timeavailablefrom', get_string('availablefromdate', 'data'), array('optional'=>true)); 28 29 $mform->addElement('date_selector', 'timeavailableto', get_string('availabletodate', 'data'), array('optional'=>true)); 30 31 $mform->addElement('date_selector', 'timeviewfrom', get_string('viewfromdate', 'data'), array('optional'=>true)); 32 33 $mform->addElement('date_selector', 'timeviewto', get_string('viewtodate', 'data'), array('optional'=>true)); 34 35 36 $countoptions = array(0=>get_string('none'))+ 37 (array_combine(range(1, DATA_MAX_ENTRIES),//keys 38 range(1, DATA_MAX_ENTRIES)));//values 39 $mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions); 40 $mform->setHelpButton('requiredentries', array('requiredentries', get_string('requiredentries', 'data'), 'data')); 41 42 $mform->addElement('select', 'requiredentriestoview', get_string('requiredentriestoview', 'data'), $countoptions); 43 $mform->setHelpButton('requiredentriestoview', array('requiredentriestoview', get_string('requiredentriestoview', 'data'), 'data')); 44 45 $mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions); 46 $mform->setHelpButton('maxentries', array('maxentries', get_string('maxentries', 'data'), 'data')); 47 48 $ynoptions = array(0 => get_string('no'), 1 => get_string('yes')); 49 $mform->addElement('select', 'comments', get_string('comments', 'data'), $ynoptions); 50 $mform->setHelpButton('comments', array('comments', get_string('allowcomments', 'data'), 'data')); 51 52 $mform->addElement('select', 'approval', get_string('requireapproval', 'data'), $ynoptions); 53 $mform->setHelpButton('approval', array('requireapproval', get_string('requireapproval', 'data'), 'data')); 54 55 if($CFG->enablerssfeeds && $CFG->data_enablerssfeeds){ 56 $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions); 57 } 58 59 $mform->addElement('checkbox', 'assessed', get_string('allowratings', 'data') , get_string('ratingsuse', 'data')); 60 61 $mform->addElement('modgrade', 'scale', get_string('grade'), false); 62 $mform->disabledIf('scale', 'assessed'); 63 64 65 $this->standard_coursemodule_elements(array('groups'=>true, 'groupings'=>true, 'groupmembersonly'=>true)); 66 67 //------------------------------------------------------------------------------- 68 // buttons 69 $this->add_action_buttons(); 70 } 71 72 function data_preprocessing(&$default_values){ 73 if (empty($default_values['scale'])){ 74 $default_values['assessed'] = 0; 75 } 76 } 77 78 } 79 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 14 11:33:29 2009 | Cross-referenced by PHPXref 0.7 |