complete_form.php
5 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
218 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 | |
| 19 | $currentPost = $post; |
| 20 | |
| 21 | $course_id = 0; |
| 22 | if ( $post->post_type === 'tutor_quiz' ) { |
| 23 | $course = tutor_utils()->get_course_by_quiz( get_the_ID() ); |
| 24 | $course_id = $course->ID; |
| 25 | } elseif ( $post->post_type === 'tutor_assignments' ) { |
| 26 | $course_id = tutor_utils()->get_course_id_by( 'assignment', $post->ID ); |
| 27 | } elseif ( $post->post_type === 'tutor_zoom_meeting' ) { |
| 28 | $course_id = get_post_meta( $post->ID, '_tutor_zm_for_course', true ); |
| 29 | } else { |
| 30 | $course_id = tutor_utils()->get_course_id_by( 'lesson', $post->ID ); |
| 31 | } |
| 32 | $disable_qa_for_this_course = get_post_meta( $course_id, '_tutor_disable_qa', true ); |
| 33 | $enable_q_and_a_on_course = tutor_utils()->get_option( 'enable_q_and_a_on_course' ) && $disable_qa_for_this_course != 'yes'; |
| 34 | |
| 35 | |
| 36 | ?> |
| 37 | |
| 38 | <?php do_action( 'tutor_lesson/single/before/lesson_sidebar' ); ?> |
| 39 | |
| 40 | <div class="tutor-sidebar-tabs-wrap"> |
| 41 | <div class="tutor-tabs-btn-group"> |
| 42 | <a href="#tutor-lesson-sidebar-tab-content" class="<?php echo esc_attr( $enable_q_and_a_on_course ? 'active' : '' ); ?>"> <i class="tutor-icon-education"></i> <span> <?php esc_html_e( 'Lesson List', 'tutor' ); ?></span></a> |
| 43 | <?php if ( $enable_q_and_a_on_course ) { ?> |
| 44 | <a href="#tutor-lesson-sidebar-qa-tab-content"> <i class="tutor-icon-question-1"></i> <span><?php esc_html_e( 'Browse Q&A', 'tutor' ); ?></span></a> |
| 45 | <?php } ?> |
| 46 | </div> |
| 47 | |
| 48 | <div class="tutor-sidebar-tabs-content"> |
| 49 | |
| 50 | <div id="tutor-lesson-sidebar-tab-content" class="tutor-lesson-sidebar-tab-item"> |
| 51 | <?php |
| 52 | $topics = tutor_utils()->get_topics( $course_id ); |
| 53 | if ( $topics->have_posts() ) { |
| 54 | while ( $topics->have_posts() ) { |
| 55 | $topics->the_post(); |
| 56 | $topic_id = get_the_ID(); |
| 57 | $topic_summery = get_the_content(); |
| 58 | ?> |
| 59 | |
| 60 | <div class="tutor-topics-in-single-lesson tutor-topics-<?php echo esc_attr( $topic_id ); ?>"> |
| 61 | <div class="tutor-topics-title <?php echo esc_attr( $topic_summery ? 'has-summery' : '' ); ?>"> |
| 62 | <h3> |
| 63 | <?php |
| 64 | the_title(); |
| 65 | if ( $topic_summery ) { |
| 66 | echo '<span class="toggle-information-icon">?</span>'; |
| 67 | } |
| 68 | ?> |
| 69 | </h3> |
| 70 | <button class="tutor-single-lesson-topic-toggle"><i class="tutor-icon-plus"></i></button> |
| 71 | </div> |
| 72 | |
| 73 | <?php |
| 74 | if ( $topic_summery ) { |
| 75 | ?> |
| 76 | <div class="tutor-topics-summery"> |
| 77 | <?php echo wp_kses_post( $topic_summery ); ?> |
| 78 | </div> |
| 79 | <?php |
| 80 | } |
| 81 | ?> |
| 82 | |
| 83 | <div class="tutor-lessons-under-topic" style="display: none"> |
| 84 | <?php |
| 85 | do_action( 'tutor/lesson_list/before/topic', $topic_id ); |
| 86 | |
| 87 | $lessons = tutor_utils()->get_course_contents_by_topic( get_the_ID(), -1 ); |
| 88 | if ( $lessons->have_posts() ) { |
| 89 | while ( $lessons->have_posts() ) { |
| 90 | $lessons->the_post(); |
| 91 | |
| 92 | if ( $post->post_type === 'tutor_quiz' ) { |
| 93 | $quiz = $post; |
| 94 | ?> |
| 95 | <div class="tutor-single-lesson-items quiz-single-item quiz-single-item-<?php echo esc_attr( $quiz->ID ); ?> <?php echo esc_attr( ( $currentPost->ID === get_the_ID() ) ? 'active' : '' ); ?>" data-quiz-id="<?php echo esc_attr( $quiz->ID ); ?>"> |
| 96 | <a href="<?php echo get_permalink( $quiz->ID ); ?>" class="sidebar-single-quiz-a" data-quiz-id="<?php echo esc_attr( $quiz->ID ); ?>"> |
| 97 | <i class="tutor-icon-doubt"></i> |
| 98 | <span class="lesson_title"><?php echo esc_attr( $quiz->post_title ); ?></span> |
| 99 | <span class="tutor-lesson-right-icons"> |
| 100 | <?php |
| 101 | do_action( 'tutor/lesson_list/right_icon_area', $post ); |
| 102 | |
| 103 | $time_limit = tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_value' ); |
| 104 | if ( $time_limit ) { |
| 105 | $time_type = tutor_utils()->get_quiz_option( $quiz->ID, 'time_limit.time_type' ); |
| 106 | echo '<span class="quiz-time-limit">' . $time_limit . ' ' . $time_type . '</span>'; |
| 107 | } |
| 108 | ?> |
| 109 | </span> |
| 110 | </a> |
| 111 | </div> |
| 112 | <?php |
| 113 | } elseif ( $post->post_type === 'tutor_assignments' ) { |
| 114 | /** |
| 115 | * Assignments |
| 116 | * |
| 117 | * @since this block v.1.3.3 |
| 118 | */ |
| 119 | |
| 120 | ?> |
| 121 | <div class="tutor-single-lesson-items assignments-single-item assignment-single-item-<?php echo esc_attr( $post->ID ); ?> <?php echo $currentPost->ID === get_the_ID() ? 'active' : ''; ?>" data-assignment-id="<?php echo esc_attr( $post->ID ); ?>"> |
| 122 | <a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" class="sidebar-single-assignment-a" data-assignment-id="<?php echo esc_attr( $post->ID ); ?>"> |
| 123 | <i class="tutor-icon-clipboard"></i> |
| 124 | <span class="lesson_title"> <?php echo esc_attr( $post->post_title ); ?> </span> |
| 125 | <span class="tutor-lesson-right-icons"> |
| 126 | <?php do_action( 'tutor/lesson_list/right_icon_area', $post ); ?> |
| 127 | </span> |
| 128 | </a> |
| 129 | </div> |
| 130 | <?php |
| 131 | |
| 132 | } elseif ( $post->post_type === 'tutor_zoom_meeting' ) { |
| 133 | /** |
| 134 | * Zoom Meeting |
| 135 | * |
| 136 | * @since this block v.1.7.1 |
| 137 | */ |
| 138 | |
| 139 | ?> |
| 140 | <div class="tutor-single-lesson-items zoom-meeting-single-item zoom-meeting-single-item-<?php echo $post->ID; ?> <?php echo $currentPost->ID === get_the_ID() ? 'active' : ''; ?>" |
| 141 | data-assignment-id="<?php echo esc_attr( $post->ID ); ?>"> |
| 142 | <a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" class="sidebar-single-zoom-meeting-a"> |
| 143 | <i class="zoom-icon"><img src="<?php echo esc_url( TUTOR_ZOOM()->url . 'assets/images/zoom-icon-grey.svg' ); ?>"></i> |
| 144 | <span class="lesson_title"> <?php echo esc_attr( $post->post_title ); ?> </span> |
| 145 | <span class="tutor-lesson-right-icons"> |
| 146 | <?php do_action( 'tutor/lesson_list/right_icon_area', $post ); ?> |
| 147 | </span> |
| 148 | </a> |
| 149 | </div> |
| 150 | <?php |
| 151 | |
| 152 | } else { |
| 153 | |
| 154 | /** |
| 155 | * Lesson |
| 156 | */ |
| 157 | |
| 158 | $video = tutor_utils()->get_video_info(); |
| 159 | |
| 160 | $play_time = false; |
| 161 | if ( $video ) { |
| 162 | $play_time = $video->playtime; |
| 163 | } |
| 164 | $is_completed_lesson = tutor_utils()->is_completed_lesson(); |
| 165 | ?> |
| 166 | |
| 167 | <div class="tutor-single-lesson-items <?php echo $currentPost->ID === get_the_ID() ? 'active' : ''; ?>"> |
| 168 | <a href="<?php the_permalink(); ?>" class="tutor-single-lesson-a" data-lesson-id="<?php the_ID(); ?>"> |
| 169 | |
| 170 | <?php |
| 171 | $tutor_lesson_type_icon = $play_time ? 'youtube' : 'document'; |
| 172 | echo '<i class="tutor-icon-' . $tutor_lesson_type_icon . '"></i>'; |
| 173 | ?> |
| 174 | <span class="lesson_title"><?php the_title(); ?></span> |
| 175 | <span class="tutor-lesson-right-icons"> |
| 176 | <?php |
| 177 | do_action( 'tutor/lesson_list/right_icon_area', $post ); |
| 178 | if ( $play_time ) { |
| 179 | echo '<i class="tutor-play-duration">' . tutor_utils()->get_optimized_duration( $play_time ) . '</i>'; |
| 180 | } |
| 181 | $lesson_complete_icon = $is_completed_lesson ? 'tutor-icon-mark tutor-done' : ''; |
| 182 | echo '<i class="tutor-lesson-complete ' . $lesson_complete_icon . '"></i>'; |
| 183 | ?> |
| 184 | </span> |
| 185 | </a> |
| 186 | </div> |
| 187 | |
| 188 | <?php |
| 189 | } |
| 190 | } |
| 191 | $lessons->reset_postdata(); |
| 192 | } |
| 193 | ?> |
| 194 | |
| 195 | <?php do_action( 'tutor/lesson_list/after/topic', $topic_id ); ?> |
| 196 | </div> |
| 197 | </div> |
| 198 | |
| 199 | <?php |
| 200 | } |
| 201 | $topics->reset_postdata(); |
| 202 | wp_reset_postdata(); |
| 203 | } |
| 204 | ?> |
| 205 | </div> |
| 206 | |
| 207 | <div id="tutor-lesson-sidebar-qa-tab-content" class="tutor-lesson-sidebar-tab-item" style="display: none;"> |
| 208 | <?php |
| 209 | tutor_lesson_sidebar_question_and_answer(); |
| 210 | ?> |
| 211 | </div> |
| 212 | |
| 213 | </div> |
| 214 | |
| 215 | </div> |
| 216 | |
| 217 | <?php do_action( 'tutor_lesson/single/after/lesson_sidebar' ); ?> |
| 218 |