Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
   1  <?php
   2  
   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.
  14  //
  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/>.
  17  
  18  /**
  19   * A form used by teachers to give feedback to reviewers on assessments
  20   *
  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
  24   */
  25  
  26  defined('MOODLE_INTERNAL') || die();
  27  
  28  require_once($CFG->dirroot . '/lib/formslib.php');
  29  
  30  class workshop_feedbackreviewer_form extends moodleform {
  31  
  32      function definition() {
  33          $mform = $this->_form;
  34  
  35          $current    = $this->_customdata['current'];
  36          $workshop   = $this->_customdata['workshop'];
  37          $editoropts = $this->_customdata['editoropts'];
  38          $options    = $this->_customdata['options'];
  39  
  40          $mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'workshop'));
  41  
  42          if (!empty($options['editableweight'])) {
  43              $mform->addElement('select', 'weight',
  44                      get_string('assessmentweight', 'workshop'), workshop::available_assessment_weights_list());
  45              $mform->setDefault('weight', 1);
  46          }
  47  
  48          $mform->addElement('static', 'gradinggrade', get_string('gradinggradecalculated', 'workshop'));
  49          if (!empty($options['overridablegradinggrade'])) {
  50              $grades = array('' => get_string('notoverridden', 'workshop'));
  51              for ($i = (int)$workshop->gradinggrade; $i >= 0; $i--) {
  52                  $grades[$i] = $i;
  53              }
  54              $mform->addElement('select', 'gradinggradeover', get_string('gradinggradeover', 'workshop'), $grades);
  55  
  56              $mform->addElement('editor', 'feedbackreviewer_editor', get_string('feedbackreviewer', 'workshop'), null, $editoropts);
  57              $mform->setType('feedbackreviewer_editor', PARAM_RAW);
  58          }
  59  
  60          $mform->addElement('hidden', 'asid');
  61          $mform->setType('asid', PARAM_INT);
  62  
  63          $mform->addElement('submit', 'save', get_string('saveandclose', 'workshop'));
  64  
  65          $this->set_data($current);
  66      }
  67  
  68      function validation($data, $files) {
  69          global $CFG, $USER, $DB;
  70  
  71          $errors = parent::validation($data, $files);
  72          return $errors;
  73      }
  74  }