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