Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]

   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  /**
  18   * This file defines interface of all grading evaluation classes
  19   *
  20   * @package    mod_workshop
  21   * @copyright  2009 David Mudrak <david.mudrak@gmail.com>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  require_once($CFG->dirroot . '/lib/formslib.php');
  28  
  29  /**
  30   * Base class for all grading evaluation subplugins.
  31   */
  32  abstract class workshop_evaluation {
  33  
  34      /** @var workshop the parent workshop instance */
  35      protected $workshop;
  36  
  37      /**
  38       * Calculates grades for assessment and updates 'gradinggrade' fields in 'workshop_assessments' table
  39       *
  40       * @param stdClass $settings settings for this round of evaluation
  41       * @param null|int|array $restrict if null, update all reviewers, otherwise update just grades for the given reviewers(s)
  42       */
  43      abstract public function update_grading_grades(stdClass $settings, $restrict=null);
  44  
  45      /**
  46       * Returns an instance of the form to provide evaluation settings.
  47        *
  48       * This is called by view.php (to display) and aggregate.php (to process and dispatch).
  49       * It returns the basic form with just the submit button by default. Evaluators may
  50       * extend or overwrite the default form to include some custom settings.
  51       *
  52       * @return workshop_evaluation_settings_form
  53       */
  54      public function get_settings_form(moodle_url $actionurl=null) {
  55  
  56          $customdata = array('workshop' => $this->workshop);
  57          $attributes = array('class' => 'evalsettingsform');
  58  
  59          return new workshop_evaluation_settings_form($actionurl, $customdata, 'post', '', $attributes);
  60      }
  61  
  62      /**
  63       * Delete all data related to a given workshop module instance
  64       *
  65       * This is called from {@link workshop_delete_instance()}.
  66       *
  67       * @param int $workshopid id of the workshop module instance being deleted
  68       * @return void
  69       */
  70      public static function delete_instance($workshopid) {
  71  
  72      }
  73  }
  74  
  75  
  76  /**
  77   * Base form to hold eventual evaluation settings.
  78   */
  79  class workshop_evaluation_settings_form extends moodleform {
  80  
  81      /**
  82       * Defines the common form fields.
  83       */
  84      public function definition() {
  85          $mform = $this->_form;
  86  
  87          $workshop = $this->_customdata['workshop'];
  88  
  89          $mform->addElement('header', 'general', get_string('evaluationsettings', 'mod_workshop'));
  90  
  91          $this->definition_sub();
  92  
  93          $mform->addElement('submit', 'submit', get_string('aggregategrades', 'workshop'));
  94      }
  95  
  96      /**
  97       * Defines the subplugin specific fields.
  98       */
  99      protected function definition_sub() {
 100      }
 101  }