|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 if (!defined('MOODLE_INTERNAL')) { 00004 die('Direct access to this script is forbidden!'); 00005 } 00006 require_once($CFG->libdir . '/formslib.php'); 00007 00008 00009 class data_existing_preset_form extends moodleform { 00010 public function definition() { 00011 $this->_form->addElement('header', 'presets', get_string('usestandard', 'data')); 00012 $this->_form->addHelpButton('presets', 'usestandard', 'data'); 00013 00014 $this->_form->addElement('hidden', 'd'); 00015 $this->_form->addElement('hidden', 'action', 'confirmdelete'); 00016 $delete = get_string('delete'); 00017 foreach ($this->_customdata['presets'] as $preset) { 00018 $this->_form->addElement('radio', 'fullname', null, ' '.$preset->description, $preset->userid.'/'.$preset->shortname); 00019 } 00020 $this->_form->addElement('submit', 'importexisting', get_string('choose')); 00021 } 00022 } 00023 00024 class data_import_preset_zip_form extends moodleform { 00025 public function definition() { 00026 $this->_form->addElement('header', 'uploadpreset', get_string('fromfile', 'data')); 00027 $this->_form->addHelpButton('uploadpreset', 'fromfile', 'data'); 00028 00029 $this->_form->addElement('hidden', 'd'); 00030 $this->_form->addElement('hidden', 'action', 'importzip'); 00031 $this->_form->addElement('filepicker', 'importfile', get_string('chooseorupload', 'data')); 00032 $this->_form->addRule('importfile', null, 'required'); 00033 $this->_form->addElement('submit', 'uploadzip', get_string('import')); 00034 } 00035 } 00036 00037 class data_export_form extends moodleform { 00038 public function definition() { 00039 $this->_form->addElement('header', 'exportheading', get_string('exportaszip', 'data')); 00040 $this->_form->addElement('hidden', 'd'); 00041 $this->_form->addElement('hidden', 'action', 'export'); 00042 $this->_form->addElement('submit', 'export', get_string('export', 'data')); 00043 } 00044 } 00045 00046 class data_save_preset_form extends moodleform { 00047 public function definition() { 00048 $this->_form->addElement('header', 'exportheading', get_string('saveaspreset', 'data')); 00049 $this->_form->addElement('hidden', 'd'); 00050 $this->_form->addElement('hidden', 'action', 'save2'); 00051 $this->_form->addElement('text', 'name', get_string('name')); 00052 $this->_form->setType('name', PARAM_FILE); 00053 $this->_form->addRule('name', null, 'required'); 00054 $this->_form->addElement('checkbox', 'overwrite', get_string('overwrite', 'data'), get_string('overrwritedesc', 'data')); 00055 $this->_form->addElement('submit', 'saveaspreset', get_string('continue')); 00056 } 00057 }