on-demand release 3.7dev+
[moodle.git] / mod / workshop / feedbackauthor_form.php
blobdf6665facb6ac5a93f8fd89a535f17e01c61af16
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * A form used by teachers to give feedback to authors on their submission
21 * @package mod_workshop
22 * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
26 defined('MOODLE_INTERNAL') || die();
28 require_once($CFG->dirroot . '/lib/formslib.php');
30 class workshop_feedbackauthor_form extends moodleform {
32 function definition() {
33 $mform = $this->_form;
35 $current = $this->_customdata['current'];
36 $workshop = $this->_customdata['workshop'];
37 $editoropts = $this->_customdata['editoropts'];
38 $options = $this->_customdata['options'];
40 $mform->addElement('header', 'feedbackauthorform', get_string('feedbackauthor', 'workshop'));
42 if (!empty($options['editablepublished'])) {
43 $mform->addElement('checkbox', 'published', get_string('publishsubmission', 'workshop'));
44 $mform->addHelpButton('published', 'publishsubmission', 'workshop');
45 $mform->setDefault('published', false);
48 $mform->addElement('static', 'grade', get_string('gradecalculated', 'workshop'));
50 $grades = array('' => get_string('notoverridden', 'workshop'));
51 for ($i = (int)$workshop->grade; $i >= 0; $i--) {
52 $grades[$i] = $i;
54 $mform->addElement('select', 'gradeover', get_string('gradeover', 'workshop'), $grades);
56 $mform->addElement('editor', 'feedbackauthor_editor', get_string('feedbackauthor', 'workshop'), null, $editoropts);
57 $mform->setType('feedbackauthor_editor', PARAM_RAW);
59 $mform->addElement('hidden', 'submissionid');
60 $mform->setType('submissionid', PARAM_INT);
62 $mform->addElement('submit', 'save', get_string('saveandclose', 'workshop'));
64 $this->set_data($current);
67 function validation($data, $files) {
68 global $CFG, $USER, $DB;
70 $errors = parent::validation($data, $files);
71 return $errors;