| [ Index ] |
PHP Cross Reference of Moodle |
[Summary view] [Print] [Text view]
1 <?php 2 require_once ($CFG->dirroot.'/course/moodleform_mod.php'); 3 4 class mod_resource_mod_form extends moodleform_mod { 5 var $_resinstance; 6 7 function definition() { 8 global $CFG; 9 $mform =& $this->_form; 10 11 // this hack is needed for different settings of each subtype 12 if (!empty($this->_instance)) { 13 if($res = get_record('resource', 'id', (int)$this->_instance)) { 14 $type = $res->type; 15 } else { 16 error('incorrect assignment'); 17 } 18 } else { 19 $type = required_param('type', PARAM_ALPHA); 20 } 21 $mform->addElement('hidden', 'type', $type); 22 $mform->setDefault('type', $type); 23 24 require($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php'); 25 $resclass = 'resource_'.$type; 26 $this->_resinstance = new $resclass(); 27 28 //------------------------------------------------------------------------------- 29 $mform->addElement('header', 'general', get_string('general', 'form')); 30 31 // $mform->addElement('static', 'statictype', get_string('assignmenttype', 'assignment'), get_string('type'.$type,'assignment')); 32 33 $mform->addElement('text', 'name', get_string('name'), array('size'=>'48')); 34 $mform->setType('name', PARAM_TEXT); 35 $mform->addRule('name', null, 'required', null, 'client'); 36 37 $mform->addElement('htmleditor', 'summary', get_string('summary')); 38 $mform->setType('summary', PARAM_RAW); 39 $mform->setHelpButton('summary', array('summary', get_string('summary'), 'resource')); 40 // summary should be optional again MDL-9485 41 //$mform->addRule('summary', get_string('required'), 'required', null, 'client'); 42 43 $mform->addElement('header', 'typedesc', get_string('resourcetype'.$type,'resource')); 44 $this->_resinstance->setup_elements($mform); 45 46 $this->standard_coursemodule_elements(false); 47 48 $this->add_action_buttons(); 49 } 50 51 function data_preprocessing(&$default_values){ 52 $this->_resinstance->setup_preprocessing($default_values); 53 } 54 55 } 56 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Nov 14 17:38:08 2007 | Cross-referenced by PHPXref 0.7 |