2 if (!defined('MOODLE_INTERNAL')) {
3 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
6 require_once($CFG->libdir
.'/formslib.php');
7 require_once($CFG->libdir
.'/csvlib.class.php');
9 class mod_data_import_form
extends moodleform
{
11 function definition() {
13 $mform =& $this->_form
;
14 $cmid = $this->_customdata
['id'];
16 $mform->addElement('filepicker', 'recordsfile', get_string('csvfile', 'data'));
18 $delimiters = csv_import_reader
::get_delimiter_list();
19 $mform->addElement('select', 'fielddelimiter', get_string('fielddelimiter', 'data'), $delimiters);
20 $mform->setDefault('fielddelimiter', 'comma');
22 $mform->addElement('text', 'fieldenclosure', get_string('fieldenclosure', 'data'));
23 $mform->setType('fieldenclosure', PARAM_CLEANHTML
);
24 $choices = core_text
::get_encodings();
25 $mform->addElement('select', 'encoding', get_string('fileencoding', 'mod_data'), $choices);
26 $mform->setDefault('encoding', 'UTF-8');
28 $submit_string = get_string('submit');
30 $mform->addElement('hidden', 'd');
31 $mform->setType('d', PARAM_INT
);
33 $this->add_action_buttons(false, $submit_string);