Merge branch 'MDL-42411-master' of git://github.com/damyon/moodle
[moodle.git] / mod / workshop / feedbackreviewer_form.php
blobc77ba5df7661854e82c73822c477e9fed11f9d60
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 reviewers on assessments
21 * @package mod
22 * @subpackage workshop
23 * @copyright 2009 David Mudrak <david.mudrak@gmail.com>
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') || die();
29 require_once($CFG->dirroot . '/lib/formslib.php');
31 class workshop_feedbackreviewer_form extends moodleform {
33 function definition() {
34 $mform = $this->_form;
36 $current = $this->_customdata['current'];
37 $workshop = $this->_customdata['workshop'];
38 $editoropts = $this->_customdata['editoropts'];
39 $options = $this->_customdata['options'];
41 $mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'workshop'));
43 if (!empty($options['editableweight'])) {
44 $mform->addElement('select', 'weight',
45 get_string('assessmentweight', 'workshop'), workshop::available_assessment_weights_list());
46 $mform->setDefault('weight', 1);
49 $mform->addElement('static', 'gradinggrade', get_string('gradinggradecalculated', 'workshop'));
50 if (!empty($options['overridablegradinggrade'])) {
51 $grades = array('' => get_string('notoverridden', 'workshop'));
52 for ($i = (int)$workshop->gradinggrade; $i >= 0; $i--) {
53 $grades[$i] = $i;
55 $mform->addElement('select', 'gradinggradeover', get_string('gradinggradeover', 'workshop'), $grades);
57 $mform->addElement('editor', 'feedbackreviewer_editor', get_string('feedbackreviewer', 'workshop'), null, $editoropts);
58 $mform->setType('feedbackreviewer_editor', PARAM_RAW);
61 $mform->addElement('hidden', 'asid');
62 $mform->setType('asid', PARAM_INT);
64 $mform->addElement('submit', 'save', get_string('saveandclose', 'workshop'));
66 $this->set_data($current);
69 function validation($data, $files) {
70 global $CFG, $USER, $DB;
72 $errors = parent::validation($data, $files);
73 return $errors;