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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 / lesson / lesson_sidebar.php
tutor / templates / single / lesson Last commit date
comment.php 3 years ago comments-loop.php 3 years ago complete_form.php 2 years ago content.php 1 year ago lesson_sidebar.php 1 year ago required-enroll.php 2 years ago sidebar_question_and_answer.php 3 years ago
lesson_sidebar.php
331 lines
1 <?php
2 /**
3 * Display Topics and Lesson lists for learn
4 *
5 * @package Tutor\Templates
6 * @subpackage Single\Lesson
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.0.0
10 */
11
12 use TUTOR\Input;
13 use Tutor\Models\QuizModel;
14 use TUTOR\Quiz;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 global $post;
21
22 $current_post_id = get_the_ID();
23 if ( ! empty( Input::post( 'lesson_id' ) ) ) {
24 $current_post_id = Input::post( 'lesson_id' );
25 }
26
27 $current_post = $post;
28 $_is_preview = get_post_meta( $current_post_id, '_is_preview', true );
29 $course_id = tutor_utils()->get_course_id_by_subcontent( $post->ID );
30
31 $user_id = get_current_user_id();
32 $enable_qa_for_this_course = get_post_meta( $course_id, '_tutor_enable_qa', true ) == 'yes';
33 $enable_q_and_a_on_course = tutor_utils()->get_option( 'enable_q_and_a_on_course' ) && $enable_qa_for_this_course;
34 $is_enrolled = tutor_utils()->is_enrolled( $course_id );
35 $is_instructor_of_this_course = tutor_utils()->has_user_course_content_access( $user_id, $course_id );
36 $is_user_admin = current_user_can( 'administrator' );
37 $is_public_course = \TUTOR\Course_List::is_public( $course_id );
38 ?>
39
40 <?php do_action( 'tutor_lesson/single/before/lesson_sidebar' ); ?>
41 <div class="tutor-course-single-sidebar-title tutor-d-flex tutor-justify-between">
42 <span class="tutor-fs-6 tutor-fw-medium tutor-color-secondary"><?php esc_html_e( 'Course Content', 'tutor' ); ?></span>
43 <span class="tutor-d-block tutor-d-xl-none">
44 <a href="#" class="tutor-iconic-btn" tutor-hide-course-single-sidebar>
45 <span class="tutor-icon-times" area-hidden="true"></span>
46 </a>
47 </span>
48 </div>
49
50 <?php
51 $topics = tutor_utils()->get_topics( $course_id );
52 if ( $topics->have_posts() ) {
53
54 // Loop through topics.
55 while ( $topics->have_posts() ) {
56 $topics->the_post();
57 $topic_id = get_the_ID();
58 $topic_summery = get_the_content();
59 $total_contents = tutor_utils()->count_completed_contents_by_topic( $topic_id );
60 $lessons = tutor_utils()->get_course_contents_by_topic( get_the_ID(), -1 );
61 $lessons = apply_filters( 'tutor_filter_lesson_sidebar', $lessons, $topic_id );
62 $is_topic_active = ! empty(
63 array_filter(
64 $lessons->posts,
65 function ( $content ) use ( $current_post ) {
66 return $content->ID == $current_post->ID;
67 }
68 )
69 );
70 ?>
71 <div class="tutor-course-topic tutor-course-topic-<?php echo esc_attr( $topic_id ); ?>">
72 <div class="tutor-accordion-item-header<?php echo $is_topic_active ? ' is-active' : ''; ?>" tutor-course-single-topic-toggler>
73 <div class="tutor-row tutor-gx-1">
74 <div class="tutor-col">
75 <div class="tutor-course-topic-title">
76 <?php the_title(); ?>
77 <?php if ( true ) : ?>
78 <?php if ( trim( $topic_summery ) ) : ?>
79 <div class="tutor-course-topic-title-info tutor-ml-8">
80 <div class="tooltip-wrap">
81 <i class="tutor-course-topic-title-info-icon tutor-icon-circle-info-o"></i>
82 <span class="tooltip-txt tooltip-bottom">
83 <?php echo esc_textarea( $topic_summery ); ?>
84 </span>
85 </div>
86 </div>
87 <?php endif; ?>
88 <?php endif; ?>
89 </div>
90 </div>
91
92 <div class="tutor-col-auto tutor-align-self-center">
93 <?php if ( isset( $total_contents['contents'] ) && $total_contents['contents'] > 0 ) : ?>
94 <div class="tutor-course-topic-summary tutor-pl-8">
95 <?php echo esc_html( isset( $total_contents['completed'] ) ? $total_contents['completed'] : 0 ); ?>/<?php echo esc_html( isset( $total_contents['contents'] ) ? $total_contents['contents'] : 0 ); ?>
96 </div>
97 <?php endif; ?>
98 </div>
99 </div>
100 </div>
101
102 <div class="tutor-accordion-item-body <?php echo $is_topic_active ? '' : 'tutor-display-none'; ?>">
103 <?php
104 do_action( 'tutor/lesson_list/before/topic', $topic_id );
105
106 // Loop through lesson, quiz, assignment, zoom lesson.
107 while ( $lessons->have_posts() ) {
108 $lessons->the_post();
109
110 $show_permalink = ! $_is_preview || $is_enrolled || get_post_meta( $post->ID, '_is_preview', true ) || $is_public_course || $is_instructor_of_this_course;
111 $show_permalink = apply_filters( 'tutor_course/single/content/show_permalink', $show_permalink, get_the_ID() );
112 $lock_icon = ! $show_permalink;
113 $show_permalink = null === $show_permalink ? true : $show_permalink;
114
115 if ( 'tutor_quiz' === $post->post_type ) {
116 $quiz = $post;
117 ?>
118 <div class="tutor-course-topic-item tutor-course-topic-item-quiz<?php echo ( get_the_ID() == $current_post->ID ) ? ' is-active' : ''; ?>" data-quiz-id="<?php echo esc_attr( $quiz->ID ); ?>">
119 <a href="<?php echo $show_permalink ? esc_url( get_permalink( $quiz->ID ) ) : '#'; ?>" data-quiz-id="<?php echo esc_attr( $quiz->ID ); ?>">
120 <div class="tutor-d-flex tutor-mr-32">
121 <span class="tutor-course-topic-item-icon tutor-icon-quiz-o tutor-mr-8 tutor-mt-2" area-hidden="true"></span>
122 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
123 <?php echo esc_html( $quiz->post_title ); ?>
124 </span>
125 </div>
126 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
127 <?php
128 $time_limit = (int) tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_value' );
129 $last_attempt = ( new QuizModel() )->get_first_or_last_attempt( $quiz->ID );
130
131 // $attempt_ended = is_object( $last_attempt ) && ( 'attempt_ended' === ( $last_attempt->attempt_status ) || $last_attempt->is_manually_reviewed ) ? true : false;
132
133 $attempt_ended = is_object( $last_attempt ) && QuizModel::ATTEMPT_STARTED !== $last_attempt->attempt_status;
134 $result_class = '';
135
136 $quiz_result = QuizModel::get_quiz_result( $quiz->ID );
137 if ( $attempt_ended && QuizModel::ATTEMPT_STARTED !== $last_attempt->attempt_status ) {
138 if ( 'fail' === $quiz_result ) {
139 $result_class = 'tutor-check-fail';
140 }
141 if ( 'pending' === $quiz_result ) {
142 $result_class = 'tutor-check-pending';
143 }
144 }
145
146 if ( $time_limit ) {
147 $time_type = tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_type' );
148
149 $time_multipliers = array(
150 'minutes' => MINUTE_IN_SECONDS,
151 'hours' => HOUR_IN_SECONDS,
152 'days' => DAY_IN_SECONDS,
153 'weeks' => WEEK_IN_SECONDS,
154 );
155
156 if ( isset( $time_multipliers[ $time_type ] ) ) {
157 $time_limit *= $time_multipliers[ $time_type ];
158 }
159
160 $hours = floor( $time_limit / HOUR_IN_SECONDS );
161 $minutes = floor( ( $time_limit % HOUR_IN_SECONDS ) / MINUTE_IN_SECONDS );
162 $seconds = $time_limit % MINUTE_IN_SECONDS;
163 $formatted_time = sprintf( '%02d:%02d:%02d', $hours, $minutes, $seconds );
164
165 $markup = '<span class="tutor-course-topic-item-duration tutor-fs-7 tutor-fw-medium tutor-color-muted tutor-mr-8">' . $formatted_time . '</span>';
166 echo wp_kses(
167 $markup,
168 array(
169 'span' => array( 'class' => true ),
170 )
171 );
172 }
173 ?>
174
175 <?php if ( ! $lock_icon ) : ?>
176 <input type="checkbox"
177 class="tutor-form-check-input tutor-form-check-circle <?php echo esc_attr( $result_class ); ?>"
178 disabled="disabled"
179 readonly="readonly"
180 <?php echo esc_attr( $attempt_ended ? 'checked="checked"' : '' ); ?> />
181 <?php else : ?>
182 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
183 <?php endif; ?>
184 </div>
185 </a>
186 </div>
187 <?php } elseif ( 'tutor_assignments' === $post->post_type ) { ?>
188 <div class="tutor-course-topic-item tutor-course-topic-item-assignment<?php echo esc_attr( get_the_ID() == $current_post->ID ? ' is-active' : '' ); ?>">
189 <a href="<?php echo $show_permalink ? esc_url( get_permalink( $post->ID ) ) : '#'; ?>" data-assignment-id="<?php echo esc_attr( $post->ID ); ?>">
190 <div class="tutor-d-flex tutor-mr-32">
191 <span class="tutor-course-topic-item-icon tutor-icon-assignment tutor-mr-8" area-hidden="true"></span>
192 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
193 <?php echo esc_html( $post->post_title ); ?>
194 </span>
195 </div>
196 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
197 <?php if ( $show_permalink ) : ?>
198 <?php do_action( 'tutor/assignment/right_icon_area', $post, $lock_icon ); ?>
199 <?php else : ?>
200 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
201 <?php endif; ?>
202 </div>
203 </a>
204 </div>
205 <?php } elseif ( 'tutor_zoom_meeting' === $post->post_type ) { ?>
206 <div class="tutor-course-topic-item tutor-course-topic-item-zoom<?php echo esc_attr( ( get_the_ID() == $current_post->ID ) ? ' is-active' : '' ); ?>">
207 <a href="<?php echo $show_permalink ? esc_url( get_permalink( $post->ID ) ) : '#'; ?>">
208 <div class="tutor-d-flex tutor-mr-32">
209 <span class="tutor-course-topic-item-icon tutor-icon-brand-zoom-o tutor-mr-8 tutor-mt-2" area-hidden="true"></span>
210 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
211 <?php echo esc_html( $post->post_title ); ?>
212 </span>
213 </div>
214 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
215 <?php if ( $show_permalink ) : ?>
216 <?php do_action( 'tutor/zoom/right_icon_area', $post->ID, $lock_icon ); ?>
217 <?php else : ?>
218 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
219 <?php endif; ?>
220 </div>
221 </a>
222 </div>
223 <?php } elseif ( 'tutor-google-meet' === $post->post_type ) { ?>
224 <div class="tutor-course-topic-item tutor-course-topic-item-zoom<?php echo esc_attr( get_the_ID() == $current_post->ID ? ' is-active' : '' ); ?>">
225 <a href="<?php echo $show_permalink ? esc_url( get_permalink( $post->ID ) ) : '#'; ?>">
226 <div class="tutor-d-flex tutor-mr-32">
227 <span class="tutor-course-topic-item-icon tutor-icon-brand-google-meet tutor-mr-8 tutor-mt-2" area-hidden="true"></span>
228 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
229 <?php echo esc_html( $post->post_title ); ?>
230 </span>
231 </div>
232 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
233 <?php if ( $show_permalink ) : ?>
234 <?php do_action( 'tutor/google_meet/right_icon_area', $post->ID, false ); ?>
235 <?php else : ?>
236 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
237 <?php endif; ?>
238 </div>
239 </a>
240 </div>
241 <?php } else { ?>
242
243 <?php
244 $video = tutor_utils()->get_video_info();
245 $play_time = false;
246 if ( $video ) {
247 $play_time = $video->playtime;
248 }
249 $is_completed_lesson = tutor_utils()->is_completed_lesson();
250 ?>
251 <div class="tutor-course-topic-item tutor-course-topic-item-lesson<?php echo esc_attr( get_the_ID() == $current_post->ID ? ' is-active' : '' ); ?>">
252 <a href="<?php echo $show_permalink ? esc_url( get_the_permalink() ) : '#'; ?>" data-lesson-id="<?php the_ID(); ?>">
253 <div class="tutor-d-flex tutor-mr-32">
254 <?php
255 $tutor_lesson_type_icon = $play_time ? 'brand-youtube-bold' : 'document-text';
256 $markup = '<span class="tutor-course-topic-item-icon tutor-icon-' . $tutor_lesson_type_icon . ' tutor-mr-8 tutor-mt-2" area-hidden="true"></span>';
257 echo wp_kses(
258 $markup,
259 array(
260 'span' => array(
261 'class' => true,
262 'area-hidden' => true,
263 ),
264 )
265 );
266 ?>
267 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
268 <?php the_title(); ?>
269 </span>
270 </div>
271
272 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
273 <?php
274 if ( $play_time ) {
275 $markup = "<span class='tutor-course-topic-item-duration tutor-fs-7 tutor-fw-medium tutor-color-muted tutor-mr-8'>" . tutor_utils()->get_optimized_duration( $play_time ) . '</span>';
276 echo wp_kses(
277 $markup,
278 array(
279 'span' => array( 'class' => true ),
280 )
281 );
282 }
283
284 $lesson_complete_icon = $is_completed_lesson ? 'checked' : '';
285
286 if ( ! $lock_icon ) {
287 $markup = "<input $lesson_complete_icon type='checkbox' class='tutor-form-check-input tutor-form-check-circle' disabled readonly />";
288 echo wp_kses(
289 $markup,
290 array(
291 'input' => array(
292 'checked' => true,
293 'class' => true,
294 'type' => true,
295 'disabled' => true,
296 'readonly' => true,
297 ),
298 )
299 );
300 } else {
301 $markup = '<i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>';
302 echo wp_kses(
303 $markup,
304 array(
305 'i' => array(
306 'class' => true,
307 'area-hidden' => true,
308 ),
309 )
310 );
311 }
312 ?>
313 </div>
314 </a>
315 </div>
316 <?php
317 }
318 }
319 $lessons->reset_postdata();
320 do_action( 'tutor/lesson_list/after/topic', $topic_id );
321 ?>
322 </div>
323 </div>
324 <?php
325 }
326 $topics->reset_postdata();
327 wp_reset_postdata();
328 }
329 ?>
330 <?php do_action( 'tutor_lesson/single/after/lesson_sidebar' ); ?>
331