mod_form.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. // This file is part of
  3. //
  4. // Moodle is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // Moodle is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  16. defined('MOODLE_INTERNAL') || die();
  17. require_once($CFG->dirroot.'/course/moodleform_mod.php');
  18. require_once($CFG->dirroot.'/mod/gradeimporter/lib.php');
  19. class mod_gradeimporter_mod_form extends moodleform_mod {
  20. public function definition() {
  21. global $CFG, $COURSE, $USER, $DB, $OUTPUT;
  22. $mform =& $this->_form;
  23. $coursemodulesid = optional_param('update', 0, PARAM_INT);
  24. // Header
  25. $mform->addElement('header', 'general', get_string('general', 'gradeimporter'));
  26. // Name text field
  27. $mform->addElement('text', 'name', get_string('name', 'gradeimporter'), array('size' => '64'));
  28. $mform->setType('name', PARAM_TEXT);
  29. $mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client');
  30. // Description
  31. $this->standard_intro_elements(get_string('description', 'gradeimporter'));
  32. $features = array('groups' => false, 'groupings' => false,
  33. 'groupmembersonly' => false, 'outcomes' => false,
  34. 'gradecat' => false, 'idnumber' => false
  35. );
  36. $this->standard_coursemodule_elements($features);
  37. // Hidden fields
  38. $mform->addElement('hidden', 'action');
  39. $mform->setType('action', PARAM_TEXT);
  40. $mform->addElement('hidden', 'id');
  41. $mform->setType('id', PARAM_TEXT);
  42. $mform->addElement('hidden', 'author_name');
  43. $mform->setType('author_name', PARAM_TEXT);
  44. $mform->addElement('hidden', 'author_modified_name');
  45. $mform->setType('author_modified_name', PARAM_TEXT);
  46. $mform->addElement('hidden', 'timecreated');
  47. $mform->setType('timecreated', PARAM_TEXT);
  48. $mform->addElement('hidden', 'position');
  49. $mform->setType('position', PARAM_TEXT);
  50. $this->add_action_buttons();
  51. }
  52. }