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.2 3.5.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / single / quiz / top.php
tutor / templates / single / quiz Last commit date
parts 3 days ago body.php 3 days ago content.php 3 years ago no_course_belongs.php 3 years ago previous-attempts.php 3 days ago single_quiz_contents.php 3 years ago top.php 3 days ago
top.php
159 lines
1 <?php
2 /**
3 * Quiz top part
4 *
5 * @package Tutor\Templates
6 * @subpackage Single\Quiz
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @version 1.4.3
10 */
11
12 use Tutor\Models\CourseModel;
13 use TUTOR\Quiz;
14
15 global $post;
16 global $next_id;
17
18 $course_content_id = get_the_ID();
19 $course_id = tutor_utils()->get_course_id_by_subcontent( $course_content_id );
20
21 $content_id = tutor_utils()->get_post_id( $course_content_id );
22 $contents = tutor_utils()->get_course_prev_next_contents_by_id( $content_id );
23 $previous_id = $contents->previous_id;
24 $next_id = $contents->next_id;
25
26 $currentPost = $post; //phpcs:ignore
27 $quiz_id = get_the_ID();
28 $is_started_quiz = tutor_utils()->is_started_quiz();
29 $course = CourseModel::get_course_by_quiz( get_the_ID() );
30 $previous_attempts = tutor_utils()->quiz_attempts();
31 $attempted_count = is_array( $previous_attempts ) ? count( $previous_attempts ) : 0;
32 $quiz_options = tutor_utils()->get_quiz_option( $quiz_id );
33 $limit_attempts_allowed = '1' === (string) ( $quiz_options['limit_attempts_allowed'] ?? '0' );
34 $configured_attempts_allowed = (int) ( $quiz_options['attempts_allowed'] ?? 0 );
35 $attempts_allowed = Quiz::get_effective_attempts_allowed( $limit_attempts_allowed, $configured_attempts_allowed );
36 $passing_grade = (int) ( $quiz_options['passing_grade'] ?? 0 );
37 $attempt_remaining = (int) $attempts_allowed - (int) $attempted_count;
38 $can_retry_quiz = Quiz::can_retry_quiz( $limit_attempts_allowed, $configured_attempts_allowed, $attempted_count );
39
40 do_action( 'tutor_quiz/single/before/top' );
41 ?>
42 <?php if ( ! $is_started_quiz && 0 == $attempted_count ) : ?>
43 <div class="tutor-start-quiz-wrapper tutor-p-md-48 tutor-p-28">
44 <div class="tutor-start-quiz-title tutor-pb-28">
45 <div class="tutor-fs-6 tutor-color-black tutor-pb-8">
46 <?php esc_html_e( 'Quiz', 'tutor' ); ?>
47 </div>
48 <div class="tutor-fs-4 tutor-fw-medium tutor-color-black">
49 <?php echo esc_html( get_the_title() ); ?>
50 </div>
51 <div>
52 <?php the_content(); // Quiz summary. ?>
53 </div>
54 </div>
55
56 <div class="tutor-quiz-info-area tutor-mb-60 tutor-mt-24">
57 <?php
58 // Show total question count.
59 $total_questions = tutor_utils()->total_questions_for_student_by_quiz( get_the_ID() );
60 if ( $total_questions ) :
61 ?>
62 <div class="tutor-quiz-info">
63 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Questions', 'tutor' ); ?>:</span>
64 <span class="tutor-fs-6 tutor-color-black">
65 <?php echo esc_html( $total_questions ); ?>
66 </span>
67 </div>
68 <?php endif; ?>
69
70 <?php
71 // Show time limit.
72 $time_limit = tutor_utils()->get_quiz_option( get_the_ID(), 'time_limit.time_value' );
73 if ( $time_limit ) :
74 $time_type = tutor_utils()->get_quiz_option( get_the_ID(), 'time_limit.time_type' );
75 $available_time_type = array(
76 'seconds' => $time_limit > 1 ? __( 'Seconds', 'tutor' ) : __( 'Second', 'tutor' ),
77 'minutes' => $time_limit > 1 ? __( 'Minutes', 'tutor' ) : __( 'Minute', 'tutor' ),
78 'hours' => $time_limit > 1 ? __( 'Hours', 'tutor' ) : __( 'Hour', 'tutor' ),
79 'days' => $time_limit > 1 ? __( 'Days', 'tutor' ) : __( 'Day', 'tutor' ),
80 'weeks' => $time_limit > 1 ? __( 'Weeks', 'tutor' ) : __( 'Week', 'tutor' ),
81 );
82 ?>
83 <div class="tutor-quiz-info">
84 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Quiz Time', 'tutor' ); ?>:</span>
85 <span class="tutor-fs-6 tutor-color-black">
86 <?php
87 echo esc_html(
88 sprintf(
89 /* translators: %d: count, %s: time unit. */
90 __( '%1$s %2$s', 'tutor' ),
91 $time_limit,
92 isset( $available_time_type[ $time_type ] ) ? $available_time_type[ $time_type ] : $time_type
93 )
94 );
95 ?>
96 </span>
97 </div>
98 <?php endif; ?>
99
100 <!-- Show Total attempt count -->
101 <div class="tutor-quiz-info">
102 <span class="tutor-fs-6 tutor-color-muted">
103 <?php esc_html_e( 'Total Attempted', 'tutor' ); ?>:
104 </span>
105 <span class="tutor-fs-6 tutor-color-black">
106 <?php echo esc_html( $attempted_count . '/' . ( 0 == $attempts_allowed ? '&#8734;' : $attempts_allowed ) ); ?>
107 </span>
108 </div>
109
110 <!-- Show Passing grade -->
111 <?php if ( $passing_grade ) : ?>
112 <div class="tutor-quiz-info">
113 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Passing Grade', 'tutor' ); ?></span>
114 <span class="tutor-fs-6 tutor-color-black">(<?php echo esc_html( $passing_grade . '%' ); ?>)</span>
115 </div>
116 <?php endif; ?>
117 </div>
118
119 <?php
120 if ( 0 === $attempted_count || $can_retry_quiz ) :
121 do_action( 'tutor_quiz/start_form/before', $quiz_id );
122 $skip_url = get_the_permalink( $next_id ? $next_id : $course_id );
123 ?>
124 <div class="tutor-quiz-btn-group">
125 <form id="tutor-start-quiz" method="post">
126 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
127
128 <input type="hidden" value="<?php echo esc_attr( $quiz_id ); ?>" name="quiz_id"/>
129 <input type="hidden" value="tutor_start_quiz" name="tutor_action"/>
130
131 <button type="submit" class="tutor-btn tutor-btn-primary tutor-btn-md start-quiz-btn" name="start_quiz_btn" value="start_quiz">
132 <?php esc_html_e( 'Start Quiz', 'tutor' ); ?>
133 </button>
134 </form>
135
136 <button class="tutor-btn tutor-btn-ghost tutor-btn-md skip-quiz-btn tutor-ml-24" data-tutor-modal-target="tutor-quiz-skip-to-next">
137 <?php esc_html_e( 'Skip Quiz', 'tutor' ); ?>
138 </button>
139 </div>
140
141 <?php
142 tutor_load_template(
143 'modal.confirm',
144 array(
145 'id' => 'tutor-quiz-skip-to-next',
146 'title' => __( 'Do You Want to Skip This Quiz?', 'tutor' ),
147 'content' => __( 'Are you sure you want to skip this quiz? Please confirm your choice.', 'tutor' ),
148 'yes' => array(
149 'text' => __( 'Yes, Skip This', 'tutor' ),
150 'attr' => array( 'onclick="window.location=\'' . $skip_url . '\';"' ),
151 ),
152 )
153 );
154 ?>
155 <?php endif; ?>
156 </div>
157 <?php endif; ?>
158 <?php do_action( 'tutor_quiz/single/after/top' ); ?>
159