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.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 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 3 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
263 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 <div class="tutor-card-body">
66 <?php
67 if ( $is_enrolled || $is_privileged_user ) {
68 ob_start();
69
70 // Course Info.
71 $is_completed_course = tutor_utils()->is_completed_course();
72 $retake_course = tutor_utils()->can_user_retake_course();
73 $course_id = get_the_ID();
74 $course_progress = tutor_utils()->get_course_completed_percent( $course_id, 0, true );
75 $completed_percent = $course_progress['completed_percent'];
76 ?>
77 <!-- course progress -->
78 <?php if ( tutor_utils()->get_option( 'enable_course_progress_bar', true, true ) && is_array( $course_progress ) && count( $course_progress ) ) : ?>
79 <div class="tutor-course-progress-wrapper tutor-mb-32">
80 <h3 class="tutor-color-black tutor-fs-5 tutor-fw-bold tutor-mb-16">
81 <?php esc_html_e( 'Course Progress', 'tutor' ); ?>
82 </h3>
83 <div class="list-item-progress">
84 <div class="tutor-fs-6 tutor-color-secondary tutor-d-flex tutor-align-center tutor-justify-between">
85 <span class="progress-steps">
86 <?php echo esc_html( $course_progress['completed_count'] ); ?>/
87 <?php echo esc_html( $course_progress['total_count'] ); ?>
88 </span>
89 <span class="progress-percentage">
90 <?php echo esc_html( $completed_percent . '%' ); ?>
91 <?php esc_html_e( 'Complete', 'tutor' ); ?>
92 </span>
93 </div>
94 <div class="tutor-progress-bar tutor-mt-12" style="--tutor-progress-value:<?php echo esc_attr( $completed_percent ); ?>%;">
95 <span class="tutor-progress-value" area-hidden="true"></span>
96 </div>
97 </div>
98 </div>
99 <?php endif; ?>
100 <?php
101 $start_content = '';
102
103 // The user is enrolled anyway. No matter manual, free, purchased, woocommerce, edd, membership.
104 do_action( 'tutor_course/single/actions_btn_group/before' );
105
106 // Show Start/Continue/Retake Button.
107 if ( $lesson_url ) {
108 $button_class = 'tutor-btn ' .
109 ( $retake_course ? 'tutor-btn-outline-primary' : 'tutor-btn-primary' ) .
110 ' tutor-btn-block' .
111 ( $retake_course ? ' tutor-course-retake-button' : '' );
112
113 // Button identifier class.
114 $button_identifier = 'start-continue-retake-button';
115 $tag = $retake_course ? 'button' : 'a';
116 ob_start();
117 ?>
118 <<?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() ); ?>">
119 <?php
120 if ( $retake_course ) {
121 esc_html_e( 'Retake This Course', 'tutor' );
122 } elseif ( $completed_percent <= 0 ) {
123 esc_html_e( 'Start Learning', 'tutor' );
124 } else {
125 esc_html_e( 'Continue Learning', 'tutor' );
126 }
127 ?>
128 </<?php echo esc_html( $tag ); ?>>
129 <?php
130 $start_content = ob_get_clean();
131 }
132 echo apply_filters( 'tutor_course/single/start/button', $start_content, get_the_ID() );//phpcs:ignore
133
134 // Show Course Completion Button.
135 if ( ! $is_completed_course ) {
136 ob_start();
137 ?>
138 <form method="post" class="tutor-mt-20">
139 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
140
141 <input type="hidden" value="<?php echo esc_attr( get_the_ID() ); ?>" name="course_id"/>
142 <input type="hidden" value="tutor_complete_course" name="tutor_action"/>
143
144 <button type="submit" class="tutor-btn tutor-btn-outline-primary tutor-btn-block" name="complete_course_btn" value="complete_course">
145 <?php esc_html_e( 'Complete Course', 'tutor' ); ?>
146 </button>
147 </form>
148 <?php
149 echo apply_filters( 'tutor_course/single/complete_form', ob_get_clean() );//phpcs:ignore
150 }
151
152 ?>
153 <?php
154 // check if has enrolled date.
155 $post_date = is_object( $is_enrolled ) && isset( $is_enrolled->post_date ) ? $is_enrolled->post_date : '';
156 if ( '' !== $post_date ) :
157 ?>
158 <div class="tutor-fs-7 tutor-color-muted tutor-mt-20 tutor-d-flex">
159 <span class="tutor-fs-6 tutor-color-success tutor-icon-purchase-mark tutor-mr-8"></span>
160 <span class="tutor-enrolled-info-text">
161 <?php esc_html_e( 'You enrolled in this course on', 'tutor' ); ?>
162 <span class="tutor-fs-7 tutor-fw-bold tutor-color-success tutor-ml-4 tutor-enrolled-info-date">
163 <?php
164 echo esc_html( tutor_i18n_get_formated_date( $post_date, get_option( 'date_format' ) ) );
165 ?>
166 </span>
167 </span>
168 </div>
169 <?php endif; ?>
170 <?php
171 do_action( 'tutor_course/single/actions_btn_group/after' );
172 echo apply_filters( 'tutor/course/single/entry-box/is_enrolled', ob_get_clean(), get_the_ID() );//phpcs:ignore
173 } elseif ( $is_public ) {
174 // Get the first content url.
175 $first_lesson_url = tutor_utils()->get_course_first_lesson( get_the_ID(), tutor()->lesson_post_type );
176 ! $first_lesson_url ? $first_lesson_url = tutor_utils()->get_course_first_lesson( get_the_ID() ) : 0;
177 ob_start();
178 ?>
179 <a href="<?php echo esc_url( $first_lesson_url ); ?>" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-btn-block">
180 <?php esc_html_e( 'Start Learning', 'tutor' ); ?>
181 </a>
182 <?php
183 echo apply_filters( 'tutor/course/single/entry-box/is_public', ob_get_clean(), get_the_ID() );//phpcs:ignore
184 } else {
185 // The course enroll options like purchase or free enrollment.
186 $price = apply_filters( 'get_tutor_course_price', null, get_the_ID() );
187
188 if ( tutor_utils()->is_course_fully_booked( null ) ) {
189 ob_start();
190 ?>
191 <div class="tutor-alert tutor-warning tutor-mt-28">
192 <div class="tutor-alert-text">
193 <span class="tutor-icon-circle-info tutor-alert-icon tutor-mr-12" area-hidden="true"></span>
194 <span>
195 <?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' ); ?>
196 </span>
197 </div>
198 </div>
199 <?php
200 echo apply_filters( 'tutor/course/single/entry-box/fully_booked', ob_get_clean(), get_the_ID() );//phpcs:ignore
201 } elseif ( $is_purchasable && $price && $tutor_course_sell_by ) {
202 // Load template based on monetization option.
203 ob_start();
204 tutor_load_template( 'single.course.add-to-cart-' . $tutor_course_sell_by );
205 echo apply_filters( 'tutor/course/single/entry-box/purchasable', ob_get_clean(), get_the_ID() );//phpcs:ignore
206 } else {
207 ob_start();
208 ?>
209 <div class="tutor-course-single-pricing">
210 <span class="tutor-fs-4 tutor-fw-bold tutor-color-black">
211 <?php esc_html_e( 'Free', 'tutor' ); ?>
212 </span>
213 </div>
214
215 <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 ); ?>">
216 <form class="tutor-enrol-course-form" method="post">
217 <?php wp_nonce_field( tutor()->nonce_action, tutor()->nonce ); ?>
218 <input type="hidden" name="tutor_course_id" value="<?php echo esc_attr( get_the_ID() ); ?>">
219 <input type="hidden" name="tutor_course_action" value="_tutor_course_enroll_now">
220 <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">
221 <?php esc_html_e( 'Enroll now', 'tutor' ); ?>
222 </button>
223 </form>
224 </div>
225
226 <div class="tutor-fs-7 tutor-color-muted tutor-mt-20 tutor-text-center">
227 <?php esc_html_e( 'Free access this course', 'tutor' ); ?>
228 </div>
229 <?php
230 echo apply_filters( 'tutor/course/single/entry-box/free', ob_get_clean(), get_the_ID() );//phpcs:ignore
231 }
232 }
233
234 do_action( 'tutor_course/single/entry/after', get_the_ID() );
235 ?>
236 </div>
237
238 <!-- Course Info -->
239 <div class="tutor-card-footer">
240 <ul class="tutor-ul">
241 <?php foreach ( $sidebar_meta as $key => $meta ) : ?>
242 <?php
243 if ( ! $meta['value'] ) {
244 continue;
245 }
246 ?>
247 <li class="tutor-d-flex<?php echo $key > 0 ? ' tutor-mt-12' : ''; ?>">
248 <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>
249 <span class="tutor-fs-6 tutor-color-secondary">
250 <?php echo wp_kses_post( $meta['value'] ); ?>
251 </span>
252 </li>
253 <?php endforeach; ?>
254 </ul>
255 </div>
256 </div>
257
258 <?php
259 if ( ! is_user_logged_in() ) {
260 tutor_load_template_from_custom_path( tutor()->path . '/views/modal/login.php' );
261 }
262 ?>
263