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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 / dashboard / my-courses.php
tutor / templates / dashboard Last commit date
announcements 1 year ago assignments 1 year ago elements 1 year ago enrolled-courses 3 years ago instructor 2 years ago my-courses 1 year ago my-quiz-attempts 3 years ago notifications 3 years ago question-answer 1 year ago quiz-attempts 3 years ago reviews 3 years ago settings 1 year ago withdraw-method-fields 3 years ago announcements.php 1 year ago assignments.php 1 year ago create-course.php 1 year ago dashboard.php 1 year ago enrolled-courses.php 1 year ago index.php 3 years ago logged-in.php 3 years ago my-courses.php 1 year ago my-profile.php 1 year ago my-quiz-attempts.php 3 years ago purchase_history.php 1 year ago question-answer.php 2 years ago quiz-attempts.php 1 year ago registration.php 2 years ago reviews.php 3 years ago settings.php 1 year ago wishlist.php 1 year ago withdraw.php 1 year ago
my-courses.php
352 lines
1 <?php
2 /**
3 * My Courses Page
4 *
5 * @package Tutor\Templates
6 * @subpackage Dashboard
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 1.4.3
10 */
11
12 use TUTOR\Input;
13 use Tutor\Models\CourseModel;
14
15 // Get the user ID and active tab.
16 $current_user_id = get_current_user_id();
17 ! isset( $active_tab ) ? $active_tab = 'my-courses' : 0;
18
19 // Map required course status according to page.
20 $status_map = array(
21 'my-courses' => CourseModel::STATUS_PUBLISH,
22 'my-courses/draft-courses' => CourseModel::STATUS_DRAFT,
23 'my-courses/pending-courses' => CourseModel::STATUS_PENDING,
24 'my-courses/schedule-courses' => CourseModel::STATUS_FUTURE,
25 );
26
27 // Set currently required course status fo rcurrent tab.
28 $status = isset( $status_map[ $active_tab ] ) ? $status_map[ $active_tab ] : CourseModel::STATUS_PUBLISH;
29
30 // Get counts for course tabs.
31 $count_map = array(
32 'publish' => CourseModel::get_courses_by_instructor( $current_user_id, CourseModel::STATUS_PUBLISH, 0, 0, true ),
33 'pending' => CourseModel::get_courses_by_instructor( $current_user_id, CourseModel::STATUS_PENDING, 0, 0, true ),
34 'draft' => CourseModel::get_courses_by_instructor( $current_user_id, CourseModel::STATUS_DRAFT, 0, 0, true ),
35 'future' => CourseModel::get_courses_by_instructor( $current_user_id, CourseModel::STATUS_FUTURE, 0, 0, true ),
36 );
37
38 $course_archive_arg = isset( $GLOBALS['tutor_course_archive_arg'] ) ? $GLOBALS['tutor_course_archive_arg']['column_per_row'] : null;
39 $courseCols = null === $course_archive_arg ? tutor_utils()->get_option( 'courses_col_per_row', 4 ) : $course_archive_arg;
40 $per_page = tutor_utils()->get_option( 'courses_per_page', 10 );
41 $paged = Input::get( 'current_page', 1, Input::TYPE_INT );
42 $offset = $per_page * ( $paged - 1 );
43
44 $results = CourseModel::get_courses_by_instructor( $current_user_id, $status, $offset, $per_page );
45 $show_course_delete = true;
46 if ( ! current_user_can( 'administrator' ) && ! tutor_utils()->get_option( 'instructor_can_delete_course' ) ) {
47 $show_course_delete = false;
48 }
49 ?>
50
51 <div class="tutor-dashboard-my-courses">
52 <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-16">
53 <?php esc_html_e( 'My Courses', 'tutor' ); ?>
54 </div>
55
56 <div class="tutor-dashboard-content-inner">
57 <div class="tutor-mb-32">
58 <ul class="tutor-nav">
59 <li class="tutor-nav-item">
60 <a class="tutor-nav-link<?php echo esc_attr( 'my-courses' === $active_tab ? ' is-active' : '' ); ?>" href="<?php echo esc_url( tutor_utils()->get_tutor_dashboard_page_permalink( 'my-courses' ) ); ?>">
61 <?php esc_html_e( 'Publish', 'tutor' ); ?> <?php echo esc_html( '(' . $count_map['publish'] . ')' ); ?>
62 </a>
63 </li>
64 <li class="tutor-nav-item">
65 <a class="tutor-nav-link<?php echo esc_attr( 'my-courses/pending-courses' === $active_tab ? ' is-active' : '' ); ?>" href="<?php echo esc_url( tutor_utils()->get_tutor_dashboard_page_permalink( 'my-courses/pending-courses' ) ); ?>">
66 <?php esc_html_e( 'Pending', 'tutor' ); ?> <?php echo esc_html( '(' . $count_map['pending'] . ')' ); ?>
67 </a>
68 </li>
69 <li class="tutor-nav-item">
70 <a class="tutor-nav-link<?php echo esc_attr( 'my-courses/draft-courses' === $active_tab ? ' is-active' : '' ); ?>" href="<?php echo esc_url( tutor_utils()->get_tutor_dashboard_page_permalink( 'my-courses/draft-courses' ) ); ?>">
71 <?php esc_html_e( 'Draft', 'tutor' ); ?> <?php echo esc_html( '(' . $count_map['draft'] . ')' ); ?>
72 </a>
73 </li>
74 <li class="tutor-nav-item">
75 <a class="tutor-nav-link<?php echo esc_attr( 'my-courses/schedule-courses' === $active_tab ? ' is-active' : '' ); ?>" href="<?php echo esc_url( tutor_utils()->get_tutor_dashboard_page_permalink( 'my-courses/schedule-courses' ) ); ?>">
76 <?php esc_html_e( 'Schedule', 'tutor' ); ?> <?php echo esc_html( '(' . $count_map['future'] . ')' ); ?>
77 </a>
78 </li>
79 </ul>
80 </div>
81
82 <!-- Course list -->
83 <?php
84 $placeholder_img = tutor()->url . 'assets/images/placeholder.svg';
85
86 if ( ! is_array( $results ) || ( ! count( $results ) && 1 == $paged ) ) {
87 tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() );
88 } else {
89 ?>
90 <div class="tutor-grid tutor-grid-3">
91 <?php
92 global $post;
93 $tutor_nonce_value = wp_create_nonce( tutor()->nonce_action );
94 foreach ( $results as $post ) :
95 setup_postdata( $post );
96
97 $avg_rating = tutor_utils()->get_course_rating()->rating_avg;
98 $tutor_course_img = get_tutor_course_thumbnail_src();
99 $id_string_delete = 'tutor_my_courses_delete_' . $post->ID;
100 $row_id = 'tutor-dashboard-my-course-' . $post->ID;
101 $course_duration = get_tutor_course_duration_context( $post->ID, true );
102 $course_students = tutor_utils()->count_enrolled_users_by_course();
103 $is_main_instructor = CourseModel::is_main_instructor( $post->ID );
104 ?>
105
106 <div id="<?php echo esc_attr( $row_id ); ?>" class="tutor-card tutor-course-card tutor-mycourse-<?php the_ID(); ?>">
107 <a href="<?php echo esc_url( get_the_permalink() ); ?>" class="tutor-d-block">
108 <div class="tutor-ratio tutor-ratio-16x9">
109 <img class="tutor-card-image-top" src="<?php echo empty( $tutor_course_img ) ? esc_url( $placeholder_img ) : esc_url( $tutor_course_img ); ?>" alt="<?php the_title(); ?>" loading="lazy">
110 </div>
111 </a>
112
113 <?php if ( false === $is_main_instructor ) : ?>
114 <div class="tutor-course-co-author-badge"><?php esc_html_e( 'Co-author', 'tutor' ); ?></div>
115 <?php endif; ?>
116
117 <div class="tutor-card-body">
118 <div class="tutor-meta tutor-mb-8">
119 <span>
120 <?php echo esc_html( get_the_date() ); ?> <?php echo esc_html( get_the_time() ); ?>
121 </span>
122 </div>
123
124 <div class="tutor-course-name tutor-fs-6 tutor-fw-bold tutor-mb-16">
125 <a href="<?php echo esc_url( get_the_permalink() ); ?>"><?php the_title(); ?></a>
126 </div>
127
128 <?php if ( ! empty( $course_duration ) || ! empty( $course_students ) ) : ?>
129 <div class="tutor-meta tutor-mt-16">
130 <?php if ( ! empty( $course_duration ) ) : ?>
131 <div>
132 <span class="tutor-icon-clock-line tutor-meta-icon" area-hidden="true"></span>
133 <span class="tutor-meta-value">
134 <?php
135 echo wp_kses(
136 stripslashes( $course_duration ),
137 array(
138 'span' => array( 'class' => true ),
139 )
140 );
141 ?>
142 </span>
143 </div>
144 <?php endif; ?>
145
146 <?php if ( ! empty( $course_students ) ) : ?>
147 <div>
148 <span class="tutor-icon-user-line tutor-meta-icon" area-hidden="true"></span>
149 <span class="tutor-meta-value">
150 <?php
151 echo wp_kses(
152 stripslashes( $course_students ),
153 array(
154 'span' => array( 'class' => true ),
155 )
156 );
157 ?>
158 </span>
159 </div>
160 <?php endif; ?>
161 </div>
162 <?php endif; ?>
163 </div>
164
165 <div class="tutor-card-footer">
166 <div class="tutor-d-flex tutor-align-center tutor-justify-between">
167 <div class="tutor-d-flex tutor-align-center">
168 <span class="tutor-fs-7 tutor-fw-medium tutor-color-muted tutor-mr-4">
169 <?php
170 $membership_only_mode = apply_filters( 'tutor_membership_only_mode', false );
171 echo esc_html( $membership_only_mode ? __( 'Plan:', 'tutor' ) : '' );
172 ?>
173 </span>
174 <span class="tutor-fs-7 tutor-fw-medium tutor-color-black">
175 <?php
176 $price = tutor_utils()->get_course_price();
177 if ( null === $price ) {
178 esc_html_e( 'Free', 'tutor' );
179 } else {
180 echo wp_kses_post( tutor_utils()->get_course_price() );
181 }
182 ?>
183 </span>
184 </div>
185 <div class="tutor-iconic-btn-group tutor-mr-n8">
186 <a href="<?php echo esc_url( tutor_utils()->course_edit_link( $post->ID, tutor()->has_pro ? 'frontend' : 'backend' ) ); ?>" class="tutor-iconic-btn tutor-my-course-edit">
187 <i class="tutor-icon-edit" area-hidden="true"></i>
188 </a>
189 <div class="tutor-dropdown-parent">
190 <button type="button" class="tutor-iconic-btn" action-tutor-dropdown="toggle">
191 <span class="tutor-icon-kebab-menu" area-hidden="true"></span>
192 </button>
193 <div id="table-dashboard-course-list-<?php echo esc_attr( $post->ID ); ?>" class="tutor-dropdown tutor-dropdown-dark tutor-text-left">
194
195 <!-- Submit Action -->
196 <?php if ( tutor()->has_pro && in_array( $post->post_status, array( CourseModel::STATUS_DRAFT ), true ) ) : ?>
197 <?php
198 $params = http_build_query(
199 array(
200 'tutor_action' => 'update_course_status',
201 'status' => CourseModel::STATUS_PENDING,
202 'course_id' => $post->ID,
203 tutor()->nonce => $tutor_nonce_value,
204 )
205 );
206 ?>
207 <a class="tutor-dropdown-item" href="?<?php echo esc_attr( $params ); ?>">
208 <i class="tutor-icon-share tutor-mr-8" area-hidden="true"></i>
209 <span>
210 <?php
211 $can_publish_course = current_user_can( 'administrator' ) || (bool) tutor_utils()->get_option( 'instructor_can_publish_course' );
212 if ( $can_publish_course ) {
213 esc_html_e( 'Publish', 'tutor' );
214 } else {
215 esc_html_e( 'Submit', 'tutor' );
216 }
217 ?>
218 </span>
219 </a>
220 <?php endif; ?>
221 <!-- # Submit Action -->
222
223 <!-- Duplicate Action -->
224 <?php if ( tutor()->has_pro && in_array( $post->post_status, array( CourseModel::STATUS_PUBLISH, CourseModel::STATUS_PENDING, CourseModel::STATUS_DRAFT ) ) ) : ?>
225 <?php
226 $params = http_build_query(
227 array(
228 'tutor_action' => 'duplicate_course',
229 'course_id' => $post->ID,
230 )
231 );
232 ?>
233 <a class="tutor-dropdown-item" href="?<?php echo esc_attr( $params ); ?>">
234 <i class="tutor-icon-copy-text tutor-mr-8" area-hidden="true"></i>
235 <span><?php esc_html_e( 'Duplicate', 'tutor' ); ?></span>
236 </a>
237 <?php endif; ?>
238 <!-- # Duplicate Action -->
239
240 <!-- Move to Draf Action -->
241 <?php if ( tutor()->has_pro && in_array( $post->post_status, array( CourseModel::STATUS_PUBLISH ) ) ) : ?>
242 <?php
243 $params = http_build_query(
244 array(
245 'tutor_action' => 'update_course_status',
246 'status' => CourseModel::STATUS_DRAFT,
247 'course_id' => $post->ID,
248 tutor()->nonce => $tutor_nonce_value,
249 )
250 );
251 ?>
252 <a class="tutor-dropdown-item" href="?<?php echo esc_attr( $params ); ?>">
253 <i class="tutor-icon-archive tutor-mr-8" area-hidden="true"></i>
254 <span><?php esc_html_e( 'Move to Draft', 'tutor' ); ?></span>
255 </a>
256 <?php endif; ?>
257 <!-- # Move to Draft Action -->
258
259 <!-- Cancel Submission -->
260 <?php if ( tutor()->has_pro && in_array( $post->post_status, array( CourseModel::STATUS_PENDING ) ) ) : ?>
261 <?php
262 $params = http_build_query(
263 array(
264 'tutor_action' => 'update_course_status',
265 'status' => CourseModel::STATUS_DRAFT,
266 'course_id' => $post->ID,
267 tutor()->nonce => $tutor_nonce_value,
268 )
269 );
270 ?>
271 <a href="?<?php echo esc_attr( $params ); ?>" class="tutor-dropdown-item">
272 <i class="tutor-icon-times tutor-mr-8" area-hidden="true"></i>
273 <span><?php esc_html_e( 'Cancel Submission', 'tutor' ); ?></span>
274 </a>
275 <?php endif; ?>
276 <!-- # Cancel Submission -->
277
278 <!-- Delete Action -->
279 <?php if ( $is_main_instructor && in_array( $post->post_status, array( CourseModel::STATUS_PUBLISH, CourseModel::STATUS_DRAFT ) ) ) : ?>
280 <?php if ( $show_course_delete ) : ?>
281 <a href="#" data-tutor-modal-target="<?php echo esc_attr( $id_string_delete ); ?>" class="tutor-dropdown-item tutor-admin-course-delete">
282 <i class="tutor-icon-trash-can-bold tutor-mr-8" area-hidden="true"></i>
283 <span><?php esc_html_e( 'Delete', 'tutor' ); ?></span>
284 </a>
285 <?php endif; ?>
286 <?php endif; ?>
287 <!-- # Delete Action -->
288
289 </div>
290 </div>
291 </div>
292 </div>
293 </div>
294
295 <!-- Delete prompt modal -->
296 <div id="<?php echo esc_attr( $id_string_delete ); ?>" class="tutor-modal">
297 <div class="tutor-modal-overlay"></div>
298 <div class="tutor-modal-window">
299 <div class="tutor-modal-content tutor-modal-content-white">
300 <button class="tutor-iconic-btn tutor-modal-close-o" data-tutor-modal-close>
301 <span class="tutor-icon-times" area-hidden="true"></span>
302 </button>
303
304 <div class="tutor-modal-body tutor-text-center">
305 <div class="tutor-mt-48">
306 <img class="tutor-d-inline-block" src="<?php echo esc_attr( tutor()->url ); ?>assets/images/icon-trash.svg" />
307 </div>
308
309 <div class="tutor-fs-3 tutor-fw-medium tutor-color-black tutor-mb-12"><?php esc_html_e( 'Delete This Course?', 'tutor' ); ?></div>
310 <div class="tutor-fs-6 tutor-color-muted"><?php esc_html_e( 'Are you sure you want to delete this course permanently from the site? Please confirm your choice.', 'tutor' ); ?></div>
311
312 <div class="tutor-d-flex tutor-justify-center tutor-my-48">
313 <button data-tutor-modal-close class="tutor-btn tutor-btn-outline-primary">
314 <?php esc_html_e( 'Cancel', 'tutor' ); ?>
315 </button>
316 <button class="tutor-btn tutor-btn-primary tutor-list-ajax-action tutor-ml-20" data-request_data='{"course_id":<?php echo esc_attr( $post->ID ); ?>,"action":"tutor_delete_dashboard_course","redirect_to":"<?php echo esc_url( tutor_utils()->get_current_url() ); ?>"}' data-delete_element_id="<?php echo esc_attr( $row_id ); ?>">
317 <?php esc_html_e( 'Yes, Delete This', 'tutor' ); ?>
318 </button>
319 </div>
320 </div>
321 </div>
322 </div>
323 </div>
324 </div>
325 <?php
326 endforeach;
327 wp_reset_postdata();
328 ?>
329 </div>
330 <div class="tutor-mt-20">
331 <?php
332 if ( $count_map[ $status ] > $per_page ) {
333 $pagination_data = array(
334 'total_items' => $count_map[ $status ],
335 'per_page' => $per_page,
336 'paged' => $paged,
337 );
338
339 tutor_load_template_from_custom_path(
340 tutor()->path . 'templates/dashboard/elements/pagination.php',
341 $pagination_data
342 );
343 }
344 ?>
345
346 </div>
347 <?php
348 }
349 ?>
350 </div>
351 </div>
352