mod_form.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * The main nasatlx configuration form
  4. *
  5. * It uses the standard core Moodle formslib. For more info about them, please
  6. * visit: http://docs.moodle.org/en/Development:lib/formslib.php
  7. *
  8. * @package mod_nasatlx
  9. * @copyright 2014 LInE - http://line.ime.usp.br
  10. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  11. */
  12. defined('MOODLE_INTERNAL') || die();
  13. require_once($CFG->dirroot.'/course/moodleform_mod.php');
  14. /**
  15. * Module instance settings form
  16. */
  17. class mod_nasatlx_mod_form extends moodleform_mod {
  18. /**
  19. * Defines forms elements
  20. */
  21. public function definition() {
  22. $mform = $this->_form;
  23. //-------------------------------------------------------------------------------
  24. // Adding the "general" fieldset, where all the common settings are showed
  25. $mform->addElement('header', 'general', get_string('general', 'form'));
  26. // Adding the standard "name" field
  27. $mform->addElement('text', 'name', get_string('nasatlxname', 'nasatlx'), array('size'=>'64'));
  28. if (!empty($CFG->formatstringstriptags)) {
  29. $mform->setType('name', PARAM_TEXT);
  30. } else {
  31. $mform->setType('name', PARAM_CLEAN);
  32. }
  33. $mform->addRule('name', null, 'required', null, 'client');
  34. $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
  35. $mform->addHelpButton('name', 'nasatlxname', 'nasatlx');
  36. // Adding the standard "intro" and "introformat" fields
  37. $this->add_intro_editor();
  38. //-------------------------------------------------------------------------------
  39. // Adding the rest of nasatlx settings, spreeading all them into this fieldset
  40. // or adding more fieldsets ('header' elements) if needed for better logic
  41. $mform->addElement('static', 'label1', 'nasatlxsetting1', 'Your nasatlx fields go here. Replace me!');
  42. $mform->addElement('header', 'nasatlxfieldset', get_string('nasatlxfieldset', 'nasatlx'));
  43. $mform->addElement('static', 'label2', 'nasatlxsetting2', 'Your nasatlx fields go here. Replace me!');
  44. //-------------------------------------------------------------------------------
  45. // add standard elements, common to all modules
  46. $this->standard_coursemodule_elements();
  47. //-------------------------------------------------------------------------------
  48. // add standard buttons, common to all modules
  49. $this->add_action_buttons();
  50. }
  51. }