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
content.php
247 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Display the content |
| 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 | global $previous_id; |
| 19 | global $next_id; |
| 20 | |
| 21 | // Get the ID of this content and the corresponding course |
| 22 | $course_content_id = get_the_ID(); |
| 23 | $course_id = tutor_utils()->get_course_id_by_subcontent( $course_content_id ); |
| 24 | |
| 25 | $_is_preview = get_post_meta( $course_content_id, '_is_preview', true ); |
| 26 | $content_id = tutor_utils()->get_post_id( $course_content_id ); |
| 27 | $contents = tutor_utils()->get_course_prev_next_contents_by_id( $content_id ); |
| 28 | $previous_id = $contents->previous_id; |
| 29 | $next_id = $contents->next_id; |
| 30 | |
| 31 | $prev_is_preview = get_post_meta( $previous_id, '_is_preview', true ); |
| 32 | $next_is_preview = get_post_meta( $next_id, '_is_preview', true ); |
| 33 | $is_enrolled = tutor_utils()->is_enrolled( $course_id ); |
| 34 | |
| 35 | $prev_is_locked = !($is_enrolled || $prev_is_preview); |
| 36 | $next_is_locked = !($is_enrolled || $next_is_preview); |
| 37 | |
| 38 | // Get total content count |
| 39 | $course_stats = tutor_utils()->get_course_completed_percent( $course_id, 0, true ); |
| 40 | |
| 41 | $jsonData = array(); |
| 42 | $jsonData['post_id'] = get_the_ID(); |
| 43 | $jsonData['best_watch_time'] = 0; |
| 44 | $jsonData['autoload_next_course_content'] = (bool) get_tutor_option( 'autoload_next_course_content' ); |
| 45 | |
| 46 | $best_watch_time = tutor_utils()->get_lesson_reading_info( get_the_ID(), 0, 'video_best_watched_time' ); |
| 47 | if ( $best_watch_time > 0 ) { |
| 48 | $jsonData['best_watch_time'] = $best_watch_time; |
| 49 | } |
| 50 | |
| 51 | $is_comment_enabled = tutor_utils()->get_option( 'enable_comment_for_lesson' ) && comments_open(); |
| 52 | $is_enrolled = tutor_utils()->is_enrolled( $course_id ); |
| 53 | ?> |
| 54 | |
| 55 | <?php do_action( 'tutor_lesson/single/before/content' ); ?> |
| 56 | <?php if ( $is_enrolled ) : ?> |
| 57 | <div class="tutor-single-page-top-bar tutor-d-flex tutor-justify-between"> |
| 58 | <div class="tutor-topbar-left-item tutor-d-flex"> |
| 59 | <div class="tutor-topbar-item tutor-topbar-sidebar-toggle tutor-hide-sidebar-bar tutor-d-flex tutor-align-center tutor-d-none tutor-d-xl-flex"> |
| 60 | <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"> |
| 61 | <span class="tutor-icon-left tutor-color-white tutor-d-flex tutor-align-center"></span> |
| 62 | </a> |
| 63 | </div> |
| 64 | <div class="tutor-topbar-item tutor-topbar-content-title-wrap tutor-d-flex tutor-align-center"> |
| 65 | <span class="tutor-icon-brand-youtube-bold tutor-color-white tutor-mr-8"></span> |
| 66 | <span class="tutor-fs-7 tutor-color-white"> |
| 67 | <?php |
| 68 | esc_html_e( 'Lesson: ', 'tutor' ); |
| 69 | the_title(); |
| 70 | ?> |
| 71 | </span> |
| 72 | </div> |
| 73 | </div> |
| 74 | <div class="tutor-topbar-right-item tutor-d-flex"> |
| 75 | <div class="tutor-topbar-assignment-details tutor-d-flex tutor-align-center"> |
| 76 | <?php |
| 77 | do_action( 'tutor_course/single/enrolled/before/lead_info/progress_bar' ); |
| 78 | ?> |
| 79 | <div class="tutor-fs-7 tutor-color-white"> |
| 80 | <?php if ( true == get_tutor_option( 'enable_course_progress_bar' ) ) : ?> |
| 81 | <span class="tutor-progress-content tutor-color-primary-60"> |
| 82 | <?php _e( 'Your Progress:', 'tutor' ); ?> |
| 83 | </span> |
| 84 | <span class="tutor-fs-7 tutor-fw-bold"> |
| 85 | <?php echo $course_stats['completed_count']; ?> |
| 86 | </span> |
| 87 | <?php _e( 'of ', 'tutor' ); ?> |
| 88 | <span class="tutor-fs-7 tutor-fw-bold"> |
| 89 | <?php echo $course_stats['total_count']; ?> |
| 90 | </span> |
| 91 | (<?php echo $course_stats['completed_percent'] . '%'; ?>) |
| 92 | <?php endif; ?> |
| 93 | </div> |
| 94 | <?php |
| 95 | do_action( 'tutor_course/single/enrolled/after/lead_info/progress_bar' ); |
| 96 | ?> |
| 97 | <!-- <div class="tutor-topbar-complete-btn tutor-ml-24"> --> |
| 98 | <?php tutor_lesson_mark_complete_html(); ?> |
| 99 | <!-- </div> --> |
| 100 | </div> |
| 101 | <div class="tutor-topbar-cross-icon tutor-ml-16 tutor-d-flex tutor-align-center"> |
| 102 | <?php $course_id = tutor_utils()->get_course_id_by( 'lesson', get_the_ID() ); ?> |
| 103 | <a href="<?php echo get_the_permalink( $course_id ); ?>"> |
| 104 | <span class="tutor-icon-times tutor-color-white tutor-d-flex tutor-align-center"></span> |
| 105 | </a> |
| 106 | </div> |
| 107 | </div> |
| 108 | </div> |
| 109 | <div class="tutor-mobile-top-navigation tutor-d-block tutor-d-sm-none tutor-my-20 tutor-mx-12"> |
| 110 | <div class="tutor-mobile-top-nav tutor-d-flex tutor-align-center tutor-justify-between"> |
| 111 | <a href="<?php echo $prev_is_locked ? '#' : get_the_permalink( $previous_id ); ?>"> |
| 112 | <span class="tutor-top-nav-icon tutor-icon-previous design-lightgrey"></span> |
| 113 | </a> |
| 114 | <div class="tutor-top-nav-title tutor-fs-6 tutor-color-black"> |
| 115 | <?php |
| 116 | the_title(); |
| 117 | ?> |
| 118 | </div> |
| 119 | <div class="tutor-topbar-cross-icon tutor-ml-16 tutor-d-sm-none tutor-d-flex tutor-d-sm-none"> |
| 120 | <?php $course_id = tutor_utils()->get_course_id_by( 'lesson', get_the_ID() ); ?> |
| 121 | <a href="<?php echo get_the_permalink( $course_id ); ?>"> |
| 122 | <span class="tutor-icon-times tutor-color-primary tutor-d-flex tutor-align-center"></span> |
| 123 | </a> |
| 124 | </div> |
| 125 | </div> |
| 126 | </div> |
| 127 | <?php else : ?> |
| 128 | <div class="tutor-single-page-top-bar tutor-d-flex tutor-justify-between"> |
| 129 | <div class="tutor-topbar-item tutor-topbar-sidebar-toggle tutor-hide-sidebar-bar tutor-d-flex tutor-align-center tutor-d-none tutor-d-xl-flex"> |
| 130 | <a href="javascript:;" class="tutor-lesson-sidebar-hide-bar"> |
| 131 | <span class="tutor-icon-left tutor-color-white tutor-d-flex tutor-align-center"></span> |
| 132 | </a> |
| 133 | </div> |
| 134 | <div class="tutor-topbar-item tutor-topbar-content-title-wrap tutor-d-flex tutor-align-center"> |
| 135 | <span class="tutor-icon-brand-youtube-bold tutor-color-white tutor-mr-8"></span> |
| 136 | <span class="tutor-fs-7 tutor-color-white"> |
| 137 | <?php |
| 138 | esc_html_e( 'Lesson: ', 'tutor' ); |
| 139 | the_title(); |
| 140 | ?> |
| 141 | </span> |
| 142 | </div> |
| 143 | |
| 144 | <div class="tutor-topbar-cross-icon tutor-ml-16 tutor-d-flex tutor-align-center"> |
| 145 | <?php $course_id = tutor_utils()->get_course_id_by( 'lesson', get_the_ID() ); ?> |
| 146 | <a href="<?php echo get_the_permalink( $course_id ); ?>"> |
| 147 | <span class="tutor-icon-times tutor-color-white tutor-d-flex tutor-align-center"></span> |
| 148 | </a> |
| 149 | </div> |
| 150 | </div> |
| 151 | <?php endif; ?> |
| 152 | |
| 153 | <!-- Load Lesson Video --> |
| 154 | <input type="hidden" id="tutor_video_tracking_information" value="<?php echo esc_attr( json_encode( $jsonData ) ); ?>"> |
| 155 | <div class="tutor-video-player-wrapper"> |
| 156 | <?php tutor_lesson_video(); ?> |
| 157 | <?php if($previous_id): ?> |
| 158 | <div class="tutor-single-course-content-prev tutor-d-flex tutor-align-center"> |
| 159 | <a href="<?php echo $prev_is_locked ? '#' : get_the_permalink( $previous_id ); ?>"> |
| 160 | <span class="tutor-icon-angle-left" area-hidden="true"></span> |
| 161 | </a> |
| 162 | </div> |
| 163 | <?php endif; ?> |
| 164 | |
| 165 | <?php if($next_id): ?> |
| 166 | <div class="tutor-single-course-content-next tutor-d-flex tutor-align-center"> |
| 167 | <a href="<?php echo $next_is_locked ? '#' : get_the_permalink( $next_id ); ?>"> |
| 168 | <span class="tutor-icon-angle-right" area-hidden="true"></span> |
| 169 | </a> |
| 170 | </div> |
| 171 | <?php endif; ?> |
| 172 | </div> |
| 173 | <?php |
| 174 | $referer_url = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ''; |
| 175 | $referer_comment_id = explode( '#', $_SERVER['REQUEST_URI'] ); |
| 176 | $url_components = parse_url( $referer_url ); |
| 177 | isset( $url_components['query'] ) ? parse_str( $url_components['query'], $output ) : null; |
| 178 | $page_tab = isset( $_GET['page_tab'] ) ? esc_attr( $_GET['page_tab'] ) : ( isset( $output['page_tab'] ) ? $output['page_tab'] : null ); |
| 179 | ?> |
| 180 | |
| 181 | <style> |
| 182 | .tutor-actual-comment.viewing{ |
| 183 | box-shadow: 0 0 10px #cdcfd5; |
| 184 | animation: blinkComment 1s infinite; |
| 185 | } |
| 186 | @keyframes blinkComment { 50% { box-shadow:0 0 0px #ffffff; } } |
| 187 | </style> |
| 188 | |
| 189 | <div class="tutor-course-spotlight-wrapper"> |
| 190 | <ul class="tutor-nav tutor-course-spotlight-nav tutor-justify-center"> |
| 191 | <li class="tutor-nav-item"> |
| 192 | <a href="#" class="tutor-nav-link<?php echo ( ! isset( $page_tab ) || 'overview' == $page_tab ) ? ' is-active' : ''; ?>" data-tutor-nav-target="tutor-course-spotlight-overview" data-tutor-query-variable="page_tab" data-tutor-query-value="overview"> |
| 193 | <span class="tutor-icon-document-text tutor-mr-8" area-hidden="true"></span> |
| 194 | <span><?php _e( 'Overview', 'tutor' ); ?></span> |
| 195 | </a> |
| 196 | </li> |
| 197 | |
| 198 | <li class="tutor-nav-item"> |
| 199 | <a href="#" class="tutor-nav-link<?php echo 'files' == $page_tab ? ' is-active' : ''; ?>" data-tutor-nav-target="tutor-course-spotlight-files" data-tutor-query-variable="page_tab" data-tutor-query-value="files"> |
| 200 | <span class="tutor-icon-paperclip tutor-mr-8" area-hidden="true"></span> |
| 201 | <span><?php _e( 'Exercise Files', 'tutor' ); ?></span> |
| 202 | </a> |
| 203 | </li> |
| 204 | |
| 205 | <?php if ( $is_comment_enabled ) : ?> |
| 206 | <li class="tutor-nav-item"> |
| 207 | <a href="#" class="tutor-nav-link<?php echo 'comments' == $page_tab ? ' is-active' : ''; ?>" data-tutor-nav-target="tutor-course-spotlight-comments" data-tutor-query-variable="page_tab" data-tutor-query-value="comments"> |
| 208 | <span class="tutor-icon-comment tutor-mr-8" area-hidden="true"></span> |
| 209 | <span><?php _e( 'Comments', 'tutor' ); ?></span> |
| 210 | </a> |
| 211 | </li> |
| 212 | <?php endif; ?> |
| 213 | </ul> |
| 214 | |
| 215 | <div class="tutor-tab tutor-course-spotlight-tab"> |
| 216 | <div id="tutor-course-spotlight-overview" class="tutor-tab-item<?php echo ( ! isset( $page_tab ) || 'overview' == $page_tab ) ? ' is-active' : ''; ?>"> |
| 217 | <div class="tutor-container"> |
| 218 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12"> |
| 219 | <?php _e( 'About Lesson', 'tutor' ); ?> |
| 220 | </div> |
| 221 | <div class="tutor-fs-6 tutor-color-secondary" style="min-height: 300px;"> |
| 222 | <?php the_content(); ?> |
| 223 | </div> |
| 224 | </div> |
| 225 | </div> |
| 226 | |
| 227 | <div id="tutor-course-spotlight-files" class="tutor-tab-item<?php echo 'files' == $page_tab ? ' is-active' : ''; ?>"> |
| 228 | <div class="tutor-container"> |
| 229 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'Exercise Files', 'tutor' ); ?></div> |
| 230 | <?php get_tutor_posts_attachments(); ?> |
| 231 | </div> |
| 232 | </div> |
| 233 | |
| 234 | <?php if ( $is_comment_enabled ) : ?> |
| 235 | <div id="tutor-course-spotlight-comments" class="tutor-tab-item<?php echo 'comments' == $page_tab ? ' is-active' : ''; ?>"> |
| 236 | <div class="tutor-container"> |
| 237 | <div class="tutor-course-spotlight-comments"> |
| 238 | <?php require __DIR__ . '/comment.php'; ?> |
| 239 | </div> |
| 240 | </div> |
| 241 | </div> |
| 242 | <?php endif; ?> |
| 243 | </div> |
| 244 | </div> |
| 245 | |
| 246 | <?php do_action( 'tutor_lesson/single/after/content' ); ?> |
| 247 |