PageRenderTime 51ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/mod/lesson/essay_form.php

https://bitbucket.org/moodle/moodle
PHP | 70 lines | 24 code | 16 blank | 30 comment | 1 complexity | 8806fa09dd8ecacf2715de4a0db3c48d MD5 | raw file
Possible License(s): Apache-2.0, LGPL-2.1, BSD-3-Clause, MIT, GPL-3.0
  1. <?php
  2. // This file is part of Moodle - http://moodle.org/
  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. /**
  17. * Essay grading form
  18. *
  19. * @package mod_lesson
  20. * @copyright 2009 Sam Hemelryk
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22. **/
  23. /**
  24. * Include formslib if it has not already been included
  25. */
  26. defined('MOODLE_INTERNAL') || die();
  27. require_once($CFG->libdir.'/formslib.php');
  28. /**
  29. * Essay grading form
  30. *
  31. * @copyright 2009 Sam Hemelryk
  32. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  33. **/
  34. class essay_grading_form extends moodleform {
  35. public function definition() {
  36. global $CFG;
  37. $mform = $this->_form;
  38. $mform->addElement('header', 'formheader', get_string('question', 'lesson'));
  39. $mform->addElement('hidden', 'id');
  40. $mform->setType('id', PARAM_INT);
  41. $mform->addElement('hidden', 'attemptid');
  42. $mform->setType('attemptid', PARAM_INT);
  43. $mform->addElement('hidden', 'mode', 'update');
  44. $mform->setType('mode', PARAM_ALPHA);
  45. $mform->addElement('static', 'question', get_string('question', 'lesson'));
  46. $mform->addElement('static', 'studentanswer', get_string('studentresponse', 'lesson', fullname($this->_customdata['user'], true)));
  47. $editoroptions = array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $CFG->maxbytes);
  48. $mform->addElement('editor', 'response_editor', get_string('comments', 'lesson'), null, $editoroptions);
  49. $mform->setType('response', PARAM_RAW);
  50. $mform->addElement('select', 'score', get_string('essayscore', 'lesson'), $this->_customdata['scoreoptions']);
  51. $mform->setType('score', PARAM_INT);
  52. $this->add_action_buttons(get_string('cancel'), get_string('savechanges'));
  53. }
  54. }