PageRenderTime 34ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/mod/wiki/comments_form.php

https://bitbucket.org/synergylearning/campusconnect
PHP | 41 lines | 25 code | 11 blank | 5 comment | 1 complexity | ea407b6cdb213811b8d7e6123f9d4485 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-3.0, GPL-3.0, LGPL-2.1, Apache-2.0, BSD-3-Clause, AGPL-3.0
  1. <?php
  2. if (!defined('MOODLE_INTERNAL')) {
  3. die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
  4. }
  5. require_once($CFG->dirroot . '/lib/formslib.php');
  6. class mod_wiki_comments_form extends moodleform {
  7. protected function definition() {
  8. $mform = $this->_form;
  9. $current = $this->_customdata['current'];
  10. $commentoptions = $this->_customdata['commentoptions'];
  11. // visible elements
  12. $mform->addElement('editor', 'entrycomment_editor', get_string('comment', 'glossary'), null, $commentoptions);
  13. $mform->addRule('entrycomment_editor', get_string('required'), 'required', null, 'client');
  14. $mform->setType('entrycomment_editor', PARAM_RAW); // processed by trust text or cleaned before the display
  15. // hidden optional params
  16. $mform->addElement('hidden', 'id', '');
  17. $mform->setType('id', PARAM_INT);
  18. $mform->addElement('hidden', 'action', '');
  19. $mform->setType('action', PARAM_ALPHAEXT);
  20. //-------------------------------------------------------------------------------
  21. // buttons
  22. $this->add_action_buttons(false);
  23. //-------------------------------------------------------------------------------
  24. $this->set_data($current);
  25. }
  26. public function edit_definition($current, $commentoptions) {
  27. $this->set_data($current);
  28. $this->set_data($commentoptions);
  29. }
  30. }