Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 111... Línea 111...
111
     *
111
     *
112
     * @param int $quizid the quiz id.
112
     * @param int $quizid the quiz id.
113
     * @param int|null $userid the the userid (optional). If passed, relevant overrides are applied.
113
     * @param int|null $userid the the userid (optional). If passed, relevant overrides are applied.
114
     * @return quiz_settings the new quiz settings object.
114
     * @return quiz_settings the new quiz settings object.
115
     */
115
     */
116
    public static function create(int $quizid, int $userid = null): self {
116
    public static function create(int $quizid, ?int $userid = null): self {
117
        $quiz = access_manager::load_quiz_and_settings($quizid);
117
        $quiz = access_manager::load_quiz_and_settings($quizid);
118
        [$course, $cm] = get_course_and_cm_from_instance($quiz, 'quiz');
118
        [$course, $cm] = get_course_and_cm_from_instance($quiz, 'quiz');
Línea 119... Línea 119...
119
 
119
 
120
        return self::create_helper($quiz, $cm, $course, $userid);
120
        return self::create_helper($quiz, $cm, $course, $userid);
Línea 125... Línea 125...
125
     *
125
     *
126
     * @param int $cmid the course-module id.
126
     * @param int $cmid the course-module id.
127
     * @param int|null $userid the the userid (optional). If passed, relevant overrides are applied.
127
     * @param int|null $userid the the userid (optional). If passed, relevant overrides are applied.
128
     * @return quiz_settings the new quiz settings object.
128
     * @return quiz_settings the new quiz settings object.
129
     */
129
     */
130
    public static function create_for_cmid(int $cmid, int $userid = null): self {
130
    public static function create_for_cmid(int $cmid, ?int $userid = null): self {
131
        [$course, $cm] = get_course_and_cm_from_cmid($cmid, 'quiz');
131
        [$course, $cm] = get_course_and_cm_from_cmid($cmid, 'quiz');
132
        $quiz = access_manager::load_quiz_and_settings($cm->instance);
132
        $quiz = access_manager::load_quiz_and_settings($cm->instance);
Línea 133... Línea 133...
133
 
133
 
134
        return self::create_helper($quiz, $cm, $course, $userid);
134
        return self::create_helper($quiz, $cm, $course, $userid);
Línea 505... Línea 505...
505
     *      IMMEDIATELY_AFTER, LATER_WHILE_OPEN or AFTER_CLOSE constants.
505
     *      IMMEDIATELY_AFTER, LATER_WHILE_OPEN or AFTER_CLOSE constants.
506
     * @param bool $short if true, return a shorter string.
506
     * @param bool $short if true, return a shorter string.
507
     * @param int|null $attemptsubmittime time this attempt was submitted. (Optional, but should be given.)
507
     * @param int|null $attemptsubmittime time this attempt was submitted. (Optional, but should be given.)
508
     * @return string an appropraite message.
508
     * @return string an appropraite message.
509
     */
509
     */
510
    public function cannot_review_message($when, $short = false, int $attemptsubmittime = null) {
510
    public function cannot_review_message($when, $short = false, ?int $attemptsubmittime = null) {
Línea 511... Línea 511...
511
 
511
 
512
        if ($attemptsubmittime === null) {
512
        if ($attemptsubmittime === null) {
513
            debugging('It is recommended that you pass $attemptsubmittime to cannot_review_message', DEBUG_DEVELOPER);
513
            debugging('It is recommended that you pass $attemptsubmittime to cannot_review_message', DEBUG_DEVELOPER);
514
            $attemptsubmittime = time(); // This will be approximately right, which is enough for the one place were it is used.
514
            $attemptsubmittime = time(); // This will be approximately right, which is enough for the one place were it is used.