parts
4 years ago
body.php
4 years ago
content.php
4 years ago
no_course_belongs.php
5 years ago
previous-attempts.php
4 years ago
single_quiz_contents.php
4 years ago
top.php
4 years ago
previous-attempts.php
51 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package TutorLMS/Templates |
| 4 | * @version 1.6.4 |
| 5 | */ |
| 6 | |
| 7 | $previous_attempts = tutor_utils()->quiz_attempts(); |
| 8 | $attempted_count = is_array($previous_attempts) ? count($previous_attempts) : 0; |
| 9 | $attempts_allowed = tutor_utils()->get_quiz_option($quiz_id, 'attempts_allowed', 0); |
| 10 | $attempt_remaining = (int) $attempts_allowed - (int) $attempted_count; |
| 11 | $feedback_mode = tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode', 0 ); |
| 12 | |
| 13 | if(isset($_GET['view_quiz_attempt_id'])) { |
| 14 | // Load single attempt details if ID provided |
| 15 | $attempt_id = (int) sanitize_text_field(tutils()->array_get('view_quiz_attempt_id', $_GET)); |
| 16 | if ($attempt_id) { |
| 17 | $user_id = get_current_user_id(); |
| 18 | $attempt_data = tutils()->get_attempt($attempt_id); |
| 19 | tutor_load_template_from_custom_path(tutor()->path . '/views/quiz/attempt-details.php', array( |
| 20 | 'attempt_id' => $attempt_id, |
| 21 | 'attempt_data' => $attempt_data, |
| 22 | 'user_id' => $user_id, |
| 23 | 'context' => 'course-single-previous-attempts' |
| 24 | )); |
| 25 | return; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | tutor_load_template_from_custom_path(tutor()->path . '/views/quiz/attempt-table.php', array( |
| 30 | 'attempt_list' => $previous_attempts, |
| 31 | 'context' => 'course-single-previous-attempts' |
| 32 | )); |
| 33 | |
| 34 | // @todo: fix typo |
| 35 | if ($feedback_mode=='retry' && (($attempt_remaining > 0 || $attempts_allowed == 0) && $previous_attempts)) { |
| 36 | do_action('tutor_quiz/start_form/before', $quiz_id); |
| 37 | ?> |
| 38 | <div class="tutor-quiz-btn-grp tutor-mt-32"> |
| 39 | <form id="tutor-start-quiz" method="post"> |
| 40 | <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?> |
| 41 | |
| 42 | <input type="hidden" value="<?php echo $quiz_id; ?>" name="quiz_id"/> |
| 43 | <input type="hidden" value="tutor_start_quiz" name="tutor_action"/> |
| 44 | |
| 45 | <button type="submit" class="tutor-btn tutor-btn-primary tutor-btn-md start-quiz-btn" name="start_quiz_btn" value="start_quiz"> |
| 46 | <?php _e( 'Start Quiz', 'tutor' ); ?> |
| 47 | </button> |
| 48 | </form> |
| 49 | </div> |
| 50 | <?php } ?> |
| 51 |