params_form.php 2.7 KB

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