announcements
4 years ago
assignments
4 years ago
earning
4 years ago
enrolled-courses
5 years ago
instructor
4 years ago
my-quiz-attempts
4 years ago
notifications
5 years ago
question-answer
5 years ago
quiz-attempts
4 years ago
reviews
4 years ago
settings
5 years ago
withdraw-method-fields
5 years ago
announcements.php
4 years ago
assignments.php
4 years ago
create-course.php
4 years ago
dashboard.php
4 years ago
earning.php
4 years ago
enrolled-courses.php
4 years ago
index.php
4 years ago
logged-in.php
5 years ago
my-courses.php
5 years ago
my-profile.php
5 years ago
my-quiz-attempts.php
4 years ago
purchase_history.php
5 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
5 years ago
wishlist.php
5 years ago
withdraw.php
4 years ago
dashboard.php
115 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package TutorLMS/Templates |
| 4 | * @version 1.4.3 |
| 5 | */ |
| 6 | |
| 7 | ?> |
| 8 | |
| 9 | <h3><?php _e('Dashboard', 'tutor') ?></h3> |
| 10 | |
| 11 | <div class="tutor-dashboard-content-inner"> |
| 12 | |
| 13 | <?php |
| 14 | $enrolled_course = tutor_utils()->get_enrolled_courses_by_user(); |
| 15 | $completed_courses = tutor_utils()->get_completed_courses_ids_by_user(); |
| 16 | $total_students = tutor_utils()->get_total_students_by_instructor(get_current_user_id()); |
| 17 | $my_courses = tutor_utils()->get_courses_by_instructor(get_current_user_id(), 'publish'); |
| 18 | $earning_sum = tutor_utils()->get_earning_sum(); |
| 19 | |
| 20 | $enrolled_course_count = $enrolled_course ? $enrolled_course->post_count : 0; |
| 21 | $completed_course_count = count($completed_courses); |
| 22 | $active_course_count = $enrolled_course_count - $completed_course_count; |
| 23 | $active_course_count<0 ? $active_course_count=0 : 0; |
| 24 | |
| 25 | $status_translations = array( |
| 26 | 'publish' => __('Published', 'tutor'), |
| 27 | 'pending' => __('Pending', 'tutor'), |
| 28 | 'trash' => __('Trash', 'tutor') |
| 29 | ); |
| 30 | |
| 31 | ?> |
| 32 | |
| 33 | <div class="tutor-dashboard-info-cards"> |
| 34 | <div class="tutor-dashboard-info-card"> |
| 35 | <p> |
| 36 | <span><?php _e('Enrolled Courses', 'tutor'); ?></span> |
| 37 | <span class="tutor-dashboard-info-val"><?php echo esc_html($enrolled_course_count); ?></span> |
| 38 | </p> |
| 39 | </div> |
| 40 | <div class="tutor-dashboard-info-card"> |
| 41 | <p> |
| 42 | <span><?php _e('Active Courses', 'tutor'); ?></span> |
| 43 | <span class="tutor-dashboard-info-val"><?php echo esc_html($active_course_count); ?></span> |
| 44 | </p> |
| 45 | </div> |
| 46 | <div class="tutor-dashboard-info-card"> |
| 47 | <p> |
| 48 | <span><?php _e('Completed Courses', 'tutor'); ?></span> |
| 49 | <span class="tutor-dashboard-info-val"><?php echo esc_html($completed_course_count); ?></span> |
| 50 | </p> |
| 51 | </div> |
| 52 | |
| 53 | <?php |
| 54 | if(current_user_can(tutor()->instructor_role)) : |
| 55 | ?> |
| 56 | <div class="tutor-dashboard-info-card"> |
| 57 | <p> |
| 58 | <span><?php _e('Total Students', 'tutor'); ?></span> |
| 59 | <span class="tutor-dashboard-info-val"><?php echo esc_html($total_students); ?></span> |
| 60 | </p> |
| 61 | </div> |
| 62 | <div class="tutor-dashboard-info-card"> |
| 63 | <p> |
| 64 | <span><?php _e('Total Courses', 'tutor'); ?></span> |
| 65 | <span class="tutor-dashboard-info-val"><?php echo esc_html(count($my_courses)); ?></span> |
| 66 | </p> |
| 67 | </div> |
| 68 | <div class="tutor-dashboard-info-card"> |
| 69 | <p> |
| 70 | <span><?php _e('Total Earnings', 'tutor'); ?></span> |
| 71 | <span class="tutor-dashboard-info-val"><?php echo tutor_utils()->tutor_price($earning_sum->instructor_amount); ?></span> |
| 72 | </p> |
| 73 | </div> |
| 74 | <?php |
| 75 | endif; |
| 76 | ?> |
| 77 | </div> |
| 78 | |
| 79 | <?php |
| 80 | $instructor_course = tutor_utils()->get_courses_for_instructors(get_current_user_id()); |
| 81 | if(count($instructor_course)) { |
| 82 | ?> |
| 83 | <div class="tutor-dashboard-info-table-wrap"> |
| 84 | <h3><?php _e('Most Popular Courses', 'tutor'); ?></h3> |
| 85 | <table class="tutor-dashboard-info-table"> |
| 86 | <thead> |
| 87 | <tr> |
| 88 | <td><?php _e('Course Name', 'tutor'); ?></td> |
| 89 | <td><?php _e('Enrolled', 'tutor'); ?></td> |
| 90 | <td><?php _e('Status', 'tutor'); ?></td> |
| 91 | </tr> |
| 92 | </thead> |
| 93 | <tbody> |
| 94 | <?php |
| 95 | foreach ($instructor_course as $course){ |
| 96 | $enrolled = tutor_utils()->count_enrolled_users_by_course($course->ID); |
| 97 | $course_status = isset($status_translations[$course->post_status]) ? $status_translations[$course->post_status] : __($course->post_status, 'tutor'); ?> |
| 98 | <tr> |
| 99 | <td> |
| 100 | <a href="<?php echo get_the_permalink($course->ID); ?>" target="_blank"><?php echo $course->post_title; ?></a> |
| 101 | </td> |
| 102 | <td><?php echo $enrolled; ?></td> |
| 103 | <td> |
| 104 | <small class="label-course-status label-course-<?php echo $course->post_status; ?>"> <?php echo $course_status; ?></small> |
| 105 | </td> |
| 106 | </tr> |
| 107 | <?php |
| 108 | } |
| 109 | ?> |
| 110 | </tbody> |
| 111 | </table> |
| 112 | </div> |
| 113 | <?php } ?> |
| 114 | |
| 115 | </div> |