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.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 2 years ago body.php 3 years ago content.php 3 years ago no_course_belongs.php 3 years ago previous-attempts.php 3 years ago single_quiz_contents.php 3 years ago top.php 2 years ago
top.php
149 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
14 global $post;
15 global $next_id;
16
17 $course_content_id = get_the_ID();
18 $course_id = tutor_utils()->get_course_id_by_subcontent( $course_content_id );
19
20 $content_id = tutor_utils()->get_post_id( $course_content_id );
21 $contents = tutor_utils()->get_course_prev_next_contents_by_id( $content_id );
22 $previous_id = $contents->previous_id;
23 $next_id = $contents->next_id;
24
25 $currentPost = $post; //phpcs:ignore
26 $quiz_id = get_the_ID();
27 $is_started_quiz = tutor_utils()->is_started_quiz();
28 $course = CourseModel::get_course_by_quiz( get_the_ID() );
29 $previous_attempts = tutor_utils()->quiz_attempts();
30 $attempted_count = is_array( $previous_attempts ) ? count( $previous_attempts ) : 0;
31
32 $feedback_mode = tutor_utils()->get_quiz_option( $quiz_id, 'feedback_mode', 0 );
33 $attempts_allowed = 'retry' != $feedback_mode ? 1 : tutor_utils()->get_quiz_option( get_the_ID(), 'attempts_allowed', 0 );
34 $passing_grade = tutor_utils()->get_quiz_option( get_the_ID(), 'passing_grade', 0 );
35 $attempt_remaining = (int) $attempts_allowed - (int) $attempted_count;
36
37 do_action( 'tutor_quiz/single/before/top' );
38 ?>
39 <?php if ( ! $is_started_quiz && 0 == $attempted_count ) : ?>
40 <div class="tutor-start-quiz-wrapper tutor-p-md-48 tutor-p-28">
41 <div class="tutor-start-quiz-title tutor-pb-28">
42 <div class="tutor-fs-6 tutor-color-black tutor-pb-8">
43 <?php esc_html_e( 'Quiz', 'tutor' ); ?>
44 </div>
45 <div class="tutor-fs-4 tutor-fw-medium tutor-color-black">
46 <?php echo esc_html( get_the_title() ); ?>
47 </div>
48 <div>
49 <?php the_content(); // Quiz summary. ?>
50 </div>
51 </div>
52
53 <div class="tutor-quiz-info-area tutor-mb-60 tutor-mt-24">
54 <?php
55 // Show total question count.
56 $total_questions = tutor_utils()->total_questions_for_student_by_quiz( get_the_ID() );
57 if ( $total_questions ) :
58 ?>
59 <div class="tutor-quiz-info">
60 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Questions', 'tutor' ); ?>:</span>
61 <span class="tutor-fs-6 tutor-color-black">
62 <?php echo esc_html( $total_questions ); ?>
63 </span>
64 </div>
65 <?php endif; ?>
66
67 <?php
68 // Show time limit.
69 $time_limit = tutor_utils()->get_quiz_option( get_the_ID(), 'time_limit.time_value' );
70 if ( $time_limit ) :
71 $time_type = tutor_utils()->get_quiz_option( get_the_ID(), 'time_limit.time_type' );
72 $available_time_type = array(
73 'seconds' => $time_limit > 1 ? __( 'Seconds', 'tutor' ) : __( 'Second', 'tutor' ),
74 'minutes' => $time_limit > 1 ? __( 'Minutes', 'tutor' ) : __( 'Minute', 'tutor' ),
75 'hours' => $time_limit > 1 ? __( 'Hours', 'tutor' ) : __( 'Hour', 'tutor' ),
76 'days' => $time_limit > 1 ? __( 'Days', 'tutor' ) : __( 'Day', 'tutor' ),
77 'weeks' => $time_limit > 1 ? __( 'Weeks', 'tutor' ) : __( 'Week', 'tutor' ),
78 );
79 ?>
80 <div class="tutor-quiz-info">
81 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Quiz Time', 'tutor' ); ?>:</span>
82 <span class="tutor-fs-6 tutor-color-black">
83 <?php
84 echo esc_html( $time_limit . ' ' . isset( $available_time_type[ $time_type ] ) ? $available_time_type[ $time_type ] : $time_type );
85 ?>
86 </span>
87 </div>
88 <?php endif; ?>
89
90 <!-- Show Total attempt count -->
91 <div class="tutor-quiz-info">
92 <span class="tutor-fs-6 tutor-color-muted">
93 <?php esc_html_e( 'Total Attempted', 'tutor' ); ?>:
94 </span>
95 <span class="tutor-fs-6 tutor-color-black">
96 <?php echo esc_html( $attempted_count . '/' . ( 0 == $attempts_allowed ? '&#8734;' : $attempts_allowed ) ); ?>
97 </span>
98 </div>
99
100 <!-- Show Passing grade -->
101 <?php if ( $passing_grade ) : ?>
102 <div class="tutor-quiz-info">
103 <span class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Passing Grade', 'tutor' ); ?></span>
104 <span class="tutor-fs-6 tutor-color-black">(<?php echo esc_html( $passing_grade . '%' ); ?>)</span>
105 </div>
106 <?php endif; ?>
107 </div>
108
109 <?php
110 if ( $attempt_remaining > 0 || 0 == $attempts_allowed ) :
111 do_action( 'tutor_quiz/start_form/before', $quiz_id );
112 $skip_url = get_the_permalink( $next_id ? $next_id : $course_id );
113 ?>
114 <div class="tutor-quiz-btn-group">
115 <form id="tutor-start-quiz" method="post">
116 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
117
118 <input type="hidden" value="<?php echo esc_attr( $quiz_id ); ?>" name="quiz_id"/>
119 <input type="hidden" value="tutor_start_quiz" name="tutor_action"/>
120
121 <button type="submit" class="tutor-btn tutor-btn-primary tutor-btn-md start-quiz-btn" name="start_quiz_btn" value="start_quiz">
122 <?php esc_html_e( 'Start Quiz', 'tutor' ); ?>
123 </button>
124 </form>
125
126 <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">
127 <?php esc_html_e( 'Skip Quiz', 'tutor' ); ?>
128 </button>
129 </div>
130
131 <?php
132 tutor_load_template(
133 'modal.confirm',
134 array(
135 'id' => 'tutor-quiz-skip-to-next',
136 'title' => __( 'Do You Want to Skip This Quiz?', 'tutor' ),
137 'content' => __( 'Are you sure you want to skip this quiz? Please confirm your choice.', 'tutor' ),
138 'yes' => array(
139 'text' => __( 'Yes, Skip This', 'tutor' ),
140 'attr' => array( 'onclick="window.location=\'' . $skip_url . '\';"' ),
141 ),
142 )
143 );
144 ?>
145 <?php endif; ?>
146 </div>
147 <?php endif; ?>
148 <?php do_action( 'tutor_quiz/single/after/top' ); ?>
149