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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 3 days ago add-to-cart-edd.php 3 days ago add-to-cart-tutor.php 11 months ago add-to-cart-woocommerce.php 1 year ago continue-lesson.php 3 years ago course-benefits.php 2 months ago course-content.php 2 months ago course-entry-box.php 3 days ago course-requirements.php 2 months ago course-target-audience.php 2 months ago course-topics.php 3 days ago instructors.php 3 years ago lead-info.php 9 months ago material-includes.php 2 months ago q_and_a_turned_off.php 3 years ago reviews-loop.php 3 days ago reviews.php 3 days ago social_share.php 3 years ago tags.php 3 years ago wc-price-html.php 3 years ago
course-entry-box.php
308 lines
1 <?php
2 /**
3 * Template for course entry box
4 *
5 * @package Tutor\Templates
6 * @subpackage Single\Course
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.0.0
10 */
11
12 use Tutor\Models\CourseModel;
13
14 // Utility data.
15 global $is_enrolled;
16
17 $is_enrolled = apply_filters( 'tutor_alter_enroll_status', $is_enrolled );
18 $lesson_url = tutor_utils()->get_course_first_lesson();
19 $is_privileged_user = tutor_utils()->has_user_course_content_access();
20 $tutor_course_sell_by = apply_filters( 'tutor_course_sell_by', null );
21 $is_public = get_post_meta( get_the_ID(), '_tutor_is_public_course', true ) == 'yes';
22
23 // Monetization info.
24 $monetize_by = tutor_utils()->get_option( 'monetize_by' );
25 $is_purchasable = tutor_utils()->is_course_purchasable();
26
27 // Get login url if.
28 $is_tutor_login_disabled = ! tutor_utils()->get_option( 'enable_tutor_native_login', null, true, true );
29 $auth_url = $is_tutor_login_disabled ? ( isset( $_SERVER['REQUEST_SCHEME'] ) ? wp_login_url( tutor_utils()->get_current_url() ) : '' ) : '';
30 $default_meta = array(
31 array(
32 'icon_class' => 'tutor-icon-mortarboard',
33 'label' => __( 'Total Enrolled', 'tutor' ),
34 'value' => tutor_utils()->get_option( 'enable_course_total_enrolled' ) ? tutor_utils()->count_enrolled_users_by_course() . ' ' . __( 'Total Enrolled', 'tutor' ) : null,
35 ),
36 array(
37 'icon_class' => 'tutor-icon-clock-line',
38 'label' => __( 'Duration', 'tutor' ),
39 'value' => get_tutor_option( 'enable_course_duration' ) ? ( get_tutor_course_duration_context() ? get_tutor_course_duration_context() . ' ' . __( 'Duration', 'tutor' ) : false ) : null,
40 ),
41 array(
42 'icon_class' => 'tutor-icon-refresh-o',
43 'label' => __( 'Last Updated', 'tutor' ),
44 'value' => get_tutor_option( 'enable_course_update_date' ) ? get_the_modified_date( get_option( 'date_format' ) ) . ' ' . __( 'Last Updated', 'tutor' ) : null,
45 ),
46 );
47
48 // Add level if enabled.
49 if ( tutor_utils()->get_option( 'enable_course_level', true, true ) ) {
50 array_unshift(
51 $default_meta,
52 array(
53 'icon_class' => 'tutor-icon-level',
54 'label' => __( 'Level', 'tutor' ),
55 'value' => get_tutor_course_level( get_the_ID() ),
56 )
57 );
58 }
59
60 // Right sidebar meta data.
61 $sidebar_meta = apply_filters( 'tutor/course/single/sidebar/metadata', $default_meta, get_the_ID() );
62 $login_url = tutor_utils()->get_option( 'enable_tutor_native_login', null, true, true ) ? '' : wp_login_url( tutor()->current_url );
63
64 ?>
65
66 <div class="tutor-card tutor-card-md tutor-sidebar-card">
67 <?php
68 $tutor_load_sidebar_actions = apply_filters( 'tutor_load_single_sidebar_actions', true, get_the_ID() );
69 if ( $tutor_load_sidebar_actions ) :
70 ?>
71 <div class="tutor-card-body">
72 <?php
73 if ( $is_enrolled || $is_privileged_user ) {
74 ob_start();
75
76 // Course Info.
77 $user_id = get_current_user_id();
78 $course_id = get_the_ID();
79 $completion_mode = tutor_utils()->get_option( 'course_completion_process' );
80 $is_completed_course = tutor_utils()->is_completed_course();
81 $retake_course = tutor_utils()->can_user_retake_course();
82 $course_progress = tutor_utils()->get_course_completed_percent( $course_id, 0, true );
83 $completed_percent = $course_progress['completed_percent'];
84 ?>
85 <!-- course progress -->
86 <?php if ( tutor_utils()->get_option( 'enable_course_progress_bar', true, true ) && is_array( $course_progress ) && count( $course_progress ) ) : ?>
87 <div class="tutor-course-progress-wrapper tutor-mb-32">
88 <h3 class="tutor-color-black tutor-fs-5 tutor-fw-bold tutor-mb-16">
89 <?php esc_html_e( 'Course Progress', 'tutor' ); ?>
90 </h3>
91 <div class="list-item-progress">
92 <div class="tutor-fs-6 tutor-color-secondary tutor-d-flex tutor-align-center tutor-justify-between">
93 <span class="progress-steps">
94 <?php echo esc_html( $course_progress['completed_count'] . '/' . $course_progress['total_count'] ); ?>
95 </span>
96 <span class="progress-percentage">
97 <?php echo esc_html( $completed_percent . '%' ); ?>
98 <?php esc_html_e( 'Complete', 'tutor' ); ?>
99 </span>
100 </div>
101 <div class="tutor-progress-bar tutor-mt-12" style="--tutor-progress-value:<?php echo esc_attr( $completed_percent ); ?>%;">
102 <span class="tutor-progress-value" aria-hidden="true"></span>
103 </div>
104 </div>
105 </div>
106 <?php endif; ?>
107 <?php
108 $start_content = '';
109
110 // The user is enrolled anyway. No matter manual, free, purchased, woocommerce, edd, membership.
111 do_action( 'tutor_course/single/actions_btn_group/before' );
112
113 // Show Start/Continue/Retake Button.
114 if ( $lesson_url ) {
115 ob_start();
116 /**
117 * Course retake button.
118 *
119 * Todo: `href` attribute is exist for backward compatibility.
120 * we need to make it `data-link` attribute and update the js code at course-landing.js
121 *
122 * @since 1.0.0
123 * @since 2.4.0 refactored and hide it when strict mode enabled and course not completed.
124 */
125 if ( $retake_course && ( CourseModel::MODE_FLEXIBLE === $completion_mode || $is_completed_course ) ) {
126 ?>
127 <button type="button"
128 class="tutor-btn tutor-btn-block tutor-btn-outline-primary start-continue-retake-button tutor-course-retake-button"
129 href="<?php echo esc_url( $lesson_url ); ?>"
130 data-course_id="<?php echo esc_attr( get_the_ID() ); ?>">
131 <?php esc_html_e( 'Retake This Course', 'tutor' ); ?>
132 </button>
133 <?php
134 }
135
136 /**
137 * Start/Continue learning button
138 *
139 * @since 1.0.0
140 * @since 2.4.0 refactored for enhance readibility.
141 */
142 $link_text = '';
143 if ( ! $is_completed_course ) {
144 if ( 0 === (int) $completed_percent ) {
145 $link_text = __( 'Start Learning', 'tutor' );
146 }
147 if ( $completed_percent > 0 && $completed_percent < 100 ) {
148 $link_text = __( 'Continue Learning', 'tutor' );
149 }
150
151 /**
152 * `Review Progress` link text shown when
153 * - strict mode enabled
154 * - course progress 100%
155 * - in course progress any quiz or assignemnt result is not passed.
156 *
157 * @since 2.4.0
158 */
159 if ( 100 === (int) $completed_percent && false === CourseModel::can_complete_course( $course_id, $user_id ) ) {
160 $lesson_url = CourseModel::get_review_progress_link( $course_id, $user_id );
161 $link_text = __( 'Review Progress', 'tutor' );
162 }
163 }
164
165 if ( strlen( $link_text ) > 0 ) {
166 ?>
167 <a href="<?php echo esc_url( $lesson_url ); ?>"
168 class="tutor-btn tutor-btn-block tutor-btn-primary tutor-mt-20">
169 <?php echo esc_html( $link_text ); ?>
170 </a>
171 <?php
172 }
173
174 $start_content = ob_get_clean();
175 }
176 echo apply_filters( 'tutor_course/single/start/button', $start_content, get_the_ID() );//phpcs:ignore
177
178 // Show Course Completion Button.
179 if ( ! $is_completed_course ) {
180 ob_start();
181 ?>
182 <form method="post" class="tutor-mt-20">
183 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce, false ); ?>
184
185 <input type="hidden" value="<?php echo esc_attr( get_the_ID() ); ?>" name="course_id"/>
186 <input type="hidden" value="tutor_complete_course" name="tutor_action"/>
187
188 <button type="submit" class="tutor-btn tutor-btn-outline-primary tutor-btn-block" name="complete_course_btn" value="complete_course">
189 <?php esc_html_e( 'Complete Course', 'tutor' ); ?>
190 </button>
191 </form>
192 <?php
193 echo apply_filters( 'tutor_course/single/complete_form', ob_get_clean() );//phpcs:ignore
194 }
195
196 ?>
197 <?php
198 // check if has enrolled date.
199 $post_date = is_object( $is_enrolled ) && isset( $is_enrolled->post_date ) ? $is_enrolled->post_date : '';
200 if ( '' !== $post_date ) :
201 ?>
202 <div class="tutor-fs-7 tutor-color-muted tutor-mt-20 tutor-d-flex">
203 <span class="tutor-fs-6 tutor-color-success tutor-icon-purchase-mark tutor-mr-8"></span>
204 <span class="tutor-enrolled-info-text">
205 <?php esc_html_e( 'You enrolled in this course on', 'tutor' ); ?>
206 <span class="tutor-fs-7 tutor-fw-bold tutor-color-success tutor-ml-4 tutor-enrolled-info-date">
207 <?php
208 echo esc_html( tutor_i18n_get_formated_date( $post_date, get_option( 'date_format' ) ) );
209 ?>
210 </span>
211 </span>
212 </div>
213 <?php endif; ?>
214 <?php
215 do_action( 'tutor_course/single/actions_btn_group/after' );
216 echo apply_filters( 'tutor/course/single/entry-box/is_enrolled', ob_get_clean(), get_the_ID() );//phpcs:ignore
217 } elseif ( $is_public ) {
218 // Get the first content url.
219 $first_lesson_url = tutor_utils()->get_course_first_lesson( get_the_ID(), tutor()->lesson_post_type );
220 ! $first_lesson_url ? $first_lesson_url = tutor_utils()->get_course_first_lesson( get_the_ID() ) : 0;
221 ob_start();
222 ?>
223 <a href="<?php echo esc_url( $first_lesson_url ); ?>" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-block">
224 <?php esc_html_e( 'Start Learning', 'tutor' ); ?>
225 </a>
226 <?php
227 echo apply_filters( 'tutor/course/single/entry-box/is_public', ob_get_clean(), get_the_ID() );//phpcs:ignore
228 } else {
229 // The course enroll options like purchase or free enrollment.
230 $price = apply_filters( 'get_tutor_course_price', null, get_the_ID() );
231
232 if ( tutor_utils()->is_course_fully_booked( null ) ) {
233 $alert_message = apply_filters( 'tutor_course_fully_booked_message', __( 'This course is full right now. We limit the number of students to create an optimized and productive group dynamic.', 'tutor' ) );
234 ob_start();
235 ?>
236 <div class="tutor-alert tutor-warning tutor-mt-28">
237 <div class="tutor-alert-text">
238 <span class="tutor-icon-circle-info tutor-alert-icon tutor-mr-12" aria-hidden="true"></span>
239 <span>
240 <?php echo wp_kses_post( $alert_message ); ?>
241 </span>
242 </div>
243 </div>
244 <?php
245 echo apply_filters( 'tutor/course/single/entry-box/fully_booked', ob_get_clean(), get_the_ID() );//phpcs:ignore
246 } elseif ( $is_purchasable && $price && $tutor_course_sell_by ) {
247 // Load template based on monetization option.
248 ob_start();
249 tutor_load_template( 'single.course.add-to-cart-' . $tutor_course_sell_by );
250 echo apply_filters( 'tutor/course/single/entry-box/purchasable', ob_get_clean(), get_the_ID() );//phpcs:ignore
251 } else {
252 ob_start();
253 ?>
254 <div class="tutor-course-single-pricing">
255 <span class="tutor-fs-4 tutor-fw-bold tutor-color-black">
256 <?php esc_html_e( 'Free', 'tutor' ); ?>
257 </span>
258 </div>
259
260 <div class="tutor-course-single-btn-group <?php echo is_user_logged_in() ? '' : 'tutor-course-entry-box-login'; ?>" data-login_url="<?php echo esc_url( $login_url ); ?>">
261 <form class="tutor-enrol-course-form" method="post">
262 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
263 <input type="hidden" name="tutor_course_id" value="<?php echo esc_attr( get_the_ID() ); ?>">
264 <input type="hidden" name="tutor_course_action" value="_tutor_course_enroll_now">
265 <button type="submit" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-block tutor-mt-24 tutor-enroll-course-button <?php echo is_user_logged_in() ? 'tutor-static-loader' : ''; ?>">
266 <?php esc_html_e( 'Enroll Now', 'tutor' ); ?>
267 </button>
268 </form>
269 </div>
270
271 <div class="tutor-fs-7 tutor-color-muted tutor-mt-20 tutor-text-center">
272 <?php esc_html_e( 'Free access this course', 'tutor' ); ?>
273 </div>
274 <?php
275 echo apply_filters( 'tutor/course/single/entry-box/free', ob_get_clean(), get_the_ID() );//phpcs:ignore
276 }
277 }
278
279 do_action( 'tutor_course/single/entry/after', get_the_ID() );
280 ?>
281 </div>
282 <?php endif; ?>
283 <!-- Course Info -->
284 <div class="tutor-card-footer <?php echo esc_attr( $tutor_load_sidebar_actions ? '' : 'tutor-no-border' ); ?>">
285 <ul class="tutor-ul">
286 <?php foreach ( $sidebar_meta as $key => $meta ) : ?>
287 <?php
288 if ( ! $meta['value'] ) {
289 continue;
290 }
291 ?>
292 <li class="tutor-d-flex<?php echo $key > 0 ? ' tutor-mt-12' : ''; ?> <?php echo esc_attr( isset( $meta['list_class'] ) ? $meta['list_class'] : '' ); ?>">
293 <span class="<?php echo esc_attr( $meta['icon_class'] ); ?> tutor-color-black tutor-mt-4 tutor-mr-12" aria-labelledby="<?php echo esc_html( $meta['label'] ); ?>"></span>
294 <span class="tutor-fs-6 tutor-color-secondary">
295 <?php echo wp_kses_post( $meta['value'] ); ?>
296 </span>
297 </li>
298 <?php endforeach; ?>
299 </ul>
300 </div>
301 </div>
302
303 <?php
304 if ( ! is_user_logged_in() ) {
305 tutor_load_template_from_custom_path( tutor()->path . '/views/modal/login.php' );
306 }
307 ?>
308