submission_form.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. require_once($CFG->dirroot.'/course/moodleform_mod.php');
  6. // require_once($CFG->dirroot.'/mod/gradeimporter/lib.php');
  7. class mod_submission_form extends moodleform_mod{
  8. function definition(){
  9. global $CFG, $DB, $OUTPUT;
  10. $mform =& $this->_form;
  11. $gradeimporter = $this->_customdata;
  12. $mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size'=>'64'));
  13. $mform->setType('name', PARAM_TEXT);
  14. $mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client');
  15. $this->standard_intro_elements(get_string('description', 'gradeimporter'));
  16. $mform->addElement('filemanager', 'submissionFiles', getString('submissionFiles', 'gradeimporter'), null,
  17. array('subdirs' => 1, 'maxbytes' => $maxbytes, 'areamaxbytes' => $maxbytes, 'maxfiles' => -1,
  18. 'accepted_types' => array('*'), 'return_types' => FILE_INTERNAL | FILE_EXTERNAL));
  19. //restrict accepted types to compacted?
  20. $mform->addHelpButton('submissionFiles', 'helpsubmissionfiles', 'gradeimporter');
  21. //csv delimiter
  22. $csv_delimiter = array();
  23. $csv_delimiter[1] = ',';
  24. /*$csv_delimiter[2] = ';';
  25. $csv_delimiter[3] = ':';
  26. $csv_delimiter[4] = '\t';
  27. */
  28. $mform->addElement('select', 'csv_delimiter', get_string('choose_type_activity', 'iassign'), $csv_delimiter, array('onChange' => 'config_type(this.value);'));
  29. $mform->setDefault('csv_delimiter', 1); // default csv_delimiter = 3
  30. $mform->addHelpButton('csv_delimiter', 'helpcsvdelimiter', 'gradeimporter');
  31. //submissionType
  32. //if the grades go into the gradebook or not
  33. $radioarray = array();
  34. $radioarray[] = $mform->createElement('radio', 'gradebook', '', get_string('gradebookY','gradeimporter'), 1, $attributes);
  35. $radioarray[] = $mform->createElement('radio', 'gradebook', '', get_string('gradebookN', 'gradeimporter'), 0, $attributes);
  36. $mform->addgroup($radioarray, 'radioar', '', array(' '), false);
  37. $mform->setDefault('gradebook', 0);
  38. //if students can se this submission or not
  39. $visibilityar = array();
  40. $visibilityar[] = $mform->createElement('radio', 'visibility', '', get_string('visibilityY','gradeimporter'), 1, $attributes);
  41. $visibilityar[] = $mform->createElement('radio', 'visibility', '', get_string('visibilityN','gradeimporter'), 0, $attributes);
  42. $mform->addgroup($visibilityar, 'radioar', '', array(' '), false);
  43. $mform->setDefault('visibility', 1);
  44. $this->add_action_buttons();
  45. }
  46. }