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