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
content.php
156 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 | $is_public = get_post_meta( $course_id, '_tutor_is_public_course', true ); |
| 35 | |
| 36 | $prev_is_locked = !($is_enrolled || $prev_is_preview || $is_public); |
| 37 | $next_is_locked = !($is_enrolled || $next_is_preview || $is_public); |
| 38 | |
| 39 | $jsonData = array(); |
| 40 | $jsonData['post_id'] = get_the_ID(); |
| 41 | $jsonData['best_watch_time'] = 0; |
| 42 | $jsonData['autoload_next_course_content'] = (bool) get_tutor_option( 'autoload_next_course_content' ); |
| 43 | |
| 44 | $best_watch_time = tutor_utils()->get_lesson_reading_info( get_the_ID(), 0, 'video_best_watched_time' ); |
| 45 | if ( $best_watch_time > 0 ) { |
| 46 | $jsonData['best_watch_time'] = $best_watch_time; |
| 47 | } |
| 48 | |
| 49 | $is_comment_enabled = tutor_utils()->get_option( 'enable_comment_for_lesson' ) && comments_open(); |
| 50 | |
| 51 | ?> |
| 52 | |
| 53 | <?php do_action( 'tutor_lesson/single/before/content' ); ?> |
| 54 | |
| 55 | <?php tutor_load_template( 'single.common.header', array( 'course_id' => $course_id, 'mark_as_complete' => true ) ); ?> |
| 56 | |
| 57 | <div class="tutor-course-topic-single-body"> |
| 58 | <!-- Load Lesson Video --> |
| 59 | <?php |
| 60 | $video_info = tutor_utils()->get_video_info(); |
| 61 | $source_key = is_object($video_info) && 'html5' !== $video_info->source ? 'source_'.$video_info->source : null; |
| 62 | $has_source = (is_object($video_info) && $video_info->source_video_id) || (isset($source_key) ? $video_info->$source_key : null); |
| 63 | ?> |
| 64 | <?php if ($has_source) : ?> |
| 65 | <input type="hidden" id="tutor_video_tracking_information" value="<?php echo esc_attr( json_encode( $jsonData ) ); ?>"> |
| 66 | <?php endif; ?> |
| 67 | <div class="tutor-video-player-wrapper"> |
| 68 | <?php tutor_lesson_video(); ?> |
| 69 | </div> |
| 70 | |
| 71 | <?php |
| 72 | $referer_url = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ''; |
| 73 | $referer_comment_id = explode( '#', $_SERVER['REQUEST_URI'] ); |
| 74 | $url_components = parse_url( $referer_url ); |
| 75 | isset( $url_components['query'] ) ? parse_str( $url_components['query'], $output ) : null; |
| 76 | $page_tab = isset( $_GET['page_tab'] ) ? esc_attr( $_GET['page_tab'] ) : ( isset( $output['page_tab'] ) ? $output['page_tab'] : null ); |
| 77 | ?> |
| 78 | |
| 79 | <style> |
| 80 | .tutor-actual-comment.viewing { |
| 81 | box-shadow: 0 0 10px #cdcfd5; |
| 82 | animation: blinkComment 1s infinite; |
| 83 | } |
| 84 | @keyframes blinkComment { 50% { box-shadow:0 0 0px #ffffff; } } |
| 85 | </style> |
| 86 | |
| 87 | <div class="tutor-course-spotlight-wrapper"> |
| 88 | <ul class="tutor-nav tutor-course-spotlight-nav tutor-justify-center"> |
| 89 | <li class="tutor-nav-item"> |
| 90 | <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"> |
| 91 | <span class="tutor-icon-document-text tutor-mr-8" area-hidden="true"></span> |
| 92 | <span><?php _e( 'Overview', 'tutor' ); ?></span> |
| 93 | </a> |
| 94 | </li> |
| 95 | |
| 96 | <li class="tutor-nav-item"> |
| 97 | <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"> |
| 98 | <span class="tutor-icon-paperclip tutor-mr-8" area-hidden="true"></span> |
| 99 | <span><?php _e( 'Exercise Files', 'tutor' ); ?></span> |
| 100 | </a> |
| 101 | </li> |
| 102 | |
| 103 | <?php if ( $is_comment_enabled ) : ?> |
| 104 | <li class="tutor-nav-item"> |
| 105 | <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"> |
| 106 | <span class="tutor-icon-comment tutor-mr-8" area-hidden="true"></span> |
| 107 | <span><?php _e( 'Comments', 'tutor' ); ?></span> |
| 108 | </a> |
| 109 | </li> |
| 110 | <?php endif; ?> |
| 111 | </ul> |
| 112 | |
| 113 | <div class="tutor-tab tutor-course-spotlight-tab"> |
| 114 | <div id="tutor-course-spotlight-overview" class="tutor-tab-item<?php echo ( ! isset( $page_tab ) || 'overview' == $page_tab ) ? ' is-active' : ''; ?>"> |
| 115 | <div class="tutor-container"> |
| 116 | <div class="tutor-row tutor-justify-center"> |
| 117 | <div class="tutor-col-xl-8"> |
| 118 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12"> |
| 119 | <?php _e( 'About Lesson', 'tutor' ); ?> |
| 120 | </div> |
| 121 | <div class="tutor-fs-6 tutor-color-secondary"> |
| 122 | <?php the_content(); ?> |
| 123 | </div> |
| 124 | </div> |
| 125 | </div> |
| 126 | </div> |
| 127 | </div> |
| 128 | |
| 129 | <div id="tutor-course-spotlight-files" class="tutor-tab-item<?php echo 'files' == $page_tab ? ' is-active' : ''; ?>"> |
| 130 | <div class="tutor-container"> |
| 131 | <div class="tutor-row tutor-justify-center"> |
| 132 | <div class="tutor-col-xl-8"> |
| 133 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black"><?php _e( 'Exercise Files', 'tutor' ); ?></div> |
| 134 | <?php get_tutor_posts_attachments(); ?> |
| 135 | </div> |
| 136 | </div> |
| 137 | </div> |
| 138 | </div> |
| 139 | |
| 140 | <?php if ( $is_comment_enabled ) : ?> |
| 141 | <div id="tutor-course-spotlight-comments" class="tutor-tab-item<?php echo 'comments' == $page_tab ? ' is-active' : ''; ?>"> |
| 142 | <div class="tutor-container"> |
| 143 | <div class="tutor-course-spotlight-comments"> |
| 144 | <?php require __DIR__ . '/comment.php'; ?> |
| 145 | </div> |
| 146 | </div> |
| 147 | </div> |
| 148 | <?php endif; ?> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | |
| 153 | <?php tutor_load_template( 'single.common.footer', array( 'course_id' => $course_id )); ?> |
| 154 | |
| 155 | <?php do_action( 'tutor_lesson/single/after/content' ); ?> |
| 156 |