mod_form.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. 'maxlength' => "256")
  29. );
  30. $mform->setType('name', PARAM_TEXT);
  31. $mform->addRule('name', get_string('error_nameField', 'gradeimporter'), 'required', null, 'client');
  32. // Description
  33. $this->standard_intro_elements(get_string('description', 'gradeimporter'));
  34. $features = array('groups' => false, 'groupings' => false,
  35. 'groupmembersonly' => false, 'outcomes' => false,
  36. 'gradecat' => false, 'idnumber' => false
  37. );
  38. $this->standard_coursemodule_elements($features);
  39. // Hidden fields
  40. $mform->addElement('hidden', 'action');
  41. $mform->setType('action', PARAM_TEXT);
  42. $mform->addElement('hidden', 'id');
  43. $mform->setType('id', PARAM_TEXT);
  44. $mform->addElement('hidden', 'author_name');
  45. $mform->setType('author_name', PARAM_TEXT);
  46. $mform->addElement('hidden', 'author_modified_name');
  47. $mform->setType('author_modified_name', PARAM_TEXT);
  48. $mform->addElement('hidden', 'timecreated');
  49. $mform->setType('timecreated', PARAM_TEXT);
  50. $mform->addElement('hidden', 'position');
  51. $mform->setType('position', PARAM_TEXT);
  52. $this->add_action_buttons();
  53. }
  54. }