first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+213
View File
@@ -0,0 +1,213 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Capability definitions for the quiz module.
*
* @package mod_quiz
* @copyright 2006 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = [
// Ability to see that the quiz exists, and the basic information
// about it, for example the start date and time limit.
'mod/quiz:view' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'guest' => CAP_ALLOW,
'student' => CAP_ALLOW,
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Ability to add a new quiz to the course.
'mod/quiz:addinstance' => [
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
],
'clonepermissionsfrom' => 'moodle/course:manageactivities'
],
// Ability to do the quiz as a 'student'.
'mod/quiz:attempt' => [
'riskbitmask' => RISK_SPAM,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'student' => CAP_ALLOW
]
],
// Ability for a 'Student' to review their previous attempts. Review by
// 'Teachers' is controlled by mod/quiz:viewreports.
'mod/quiz:reviewmyattempts' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'student' => CAP_ALLOW
],
'clonepermissionsfrom' => 'moodle/quiz:attempt'
],
// Edit the quiz settings, add and remove questions.
'mod/quiz:manage' => [
'riskbitmask' => RISK_SPAM,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Edit the quiz overrides.
'mod/quiz:manageoverrides' => [
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// View the quiz overrides (only checked for users who don't have mod/quiz:manageoverrides.
'mod/quiz:viewoverrides' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Preview the quiz.
'mod/quiz:preview' => [
'captype' => 'write', // Only just a write.
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Manually grade and comment on student attempts at a question.
'mod/quiz:grade' => [
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Regrade quizzes.
'mod/quiz:regrade' => [
'riskbitmask' => RISK_SPAM,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
],
'clonepermissionsfrom' => 'mod/quiz:grade'
],
// View the quiz reports.
'mod/quiz:viewreports' => [
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Delete attempts using the overview report.
'mod/quiz:deleteattempts' => [
'riskbitmask' => RISK_DATALOSS,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Re-open attempts after they are closed.
'mod/quiz:reopenattempts' => [
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
],
// Do not have the time limit imposed. Used for accessibility legislation compliance.
'mod/quiz:ignoretimelimits' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => []
],
// Receive a confirmation message of own quiz submission.
'mod/quiz:emailconfirmsubmission' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => []
],
// Receive a notification message of other peoples' quiz submissions.
'mod/quiz:emailnotifysubmission' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => []
],
// Receive a notification message when a quiz attempt becomes overdue.
'mod/quiz:emailwarnoverdue' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => []
],
// Receive a notification message when a quiz attempt manual graded.
'mod/quiz:emailnotifyattemptgraded' => [
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => []
],
];
+38
View File
@@ -0,0 +1,38 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defined caches used internally by the plugin.
*
* @package mod_quiz
* @copyright 2021 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
declare(strict_types=1);
defined('MOODLE_INTERNAL') || die();
$definitions = [
'overrides' => [
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'datasource' => '\mod_quiz\cache\overrides',
'invalidationevents' => [
\mod_quiz\local\override_cache::INVALIDATION_USERDATARESET,
],
],
];
+61
View File
@@ -0,0 +1,61 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Add event handlers for the quiz
*
* @package mod_quiz
* @category event
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$observers = [
// Handle group events, so that open quiz attempts with group overrides get updated check times.
[
'eventname' => '\core\event\course_reset_started',
'callback' => '\mod_quiz\group_observers::course_reset_started',
],
[
'eventname' => '\core\event\course_reset_ended',
'callback' => '\mod_quiz\group_observers::course_reset_ended',
],
[
'eventname' => '\core\event\group_deleted',
'callback' => '\mod_quiz\group_observers::group_deleted'
],
[
'eventname' => '\core\event\group_member_added',
'callback' => '\mod_quiz\group_observers::group_member_added',
],
[
'eventname' => '\core\event\group_member_removed',
'callback' => '\mod_quiz\group_observers::group_member_removed',
],
// Handle our own \mod_quiz\event\attempt_submitted event, as a way to
// send confirmation messages asynchronously.
[
'eventname' => '\mod_quiz\event\attempt_submitted',
'includefile' => '/mod/quiz/locallib.php',
'callback' => 'quiz_attempt_submitted_handler',
'internal' => false
],
];
+204
View File
@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/quiz/db" VERSION="20230804" COMMENT="XMLDB file for Moodle mod/quiz"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="quiz" COMMENT="The settings for each quiz.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Standard Moodle primary key."/>
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key reference to the course this quiz is part of."/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Quiz name."/>
<FIELD NAME="intro" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Quiz introduction text."/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Quiz intro text format."/>
<FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time when this quiz opens. (0 = no restriction.)"/>
<FIELD NAME="timeclose" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time when this quiz closes. (0 = no restriction.)"/>
<FIELD NAME="timelimit" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time limit for quiz attempts, in seconds."/>
<FIELD NAME="overduehandling" TYPE="char" LENGTH="16" NOTNULL="true" DEFAULT="autoabandon" SEQUENCE="false" COMMENT="The method used to handle overdue attempts. 'autosubmit', 'graceperiod' or 'autoabandon'."/>
<FIELD NAME="graceperiod" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The amount of time (in seconds) after the time limit runs out during which attempts can still be submitted, if overduehandling is set to allow it."/>
<FIELD NAME="preferredbehaviour" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="The behaviour to ask questions to use."/>
<FIELD NAME="canredoquestions" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Allows students to redo any completed question within a quiz attempt."/>
<FIELD NAME="attempts" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The maximum number of attempts a student is allowed."/>
<FIELD NAME="attemptonlast" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether subsequent attempts start from the answer to the previous attempt (1) or start blank (0)."/>
<FIELD NAME="grademethod" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="One of the values QUIZ_GRADEHIGHEST, QUIZ_GRADEAVERAGE, QUIZ_ATTEMPTFIRST or QUIZ_ATTEMPTLAST."/>
<FIELD NAME="decimalpoints" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="2" SEQUENCE="false" COMMENT="Number of decimal points to use when displaying grades."/>
<FIELD NAME="questiondecimalpoints" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="-1" SEQUENCE="false" COMMENT="Number of decimal points to use when displaying question grades. (-1 means use decimalpoints.)"/>
<FIELD NAME="reviewattempt" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to review their quiz attempts at various times. This is a bit field, decoded by the \mod_quiz\question\display_options class. It is formed by ORing together the constants defined there."/>
<FIELD NAME="reviewcorrectness" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to review the correctness of the questions in their quiz attempts at various times. A bit field, like reviewattempt."/>
<FIELD NAME="reviewmaxmarks" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Works with reviewmarks to control whether users can see grades at various times. 0 here means no grade information is shown at all. If 1, student can see the number of marks available for this question, and reviewmarks applies. A bit field, like reviewattempt."/>
<FIELD NAME="reviewmarks" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Works with reviewmaxmarks to control whether users can see grades at various times. If reviewmaxmarks is 1, then this controls whether students can see the the mark they got for the question, in addition to the max. A bit field, like reviewattempt."/>
<FIELD NAME="reviewspecificfeedback" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to see the specific feedback in their quiz attempts. A bit field, like reviewattempt."/>
<FIELD NAME="reviewgeneralfeedback" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to see the general feedback in their quiz attempts. A bit field, like reviewattempt."/>
<FIELD NAME="reviewrightanswer" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to see the right answer in their quiz attempts. A bit field, like reviewattempt."/>
<FIELD NAME="reviewoverallfeedback" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether users are allowed to see the overall feedback in their quiz attempts. A bit field, like reviewattempt."/>
<FIELD NAME="questionsperpage" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="How often to insert a page break when editing the quiz, or when shuffling the question order."/>
<FIELD NAME="navmethod" TYPE="char" LENGTH="16" NOTNULL="true" DEFAULT="free" SEQUENCE="false" COMMENT="Any constraints on how the user is allowed to navigate around the quiz. Currently recognised values are 'free' and 'seq'."/>
<FIELD NAME="shuffleanswers" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether the parts of the question should be shuffled, in those question types that support it."/>
<FIELD NAME="sumgrades" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The total of all the question instance maxmarks."/>
<FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The total that the quiz overall grade is scaled to be out of."/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The time when the quiz was added to the course."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Last modified time."/>
<FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="A password that the student must enter before starting or continuing a quiz attempt."/>
<FIELD NAME="subnet" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Used to restrict the IP addresses from which this quiz can be attempted. The format is as requried by the address_in_subnet function."/>
<FIELD NAME="browsersecurity" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="Restriciton on the browser the student must use. E.g. 'securewindow'."/>
<FIELD NAME="delay1" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Delay that must be left between the first and second attempt, in seconds."/>
<FIELD NAME="delay2" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Delay that must be left between the second and subsequent attempt, in seconds."/>
<FIELD NAME="showuserpicture" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Option to show the user's picture during the attempt and on the review page."/>
<FIELD NAME="showblocks" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether blocks should be shown on the attempt.php and review.php pages."/>
<FIELD NAME="completionattemptsexhausted" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="completionminattempts" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="allowofflineattempts" TYPE="int" LENGTH="1" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Whether to allow the quiz to be attempted offline in the mobile app"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
</INDEXES>
</TABLE>
<TABLE NAME="quiz_grade_items" COMMENT="Where a quiz supports mulitple grades, this table stores what those grade items are.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="quizid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Foreign key references quiz.id."/>
<FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Used to control the order of the grade items when they are displayed"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The name of this grade-item. PARAM_TEXT."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quizid" TYPE="foreign" FIELDS="quizid" REFTABLE="quiz" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="quizid-sortorder" UNIQUE="true" FIELDS="quizid, sortorder" COMMENT="The sortorder must be unique within the scope of one quiz."/>
</INDEXES>
</TABLE>
<TABLE NAME="quiz_slots" COMMENT="Stores the question used in a quiz, with the order, and for each question, which page it appears on, and the maximum mark (weight).">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="slot" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Where this question comes in order in the list of questions in this quiz. Like question_attempts.slot."/>
<FIELD NAME="quizid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references quiz.id."/>
<FIELD NAME="page" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The page number that this questions appears on. If the question in slot n appears on page p, then the question in slot n+1 must appear on page p or p+1. Well, except that when a quiz is being created, there may be empty pages, which would cause the page number to jump here."/>
<FIELD NAME="displaynumber" TYPE="char" LENGTH="16" NOTNULL="false" SEQUENCE="false" COMMENT="Stores customised question number such as 1.2, A1, B12. If this is null, the default number is used."/>
<FIELD NAME="requireprevious" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Set to 1 when current question requires previous one to be answered first."/>
<FIELD NAME="maxmark" TYPE="number" LENGTH="12" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="7" COMMENT="How many marks this question contributes to quiz.sumgrades."/>
<FIELD NAME="quizgradeitemid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="If the quiz suports multiple sub-grades, which one this slot contributes, if any."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quizid" TYPE="foreign" FIELDS="quizid" REFTABLE="quiz" REFFIELDS="id"/>
<KEY NAME="quizgradeitemid" TYPE="foreign" FIELDS="quizgradeitemid" REFTABLE="quiz_grade_items" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="quizid-slot" UNIQUE="true" FIELDS="quizid, slot"/>
</INDEXES>
</TABLE>
<TABLE NAME="quiz_sections" COMMENT="Stores sections of a quiz with section name (heading), from slot-number N and whether the question order should be shuffled.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="quizid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Foreign key references quiz.id."/>
<FIELD NAME="firstslot" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Number of the first slot in the section. The section runs from here to the start of the next section, or the end of the quiz."/>
<FIELD NAME="heading" TYPE="char" LENGTH="1333" NOTNULL="false" SEQUENCE="false" COMMENT="The text of the heading. May be an empty string/null. Multilang format."/>
<FIELD NAME="shufflequestions" TYPE="int" LENGTH="4" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Whether the question order within this section should be shuffled for each attempt."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quizid" TYPE="foreign" FIELDS="quizid" REFTABLE="quiz" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="quizid-firstslot" UNIQUE="true" FIELDS="quizid, firstslot"/>
</INDEXES>
</TABLE>
<TABLE NAME="quiz_feedback" COMMENT="Feedback given to students based on which grade band their overall score lies.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="quizid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references quiz.id."/>
<FIELD NAME="feedbacktext" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="The feedback to show for a attempt where mingrade &lt;= attempt grade &lt; maxgrade. See function quiz_feedback_for_grade in mod/quiz/locallib.php."/>
<FIELD NAME="feedbacktextformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="mingrade" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The lower limit of this grade band. Inclusive."/>
<FIELD NAME="maxgrade" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The upper limit of this grade band. Exclusive."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quizid" TYPE="foreign" FIELDS="quizid" REFTABLE="quiz" REFFIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="quiz_overrides" COMMENT="The overrides to quiz settings on a per-user and per-group basis.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references quiz.id"/>
<FIELD NAME="groupid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Foreign key references groups.id. Can be null if this is a per-user override."/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Foreign key references user.id. Can be null if this is a per-group override."/>
<FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Time at which students may start attempting this quiz. Can be null, in which case the quiz default is used."/>
<FIELD NAME="timeclose" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Time by which students must have completed their attempt. Can be null, in which case the quiz default is used."/>
<FIELD NAME="timelimit" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Time limit in seconds. Can be null, in which case the quiz default is used."/>
<FIELD NAME="attempts" TYPE="int" LENGTH="6" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Quiz password. Can be null, in which case the quiz default is used."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quiz" TYPE="foreign" FIELDS="quiz" REFTABLE="quiz" REFFIELDS="id"/>
<KEY NAME="groupid" TYPE="foreign" FIELDS="groupid" REFTABLE="groups" REFFIELDS="id"/>
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
</KEYS>
</TABLE>
<TABLE NAME="quiz_attempts" COMMENT="Stores users attempts at quizzes.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" COMMENT="Standard Moodle primary key."/>
<FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key reference to the quiz that was attempted."/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key reference to the user whose attempt this is."/>
<FIELD NAME="attempt" TYPE="int" LENGTH="6" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Sequentially numbers this student's attempts at this quiz."/>
<FIELD NAME="uniqueid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key reference to the question_usage that holds the details of the the question_attempts that make up this quiz attempt."/>
<FIELD NAME="layout" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="currentpage" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="preview" TYPE="int" LENGTH="3" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="state" TYPE="char" LENGTH="16" NOTNULL="true" DEFAULT="inprogress" SEQUENCE="false" COMMENT="The current state of the attempts. 'inprogress', 'overdue', 'finished' or 'abandoned'."/>
<FIELD NAME="timestart" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time when the attempt was started."/>
<FIELD NAME="timefinish" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Time when the attempt was submitted. 0 if the attempt has not been submitted yet."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Last modified time."/>
<FIELD NAME="timemodifiedoffline" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Last modified time via web services."/>
<FIELD NAME="timecheckstate" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Next time quiz cron should check attempt for state changes. NULL means never check."/>
<FIELD NAME="sumgrades" TYPE="number" LENGTH="10" NOTNULL="false" SEQUENCE="false" DECIMALS="5" COMMENT="Total marks for this attempt."/>
<FIELD NAME="gradednotificationsenttime" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The timestamp when the 'graded' notification was sent."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quiz" TYPE="foreign" FIELDS="quiz" REFTABLE="quiz" REFFIELDS="id"/>
<KEY NAME="userid" TYPE="foreign" FIELDS="userid" REFTABLE="user" REFFIELDS="id"/>
<KEY NAME="uniqueid" TYPE="foreign-unique" FIELDS="uniqueid" REFTABLE="question_usages" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="quiz-userid-attempt" UNIQUE="true" FIELDS="quiz, userid, attempt"/>
<INDEX NAME="state-timecheckstate" UNIQUE="false" FIELDS="state, timecheckstate"/>
</INDEXES>
</TABLE>
<TABLE NAME="quiz_grades" COMMENT="Stores the overall grade for each user on the quiz, based on their various attempts and the quiz.grademethod setting.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="quiz" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references quiz.id."/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Foreign key references user.id."/>
<FIELD NAME="grade" TYPE="number" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" DECIMALS="5" COMMENT="The overall grade from the quiz. Not affected by overrides in the gradebook."/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="The last time this grade changed."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="quiz" TYPE="foreign" FIELDS="quiz" REFTABLE="quiz" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="userid" UNIQUE="false" FIELDS="userid"/>
</INDEXES>
</TABLE>
<TABLE NAME="quiz_reports" COMMENT="Lists all the installed quiz reports and their display order and so on. No need to worry about deleting old records. Only records with an equivalent directory are displayed.">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="name of the report, same as the directory name"/>
<FIELD NAME="displayorder" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="display order for report tabs"/>
<FIELD NAME="capability" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Capability required to see this report. May be blank which means use the default of mod/quiz:viewreport. This is used when deciding which tabs to render."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="name" UNIQUE="true" FIELDS="name"/>
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
+44
View File
@@ -0,0 +1,44 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Definition of log events for the quiz module.
*
* @package mod_quiz
* @category log
* @copyright 2010 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$logs = [
['module' => 'quiz', 'action' => 'add', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'update', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'view', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'report', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'attempt', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'submit', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'review', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'editquestions', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'preview', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'start attempt', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'close attempt', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'continue attempt', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'edit override', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'delete override', 'mtable' => 'quiz', 'field' => 'name'],
['module' => 'quiz', 'action' => 'view summary', 'mtable' => 'quiz', 'field' => 'name'],
];
+66
View File
@@ -0,0 +1,66 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines message providers (types of message sent) for the quiz module.
*
* @package mod_quiz
* @copyright 2010 Andrew Davis http://moodle.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$messageproviders = [
// Notify teacher that a student has submitted a quiz attempt.
'submission' => [
'capability' => 'mod/quiz:emailnotifysubmission',
'defaults' => [
'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
],
],
// Confirm a student's quiz attempt.
'confirmation' => [
'capability' => 'mod/quiz:emailconfirmsubmission',
'defaults' => [
'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
],
],
// Warning to the student that their quiz attempt is now overdue, if the quiz
// has a grace period.
'attempt_overdue' => [
'capability' => 'mod/quiz:emailwarnoverdue',
'defaults' => [
'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
],
],
'attempt_grading_complete' => [
'capability' => 'mod/quiz:emailnotifyattemptgraded',
'defaults' => [
'popup' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'email' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
'airnotifier' => MESSAGE_PERMITTED + MESSAGE_DEFAULT_ENABLED,
],
],
];
+69
View File
@@ -0,0 +1,69 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains mappings for classes that have been renamed.
*
* @package mod_quiz
* @copyright 2022 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$renamedclasses = [
// Since Moodle 4.1.
'mod_quiz\local\views\secondary' => 'mod_quiz\navigation\views\secondary',
// Since Moodle 4.2.
'mod_quiz_display_options' => 'mod_quiz\question\display_options',
'qubaids_for_quiz' => 'mod_quiz\question\qubaids_for_quiz',
'qubaids_for_quiz_user' => 'mod_quiz\question\qubaids_for_quiz_user',
'mod_quiz_admin_setting_browsersecurity' => 'mod_quiz\admin\browser_security_setting',
'mod_quiz_admin_setting_grademethod' => 'mod_quiz\admin\grade_method_setting',
'mod_quiz_admin_setting_overduehandling' => 'mod_quiz\admin\overdue_handling_setting',
'mod_quiz_admin_review_setting' => 'mod_quiz\admin\review_setting',
'mod_quiz_admin_setting_user_image' => 'mod_quiz\admin\user_image_setting',
'mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_browsersecurity' =>
'mod_quiz\adminpresets\adminpresets_browser_security_setting',
'mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_grademethod' =>
'mod_quiz\adminpresets\adminpresets_grade_method_setting',
'mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_overduehandling' =>
'mod_quiz\adminpresets\adminpresets_overdue_handling_setting',
'mod_quiz\adminpresets\adminpresets_mod_quiz_admin_review_setting' =>
'mod_quiz\adminpresets\adminpresets_review_setting',
'mod_quiz\adminpresets\adminpresets_mod_quiz_admin_setting_user_image' =>
'mod_quiz\adminpresets\adminpresets_user_image_setting',
'quiz_default_report' => 'mod_quiz\local\reports\report_base',
'quiz_attempts_report' => 'mod_quiz\local\reports\attempts_report',
'mod_quiz_attempts_report_form' => 'mod_quiz\local\reports\attempts_report_options_form',
'mod_quiz_attempts_report_options' => 'mod_quiz\local\reports\attempts_report_options',
'quiz_attempts_report_table' => 'mod_quiz\local\reports\attempts_report_table',
'quiz_access_manager' => 'mod_quiz\access_manager',
'mod_quiz_preflight_check_form' => 'mod_quiz\form\preflight_check_form',
'quiz_override_form' => 'mod_quiz\form\edit_override_form',
'quiz_access_rule_base' => 'mod_quiz\local\access_rule_base',
'quiz_add_random_form' => 'mod_quiz\form\add_random_form',
'mod_quiz_links_to_other_attempts' => 'mod_quiz\output\links_to_other_attempts',
'mod_quiz_view_object' => 'mod_quiz\output\view_page',
'mod_quiz_renderer' => 'mod_quiz\output\renderer',
'quiz_nav_question_button' => 'mod_quiz\output\navigation_question_button',
'quiz_nav_section_heading' => 'mod_quiz\output\navigation_section_heading',
'quiz_nav_panel_base' => 'mod_quiz\output\navigation_panel_base',
'quiz_attempt_nav_panel' => 'mod_quiz\output\navigation_panel_attempt',
'quiz_review_nav_panel' => 'mod_quiz\output\navigation_panel_review',
'quiz_attempt' => 'mod_quiz\quiz_attempt',
'quiz' => 'mod_quiz\quiz_settings',
];
+306
View File
@@ -0,0 +1,306 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Quiz external functions and service definitions.
*
* @package mod_quiz
* @category external
* @copyright 2016 Juan Leyva <juan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 3.1
*/
defined('MOODLE_INTERNAL') || die;
$functions = [
'mod_quiz_get_quizzes_by_courses' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_quizzes_by_courses',
'description' => 'Returns a list of quizzes in a provided list of courses,
if no list is provided all quizzes that the user can view will be returned.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_view_quiz' => [
'classname' => 'mod_quiz_external',
'methodname' => 'view_quiz',
'description' => 'Trigger the course module viewed event and update the module completion status.',
'type' => 'write',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_user_attempts' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_user_attempts',
'description' => 'Return a list of attempts for the given quiz and user.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_user_best_grade' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_user_best_grade',
'description' => 'Get the best current grade for the given user on a quiz.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_combined_review_options' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_combined_review_options',
'description' => 'Combines the review options from a number of different quiz attempts.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_start_attempt' => [
'classname' => 'mod_quiz_external',
'methodname' => 'start_attempt',
'description' => 'Starts a new attempt at a quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_attempt_data' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_attempt_data',
'description' => 'Returns information for the given attempt page for a quiz attempt in progress.',
'type' => 'read',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_attempt_summary' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_attempt_summary',
'description' => 'Returns a summary of a quiz attempt before it is submitted.',
'type' => 'read',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_save_attempt' => [
'classname' => 'mod_quiz_external',
'methodname' => 'save_attempt',
'description' => 'Processes save requests during the quiz.
This function is intended for the quiz auto-save feature.',
'type' => 'write',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_process_attempt' => [
'classname' => 'mod_quiz_external',
'methodname' => 'process_attempt',
'description' => 'Process responses during an attempt at a quiz and also deals with attempts finishing.',
'type' => 'write',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_attempt_review' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_attempt_review',
'description' => 'Returns review information for the given finished attempt, can be used by users or teachers.',
'type' => 'read',
'capabilities' => 'mod/quiz:reviewmyattempts',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_view_attempt' => [
'classname' => 'mod_quiz_external',
'methodname' => 'view_attempt',
'description' => 'Trigger the attempt viewed event.',
'type' => 'write',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_view_attempt_summary' => [
'classname' => 'mod_quiz_external',
'methodname' => 'view_attempt_summary',
'description' => 'Trigger the attempt summary viewed event.',
'type' => 'write',
'capabilities' => 'mod/quiz:attempt',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_view_attempt_review' => [
'classname' => 'mod_quiz_external',
'methodname' => 'view_attempt_review',
'description' => 'Trigger the attempt reviewed event.',
'type' => 'write',
'capabilities' => 'mod/quiz:reviewmyattempts',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_quiz_feedback_for_grade' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_quiz_feedback_for_grade',
'description' => 'Get the feedback text that should be show to a student who got the given grade in the given quiz.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_quiz_access_information' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_quiz_access_information',
'description' => 'Return access information for a given quiz.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_attempt_access_information' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_attempt_access_information',
'description' => 'Return access information for a given attempt in a quiz.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_get_quiz_required_qtypes' => [
'classname' => 'mod_quiz_external',
'methodname' => 'get_quiz_required_qtypes',
'description' => 'Return the potential question types that would be required for a given quiz.',
'type' => 'read',
'capabilities' => 'mod/quiz:view',
'services' => [MOODLE_OFFICIAL_MOBILE_SERVICE]
],
'mod_quiz_set_question_version' => [
'classname' => 'mod_quiz\external\submit_question_version',
'description' => 'Set the version of question that would be required for a given quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:view',
'ajax' => true,
],
'mod_quiz_reopen_attempt' => [
'classname' => 'mod_quiz\external\reopen_attempt',
'description' => 'Re-open an attempt that is currently in the never submitted state.',
'type' => 'write',
'capabilities' => 'mod/quiz:reopenattempts',
'ajax' => true,
],
'mod_quiz_get_reopen_attempt_confirmation' => [
'classname' => 'mod_quiz\external\get_reopen_attempt_confirmation',
'description' => 'Verify it is OK to re-open a given quiz attempt, and if so, return a suitable confirmation message.',
'type' => 'read',
'capabilities' => 'mod/quiz:reopenattempts',
'ajax' => true,
],
'mod_quiz_add_random_questions' => [
'classname' => 'mod_quiz\external\add_random_questions',
'description' => 'Add a number of random questions to a quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_update_filter_condition' => [
'classname' => 'mod_quiz\external\update_filter_condition',
'description' => 'Update filter condition for a random question slot.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_save_overrides' => [
'classname' => 'mod_quiz\external\save_overrides',
'description' => 'Update or insert quiz overrides',
'type' => 'write',
'capabilities' => 'mod/quiz:manageoverrides',
'ajax' => true,
],
'mod_quiz_delete_overrides' => [
'classname' => 'mod_quiz\external\delete_overrides',
'description' => 'Delete quiz overrides',
'type' => 'write',
'capabilities' => 'mod/quiz:manageoverrides',
'ajax' => true,
],
'mod_quiz_get_overrides' => [
'classname' => 'mod_quiz\external\get_overrides',
'description' => 'Get quiz overrides',
'type' => 'read',
'capabilities' => 'mod/quiz:manageoverrides',
'ajax' => true,
],
'mod_quiz_create_grade_items' => [
'classname' => 'mod_quiz\external\create_grade_items',
'description' => 'Create quiz grade items. All grade items must belong to the same quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_delete_grade_items' => [
'classname' => 'mod_quiz\external\delete_grade_items',
'description' => 'Delete quiz grade items. All grade items must belong to the same quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_update_grade_items' => [
'classname' => 'mod_quiz\external\update_grade_items',
'description' => 'Update quiz grade items. All grade items must belong to the same quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_update_slots' => [
'classname' => 'mod_quiz\external\update_slots',
'description' => 'Update the properties of slots in a quiz. All slots must belong to the same quiz.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_get_edit_grading_page_data' => [
'classname' => 'mod_quiz\external\get_edit_grading_page_data',
'description' => 'Get the data required to re-render the Quiz grading setup page',
'type' => 'read',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
'mod_quiz_create_grade_item_per_section' => [
'classname' => 'mod_quiz\external\create_grade_item_per_section',
'description' => 'For a quiz with no grade items yet, create a grade item for each section, with the questions in that section assigned.',
'type' => 'write',
'capabilities' => 'mod/quiz:manage',
'ajax' => true,
],
];
+6
View File
@@ -0,0 +1,6 @@
{
"plugintypes": {
"quiz": "mod\/quiz\/report",
"quizaccess": "mod\/quiz\/accessrule"
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Definition of Quiz scheduled tasks.
*
* @package mod_quiz
* @category task
* @copyright 2017 Michael Hughes <michaelhughes@strath.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$tasks = [
[
'classname' => 'mod_quiz\task\update_overdue_attempts',
'blocking' => 0,
'minute' => '*',
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
],
[
'classname' => 'mod_quiz\task\quiz_notify_attempt_manual_grading_completed',
'blocking' => 0,
'minute' => 'R',
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
]
];
+139
View File
@@ -0,0 +1,139 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Upgrade script for the quiz module.
*
* @package mod_quiz
* @copyright 2006 Eloy Lafuente (stronk7)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Quiz module upgrade function.
* @param string $oldversion the version we are upgrading from.
*/
function xmldb_quiz_upgrade($oldversion) {
global $CFG, $DB;
$dbman = $DB->get_manager();
// Automatically generated Moodle v4.1.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2022120500) {
// Define field displaynumber to be added to quiz_slots.
$table = new xmldb_table('quiz_slots');
$field = new xmldb_field('displaynumber', XMLDB_TYPE_CHAR, '16', null, null, null, null, 'page');
// Conditionally launch add field displaynumber.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2022120500, 'quiz');
}
// Automatically generated Moodle v4.2.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2023042401) {
// Define field reviewmaxmarks to be added to quiz.
$table = new xmldb_table('quiz');
$field = new xmldb_field('reviewmaxmarks', XMLDB_TYPE_INTEGER, '6', null, XMLDB_NOTNULL, null, '0', 'reviewcorrectness');
// Conditionally launch add field reviewmaxmarks.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2023042401, 'quiz');
}
// Automatically generated Moodle v4.3.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2023112300) {
// Set the value for all existing rows to match the previous behaviour,
// but only where users have not already set another value.
$DB->set_field('quiz', 'reviewmaxmarks', 0x11110, ['reviewmaxmarks' => 0]);
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2023112300, 'quiz');
}
if ($oldversion < 2023112400) {
// Define table quiz_grade_items to be created.
$table = new xmldb_table('quiz_grade_items');
// Adding fields to table quiz_grade_items.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('quizid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('sortorder', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
// Adding keys to table quiz_grade_items.
$table->add_key('primary', XMLDB_KEY_PRIMARY, ['id']);
$table->add_key('quizid', XMLDB_KEY_FOREIGN, ['quizid'], 'quiz', ['id']);
// Adding indexes to table quiz_grade_items.
$table->add_index('quizid-sortorder', XMLDB_INDEX_UNIQUE, ['quizid', 'sortorder']);
// Conditionally launch create table for quiz_grade_items.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2023112400, 'quiz');
}
if ($oldversion < 2023112401) {
// Define field quizgradeitemid to be added to quiz_slots.
$table = new xmldb_table('quiz_slots');
$field = new xmldb_field('quizgradeitemid', XMLDB_TYPE_INTEGER, '10', null, null, null, null, 'maxmark');
// Conditionally launch add field quizgradeitemid.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2023112401, 'quiz');
}
if ($oldversion < 2023112402) {
// Define key quizgradeitemid (foreign) to be added to quiz_slots.
$table = new xmldb_table('quiz_slots');
$key = new xmldb_key('quizgradeitemid', XMLDB_KEY_FOREIGN, ['quizgradeitemid'], 'quiz_grade_items', ['id']);
// Launch add key quizgradeitemid.
$dbman->add_key($table, $key);
// Quiz savepoint reached.
upgrade_mod_savepoint(true, 2023112402, 'quiz');
}
// Automatically generated Moodle v4.4.0 release upgrade line.
// Put any upgrade step following this.
return true;
}