Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 403]
1 <?php 2 if (!defined('MOODLE_INTERNAL')) { 3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page 4 } 5 6 require_once($CFG->libdir.'/formslib.php'); 7 require_once($CFG->libdir.'/csvlib.class.php'); 8 9 class mod_data_import_form extends moodleform { 10 11 function definition() { 12 $mform =& $this->_form; 13 14 $dataid = $this->_customdata['dataid']; 15 $backtourl = $this->_customdata['backtourl']; 16 17 $mform->addElement('filepicker', 'recordsfile', get_string('csvfile', 'data')); 18 19 $delimiters = csv_import_reader::get_delimiter_list(); 20 $mform->addElement('select', 'fielddelimiter', get_string('fielddelimiter', 'data'), $delimiters); 21 $mform->setDefault('fielddelimiter', 'comma'); 22 23 $mform->addElement('text', 'fieldenclosure', get_string('fieldenclosure', 'data')); 24 $mform->setType('fieldenclosure', PARAM_CLEANHTML); 25 26 $choices = core_text::get_encodings(); 27 $mform->addElement('select', 'encoding', get_string('fileencoding', 'mod_data'), $choices); 28 $mform->setDefault('encoding', 'UTF-8'); 29 30 // Database activity ID. 31 $mform->addElement('hidden', 'd'); 32 $mform->setType('d', PARAM_INT); 33 $mform->setDefault('d', $dataid); 34 35 // Back to URL. 36 $mform->addElement('hidden', 'backto'); 37 $mform->setType('backto', PARAM_LOCALURL); 38 $mform->setDefault('backto', $backtourl); 39 40 $this->add_action_buttons(true, get_string('submit')); 41 } 42 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body