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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
276 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' : ''; ?> tutor-d-flex tutor-align-center">
47 <span class="tutor-icon-open-book-o tutor-mr-8" area-hidden="true"></span>
48 <span class="tutor-fs-7 tutor-fw-medium tutor-color-secondary">
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="sidebar-qna-tab-content" class="tutor-sidebar-tab-item tutor-quiz-tab tutor-d-flex tutor-align-center">
54 <span class="tutor-icon-question tutor-mr-8" area-hidden="true"></span>
55 <span class="tutor-fs-7 tutor-fw-medium tutor-color-secondary">
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-row">
76 <div class="tutor-topics-title-left tutor-col">
77 <div class="tutor-topics-title-inner tutor-fs-6 tutor-fw-medium tutor-color-primary">
78 <?php the_title(); ?>
79 <?php if ( true ) : ?>
80 <?php if(trim($topic_summery)) : ?>
81 <div class="tutor-topics-title-info">
82 <div class="tooltip-wrap">
83 <i class="tutor-topics-title-info-icon tutor-icon-circle-info-o tutor-color-muted"></i>
84 <span class="tooltip-txt tooltip-bottom">
85 <?php echo $topic_summery; ?>
86 </span>
87 </div>
88 </div>
89 <?php endif; ?>
90 <?php endif; ?>
91 </div>
92 </div>
93
94 <div class="tutor-topics-title-right tutor-col-auto">
95 <?php if ( isset( $total_contents['contents'] ) && $total_contents['contents'] > 0 ) : ?>
96 <div class="tutor-topic-subtitle tutor-fs-7 tutor-color-secondary">
97 <?php echo esc_html( isset( $total_contents['completed'] ) ? $total_contents['completed'] : 0 ); ?>/<?php echo esc_html( isset( $total_contents['contents'] ) ? $total_contents['contents'] : 0 ); ?>
98 </div>
99 <?php endif; ?>
100 </div>
101 </div>
102
103 <?php
104 do_action( 'tutor/lesson_list/before/topic', $topic_id );
105 $lessons = tutor_utils()->get_course_contents_by_topic( get_the_ID(), -1 );
106 $is_enrolled = tutor_utils()->is_enrolled( $course_id, get_current_user_id() );
107 while ( $lessons->have_posts() ) {
108 $lessons->the_post();
109 $is_public_course = \TUTOR\Course_List::is_public( $course_id );
110 $show_permalink = !$_is_preview || $is_enrolled || get_post_meta( $post->ID, '_is_preview', true ) || $is_public_course;
111 if ( $post->post_type === 'tutor_quiz' ) {
112 $quiz = $post;
113 ?>
114 <div class="tutor-lessons-under-topic" data-quiz-id="<?php echo $quiz->ID; ?>">
115 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-primary' : ''; ?>">
116 <a href="<?php echo $show_permalink ? get_permalink( $quiz->ID ) : '#'; ?>" class="tutor-single-quiz-a tutor-d-flex tutor-justify-between" data-quiz-id="<?php echo $quiz->ID; ?>">
117 <div class="tutor-single-lesson-items-left tutor-d-flex">
118 <span class="tutor-icon-quiz-o tutor-mr-8" area-hidden="true"></span>
119 <span class="lesson_title tutor-fs-7 tutor-color-secondary">
120 <?php echo $quiz->post_title; ?>
121 </span>
122 </div>
123 <div class="tutor-single-lesson-items-right tutor-d-flex tutor-lesson-right-icons">
124 <span class="tutor-fs-7 tutor-color-secondary">
125 <?php
126 $time_limit = (int) tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_value' );
127 if ( $time_limit ) {
128 $time_type = tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_type' );
129
130 $time_type=='minutes' ? $time_limit=$time_limit*60 : 0;
131 $time_type=='hours' ? $time_limit=$time_limit*3660 : 0;
132 $time_type=='days' ? $time_limit=$time_limit*86400 : 0;
133 $time_type=='weeks' ? $time_limit=$time_limit*86400*7 : 0;
134
135 // To Fix: If time larger than 24 hours, the hour portion starts from 0 again. Fix later.
136 echo gmdate('H:i:s', $time_limit);
137 }
138
139 $has_attempt = tutor_utils()->has_attempted_quiz( get_current_user_id(), $quiz->ID )
140 ?>
141
142 <?php if($show_permalink): ?>
143 <input type="checkbox" class="tutor-form-check-input tutor-form-check-circle" disabled="disabled" readonly="readonly" <?php echo esc_attr( $has_attempt ? 'checked="checked"' : '' ); ?>/>
144 <?php else: ?>
145 <i class="tutor-icon-lock-line" area-hidden="true"></i>
146 <?php endif; ?>
147 </span>
148 </div>
149 </a>
150 </div>
151 </div>
152 <?php
153
154 } elseif ( $post->post_type === 'tutor_assignments' ) {
155 /**
156 * Assignments
157 *
158 * @since this block v.1.3.3
159 */
160 ?>
161 <div class="tutor-lessons-under-topic">
162 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-primary' : ''; ?>">
163 <a href="<?php echo $show_permalink ? get_permalink( $post->ID ) : '#'; ?>" class="tutor-single-assignment-a tutor-d-flex tutor-justify-between" data-assignment-id="<?php echo $post->ID; ?>">
164 <div class="tutor-single-lesson-items-left tutor-d-flex">
165 <span class="tutor-icon-assignment tutor-mr-8" area-hidden="true"></span>
166 <span class="lesson_title tutor-fs-7 tutor-color-secondary">
167 <?php echo $post->post_title; ?>
168 </span>
169 </div>
170 <div class="tutor-single-lesson-items-right tutor-d-flex tutor-lesson-right-icons">
171 <?php if($show_permalink): ?>
172 <?php do_action( 'tutor/assignment/right_icon_area', $post ); ?>
173 <?php else: ?>
174 <i class="tutor-icon-lock-line"></i>
175 <?php endif; ?>
176 </div>
177 </a>
178 </div>
179 </div>
180 <?php
181 } elseif ( $post->post_type === 'tutor_zoom_meeting' ) {
182 /**
183 * Zoom Meeting
184 *
185 * @since this block v.1.7.1
186 */
187 ?>
188 <div class="tutor-lessons-under-topic">
189 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-primary' : ''; ?>">
190 <a href="<?php echo $show_permalink ? esc_url( get_permalink( $post->ID ) ) : '#'; ?>" class="sidebar-single-zoom-meeting-a tutor-d-flex tutor-justify-between">
191 <div class="tutor-single-lesson-items-left tutor-d-flex">
192 <span class="tutor-icon-brand-zoom-o tutor-mr-8" area-hidden="true"></span>
193 <span class="lesson_title tutor-fs-7 tutor-color-secondary">
194 <?php echo esc_html( $post->post_title ); ?>
195 </span>
196 </div>
197 <div class="tutor-single-lesson-items-right tutor-d-flex tutor-lesson-right-icons">
198 <?php if($show_permalink): ?>
199 <?php do_action( 'tutor/zoom/right_icon_area', $post->ID ); ?>
200 <?php else: ?>
201 <i class="tutor-icon-lock-line"></i>
202 <?php endif; ?>
203 </div>
204 </a>
205 </div>
206 </div>
207 <?php
208
209 } else {
210
211 /**
212 * Lesson
213 */
214
215 $video = tutor_utils()->get_video_info();
216
217 $play_time = false;
218 if ( $video ) {
219 $play_time = $video->playtime;
220 }
221 $is_completed_lesson = tutor_utils()->is_completed_lesson();
222 ?>
223 <div class="tutor-lessons-under-topic">
224 <div class="tutor-single-lesson-items <?php echo ( $currentPost->ID == get_the_ID() ) ? 'active tutor-color-primary' : ''; ?>">
225 <a href="<?php echo $show_permalink ? get_the_permalink() : '#'; ?>" class="tutor-single-lesson-a tutor-d-flex tutor-justify-between" data-lesson-id="<?php the_ID(); ?>">
226 <div class="tutor-single-lesson-items-left tutor-d-flex">
227 <?php
228 $tutor_lesson_type_icon = $play_time ? 'brand-youtube-bold' : 'file-document';
229 echo '<span class="tutor-icon-' . $tutor_lesson_type_icon . ' tutor-mr-8" area-hidden="true"></span>';
230 ?>
231 <span class="lesson_title tutor-fs-7 tutor-color-secondary">
232 <?php the_title(); ?>
233 </span>
234 </div>
235 <div class="tutor-single-lesson-items-right tutor-d-flex">
236 <?php
237 do_action( 'tutor/lesson_list/right_icon_area', $post );
238 if ( $play_time ) {
239 echo "<span class='tutor-fs-7 tutor-color-secondary'>" . tutor_utils()->get_optimized_duration( $play_time ) . '</span>';
240 }
241 $lesson_complete_icon = $is_completed_lesson ? 'checked' : '';
242
243 if($show_permalink) {
244 echo "<input $lesson_complete_icon type='checkbox' class='tutor-form-check-input tutor-form-check-circle' disabled readonly />";
245 } else {
246 echo '<i class="tutor-icon-lock-line"></i>';
247 }
248 ?>
249 </div>
250 </a>
251 </div>
252 </div>
253 <?php
254 }
255 }
256 $lessons->reset_postdata();
257 do_action( 'tutor/lesson_list/after/topic', $topic_id );
258 ?>
259 </div>
260 <?php
261 }
262 $topics->reset_postdata();
263 wp_reset_postdata();
264 }
265 ?>
266 </div>
267
268 <div id="sidebar-qna-tab-content" class="tutor-lesson-sidebar-tab-item">
269 <?php
270 tutor_lesson_sidebar_question_and_answer();
271 ?>
272 </div>
273 </div>
274 </div>
275 <?php do_action( 'tutor_lesson/single/after/lesson_sidebar' ); ?>
276