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.
   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   * Class for storing calculated sub question statistics and intermediate calculation values.
  19   *
  20   * @package    core_question
  21   * @copyright  2013 The Open University
  22   * @author     James Pratt me@jamiep.org
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  namespace core_question\statistics\questions;
  27  defined('MOODLE_INTERNAL') || die();
  28  
  29  /**
  30   * A class to store calculated stats for a sub question.
  31   *
  32   * @package    core_question
  33   * @copyright  2013 The Open University
  34   * @author     James Pratt me@jamiep.org
  35   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  36   */
  37  class calculated_for_subquestion extends calculated {
  38      public $subquestion = true;
  39  
  40      /**
  41       * @var array What slots is this sub question used in?
  42       */
  43      public $usedin = array();
  44  
  45      /**
  46       * @var bool Have the slots this sub question has been used in got different grades?
  47       */
  48      public $differentweights = false;
  49  
  50      public $negcovar = 0;
  51  
  52      /**
  53       * @var int only set immediately before display in the table. The order of display in the table.
  54       */
  55      public $subqdisplayorder;
  56  
  57      /**
  58       * Constructor.
  59       *
  60       * @param object|null $step the step data for the step that this sub-question was first encountered in.
  61       * @param int|null $variant the variant no
  62       */
  63      public function __construct($step = null, $variant = null) {
  64          if ($step !== null) {
  65              $this->questionid = $step->questionid;
  66              $this->maxmark = $step->maxmark;
  67          }
  68          $this->variant = $variant;
  69      }
  70  }