submission_form.php 3.0 KB

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