Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.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  namespace mod_quiz\output;
  18  
  19  use mod_quiz\access_manager;
  20  use mod_quiz\form\preflight_check_form;
  21  use mod_quiz\quiz_attempt;
  22  use moodle_url;
  23  
  24  /**
  25   * This class captures all the various information to render the front page of the quiz activity.
  26   *
  27   * This class is not currently renderable or templatable, but it very nearly could be,
  28   * which is why it is in the output namespace. It is used to send data to the renderer.
  29   *
  30   * @package   mod_quiz
  31   * @category  output
  32   * @copyright 2011 The Open University
  33   * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  34   */
  35  class view_page {
  36      /** @var array $infomessages of messages with information to display about the quiz. */
  37      public $infomessages;
  38      /** @var array $attempts contains all the user's attempts at this quiz. */
  39      public $attempts;
  40      /** @var quiz_attempt[] $attemptobjs objects corresponding to $attempts. */
  41      public $attemptobjs;
  42      /** @var access_manager $accessmanager contains various access rules. */
  43      public $accessmanager;
  44      /** @var bool $canreviewmine whether the current user has the capability to
  45       *       review their own attempts. */
  46      public $canreviewmine;
  47      /** @var bool $canedit whether the current user has the capability to edit the quiz. */
  48      public $canedit;
  49      /** @var moodle_url $editurl the URL for editing this quiz. */
  50      public $editurl;
  51      /** @var int $attemptcolumn contains the number of attempts done. */
  52      public $attemptcolumn;
  53      /** @var int $gradecolumn contains the grades of any attempts. */
  54      public $gradecolumn;
  55      /** @var int $markcolumn contains the marks of any attempt. */
  56      public $markcolumn;
  57      /** @var int $overallstats contains all marks for any attempt. */
  58      public $overallstats;
  59      /** @var string $feedbackcolumn contains any feedback for and attempt. */
  60      public $feedbackcolumn;
  61      /** @var string $timenow contains a timestamp in string format. */
  62      public $timenow;
  63      /** @var int $numattempts contains the total number of attempts. */
  64      public $numattempts;
  65      /** @var float $mygrade contains the user's final grade for a quiz. */
  66      public $mygrade;
  67      /** @var bool $moreattempts whether this user is allowed more attempts. */
  68      public $moreattempts;
  69      /** @var int $mygradeoverridden contains an overriden grade. */
  70      public $mygradeoverridden;
  71      /** @var string $gradebookfeedback contains any feedback for a gradebook. */
  72      public $gradebookfeedback;
  73      /** @var bool $unfinished contains 1 if an attempt is unfinished. */
  74      public $unfinished;
  75      /** @var stdClass $lastfinishedattempt the last attempt from the attempts array. */
  76      public $lastfinishedattempt;
  77      /** @var array $preventmessages of messages telling the user why they can't
  78       *       attempt the quiz now. */
  79      public $preventmessages;
  80      /** @var string $buttontext caption for the start attempt button. If this is null, show no
  81       *      button, or if it is '' show a back to the course button. */
  82      public $buttontext;
  83      /** @var moodle_url $startattempturl URL to start an attempt. */
  84      public $startattempturl;
  85      /** @var preflight_check_form|null $preflightcheckform confirmation form that must be
  86       *       submitted before an attempt is started, if required. */
  87      public $preflightcheckform;
  88      /** @var moodle_url $startattempturl URL for any Back to the course button. */
  89      public $backtocourseurl;
  90      /** @var bool $showbacktocourse should we show a back to the course button? */
  91      public $showbacktocourse;
  92      /** @var bool whether the attempt must take place in a popup window. */
  93      public $popuprequired;
  94      /** @var array options to use for the popup window, if required. */
  95      public $popupoptions;
  96      /** @var bool $quizhasquestions whether the quiz has any questions. */
  97      public $quizhasquestions;
  98  }