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