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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 comments-loop.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
232 lines
1 <?php
2
3 /**
4 * Display Topics and Lesson lists for learn
5 *
6 * @since v.1.0.0
7 * @author themeum
8 * @url https://themeum.com
9 *
10 * @package TutorLMS/Templates
11 * @version 1.4.3
12 */
13
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 global $post;
19 $post_id = get_the_ID();
20 if (!empty($_POST['lesson_id'])) {
21 $post_id = sanitize_text_field($_POST['lesson_id']);
22 }
23 $currentPost = $post;
24 $_is_preview = get_post_meta($post_id, '_is_preview', true);
25 $course_id = tutor_utils()->get_course_id_by_subcontent($post->ID);
26
27 $user_id = get_current_user_id();
28 $enable_qa_for_this_course = get_post_meta($course_id, '_tutor_enable_qa', true) == 'yes';
29 $enable_q_and_a_on_course = tutor_utils()->get_option('enable_q_and_a_on_course') && $enable_qa_for_this_course;
30 $is_enrolled = tutor_utils()->is_enrolled($course_id);
31 $is_instructor_of_this_course = tutor_utils()->has_user_course_content_access($user_id, $course_id);
32 $is_user_admin = current_user_can('administrator');
33 ?>
34
35 <?php do_action('tutor_lesson/single/before/lesson_sidebar'); ?>
36 <div class="tutor-course-single-sidebar-title tutor-d-flex tutor-justify-between">
37 <span class="tutor-fs-6 tutor-fw-medium tutor-color-secondary"><?php _e("Course Content", "tutor"); ?></span>
38 <span class="tutor-d-block tutor-d-xl-none">
39 <a href="#" class="tutor-iconic-btn" tutor-hide-course-single-sidebar>
40 <span class="tutor-icon-times" area-hidden="true"></span>
41 </a>
42 </span>
43 </div>
44
45 <?php
46 $topics = tutor_utils()->get_topics($course_id);
47 if ($topics->have_posts()) {
48
49 // Loop through topics
50 while ($topics->have_posts()) {
51 $topics->the_post();
52 $topic_id = get_the_ID();
53 $topic_summery = get_the_content();
54 $total_contents = tutor_utils()->count_completed_contents_by_topic($topic_id);
55 $lessons = tutor_utils()->get_course_contents_by_topic(get_the_ID(), -1);
56 $is_topic_active = !empty(array_filter($lessons->posts, function ($content) use ($currentPost) {
57 return $content->ID == $currentPost->ID;
58 }));
59 ?>
60 <div class="tutor-course-topic tutor-course-topic-<?php echo $topic_id; ?>">
61 <div class="tutor-accordion-item-header<?php echo $is_topic_active ? ' is-active' : ''; ?>" tutor-course-single-topic-toggler>
62 <div class="tutor-row tutor-gx-1">
63 <div class="tutor-col">
64 <div class="tutor-course-topic-title">
65 <?php the_title(); ?>
66 <?php if (true) : ?>
67 <?php if (trim($topic_summery)) : ?>
68 <div class="tutor-course-topic-title-info tutor-ml-8">
69 <div class="tooltip-wrap">
70 <i class="tutor-course-topic-title-info-icon tutor-icon-circle-info-o"></i>
71 <span class="tooltip-txt tooltip-bottom">
72 <?php echo $topic_summery; ?>
73 </span>
74 </div>
75 </div>
76 <?php endif; ?>
77 <?php endif; ?>
78 </div>
79 </div>
80
81 <div class="tutor-col-auto tutor-align-self-center">
82 <?php if (isset($total_contents['contents']) && $total_contents['contents'] > 0) : ?>
83 <div class="tutor-course-topic-summary tutor-pl-8">
84 <?php echo esc_html(isset($total_contents['completed']) ? $total_contents['completed'] : 0); ?>/<?php echo esc_html(isset($total_contents['contents']) ? $total_contents['contents'] : 0); ?>
85 </div>
86 <?php endif; ?>
87 </div>
88 </div>
89 </div>
90
91 <div class="tutor-accordion-item-body" style="<?php echo $is_topic_active ? ' display: block;' : 'display: none;'; ?>">
92 <?php
93 do_action('tutor/lesson_list/before/topic', $topic_id);
94 $is_enrolled = tutor_utils()->is_enrolled($course_id, get_current_user_id());
95
96 // Loop through lesson, quiz, assignment, zoom lesson
97 while ($lessons->have_posts()) {
98 $lessons->the_post();
99 $is_public_course = \TUTOR\Course_List::is_public($course_id);
100
101 $show_permalink = !$_is_preview || $is_enrolled || get_post_meta($post->ID, '_is_preview', true) || $is_public_course || $is_instructor_of_this_course;
102 $show_permalink = apply_filters( 'tutor_course/single/content/show_permalink', $show_permalink, get_the_ID() );
103
104 $lock_icon = !$show_permalink;
105 $show_permalink = $show_permalink===null ? true : $show_permalink;
106
107 if ($post->post_type === 'tutor_quiz') {
108 $quiz = $post;
109 ?>
110 <div class="tutor-course-topic-item tutor-course-topic-item-quiz<?php echo ($currentPost->ID == get_the_ID()) ? ' is-active' : ''; ?>" data-quiz-id="<?php echo $quiz->ID; ?>">
111 <a href="<?php echo $show_permalink ? get_permalink($quiz->ID) : '#'; ?>" data-quiz-id="<?php echo $quiz->ID; ?>">
112 <div class="tutor-d-flex tutor-mr-32">
113 <span class="tutor-course-topic-item-icon tutor-icon-quiz-o tutor-mr-8" area-hidden="true"></span>
114 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
115 <?php echo $quiz->post_title; ?>
116 </span>
117 </div>
118 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
119 <?php
120 $time_limit = (int) tutor_utils()->get_quiz_option($quiz->ID, 'time_limit.time_value');
121 $has_attempt = tutor_utils()->has_attempted_quiz(get_current_user_id(), $quiz->ID);
122 if ($time_limit) {
123 $time_type = tutor_utils()->get_quiz_option($quiz->ID, 'time_limit.time_type');
124 $time_type == 'minutes' ? $time_limit = $time_limit * 60 : 0;
125 $time_type == 'hours' ? $time_limit = $time_limit * 3660 : 0;
126 $time_type == 'days' ? $time_limit = $time_limit * 86400 : 0;
127 $time_type == 'weeks' ? $time_limit = $time_limit * 86400 * 7 : 0;
128
129 // To Fix: If time larger than 24 hours, the hour portion starts from 0 again. Fix later.
130 echo '<span class="tutor-course-topic-item-duration tutor-fs-7 tutor-fw-medium tutor-color-muted tutor-mr-8">' . tutor_utils()->course_content_time_format(gmdate('H:i:s', $time_limit)) . '</span>';
131 }
132 ?>
133
134 <?php if (!$lock_icon) : ?>
135 <input type="checkbox" class="tutor-form-check-input tutor-form-check-circle" disabled="disabled" readonly="readonly" <?php echo esc_attr($has_attempt ? 'checked="checked"' : ''); ?> />
136 <?php else : ?>
137 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
138 <?php endif; ?>
139 </div>
140 </a>
141 </div>
142 <?php } elseif ($post->post_type === 'tutor_assignments') { ?>
143 <div class="tutor-course-topic-item tutor-course-topic-item-assignment<?php echo ($currentPost->ID == get_the_ID()) ? ' is-active' : ''; ?>">
144 <a href="<?php echo $show_permalink ? get_permalink($post->ID) : '#'; ?>" data-assignment-id="<?php echo $post->ID; ?>">
145 <div class="tutor-d-flex tutor-mr-32">
146 <span class="tutor-course-topic-item-icon tutor-icon-assignment tutor-mr-8" area-hidden="true"></span>
147 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
148 <?php echo $post->post_title; ?>
149 </span>
150 </div>
151 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
152 <?php if ($show_permalink) : ?>
153 <?php do_action('tutor/assignment/right_icon_area', $post, $lock_icon); ?>
154 <?php else : ?>
155 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
156 <?php endif; ?>
157 </div>
158 </a>
159 </div>
160 <?php } elseif ($post->post_type === 'tutor_zoom_meeting') { ?>
161 <div class="tutor-course-topic-item tutor-course-topic-item-zoom<?php echo ($currentPost->ID == get_the_ID()) ? ' is-active' : ''; ?>">
162 <a href="<?php echo $show_permalink ? esc_url(get_permalink($post->ID)) : '#'; ?>">
163 <div class="tutor-d-flex tutor-mr-32">
164 <span class="tutor-course-topic-item-icon tutor-icon-brand-zoom-o tutor-mr-8" area-hidden="true"></span>
165 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
166 <?php echo esc_html($post->post_title); ?>
167 </span>
168 </div>
169 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
170 <?php if ($show_permalink) : ?>
171 <?php do_action('tutor/zoom/right_icon_area', $post->ID, $lock_icon); ?>
172 <?php else : ?>
173 <i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>
174 <?php endif; ?>
175 </div>
176 </a>
177 </div>
178 <?php } else { ?>
179 <?php
180 $video = tutor_utils()->get_video_info();
181 $play_time = false;
182 if ($video) {
183 $play_time = $video->playtime;
184 }
185 $is_completed_lesson = tutor_utils()->is_completed_lesson();
186 ?>
187 <div class="tutor-course-topic-item tutor-course-topic-item-lesson<?php echo ($currentPost->ID == get_the_ID()) ? ' is-active' : ''; ?>">
188 <a href="<?php echo $show_permalink ? get_the_permalink() : '#'; ?>" data-lesson-id="<?php the_ID(); ?>">
189 <div class="tutor-d-flex tutor-mr-32">
190 <?php
191 $tutor_lesson_type_icon = $play_time ? 'brand-youtube-bold' : 'document-text';
192 echo '<span class="tutor-course-topic-item-icon tutor-icon-' . $tutor_lesson_type_icon . ' tutor-mr-8" area-hidden="true"></span>';
193 ?>
194 <span class="tutor-course-topic-item-title tutor-fs-7 tutor-fw-medium">
195 <?php the_title(); ?>
196 </span>
197 </div>
198
199 <div class="tutor-d-flex tutor-ml-auto tutor-flex-shrink-0">
200 <?php
201 // do_action('tutor/lesson_list/right_icon_area', $post);
202
203 if ($play_time) {
204 echo "<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>';
205 }
206
207 $lesson_complete_icon = $is_completed_lesson ? 'checked' : '';
208
209 if (!$lock_icon) {
210 echo "<input $lesson_complete_icon type='checkbox' class='tutor-form-check-input tutor-form-check-circle' disabled readonly />";
211 } else {
212 echo '<i class="tutor-icon-lock-line tutor-fs-7 tutor-color-muted tutor-mr-4" area-hidden="true"></i>';
213 }
214 ?>
215 </div>
216 </a>
217 </div>
218 <?php
219 }
220 }
221 $lessons->reset_postdata();
222 do_action('tutor/lesson_list/after/topic', $topic_id);
223 ?>
224 </div>
225 </div>
226 <?php
227 }
228 $topics->reset_postdata();
229 wp_reset_postdata();
230 }
231 ?>
232 <?php do_action('tutor_lesson/single/after/lesson_sidebar'); ?>