|
@@ -3,60 +3,97 @@
|
|
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
|
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
|
}
|
|
}
|
|
|
|
|
|
- require_once($CFG->dirroot.'/course/moodleform_mod.php');
|
|
|
|
- // require_once($CFG->dirroot.'/mod/gradeimporter/lib.php');
|
|
|
|
|
|
+ require_once($CFG->dirroot.'/lib/formslib.php');
|
|
|
|
|
|
- class mod_submission_form extends moodleform_mod{
|
|
|
|
|
|
+ //require_once($CFG->dirroot.'/course/moodleform_mod.php');
|
|
|
|
+ //require_once($CFG->dirroot.'/mod/gradeimporter/lib.php');
|
|
|
|
+
|
|
|
|
+ class mod_gradeimporter_submission_form extends moodleform{
|
|
|
|
|
|
function definition(){
|
|
function definition(){
|
|
- global $CFG, $DB, $OUTPUT;
|
|
|
|
|
|
+ global $CFG, $DB;
|
|
|
|
|
|
$mform =& $this->_form;
|
|
$mform =& $this->_form;
|
|
- $gradeimporter = $this->_customdata;
|
|
|
|
|
|
+
|
|
|
|
+ $submission = $this->_customdata['submission'];
|
|
|
|
+ $cm = $this->_customdata['cm'];
|
|
|
|
+ $descriptionoptions = $this->_customdata['descriptionoptions'];
|
|
|
|
+ $submissionoptions = $this->_customdata['submissionoptions'];
|
|
|
|
+
|
|
|
|
+ $context = context_module::instance($cm->id);
|
|
|
|
+ $fmtoptions = array('context'=>$context);
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------
|
|
|
|
+//form elements start here
|
|
|
|
+ $mform->addElement('header', 'general', get_string('general', 'form'));
|
|
|
|
+
|
|
|
|
+ //submission name
|
|
$mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size'=>'64'));
|
|
$mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size'=>'64'));
|
|
$mform->setType('name', PARAM_TEXT);
|
|
$mform->setType('name', PARAM_TEXT);
|
|
$mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client');
|
|
$mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client');
|
|
|
|
|
|
- $this->standard_intro_elements(get_string('description', 'gradeimporter'));
|
|
|
|
|
|
+ //description
|
|
|
|
+ $mform->addElement('editor', 'description_editor', get_string('submissiondescription', 'gradeimporter'), null, $descriptionoptions);
|
|
|
|
+
|
|
|
|
+ //description format
|
|
|
|
+ //kill on the install.xml
|
|
|
|
+
|
|
|
|
+ $mform->addElement('header', 'filehandling', get_string('filehandling', 'gradeimporter'));
|
|
|
|
|
|
- $mform->addElement('filemanager', 'submissionFiles', getString('submissionFiles', 'gradeimporter'), null,
|
|
|
|
- array('subdirs' => 1, 'maxbytes' => $maxbytes, 'areamaxbytes' => $maxbytes, 'maxfiles' => -1,
|
|
|
|
- 'accepted_types' => array('*'), 'return_types' => FILE_INTERNAL | FILE_EXTERNAL));
|
|
|
|
- //restrict accepted types to compacted?
|
|
|
|
- $mform->addHelpButton('submissionFiles', 'helpsubmissionfiles', 'gradeimporter');
|
|
|
|
|
|
+ //submission type
|
|
|
|
+ $submissiontype = array();
|
|
|
|
+ $submissiontype[0] = get_string('exam', 'gradeimporter');
|
|
|
|
+ $submissiontype[1] = get_string('activity', 'gradeimporter');
|
|
|
|
|
|
- //csv delimiter
|
|
|
|
|
|
+
|
|
|
|
+ $mform->addElement('select', 'type', get_string('submissiontype', 'gradeimporter'), $submissiontype, array('onChange' => 'config_type(this.value);'));
|
|
|
|
+ //$mform->setDefault('submissiontype', 0); // default submissiontype = 3
|
|
|
|
+ $mform->addHelpButton('submissiontype', 'subtype_help', 'gradeimporter');
|
|
|
|
+
|
|
|
|
+ //receive the files
|
|
|
|
+ $mform->addElement('filemanager', 'submission_filemanager', get_string('submissionFiles', 'gradeimporter'), null, $descriptionoptions);
|
|
|
|
+ $mform->addHelpButton('submission_filemanager', 'submissionfiles', 'gradeimporter');
|
|
|
|
|
|
|
|
+ //csv delimiter
|
|
$csv_delimiter = array();
|
|
$csv_delimiter = array();
|
|
$csv_delimiter[1] = ',';
|
|
$csv_delimiter[1] = ',';
|
|
/*$csv_delimiter[2] = ';';
|
|
/*$csv_delimiter[2] = ';';
|
|
$csv_delimiter[3] = ':';
|
|
$csv_delimiter[3] = ':';
|
|
$csv_delimiter[4] = '\t';
|
|
$csv_delimiter[4] = '\t';
|
|
-*/
|
|
|
|
- $mform->addElement('select', 'csv_delimiter', get_string('choose_type_activity', 'iassign'), $csv_delimiter, array('onChange' => 'config_type(this.value);'));
|
|
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ $mform->addElement('select', 'csv_delimiter', get_string('csvdelimiter', 'gradeimporter'), $csv_delimiter, array('onChange' => 'config_type(this.value);'));
|
|
$mform->setDefault('csv_delimiter', 1); // default csv_delimiter = 3
|
|
$mform->setDefault('csv_delimiter', 1); // default csv_delimiter = 3
|
|
- $mform->addHelpButton('csv_delimiter', 'helpcsvdelimiter', 'gradeimporter');
|
|
|
|
-
|
|
|
|
- //submissionType
|
|
|
|
|
|
+ $mform->addHelpButton('csv_delimiter', 'csvdelimiter_help', 'gradeimporter');
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //gradebook Y/N Combobox
|
|
|
|
+ $ynarray = array();
|
|
|
|
+ $ynarray[0] = get_string('no', 'gradeimporter');
|
|
|
|
+ $ynarray[1] = get_string('yes', 'gradeimporter');
|
|
|
|
+ $mform->addElement('select', 'gradebook', get_string('gradebookYN', 'gradeimporter'), $ynarray);
|
|
|
|
+ //$mform->setDefault('gradebook', 0);
|
|
|
|
+ $mform->addHelpButton('gradebook', 'gradebook_help', 'gradeimporter');
|
|
|
|
|
|
- //if the grades go into the gradebook or not
|
|
|
|
- $radioarray = array();
|
|
|
|
- $radioarray[] = $mform->createElement('radio', 'gradebook', '', get_string('gradebookY','gradeimporter'), 1, $attributes);
|
|
|
|
- $radioarray[] = $mform->createElement('radio', 'gradebook', '', get_string('gradebookN', 'gradeimporter'), 0, $attributes);
|
|
|
|
- $mform->addgroup($radioarray, 'radioar', '', array(' '), false);
|
|
|
|
- $mform->setDefault('gradebook', 0);
|
|
|
|
|
|
|
|
|
|
+ //visibility Y/N Combobox
|
|
|
|
+ $mform->addElement('select', 'visibility', get_string('visibilityYN', 'gradeimporter'), $ynarray);
|
|
|
|
+ //$mform->setDefault('visibility', 0);
|
|
|
|
+ $mform->addHelpButton('visibility', 'visibility_help', 'gradeimporter');
|
|
|
|
|
|
- //if students can se this submission or not
|
|
|
|
- $visibilityar = array();
|
|
|
|
- $visibilityar[] = $mform->createElement('radio', 'visibility', '', get_string('visibilityY','gradeimporter'), 1, $attributes);
|
|
|
|
- $visibilityar[] = $mform->createElement('radio', 'visibility', '', get_string('visibilityN','gradeimporter'), 0, $attributes);
|
|
|
|
- $mform->addgroup($visibilityar, 'radioar', '', array(' '), false);
|
|
|
|
- $mform->setDefault('visibility', 1);
|
|
|
|
|
|
+ //-----------------------------
|
|
|
|
+ //hidden fields
|
|
|
|
+ $mform->addElement('hidden', 'id');
|
|
|
|
+ $mform->setType('id', PARAM_INT);
|
|
|
|
+ $mform->addElement('hidden', 'cmid');
|
|
|
|
+ $mform->setType('cmid', PARAM_INT);
|
|
|
|
+ //------------------------------
|
|
|
|
|
|
|
|
+ //--------------------------------------------------------------
|
|
$this->add_action_buttons();
|
|
$this->add_action_buttons();
|
|
|
|
+
|
|
|
|
+ //--------------------------------------------------------------
|
|
|
|
+ $this->set_data($submission);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|