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