Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
1 <?php 2 3 if (!defined('MOODLE_INTERNAL')) { 4 die('Direct access to this script is forbidden!'); 5 } 6 require_once($CFG->libdir . '/formslib.php'); 7 8 9 class data_existing_preset_form extends moodleform { 10 public function definition() { 11 $this->_form->addElement('header', 'presets', get_string('usestandard', 'data')); 12 $this->_form->addHelpButton('presets', 'usestandard', 'data'); 13 14 $this->_form->addElement('hidden', 'd'); 15 $this->_form->setType('d', PARAM_INT); 16 $this->_form->addElement('hidden', 'action', 'confirmdelete'); 17 $this->_form->setType('action', PARAM_ALPHANUM); 18 $delete = get_string('delete'); 19 foreach ($this->_customdata['presets'] as $preset) { 20 $this->_form->addElement('radio', 'fullname', null, ' '.$preset->description, $preset->userid.'/'.$preset->shortname); 21 } 22 $this->_form->addElement('submit', 'importexisting', get_string('choose')); 23 } 24 } 25 26 class data_import_preset_zip_form extends moodleform { 27 public function definition() { 28 $this->_form->addElement('header', 'uploadpreset', get_string('fromfile', 'data')); 29 $this->_form->addHelpButton('uploadpreset', 'fromfile', 'data'); 30 31 $this->_form->addElement('hidden', 'd'); 32 $this->_form->setType('d', PARAM_INT); 33 $this->_form->addElement('hidden', 'mode', 'import'); 34 $this->_form->setType('mode', PARAM_ALPHANUM); 35 $this->_form->addElement('hidden', 'action', 'importzip'); 36 $this->_form->setType('action', PARAM_ALPHANUM); 37 $this->_form->addElement('filepicker', 'importfile', get_string('chooseorupload', 'data')); 38 $this->_form->addRule('importfile', null, 'required'); 39 $buttons = [ 40 $this->_form->createElement('submit', 'submitbutton', get_string('save')), 41 $this->_form->createElement('cancel'), 42 ]; 43 $this->_form->addGroup($buttons, 'buttonar', '', [' '], false); 44 } 45 } 46 47 class data_export_form extends moodleform { 48 public function definition() { 49 $this->_form->addElement('header', 'exportheading', get_string('exportaszip', 'data')); 50 $this->_form->addElement('hidden', 'd'); 51 $this->_form->setType('d', PARAM_INT); 52 $this->_form->addElement('hidden', 'action', 'export'); 53 $this->_form->setType('action', PARAM_ALPHANUM); 54 $this->_form->addElement('submit', 'export', get_string('export', 'data')); 55 } 56 } 57 58 class data_save_preset_form extends moodleform { 59 public function definition() { 60 $this->_form->addElement('header', 'exportheading', get_string('saveaspreset', 'data')); 61 $this->_form->addElement('hidden', 'd'); 62 $this->_form->setType('d', PARAM_INT); 63 $this->_form->addElement('hidden', 'action', 'save2'); 64 $this->_form->setType('action', PARAM_ALPHANUM); 65 $this->_form->addElement('text', 'name', get_string('name')); 66 $this->_form->setType('name', PARAM_FILE); 67 $this->_form->addRule('name', null, 'required'); 68 $this->_form->addElement('checkbox', 'overwrite', get_string('overwrite', 'data'), get_string('overrwritedesc', 'data')); 69 $this->_form->addElement('submit', 'saveaspreset', get_string('continue')); 70 } 71 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body