| [ 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_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 if (!empty($CFG->formatstringstriptags)) { 35 $mform->setType('name', PARAM_TEXT); 36 } else { 37 $mform->setType('name', PARAM_CLEAN); 38 } 39 $mform->addRule('name', null, 'required', null, 'client'); 40 41 $mform->addElement('htmleditor', 'summary', get_string('summary')); 42 $mform->setType('summary', PARAM_RAW); 43 $mform->setHelpButton('summary', array('summary', get_string('summary'), 'resource')); 44 // summary should be optional again MDL-9485 45 //$mform->addRule('summary', get_string('required'), 'required', null, 'client'); 46 47 $mform->addElement('header', 'typedesc', get_string('resourcetype'.$type,'resource')); 48 $this->_resinstance->setup_elements($mform); 49 50 $this->standard_coursemodule_elements(array('groups'=>false, 'groupmembersonly'=>true, 'gradecat'=>false)); 51 52 $this->add_action_buttons(); 53 } 54 55 function data_preprocessing(&$default_values){ 56 $this->_resinstance->setup_preprocessing($default_values); 57 } 58 59 } 60 ?>
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 |