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.2 3.2.3 3.3.0 3.3.1 3.4.0 3.4.1 3.4.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 / views / pages / course-list.php
tutor / views / pages Last commit date
tools 4 years ago add_new_instructor.php 4 years ago addons.php 4 years ago announcements.php 4 years ago answer.php 4 years ago course-list.php 4 years ago enable_disable_addons.php 4 years ago get-pro.php 5 years ago instructors.php 4 years ago question_answer.php 4 years ago quiz_attempts.php 4 years ago students.php 4 years ago tools.php 4 years ago tutor-pro-addons.php 4 years ago uninstall.php 4 years ago view_attempt.php 4 years ago welcome.php 4 years ago withdraw_requests.php 4 years ago
course-list.php
386 lines
1 <?php
2 /**
3 * Course List Template.
4 *
5 * @package Course List
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12
13 use TUTOR\Course_List;
14
15 $courses = new Course_List();
16
17 /**
18 * Short able params
19 */
20 $course_id = isset( $_GET['course-id'] ) ? sanitize_text_field( $_GET['course-id'] ) : '';
21 $order_filter = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC';
22 $date = isset( $_GET['date'] ) ? sanitize_text_field( $_GET['date'] ) : '';
23 $search_filter = isset( $_GET['search'] ) ? sanitize_text_field( $_GET['search'] ) : '';
24 $category_slug = isset( $_GET['category'] ) ? sanitize_text_field( $_GET['category'] ) : '';
25
26 /**
27 * Determine active tab
28 */
29 $active_tab = isset( $_GET['data'] ) && $_GET['data'] !== '' ? esc_html__( $_GET['data'] ) : 'all';
30
31 /**
32 * Pagination data
33 */
34 $paged_filter = ( isset( $_GET['paged'] ) && is_numeric( $_GET['paged'] ) && $_GET['paged'] >= 1 ) ? $_GET['paged'] : 1;
35 $limit = tutor_utils()->get_option( 'pagination_per_page' );
36 $offset = ( $limit * $paged_filter ) - $limit;
37
38 /**
39 * Navbar data to make nav menu
40 */
41 $add_course_url = esc_url( admin_url( 'post-new.php?post_type=courses' ) );
42 $navbar_data = array(
43 'page_title' => $courses->page_title,
44 'tabs' => $courses->tabs_key_value( $category_slug, $course_id, $date, $search_filter ),
45 'active' => $active_tab,
46 'add_button' => true,
47 'button_title' => __( 'Add New', 'tutor' ),
48 'button_url' => $add_course_url,
49 );
50
51 /**
52 * Bulk action & filters
53 */
54 // $filters = array(
55 // 'bulk_action' => $enrollments->bulk_action,
56 // 'bulk_actions' => $enrollments->prpare_bulk_actions(),
57 // 'search_filter' => true,
58 // );
59 $filters = array(
60 'bulk_action' => $courses->bulk_action,
61 'bulk_actions' => $courses->prepare_bulk_actions(),
62 'ajax_action' => 'tutor_course_list_bulk_action',
63 'filters' => true,
64 'category_filter' => true,
65 );
66
67
68 $args = array(
69 'post_type' => tutor()->course_post_type,
70 'orderby' => 'ID',
71 'order' => $order_filter,
72 'paged' => $paged_filter,
73 'offset' => $offset,
74 'posts_per_page' => tutor_utils()->get_option( 'pagination_per_page' ),
75 );
76
77 if ( 'all' === $active_tab || 'mine' === $active_tab ) {
78 $args['post_status'] = array( 'publish', 'pending', 'draft', 'trash', 'private' );
79 } else {
80 $status = $active_tab === 'published' ? 'publish' : $active_tab;
81 $args['post_status'] = array( $status );
82 }
83
84 if ( 'mine' === $active_tab ) {
85 $args['author'] = get_current_user_id();
86 }
87 $date_filter = sanitize_text_field( tutor_utils()->array_get( 'date', $_GET, '' ) );
88
89 $year = date( 'Y', strtotime( $date_filter ) );
90 $month = date( 'm', strtotime( $date_filter ) );
91 $day = date( 'd', strtotime( $date_filter ) );
92 // Add date query.
93 if ( '' !== $date_filter ) {
94 $args['date_query'] = array(
95 array(
96 'year' => $year,
97 'month' => $month,
98 'day' => $day,
99 ),
100 );
101 }
102
103 if ( '' !== $course_id ) {
104 $args['p'] = $course_id;
105 }
106 // Add author param.
107 if ( 'mine' === $active_tab || ! current_user_can( 'administrator' ) ) {
108 $args['author'] = get_current_user_id();
109 }
110 // Search filter.
111 if ( '' !== $search_filter ) {
112 $args['s'] = $search_filter;
113 }
114 // Category filter.
115 if ( '' !== $category_slug ) {
116 $args['tax_query'] = array(
117 array(
118 'taxonomy' => 'course-category',
119 'field' => 'slug',
120 'terms' => $category_slug,
121 ),
122 );
123 }
124
125 add_filter( 'posts_search', '_tutor_search_by_title_only', 500, 2 );
126
127 $the_query = new WP_Query( $args );
128
129 remove_filter( 'posts_search', '_tutor_search_by_title_only', 500 );
130
131 $available_status = array(
132 'publish' => array(__( 'Publish', 'tutor' ), 'select-success'),
133 'pending' => array(__( 'Pending', 'tutor' ), 'select-warning'),
134 'trash' => array(__( 'Trash', 'tutor' ), 'select-danger'),
135 'draft' => array(__( 'Draft', 'tutor' ), 'select-default'),
136 'private' => array(__( 'Private', 'tutor' ), 'select-default'),
137 );
138
139 ?>
140
141 <?php
142 /**
143 * Load Templates with data.
144 */
145 $navbar_template = tutor()->path . 'views/elements/navbar.php';
146 $filters_template = tutor()->path . 'views/elements/filters.php';
147 tutor_load_template_from_custom_path( $navbar_template, $navbar_data );
148 tutor_load_template_from_custom_path( $filters_template, $filters );
149
150 ?>
151 <div class="tutor-admin-page-content-wrapper tutor-mt-24 tutor-pr-20">
152 <div class="tutor-ui-table-wrapper">
153 <table class="tutor-ui-table tutor-ui-table-responsive table-dashboard-course-list td-align-middle">
154 <thead class="tutor-text-sm tutor-text-400">
155 <tr>
156 <th>
157 <div class="tutor-d-flex">
158 <input type="checkbox" id="tutor-bulk-checkbox-all" class="tutor-form-check-input" />
159 </div>
160 </th>
161 <th class="tutor-table-rows-sorting">
162 <div class="tutor-fs-7 tutor-color-black-60">
163 <span class="tutor-fs-7">
164 <?php esc_html_e( 'Date', 'tutor' ); ?>
165 </span>
166 <span class="a-to-z-sort-icon tutor-icon-ordering-a-to-z-filled tutor-icon-18"></span>
167 </div>
168 </th>
169 <th class="tutor-table-rows-sorting">
170 <div class="tutor-fs-7 tutor-color-black-60">
171 <span class="tutor-fs-7">
172 <?php esc_html_e( 'Title', 'tutor' ); ?>
173 </span>
174 <span class="a-to-z-sort-icon tutor-icon-ordering-a-to-z-filled tutor-icon-18"></span>
175 </div>
176 </th>
177 <th class="tutor-table-rows-sorting">
178 <div class="tutor-color-black-60">
179 <span class="tutor-fs-7">
180 <?php esc_html_e( 'Author', 'tutor' ); ?>
181 </span>
182 <span class="a-to-z-sort-icon tutor-icon-ordering-a-to-z-filled tutor-icon-18"></span>
183 </div>
184 </th>
185 <th>
186 <div class="tutor-fs-7 tutor-color-black-60">
187 <?php esc_html_e( 'Course Categories', 'tutor' ); ?>
188 </div>
189 </th>
190 <th>
191 <div class="tutor-fs-7 tutor-color-black-60">
192 <?php esc_html_e( 'Students', 'tutor' ); ?>
193 </div>
194 </th>
195 <th>
196 <div class="tutor-fs-7 tutor-color-black-60">
197 <?php esc_html_e( 'Price', 'tutor' ); ?>
198 </div>
199 </th>
200 <th class="tutor-shrink"></th>
201 </tr>
202 </thead>
203 <tbody class="tutor-text-500">
204 <?php if ( $the_query->have_posts() ) : ?>
205 <?php
206 foreach ( $the_query->posts as $key => $post ) :
207 $count_lesson = tutor_utils()->get_lesson_count_by_course( $post->ID );
208 $count_quiz = $courses->get_all_quiz_by_course( $post->ID );
209 $topics = tutor_utils()->get_topics( $post->ID );
210 $count_assignment = tutor_utils()->get_assignments_by_course( $post->ID )->count;
211 $count_topic = $topics->found_posts;
212 $student_details = $courses->course_enrollments_with_student_details( $post->ID );
213 $total_student = $student_details['total_enrollments'];
214 $author_details = get_userdata( $post->post_author );
215 ?>
216 <tr>
217 <td data-th="<?php esc_html_e( 'Checkbox', 'tutor' ); ?>">
218 <div class="td-checkbox tutor-d-flex ">
219 <input type="checkbox" class="tutor-form-check-input tutor-bulk-checkbox" name="tutor-bulk-checkbox-all" value="<?php echo esc_attr( $post->ID ); ?>" />
220 </div>
221 </td>
222 <td data-th="<?php esc_html_e( 'Date', 'tutor' ); ?>">
223 <div class="td-datetime">
224 <div class="tutor-fs-7 tutor-color-black tutor-fw-medium tutor-d-block tutor-mb-8">
225 <?php echo esc_html( tutor_get_formated_date( get_option( 'date_format' ), $post->post_date ) ); ?>
226 </div>
227 <div class="tutor-fs-8 tutor-color-muted tutor-fw-medium tutor-d-block">
228 <?php echo esc_html( tutor_get_formated_date( get_option( 'time_format' ), $post->post_date ) ); ?>
229 </div>
230 </div>
231 </td>
232
233 <td data-th="<?php esc_html_e( 'Course Name', 'tutor' ); ?>" class="column-fullwidth">
234 <div class="td-course tutor-color-black tutor-fs-6 tutor-fw-medium tutor-line-clamp-2">
235 <a href="<?php echo esc_url( admin_url( 'post.php?post=' . $post->ID . '&action=edit' ) ); ?>">
236 <?php echo esc_html( $post->post_title ); ?>
237 </a>
238 <div class="course-meta">
239 <span class="tutor-color-muted tutor-fs-7 tutor-fw-medium">
240 <?php esc_html_e( 'Topic:', 'tutor' ); ?>
241 <strong class="tutor-color-black">
242 <?php echo esc_html( $count_topic ); ?>
243 </strong>
244 </span>
245 <span class="tutor-color-muted tutor-fs-7 tutor-fw-medium">
246 <?php esc_html_e( 'Lesson:', 'tutor' ); ?>
247 <strong class="tutor-color-black">
248 <?php echo esc_html( $count_lesson ); ?>
249 </strong>
250 </span>
251 <span class="tutor-color-muted tutor-fs-7 tutor-fw-medium">
252 <?php esc_html_e( 'Quiz:', 'tutor' ); ?>
253 <strong class="tutor-color-black">
254 <?php echo esc_html( $count_quiz ); ?>
255 </strong>
256 </span>
257 <span class="tutor-color-muted tutor-fs-7 tutor-fw-medium">
258 <?php esc_html_e( 'Assignment:', 'tutor' ); ?>
259 <strong class="tutor-color-black">
260 <?php echo esc_html( $count_assignment ); ?>
261 </strong>
262 </span>
263 </div>
264 </div>
265 </td>
266 <td data-th="<?php esc_html_e( 'Author', 'tutor' ); ?>">
267 <div class="td-avatar">
268 <?php
269 echo get_avatar( $post->post_author, '96' );
270 ?>
271 <p class="tutor-fs-6 tutor-fw-medium tutor-color-black">
272 <?php echo esc_html( $author_details ? $author_details->display_name : '' ); ?>
273 </p>
274 <a
275 href="<?php echo esc_url( tutor_utils()->profile_url( $post->post_author, true ) ); ?>"
276 class="btn-text btn-detail-link tutor-color-design-dark" target="_blank"
277 >
278 <span class="tutor-icon-detail-link-filled"></span>
279 </a>
280 </div>
281 </td>
282 <td data-th="<?php esc_html_e( 'Course Category', 'tutor' ); ?>">
283 <?php
284 $terms = wp_get_post_terms( $post->ID, 'course-category' );
285 echo implode(', ', array_column($terms, 'name')) . '&nbsp;';
286 ?>
287 </td>
288 <td data-th="<?php esc_html_e( 'Student', 'tutor' ); ?>">
289 <div class="tutor-fs-7 tutor-color-black">
290 <?php echo esc_html( $total_student ); ?>
291 </div>
292 </td>
293 <td data-th="<?php esc_html_e( 'Price', 'tutor' ); ?>">
294 <div class="tutor-fs-7 tutor-color-black">
295 <?php
296 $price = tutor_utils()->get_course_price( $post->ID );
297 if ( null == $price ) {
298 esc_html_e( 'Free', 'tutor' );
299 }
300 else {
301 echo $price; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
302 }
303 // Alert class for course status.
304 $status = ( 'publish' === $post->post_status ? 'select-success' : ( 'pending' === $post->post_status ? 'select-warning' : ( 'trash' === $post->post_status ? 'select-danger' : ( 'private' === $post->post_status ? 'select-default' : 'select-default' ) ) ) );
305 ?>
306 </div>
307 </td>
308 <td data-th="<?php esc_html_e( 'Action', 'tutor' ); ?>">
309 <div class="inline-flex-center td-action-btns">
310 <div class="tutor-form-select-with-icon <?php echo esc_attr( $status ); ?>">
311 <select title="<?php esc_attr_e( 'Update course status', 'tutor' ); ?>" class="tutor-table-row-status-update" data-id="<?php echo esc_attr( $post->ID ); ?>" data-status="<?php echo esc_attr( $post->post_status ); ?>" data-status_key="status" data-action="tutor_change_course_status">
312 <?php foreach ( $available_status as $key => $value ) : ?>
313 <option data-status_class="<?php echo esc_attr( $value[1] ); ?>" value="<?php echo $key; ?>" <?php selected( $key, $post->post_status, 'selected' ); ?>>
314 <?php echo esc_html( $value[0] ); ?>
315 </option>
316 <?php endforeach; ?>
317 </select>
318 <i class="icon1 tutor-icon-eye-fill-filled"></i>
319 <i class="icon2 tutor-icon-angle-down-filled"></i>
320 </div>
321 <a href="<?php echo esc_url( admin_url( 'post.php?post=' . $post->ID . '&action=edit' ) ); ?>" class="btn-outline tutor-btn">
322 <?php esc_html_e( 'Edit', 'tutor' ); ?>
323 </a>
324 <div class="tutor-popup-opener">
325 <button
326 type="button"
327 class="popup-btn"
328 data-tutor-popup-target="table-dashboard-course-list-<?php echo esc_attr( $post->ID ); ?>"
329 >
330 <span class="toggle-icon"></span>
331 </button>
332 <ul id="table-dashboard-course-list-<?php echo esc_attr( $post->ID ); ?>" class="popup-menu" style="width: 220px;">
333 <?php do_action( 'tutor_admin_befor_course_list_action', $post->ID ); ?>
334 <li>
335 <a href="<?php echo esc_url( get_permalink( $post->ID ) ); ?>" target="_blank">
336 <i class="tutor-icon-eye-fill-filled"></i>
337 <span class="tutor-fs-6 tutor-color-white">
338 <?php esc_html_e( 'View Course', 'tutor' ); ?>
339 </span>
340 </a>
341 </li>
342 <?php do_action( 'tutor_admin_middle_course_list_action', $post->ID ); ?>
343 <li>
344 <a href="javascript:void(0)" class="tutor-admin-course-delete" data-tutor-modal-target="tutor-common-confirmation-modal" data-id="<?php echo esc_attr( $post->ID ); ?>">
345 <i class="tutor-icon-delete-fill-filled tutor-color-design-white"></i>
346 <span class="tutor-fs-6 tutor-color-white">
347 <?php esc_html_e( 'Delete Permanently', 'tutor' ); ?>
348 </span>
349 </a>
350 </li>
351 <?php do_action( 'tutor_admin_after_course_list_action', $post->ID ); ?>
352 </ul>
353 </div>
354 </div>
355 </td>
356 </tr>
357 <?php endforeach; ?>
358 <?php else : ?>
359 <tr>
360 <td colspan="100%" class="column-empty-state">
361 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
362 </td>
363 </tr>
364 <?php endif; ?>
365 </tbody>
366 </table>
367 </div>
368 </div>
369 <div class="tutor-admin-page-pagination-wrapper tutor-mt-48 tutor-pr-20">
370 <?php
371 /**
372 * Prepare pagination data & load template
373 */
374 if($the_query->found_posts > $limit) {
375 $pagination_data = array(
376 'total_items' => $the_query->found_posts,
377 'per_page' => $limit,
378 'paged' => $paged_filter,
379 );
380 $pagination_template = tutor()->path . 'views/elements/pagination.php';
381 tutor_load_template_from_custom_path( $pagination_template, $pagination_data );
382 }
383 ?>
384 </div>
385
386 <?php tutor_load_template_from_custom_path( tutor()->path . 'views/elements/common-confirm-popup.php' );