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