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