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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 4 years ago complete_form.php 4 years ago content.php 4 years ago lesson_sidebar.php 4 years ago required-enroll.php 4 years ago sidebar_question_and_answer.php 4 years ago
lesson_sidebar.php
272 lines
1 <?php
2 /**
3 * Display Topics and Lesson lists for learn
4 *
5 * @since v.1.0.0
6 * @author themeum
7 * @url https://themeum.com
8 *
9 * @package TutorLMS/Templates
10 * @version 1.4.3
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 global $post;
18 $post_id = get_the_ID();
19 if ( ! empty( $_POST['lesson_id'] ) ) {
20 $post_id = sanitize_text_field( $_POST['lesson_id'] );
21 }
22 $currentPost = $post;
23 $_is_preview = get_post_meta( $post_id, '_is_preview', true );
24 $course_id = 0;
25 if ( $post->post_type === 'tutor_quiz' ) {
26 $course = tutor_utils()->get_course_by_quiz( get_the_ID() );
27 $course_id = $course->ID;
28 } elseif ( $post->post_type === 'tutor_assignments' ) {
29 $course_id = tutor_utils()->get_course_id_by( 'assignment', $post->ID );
30 } elseif ( $post->post_type === 'tutor_zoom_meeting' ) {
31 $course_id = get_post_meta( $post->ID, '_tutor_zm_for_course', true );
32 } else {
33 $course_id = tutor_utils()->get_course_id_by( 'lesson', $post->ID );
34 }
35 $user_id = get_current_user_id();
36 $enable_qa_for_this_course = get_post_meta( $course_id, '_tutor_enable_qa', true ) == 'yes';
37 $enable_q_and_a_on_course = tutor_utils()->get_option( 'enable_q_and_a_on_course' ) && $enable_qa_for_this_course;
38 $is_enrolled = tutor_utils()->is_enrolled( $course_id );
39 $is_instructor_of_this_course = tutor_utils()->is_instructor_of_this_course( $user_id, $course_id );
40 $is_user_admin = current_user_can( 'administrator' );
41 ?>
42
43 <?php do_action( 'tutor_lesson/single/before/lesson_sidebar' ); ?>
44 <div class="tutor-sidebar-tabs-wrap">
45 <div class="tutor-lessons-tab-area tutor-<?php echo esc_html( isset( $context ) ? $context : 'desktop' ); ?>-sidebar-area">
46 <div data-sidebar-tab="tutor-lesson-sidebar-tab-content" class="tutor-sidebar-tab-item tutor-lessons-tab <?php echo $enable_q_and_a_on_course ? 'active' : ''; ?> flex-center">
47 <span class="tutor-icon-education-filled"></span>
48 <span class="text-medium-caption tutor-color-black-70">
49 <?php esc_html_e( 'Lesson List', 'tutor' ); ?>
50 </span>
51 </div>
52 <?php if ( $enable_q_and_a_on_course && ( $is_enrolled || $is_instructor_of_this_course || $is_user_admin ) ): ?>
53 <div data-sidebar-tab="sideabr-qna-tab-content" class="tutor-sidebar-tab-item tutor-quiz-tab flex-center">
54 <span class="tutor-icon-question-filled"></span>
55 <span class="text-medium-caption tutor-color-black-70">
56 <?php esc_html_e( 'Question & Answer', 'tutor' ); ?>
57 </span>
58 </div>
59 <?php endif; ?>
60 </div>
61
62 <div class="tutor-sidebar-tabs-content">
63 <div id="tutor-lesson-sidebar-tab-content" class="tutor-lesson-sidebar-tab-item active">
64 <?php
65 $topics = tutor_utils()->get_topics( $course_id );
66 if ( $topics->have_posts() ) {
67 while ( $topics->have_posts() ) {
68 $topics->the_post();
69 $topic_id = get_the_ID();
70 $topic_summery = get_the_content();
71 $total_contents = tutor_utils()->count_completed_contents_by_topic( $topic_id );
72 ?>
73
74 <div class="tutor-topics-in-single-lesson tutor-topics-<?php echo $topic_id; ?>">
75 <div class="tutor-topics-title tutor-d-flex tutor-justify-content-between">
76 <div class="tutor-topics-title-left">
77 <div class="tutor-topics-title-inner">
78 <div class="text-medium-h6 tutor-color-text-brand"><?php the_title(); ?></div>
79 <?php if ( true ): ?>
80 <div class="tutor-topics-title-info">
81 <div class="tooltip-wrap tutor-d-flex">
82 <i class="tutor-icon-circle-outline-info-filled tutor-icon-24 color-black-40"></i>
83 <span class="tooltip-txt tooltip-bottom">
84 <?php echo $topic_summery; ?>
85 </span>
86 </div>
87 </div>
88 <?php endif; ?>
89 </div>
90 </div>
91 <div class="tutor-topics-title-right">
92 <?php if ( isset( $total_contents['contents'] ) && $total_contents['contents'] > 0 ) : ?>
93 <div class="tutor-topic-subtitle tutor-fs-7 tutor-fw-normal tutor-color-black-60">
94 <?php echo esc_html( isset( $total_contents['completed'] ) ? $total_contents['completed'] : 0 ); ?>/<?php echo esc_html( isset( $total_contents['contents'] ) ? $total_contents['contents'] : 0 ); ?>
95 </div>
96 <?php endif; ?>
97 </div>
98 </div>
99 <?php
100 do_action( 'tutor/lesson_list/before/topic', $topic_id );
101 $lessons = tutor_utils()->get_course_contents_by_topic( get_the_ID(), -1 );
102 $is_enrolled = tutor_utils()->is_enrolled( $course_id, get_current_user_id() );
103
104 while ( $lessons->have_posts() ) {
105 $lessons->the_post();
106 $show_permalink = !$_is_preview || $is_enrolled || get_post_meta( $post->ID, '_is_preview', true );
107 if ( $post->post_type === 'tutor_quiz' ) {
108 $quiz = $post;
109 ?>
110 <div class="tutor-lessons-under-topic" data-quiz-id="<?php echo $quiz->ID; ?>">
111 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-design-brand' : ''; ?>">
112 <a href="<?php echo $show_permalink ? get_permalink( $quiz->ID ) : '#'; ?>" class="tutor-single-quiz-a tutor-d-flex tutor-justify-content-between" data-quiz-id="<?php echo $quiz->ID; ?>">
113 <div class="tutor-single-lesson-items-left tutor-d-flex">
114 <span class="tutor-icon-quiz-filled"></span>
115 <span class="lesson_title tutor-fs-7 tutor-fw-normal tutor-color-black-70">
116 <?php echo $quiz->post_title; ?>
117 </span>
118 </div>
119 <div class="tutor-single-lesson-items-right tutor-d-flex tutor-lesson-right-icons">
120 <span class="text-regular-caption tutor-color-black-70">
121 <?php
122 $time_limit = tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_value' );
123 if ( $time_limit ) {
124 $time_type = tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_type' );
125
126 $time_type=='minutes' ? $time_limit=$time_limit*60 : 0;
127 $time_type=='hours' ? $time_limit=$time_limit*3660 : 0;
128 $time_type=='days' ? $time_limit=$time_limit*86400 : 0;
129 $time_type=='weeks' ? $time_limit=$time_limit*86400*7 : 0;
130
131 // To Fix: If time larger than 24 hours, the hour portion starts from 0 again. Fix later.
132 echo gmdate('H:i:s', $time_limit);
133 }
134
135 $has_attempt = tutor_utils()->has_attempted_quiz( get_current_user_id(), $quiz->ID )
136 ?>
137
138 <?php if($show_permalink): ?>
139 <input type='checkbox' class='tutor-form-check-input tutor-form-check-circle' disabled="disabled" readonly="readonly" <?php echo esc_attr( $has_attempt ? 'checked="checked"' : '' ); ?>/>
140 <?php else: ?>
141 <i class="tutor-icon-lock-stroke-filled"></i>
142 <?php endif; ?>
143 </span>
144 </div>
145 </a>
146 </div>
147 </div>
148 <?php
149
150 } elseif ( $post->post_type === 'tutor_assignments' ) {
151 /**
152 * Assignments
153 *
154 * @since this block v.1.3.3
155 */
156 ?>
157 <div class="tutor-lessons-under-topic">
158 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-design-brand' : ''; ?>">
159 <a href="<?php echo $show_permalink ? get_permalink( $post->ID ) : '#'; ?>" class="tutor-single-assignment-a tutor-d-flex tutor-justify-content-between" data-assignment-id="<?php echo $post->ID; ?>">
160 <div class="tutor-single-lesson-items-left tutor-d-flex">
161 <span class="tutor-icon-assignment-filled"></span>
162 <span class="lesson_title tutor-fs-7 tutor-fw-normal tutor-color-black-70">
163 <?php echo $post->post_title; ?>
164 </span>
165 </div>
166 <div class="tutor-single-lesson-items-right tutor-d-flex tutor-lesson-right-icons">
167 <?php if($show_permalink): ?>
168 <?php do_action( 'tutor/assignment/right_icon_area', $post ); ?>
169 <?php else: ?>
170 <i class="tutor-icon-lock-stroke-filled"></i>
171 <?php endif; ?>
172 </div>
173 </a>
174 </div>
175 </div>
176 <?php
177 } elseif ( $post->post_type === 'tutor_zoom_meeting' ) {
178 /**
179 * Zoom Meeting
180 *
181 * @since this block v.1.7.1
182 */
183 ?>
184 <div class="tutor-lessons-under-topic">
185 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-design-brand' : ''; ?>">
186 <a href="<?php echo $show_permalink ? esc_url( get_permalink( $post->ID ) ) : '#'; ?>" class="sidebar-single-zoom-meeting-a tutor-d-flex tutor-justify-content-between">
187 <div class="tutor-single-lesson-items-left tutor-d-flex">
188 <span class="tutor-icon-zoom"></span>
189 <span class="lesson_title tutor-fs-7 tutor-fw-normal tutor-color-black-70">
190 <?php echo esc_html( $post->post_title ); ?>
191 </span>
192 </div>
193 <div class="tutor-single-lesson-items-right tutor-d-flex tutor-lesson-right-icons">
194 <?php if($show_permalink): ?>
195 <?php do_action( 'tutor/zoom/right_icon_area', $post->ID ); ?>
196 <?php else: ?>
197 <i class="tutor-icon-lock-stroke-filled"></i>
198 <?php endif; ?>
199 </div>
200 </a>
201 </div>
202 </div>
203 <?php
204
205 } else {
206
207 /**
208 * Lesson
209 */
210
211 $video = tutor_utils()->get_video_info();
212
213 $play_time = false;
214 if ( $video ) {
215 $play_time = $video->playtime;
216 }
217 $is_completed_lesson = tutor_utils()->is_completed_lesson();
218 ?>
219 <div class="tutor-lessons-under-topic">
220 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-design-brand' : ''; ?>">
221 <a href="<?php echo $show_permalink ? get_the_permalink() : '#'; ?>" class="tutor-single-lesson-a tutor-d-flex tutor-justify-content-between" data-lesson-id="<?php the_ID(); ?>">
222 <div class="tutor-single-lesson-items-left tutor-d-flex">
223 <?php
224 $tutor_lesson_type_icon = $play_time ? 'youtube-brand' : 'document-file';
225 echo "<span class='tutor-icon-$tutor_lesson_type_icon'></span>";
226 ?>
227 <span class="lesson_title tutor-fs-7 tutor-fw-normal tutor-color-black-70">
228 <?php the_title(); ?>
229 </span>
230 </div>
231 <div class="tutor-single-lesson-items-right tutor-d-flex">
232 <?php
233 do_action( 'tutor/lesson_list/right_icon_area', $post );
234 if ( $play_time ) {
235 echo "<span class='text-regular-caption tutor-color-black-70'>" . tutor_utils()->get_optimized_duration( $play_time ) . '</span>';
236 }
237 $lesson_complete_icon = $is_completed_lesson ? 'checked' : '';
238
239 if($show_permalink) {
240 echo "<input $lesson_complete_icon type='checkbox' class='tutor-form-check-input tutor-form-check-circle' disabled readonly />";
241 } else {
242 echo '<i class="tutor-icon-lock-stroke-filled"></i>';
243 }
244 ?>
245 </div>
246 </a>
247 </div>
248 </div>
249 <?php
250 }
251 }
252 $lessons->reset_postdata();
253 do_action( 'tutor/lesson_list/after/topic', $topic_id );
254 ?>
255 </div>
256 <?php
257 }
258 $topics->reset_postdata();
259 wp_reset_postdata();
260 }
261 ?>
262 </div>
263
264 <div id="sideabr-qna-tab-content" class="tutor-lesson-sidebar-tab-item">
265 <?php
266 tutor_lesson_sidebar_question_and_answer();
267 ?>
268 </div>
269 </div>
270 </div>
271 <?php do_action( 'tutor_lesson/single/after/lesson_sidebar' ); ?>
272