| [ 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_assignment_mod_form extends moodleform_mod { 5 6 function definition() { 7 global $CFG; 8 $mform =& $this->_form; 9 10 // this hack is needed for different settings of each subtype 11 if (!empty($this->_instance)) { 12 if($ass = get_record('assignment', 'id', (int)$this->_instance)) { 13 $type = $ass->assignmenttype; 14 } else { 15 error('incorrect assignment'); 16 } 17 } else { 18 $type = required_param('type', PARAM_ALPHA); 19 } 20 $mform->addElement('hidden', 'assignmenttype', $type); 21 $mform->setDefault('assignmenttype', $type); 22 $mform->addElement('hidden', 'type', $type); 23 $mform->setDefault('type', $type); 24 25 require($CFG->dirroot.'/mod/assignment/type/'.$type.'/assignment.class.php'); 26 $assignmentclass = 'assignment_'.$type; 27 $assignmentinstance = new $assignmentclass(); 28 29 //------------------------------------------------------------------------------- 30 $mform->addElement('header', 'general', get_string('general', 'form')); 31 32 // $mform->addElement('static', 'statictype', get_string('assignmenttype', 'assignment'), get_string('type'.$type,'assignment')); 33 34 $mform->addElement('text', 'name', get_string('assignmentname', 'assignment'), array('size'=>'64')); 35 if (!empty($CFG->formatstringstriptags)) { 36 $mform->setType('name', PARAM_TEXT); 37 } else { 38 $mform->setType('name', PARAM_CLEAN); 39 } 40 $mform->addRule('name', null, 'required', null, 'client'); 41 42 $mform->addElement('htmleditor', 'description', get_string('description', 'assignment')); 43 $mform->setType('description', PARAM_RAW); 44 $mform->setHelpButton('description', array('writing', 'questions', 'richtext'), false, 'editorhelpbutton'); 45 $mform->addRule('description', get_string('required'), 'required', null, 'client'); 46 47 $mform->addElement('modgrade', 'grade', get_string('grade')); 48 $mform->setDefault('grade', 100); 49 50 $mform->addElement('date_time_selector', 'timeavailable', get_string('availabledate', 'assignment'), array('optional'=>true)); 51 $mform->setDefault('timeavailable', time()); 52 $mform->addElement('date_time_selector', 'timedue', get_string('duedate', 'assignment'), array('optional'=>true)); 53 $mform->setDefault('timedue', time()+7*24*3600); 54 55 $ynoptions = array( 0 => get_string('no'), 1 => get_string('yes')); 56 57 $mform->addElement('select', 'preventlate', get_string('preventlate', 'assignment'), $ynoptions); 58 $mform->setDefault('preventlate', 0); 59 60 $mform->addElement('header', 'typedesc', get_string('type'.$type,'assignment')); 61 $assignmentinstance->setup_elements($mform); 62 63 $features = new stdClass; 64 $features->groups = true; 65 $features->groupings = true; 66 $features->groupmembersonly = true; 67 $this->standard_coursemodule_elements($features); 68 69 $this->add_action_buttons(); 70 } 71 72 73 74 } 75 ?>
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 |