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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 / course / course-entry-box.php
tutor / templates / single / course Last commit date
enrolled 4 years ago add-to-cart-edd.php 4 years ago add-to-cart-woocommerce.php 4 years ago add-to-cart.php 4 years ago continue-lesson.php 4 years ago course-benefits.php 4 years ago course-content.php 4 years ago course-enrolled-box.php 4 years ago course-entry-box.php 4 years ago course-requirements.php 4 years ago course-target-audience.php 4 years ago course-topics.php 4 years ago instructors.php 4 years ago lead-info.php 4 years ago material-includes.php 4 years ago q_and_a_turned_off.php 5 years ago reviews-loop.php 4 years ago reviews.php 4 years ago social_share.php 4 years ago tags.php 4 years ago wc-price-html.php 4 years ago
course-entry-box.php
254 lines
1 <?php
2 // Utillity data
3 $is_enrolled = apply_filters( 'tutor_alter_enroll_status', tutor_utils()->is_enrolled() );
4 $lesson_url = tutor_utils()->get_course_first_lesson();
5 $is_administrator = tutor_utils()->has_user_role( 'administrator' );
6 $is_instructor = tutor_utils()->is_instructor_of_this_course();
7 $course_content_access = (bool) get_tutor_option( 'course_content_access_for_ia' );
8 $is_privileged_user = $course_content_access && ( $is_administrator || $is_instructor );
9 $tutor_course_sell_by = apply_filters( 'tutor_course_sell_by', null );
10 $is_public = get_post_meta( get_the_ID(), '_tutor_is_public_course', true ) == 'yes';
11
12 // Monetization info
13 $monetize_by = tutor_utils()->get_option( 'monetize_by' );
14 $enable_guest_course_cart = tutor_utils()->get_option( 'enable_guest_course_cart' );
15 $is_purchasable = tutor_utils()->is_course_purchasable();
16
17 // Get login url if
18 $is_tutor_login_disabled = ! tutor_utils()->get_option( 'enable_tutor_native_login', null, true, true );
19 $auth_url = $is_tutor_login_disabled ? ( isset( $_SERVER['REQUEST_SCHEME'] ) ? wp_login_url( $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ) : '' ) : '';
20
21
22 $default_meta = array(
23 array(
24 'icon_class' => 'tutor-icon-student-line-1',
25 'label' => __( 'Total Enrolled', 'tutor' ),
26 'value' => tutor_utils()->get_option( 'enable_course_total_enrolled' ) ? tutor_utils()->count_enrolled_users_by_course() : null,
27 ),
28 array(
29 'icon_class' => 'tutor-icon-clock-filled',
30 'label' => __( 'Duration', 'tutor' ),
31 'value' => get_tutor_option( 'enable_course_duration' ) ? get_tutor_course_duration_context() : null,
32 ),
33 array(
34 'icon_class' => 'tutor-icon-refresh-l',
35 'label' => __( 'Last Updated', 'tutor' ),
36 'value' => get_tutor_option( 'enable_course_update_date' ) ? tutor_get_formated_date( get_option( 'date_format' ), get_the_modified_date() ) : null,
37 ),
38 );
39
40 // Add level if enabled
41 if(tutor_utils()->get_option('enable_course_level', true, true)) {
42 array_unshift($default_meta, array(
43 'icon_class' => 'tutor-icon-level-line',
44 'label' => __( 'Level', 'tutor' ),
45 'value' => get_tutor_course_level( get_the_ID() ),
46 ));
47 }
48
49 // Right sidebar meta data
50 $sidebar_meta = apply_filters('tutor/course/single/sidebar/metadata', $default_meta, get_the_ID() );
51
52 $login_class = (!is_user_logged_in() && !$is_public) ? 'tutor-course-entry-box-login' : '';
53 $login_url = tutor_utils()->get_option( 'enable_tutor_native_login', null, true, true ) ? '' : wp_login_url( tutor()->current_url );
54 ?>
55
56 <div class="tutor-course-sidebar-card">
57 <!-- Course Entry -->
58 <div class="tutor-course-sidebar-card-body tutor-p-32 <?php echo $login_class; ?>" data-login_url="<?php echo $login_url; ?>">
59 <?php
60 if ( $is_enrolled ) {
61 ob_start();
62
63 // Course Info
64 $completed_lessons = tutor_utils()->get_completed_lesson_count_by_course();
65 $completed_percent = tutor_utils()->get_course_completed_percent();
66 $is_completed_course = tutor_utils()->is_completed_course();
67 $completed_anyway = $is_completed_course || $completed_percent >= 100;
68 $retake_course = is_single_course() && tutor_utils()->get_option( 'course_retake_feature', false ) && $completed_anyway;
69 $course_id = get_the_ID();
70 $course_progress = tutor_utils()->get_course_completed_percent( $course_id, 0, true );
71 ?>
72 <!-- course progress -->
73 <?php if ( tutor_utils()->get_option('enable_course_progress_bar', true, true) && is_array( $course_progress ) && count( $course_progress ) ) : ?>
74 <div class="tutor-course-progress-wrapper tutor-mb-32" style="width: 100%;">
75 <span class="tutor-color-black tutor-fs-6 tutor-fw-medium">
76 <?php esc_html_e( 'Course Progress', 'tutor' ); ?>
77 </span>
78 <div class="list-item-progress tutor-mt-16">
79 <div class="text-regular-body tutor-color-black-60 tutor-d-flex tutor-align-items-center tutor-justify-content-between">
80 <span class="progress-steps">
81 <?php echo esc_html( $course_progress['completed_count'] ); ?>/
82 <?php echo esc_html( $course_progress['total_count'] ); ?>
83 </span>
84 <span class="progress-percentage">
85 <?php echo esc_html( $course_progress['completed_percent'] . '%' ); ?>
86 <?php esc_html_e( 'Complete', 'tutor' ); ?>
87 </span>
88 </div>
89 <div class="progress-bar tutor-mt-12" style="--progress-value:<?php echo esc_attr( $course_progress['completed_percent'] ); ?>%;">
90 <span class="progress-value"></span>
91 </div>
92 </div>
93 </div>
94 <?php endif; ?>
95 <?php
96 $start_content = '';
97
98 // The user is enrolled anyway. No matter manual, free, purchased, woocommerce, edd, membership
99 do_action( 'tutor_course/single/actions_btn_group/before' );
100
101 // Show Start/Continue/Retake Button
102 if ( $lesson_url ) {
103 $button_class = 'tutor-is-fullwidth tutor-btn ' .
104 ( $retake_course ? 'tutor-btn-tertiary tutor-is-outline tutor-btn-lg tutor-btn-full' : '' ) .
105 ' tutor-is-fullwidth tutor-pr-0 tutor-pl-0 ' .
106 ( $retake_course ? ' tutor-course-retake-button' : '' );
107
108 // Button identifier class
109 $button_identifier = 'start-continue-retake-button';
110 $tag = $retake_course ? 'button' : 'a';
111 ob_start();
112 ?>
113 <<?php echo $tag; ?> <?php echo $retake_course ? 'disabled="disabled"' : ''; ?> href="<?php echo esc_url( $lesson_url ); ?>" class="<?php echo esc_attr( $button_class . ' ' . $button_identifier ); ?>" data-course_id="<?php echo esc_attr( get_the_ID() ); ?>">
114 <?php
115 if ( $retake_course ) {
116 esc_html_e( 'Retake This Course', 'tutor' );
117 } elseif ( $completed_percent <= 0 ) {
118 esc_html_e( 'Start Learning', 'tutor' );
119 } else {
120 esc_html_e( 'Continue Learning', 'tutor' );
121 }
122 ?>
123 </<?php echo $tag; ?>>
124 <?php
125 $start_content = ob_get_clean();
126 }
127 echo apply_filters( 'tutor_course/single/start/button', $start_content, get_the_ID() );
128
129
130
131 // Show Course Completion Button.
132 if ( ! $is_completed_course ) {
133 ob_start();
134 ?>
135 <form method="post">
136 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
137
138 <input type="hidden" value="<?php echo esc_attr( get_the_ID() ); ?>" name="course_id"/>
139 <input type="hidden" value="tutor_complete_course" name="tutor_action"/>
140
141 <button type="submit" class="tutor-mt-24 tutor-btn tutor-btn-tertiary tutor-is-outline tutor-btn-lg tutor-btn-full" name="complete_course_btn" value="complete_course">
142 <?php esc_html_e( 'Complete Course', 'tutor' ); ?>
143 </button>
144 </form>
145 <?php
146 echo apply_filters( 'tutor_course/single/complete_form', ob_get_clean() );
147 }
148
149 ?>
150 <div class="text-regular-caption tutor-color-muted tutor-mt-12 tutor-d-flex tutor-justify-content-center">
151 <span class="tutor-icon-26 tutor-color-success tutor-icon-purchase-filled tutor-mr-8"></span>
152 <span class="tutor-enrolled-info-text">
153 <?php esc_html_e( 'You enrolled in this course on', 'tutor' ); ?>
154 <span class="text-bold-small tutor-color-success tutor-ml-4 tutor-enrolled-info-date">
155 <?php echo esc_html( tutor_get_formated_date( get_option( 'date_format' ), $is_enrolled->post_date ) ); ?>
156 </span>
157 </span>
158 </div>
159 <?php
160 do_action( 'tutor_course/single/actions_btn_group/after' );
161 echo apply_filters( 'tutor/course/single/entry-box/is_enrolled', ob_get_clean(), get_the_ID() );
162 } else if ( $is_public ) {
163 // Get the first content url
164 $first_lesson_url = tutor_utils()->get_course_first_lesson( get_the_ID(), tutor()->lesson_post_type );
165 !$first_lesson_url ? $first_lesson_url = tutor_utils()->get_course_first_lesson( get_the_ID() ) : 0;
166 ob_start();
167 ?>
168 <a href="<?php echo esc_url( $first_lesson_url ); ?>" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-full">
169 <?php esc_html_e( 'Start Learning', 'tutor' ); ?>
170 </a>
171 <?php
172 echo apply_filters( 'tutor/course/single/entry-box/is_public', ob_get_clean(), get_the_ID() );
173 } else {
174 // The course enroll options like purchase or free enrolment
175 $price = apply_filters( 'get_tutor_course_price', null, get_the_ID() );
176
177 if ( tutor_utils()->is_course_fully_booked( null ) ) {
178 ob_start();
179 ?>
180 <div class="tutor-alert tutor-warning tutor-mt-28">
181 <div class="tutor-alert-text">
182 <span class="tutor-alert-icon tutor-icon-34 tutor-icon-circle-outline-info-filled tutor-mr-12"></span>
183 <span>
184 <?php esc_html_e( 'This course is full right now. We limit the number of students to create an optimized and productive group dynamic.', 'tutor' ); ?>
185 </span>
186 </div>
187 </div>
188 <?php
189 echo apply_filters( 'tutor/course/single/entry-box/fully_booked', ob_get_clean(), get_the_ID() );
190 } elseif ( $is_purchasable && $price && $tutor_course_sell_by ) {
191 // Load template based on monetization option
192 ob_start();
193 tutor_load_template( 'single.course.add-to-cart-' . $tutor_course_sell_by );
194 echo apply_filters( 'tutor/course/single/entry-box/purchasable', ob_get_clean(), get_the_ID() );
195 } else {
196 ob_start();
197 ?>
198 <div class="tutor-course-sidebar-card-pricing tutor-d-flex tutor-align-items-end tutor-justify-content-between">
199 <div>
200 <span class="text-bold-h4 tutor-color-black"><?php esc_html_e( 'Free', 'tutor' ); ?></span>
201 </div>
202 </div>
203 <div class="tutor-course-sidebar-card-btns">
204 <form class="tutor-enrol-course-form" method="post">
205 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
206 <input type="hidden" name="tutor_course_id" value="<?php echo esc_attr( get_the_ID() ); ?>">
207 <input type="hidden" name="tutor_course_action" value="_tutor_course_enroll_now">
208 <button type="submit" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-full tutor-mt-24 tutor-enroll-course-button">
209 <?php esc_html_e( 'Enroll Course', 'tutor' ); ?>
210 </button>
211 </form>
212 </div>
213 <div class="text-regular-caption tutor-color-muted tutor-mt-12 tutor-text-center">
214 <?php esc_html_e( 'Free acess this course', 'tutor' ); ?>
215 </div>
216 <?php
217 echo apply_filters( 'tutor/course/single/entry-box/free', ob_get_clean(), get_the_ID() );
218 }
219 }
220 ?>
221 </div>
222
223 <!-- Course Info -->
224 <div class="tutor-course-sidebar-card-footer tutor-p-32">
225 <ul class="tutor-course-sidebar-card-meta-list tutor-m-0 tutor-pl-0">
226 <?php foreach ( $sidebar_meta as $meta ) : ?>
227 <?php
228 if ( ! $meta['value'] ) {
229 continue;}
230 ?>
231 <li class="tutor-d-flex tutor-align-items-start tutor-align-items-xl-center tutor-justify-content-between">
232 <div class="flex-center">
233 <span class="tutor-icon-24 <?php echo esc_attr( $meta['icon_class'] ); ?> tutor-color-black"></span>
234 <span class="text-regular-caption tutor-color-muted tutor-ml-8">
235 <?php echo esc_html( $meta['label'] ); ?>
236 </span>
237 </div>
238 <div>
239 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
240 <?php echo wp_kses_post( $meta['value'] ); ?>
241 </span>
242 </div>
243 </li>
244 <?php endforeach; ?>
245 </ul>
246 </div>
247 </div>
248
249 <?php
250 if ( ! is_user_logged_in() ) {
251 tutor_load_template_from_custom_path( tutor()->path . '/views/modal/login.php' );
252 }
253 ?>
254