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.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 / dashboard.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 3 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 3 years ago
dashboard.php
392 lines
1 <?php
2 /**
3 * Frontend Dashboard Template
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\Models\CourseModel;
13 use Tutor\Models\WithdrawModel;
14
15 if ( tutor_utils()->get_option( 'enable_profile_completion' ) ) {
16 $profile_completion = tutor_utils()->user_profile_completion();
17 $is_instructor = tutor_utils()->is_instructor( null, true );
18 $total_count = count( $profile_completion );
19 $incomplete_count = count(
20 array_filter(
21 $profile_completion,
22 function( $data ) {
23 return ! $data['is_set'];
24 }
25 )
26 );
27 $complete_count = $total_count - $incomplete_count;
28
29 if ( $is_instructor ) {
30 if ( isset( $total_count ) && isset( $incomplete_count ) && $incomplete_count <= $total_count ) {
31 ?>
32 <div class="tutor-profile-completion tutor-card tutor-px-32 tutor-py-24 tutor-mb-40">
33 <div class="tutor-row tutor-gx-0">
34 <div class="tutor-col-lg-7 <?php echo tutor_utils()->is_instructor() ? 'tutor-profile-completion-content-admin' : ''; ?>">
35 <div class="tutor-fs-5 tutor-fw-medium tutor-color-black">
36 <?php esc_html_e( 'Complete Your Profile', 'tutor' ); ?>
37 </div>
38
39 <div class="tutor-row tutor-align-center tutor-mt-12">
40 <div class="tutor-col">
41 <div class="tutor-row tutor-gx-1">
42 <?php for ( $i = 1; $i <= $total_count; $i++ ) : ?>
43 <div class="tutor-col">
44 <div class="tutor-progress-bar" style="--tutor-progress-value: <?php echo $i > $complete_count ? 0 : 100; ?>%; height: 8px;"><div class="tutor-progress-value" area-hidden="true"></div></div>
45 </div>
46 <?php endfor; ?>
47 </div>
48 </div>
49
50 <div class="tutor-col-auto">
51 <span class="tutor-round-box tutor-my-n20">
52 <i class="tutor-icon-trophy" area-hidden="true"></i>
53 </span>
54 </div>
55 </div>
56
57 <div class="tutor-fs-6 tutor-mt-20">
58 <?php
59 $profile_complete_text = __( 'Please complete profile', 'tutor' );
60 if ( $complete_count > ( $total_count / 2 ) && $complete_count < $total_count ) {
61 $profile_complete_text = __( 'You are almost done', 'tutor' );
62 } elseif ( $complete_count === $total_count ) {
63 $profile_complete_text = __( 'Thanks for completing your profile', 'tutor' );
64 }
65 $profile_complete_status = $profile_complete_text;
66 ?>
67
68 <span class="tutor-color-muted"><?php echo esc_html( $profile_complete_status ); ?>:</span>
69 <span><?php echo esc_html( $complete_count . '/' . $total_count ); ?></span>
70 </div>
71 </div>
72
73 <div class="tutor-col-lg-1 tutor-text-center tutor-my-24 tutor-my-lg-n24">
74 <div class="tutor-vr tutor-d-none tutor-d-lg-inline-flex"></div>
75 <div class="tutor-hr tutor-d-flex tutor-d-lg-none"></div>
76 </div>
77
78 <div class="tutor-col-lg-4 tutor-d-flex tutor-flex-column tutor-justify-center">
79 <?php
80 $i = 0;
81 foreach ( $profile_completion as $key => $data ) {
82 $is_set = $data['is_set']; // Whether the step is done or not.
83 ?>
84 <div class="tutor-d-flex tutor-align-center<?php echo $i < ( count( $profile_completion ) - 1 ) ? ' tutor-mb-8' : ''; ?>">
85 <?php if ( $is_set ) : ?>
86 <span class="tutor-icon-circle-mark-line tutor-color-success tutor-mr-8"></span>
87 <?php else : ?>
88 <span class="tutor-icon-circle-times-line tutor-color-warning tutor-mr-8"></span>
89 <?php endif; ?>
90
91 <span class="<?php echo $is_set ? 'tutor-color-secondary' : 'tutor-color-muted'; ?>">
92 <a class="tutor-btn tutor-btn-ghost tutor-has-underline" href="<?php echo esc_url( $data['url'] ); ?>">
93 <?php echo esc_html( $data['text'] ); ?>
94 </a>
95 </span>
96 </div>
97 <?php
98 $i++;
99 }
100 ?>
101 </div>
102 </div>
103 </div>
104 <?php
105 }
106 } else {
107 if ( ! $profile_completion['_tutor_profile_photo']['is_set'] ) {
108 $alert_message = sprintf(
109 '<div class="tutor-alert tutor-primary tutor-mb-20">
110 <div class="tutor-alert-text">
111 <span class="tutor-alert-icon tutor-fs-4 tutor-icon-circle-info tutor-mr-12"></span>
112 <span>
113 %s
114 </span>
115 </div>
116 <div class="alert-btn-group">
117 <a href="%s" class="tutor-btn tutor-btn-sm">' . __( 'Click Here', 'tutor' ) . '</a>
118 </div>
119 </div>',
120 $profile_completion['_tutor_profile_photo']['text'],
121 tutor_utils()->tutor_dashboard_url( 'settings' )
122 );
123
124 echo $alert_message; //phpcs:ignore
125 }
126 }
127 }
128 ?>
129
130 <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-capitalize-text tutor-mb-24 tutor-dashboard-title"><?php esc_html_e( 'Dashboard', 'tutor' ); ?></div>
131 <div class="tutor-dashboard-content-inner">
132 <?php
133 $user_id = get_current_user_id();
134 $enrolled_course = tutor_utils()->get_enrolled_courses_by_user();
135 $completed_courses = tutor_utils()->get_completed_courses_ids_by_user();
136 $total_students = tutor_utils()->get_total_students_by_instructor( $user_id );
137 $my_courses = CourseModel::get_courses_by_instructor( $user_id, CourseModel::STATUS_PUBLISH );
138 $earning_sum = WithdrawModel::get_withdraw_summary( $user_id );
139 $active_courses = tutor_utils()->get_active_courses_by_user( $user_id );
140
141 $enrolled_course_count = $enrolled_course ? $enrolled_course->post_count : 0;
142 $completed_course_count = count( $completed_courses );
143 $active_course_count = is_object( $active_courses ) && $active_courses->have_posts() ? $active_courses->post_count : 0;
144
145 $status_translations = array(
146 'publish' => __( 'Published', 'tutor' ),
147 'pending' => __( 'Pending', 'tutor' ),
148 'trash' => __( 'Trash', 'tutor' ),
149 );
150
151 ?>
152 <div class="tutor-row tutor-gx-lg-4">
153 <div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
154 <div class="tutor-card">
155 <div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
156 <span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
157 <i class="tutor-icon-book-open" area-hidden="true"></i>
158 </span>
159 <div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $enrolled_course_count ); ?></div>
160 <div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Enrolled Courses', 'tutor' ); ?></div>
161 <div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $enrolled_course_count ); ?></div>
162 </div>
163 </div>
164 </div>
165
166 <div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
167 <div class="tutor-card">
168 <div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
169 <span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
170 <i class="tutor-icon-mortarboard-o" area-hidden="true"></i>
171 </span>
172 <div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $active_course_count ); ?></div>
173 <div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Active Courses', 'tutor' ); ?></div>
174 <div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $active_course_count ); ?></div>
175 </div>
176 </div>
177 </div>
178
179 <div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
180 <div class="tutor-card">
181 <div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
182 <span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
183 <i class="tutor-icon-trophy" area-hidden="true"></i>
184 </span>
185 <div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $completed_course_count ); ?></div>
186 <div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Completed Courses', 'tutor' ); ?></div>
187 <div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $completed_course_count ); ?></div>
188 </div>
189 </div>
190 </div>
191
192 <?php
193 if ( current_user_can( tutor()->instructor_role ) ) :
194 ?>
195 <div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
196 <div class="tutor-card">
197 <div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
198 <span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
199 <i class="tutor-icon-user-graduate" area-hidden="true"></i>
200 </span>
201 <div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $total_students ); ?></div>
202 <div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Total Students', 'tutor' ); ?></div>
203 <div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $total_students ); ?></div>
204 </div>
205 </div>
206 </div>
207
208 <div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
209 <div class="tutor-card">
210 <div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
211 <span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
212 <i class="tutor-icon-box-open" area-hidden="true"></i>
213 </span>
214 <div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( count( $my_courses ) ); ?></div>
215 <div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Total Courses', 'tutor' ); ?></div>
216 <div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( count( $my_courses ) ); ?></div>
217 </div>
218 </div>
219 </div>
220
221 <div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
222 <div class="tutor-card">
223 <div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
224 <span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
225 <i class="tutor-icon-coins" area-hidden="true"></i>
226 </span>
227 <div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo wp_kses_post( tutor_utils()->tutor_price( $earning_sum->total_income ) ); ?></div>
228 <div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Total Earnings', 'tutor' ); ?></div>
229 <div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo wp_kses_post( tutor_utils()->tutor_price( $earning_sum->total_income ) ); ?></div>
230 </div>
231 </div>
232 </div>
233 <?php
234 endif;
235 ?>
236 </div>
237 </div>
238
239 <?php
240 /**
241 * Active users in progress courses
242 */
243 $placeholder_img = tutor()->url . 'assets/images/placeholder.svg';
244 $courses_in_progress = tutor_utils()->get_active_courses_by_user( get_current_user_id() );
245 ?>
246
247 <?php if ( $courses_in_progress && $courses_in_progress->have_posts() ) : ?>
248 <div class="tutor-frontend-dashboard-course-progress">
249 <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-capitalize-text tutor-mb-24">
250 <?php esc_html_e( 'In Progress Courses', 'tutor' ); ?>
251 </div>
252 <?php
253 while ( $courses_in_progress->have_posts() ) :
254 $courses_in_progress->the_post();
255 $tutor_course_img = get_tutor_course_thumbnail_src();
256 $course_rating = tutor_utils()->get_course_rating( get_the_ID() );
257 $course_progress = tutor_utils()->get_course_completed_percent( get_the_ID(), 0, true );
258 $completed_number = 0 === (int) $course_progress['completed_count'] ? 1 : (int) $course_progress['completed_count'];
259 ?>
260 <div class="tutor-course-progress-item tutor-card tutor-mb-20">
261 <div class="tutor-row tutor-gx-0">
262 <div class="tutor-col-lg-4">
263 <div class="tutor-ratio tutor-ratio-3x2">
264 <img class="tutor-card-image-left" src="<?php echo empty( $tutor_course_img ) ? esc_url( $placeholder_img ) : esc_url( $tutor_course_img ); ?>" alt="<?php the_title(); ?>" loading="lazy">
265 </div>
266 </div>
267
268 <div class="tutor-col-lg-8 tutor-align-self-center">
269 <div class="tutor-card-body">
270 <?php if ( $course_rating ) : ?>
271 <div class="tutor-ratings tutor-mb-4">
272 <?php tutor_utils()->star_rating_generator( $course_rating->rating_avg ); ?>
273 <div class="tutor-ratings-count">
274 <?php echo esc_html( number_format( $course_rating->rating_avg, 2 ) ); ?>
275 </div>
276 </div>
277 <?php endif; ?>
278
279 <div class="tutor-course-progress-item-title tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12">
280 <?php the_title(); ?>
281 </div>
282
283 <div class="tutor-d-flex tutor-fs-7 tutor-mb-32">
284 <span class="tutor-color-muted tutor-mr-4"><?php esc_html_e( 'Completed Lessons:', 'tutor' ); ?></span>
285 <span class="tutor-fw-medium tutor-color-black">
286 <span>
287 <?php echo esc_html( $course_progress['completed_count'] ); ?>
288 </span>
289 <?php esc_html_e( 'of', 'tutor' ); ?>
290 <span>
291 <?php echo esc_html( $course_progress['total_count'] ); ?>
292 </span>
293 <?php echo esc_html( _n( 'lesson', 'lessons', $completed_number, 'tutor' ) ); ?>
294 </span>
295 </div>
296
297 <div class="tutor-row tutor-align-center">
298 <div class="tutor-col">
299 <div class="tutor-progress-bar tutor-mr-16" style="--tutor-progress-value:<?php echo esc_attr( $course_progress['completed_percent'] ); ?>%"><span class="tutor-progress-value" area-hidden="true"></span></div>
300 </div>
301
302 <div class="tutor-col-auto">
303 <span class="progress-percentage tutor-fs-7 tutor-color-muted">
304 <span class="tutor-fw-medium tutor-color-black ">
305 <?php echo esc_html( $course_progress['completed_percent'] . '%' ); ?>
306 </span><?php esc_html_e( 'Complete', 'tutor' ); ?>
307 </span>
308 </div>
309 </div>
310 </div>
311 </div>
312 <a class="tutor-stretched-link" href="<?php the_permalink(); ?>"></a>
313 </div>
314 </div>
315 <?php endwhile; ?>
316 <?php wp_reset_postdata(); ?>
317 </div>
318 <?php endif; ?>
319
320 <?php
321 $instructor_course = tutor_utils()->get_courses_for_instructors( get_current_user_id() );
322
323 if ( count( $instructor_course ) ) {
324 $course_badges = array(
325 'publish' => 'success',
326 'pending' => 'warning',
327 'trash' => 'danger',
328 );
329
330 ?>
331 <div class="popular-courses-heading-dashboard tutor-d-flex tutor-justify-between tutor-mb-24 tutor-mt-md-40 tutor-mt-0">
332 <span class="tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'My Courses', 'tutor' ); ?></span>
333 <a class="tutor-btn tutor-btn-ghost" href="<?php echo esc_url( tutor_utils()->tutor_dashboard_url( 'my-courses' ) ); ?>">
334 <?php esc_html_e( 'View All', 'tutor' ); ?>
335 </a>
336 </div>
337
338 <div class="tutor-dashboard-content-inner">
339 <div class="tutor-table-responsive">
340 <table class="tutor-table table-popular-courses">
341 <thead>
342 <tr>
343 <th>
344 <?php esc_html_e( 'Course Name', 'tutor' ); ?>
345 </th>
346 <th>
347 <?php esc_html_e( 'Enrolled', 'tutor' ); ?>
348 </th>
349 <th>
350 <?php esc_html_e( 'Rating', 'tutor' ); ?>
351 </th>
352 </tr>
353 </thead>
354
355 <tbody>
356 <?php if ( is_array( $instructor_course ) && count( $instructor_course ) ) : ?>
357 <?php
358 foreach ( $instructor_course as $course ) :
359 $enrolled = tutor_utils()->count_enrolled_users_by_course( $course->ID );
360 $course_status = isset( $status_translations[ $course->post_status ] ) ? $status_translations[ $course->post_status ] : __( $course->post_status, 'tutor' ); //phpcs:ignore
361 $course_rating = tutor_utils()->get_course_rating( $course->ID );
362 $course_badge = isset( $course_badges[ $course->post_status ] ) ? $course_badges[ $course->post_status ] : 'dark';
363 ?>
364 <tr>
365 <td>
366 <a href="<?php echo esc_url( get_the_permalink( $course->ID ) ); ?>" target="_blank">
367 <?php echo esc_html( $course->post_title ); ?>
368 </a>
369 </td>
370 <td>
371 <?php echo esc_html( $enrolled ); ?>
372 </td>
373 <td>
374 <?php tutor_utils()->star_rating_generator_v2( $course_rating->rating_avg, null, true ); ?>
375 </td>
376 </tr>
377 <?php endforeach; ?>
378 <?php else : ?>
379 <tr>
380 <td colspan="100%" class="column-empty-state">
381 <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
382 </td>
383 </tr>
384 <?php endif; ?>
385 </tbody>
386 </table>
387 </div>
388 </div>
389 <?php
390 }
391 ?>
392