Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [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      /**
  35       * Calculates grades for assessment and updates 'gradinggrade' fields in 'workshop_assessments' table
  36       *
  37       * @param stdClass $settings settings for this round of evaluation
  38       * @param null|int|array $restrict if null, update all reviewers, otherwise update just grades for the given reviewers(s)
  39       */
  40      abstract public function update_grading_grades(stdClass $settings, $restrict=null);
  41  
  42      /**
  43       * Returns an instance of the form to provide evaluation settings.
  44        *
  45       * This is called by view.php (to display) and aggregate.php (to process and dispatch).
  46       * It returns the basic form with just the submit button by default. Evaluators may
  47       * extend or overwrite the default form to include some custom settings.
  48       *
  49       * @return workshop_evaluation_settings_form
  50       */
  51      public function get_settings_form(moodle_url $actionurl=null) {
  52  
  53          $customdata = array('workshop' => $this->workshop);
  54          $attributes = array('class' => 'evalsettingsform');
  55  
  56          return new workshop_evaluation_settings_form($actionurl, $customdata, 'post', '', $attributes);
  57      }
  58  
  59      /**
  60       * Delete all data related to a given workshop module instance
  61       *
  62       * This is called from {@link workshop_delete_instance()}.
  63       *
  64       * @param int $workshopid id of the workshop module instance being deleted
  65       * @return void
  66       */
  67      public static function delete_instance($workshopid) {
  68  
  69      }
  70  }
  71  
  72  
  73  /**
  74   * Base form to hold eventual evaluation settings.
  75   */
  76  class workshop_evaluation_settings_form extends moodleform {
  77  
  78      /**
  79       * Defines the common form fields.
  80       */
  81      public function definition() {
  82          $mform = $this->_form;
  83  
  84          $workshop = $this->_customdata['workshop'];
  85  
  86          $mform->addElement('header', 'general', get_string('evaluationsettings', 'mod_workshop'));
  87  
  88          $this->definition_sub();
  89  
  90          $mform->addElement('submit', 'submit', get_string('aggregategrades', 'workshop'));
  91      }
  92  
  93      /**
  94       * Defines the subplugin specific fields.
  95       */
  96      protected function definition_sub() {
  97      }
  98  }