1
0

params_form.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. * Form to add and edit iLM params.
  4. *
  5. * @author Patricia Alves Rodrigues
  6. * @author Leônidas O. Brandão
  7. * @version v 1.0 2013/09/11
  8. * @package mod_iassign_settings
  9. * @since 2010/09/11
  10. * @copyright iMatica (<a href="http://www.matematica.br">iMath</a>) - Computer Science Dep. of IME-USP (Brazil)
  11. *
  12. * <b>License</b>
  13. * - http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  14. */
  15. // Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly.
  16. if (!defined('MOODLE_INTERNAL')) {
  17. die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
  18. }
  19. require_once ($CFG->libdir . '/formslib.php');
  20. require_once ($CFG->dirroot . '/course/moodleform_mod.php');
  21. require_once ($CFG->dirroot . '/mod/iassign/lib.php');
  22. /// This class create form based moodleform.
  23. // @see moodleform
  24. class param_ilm_form extends moodleform {
  25. // Add elements to form
  26. function definition () {
  27. global $CFG, $COURSE, $USER, $DB;
  28. $mform = & $this->_form;
  29. //-------------------------------------------------------------------------------
  30. /// Adding the "data_ilm" fieldset, where all the common settings are showed
  31. $mform->addElement('header', 'data_param', get_string('data_param', 'iassign'));
  32. /// Adding the standard "name" field
  33. $mform->addElement('text', 'param_name', get_string('config_param_name', 'iassign'), array('size' => '55'));
  34. $mform->setType('param_name', PARAM_TEXT);
  35. $mform->addRule('param_name', get_string('required', 'iassign'), 'required');
  36. /// Adding the standard "version" field
  37. $mform->addElement('text', 'param_value', get_string('config_param_value', 'iassign'), array('size' => '55'));
  38. $mform->setType('param_value', PARAM_TEXT);
  39. $mform->addRule('param_value', get_string('required', 'iassign'), 'required');
  40. /// Adding the standard "description" field
  41. $mform->addElement('htmleditor', 'description', get_string('config_param_description', 'iassign'));
  42. $mform->setType('description', PARAM_RAW);
  43. $mform->addRule('description', get_string('required', 'iassign'), 'required');
  44. /// Adding the standard "evaluate" field
  45. $mform->addElement('selectyesno', 'visible', get_string('visible', 'iassign'));
  46. $mform->setDefault('visible', 1);
  47. $mform->addRule('visible', get_string('required', 'iassign'), 'required');
  48. $mform->addElement('hidden', 'id');
  49. $mform->setType('id', PARAM_INT);
  50. $mform->addElement('hidden', 'iassign_ilmid');
  51. $mform->setType('iassign_ilmid', PARAM_INT);
  52. $mform->addElement('hidden', 'action');
  53. $mform->setType('action', PARAM_TEXT);
  54. $this->add_action_buttons();
  55. }
  56. }