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