announcements
4 years ago
assignments
4 years ago
earning
4 years ago
enrolled-courses
4 years ago
instructor
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
4 years ago
withdraw-method-fields
4 years ago
announcements.php
4 years ago
assignments.php
4 years ago
create-course.php
4 years ago
dashboard-menu.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
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
4 years ago
dashboard.php
125 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"> |
| 60 | <?php echo esc_html( $total_students ); ?> |
| 61 | </span> |
| 62 | </p> |
| 63 | </div> |
| 64 | <div class="tutor-dashboard-info-card"> |
| 65 | <p> |
| 66 | <span><?php _e( 'Total Courses', 'tutor' ); ?></span> |
| 67 | <span class="tutor-dashboard-info-val"><?php echo count( $my_courses ); ?></span> |
| 68 | </p> |
| 69 | </div> |
| 70 | <div class="tutor-dashboard-info-card"> |
| 71 | <p> |
| 72 | <span><?php _e( 'Total Earnings', 'tutor' ); ?></span> |
| 73 | <span class="tutor-dashboard-info-val"> |
| 74 | <?php echo tutor_kses_html( tutor_utils()->tutor_price( $earning_sum->instructor_amount ) ); ?> |
| 75 | </span> |
| 76 | </p> |
| 77 | </div> |
| 78 | <?php |
| 79 | endif; |
| 80 | ?> |
| 81 | </div> |
| 82 | |
| 83 | <?php |
| 84 | $instructor_course = tutor_utils()->get_courses_for_instructors( get_current_user_id() ); |
| 85 | if ( count( $instructor_course ) ) { |
| 86 | ?> |
| 87 | <div class="tutor-dashboard-info-table-wrap"> |
| 88 | <h3><?php _e( 'Most Popular Courses', 'tutor' ); ?></h3> |
| 89 | <table class="tutor-dashboard-info-table"> |
| 90 | <thead> |
| 91 | <tr> |
| 92 | <td><?php _e( 'Course Name', 'tutor' ); ?></td> |
| 93 | <td><?php _e( 'Enrolled', 'tutor' ); ?></td> |
| 94 | <td><?php _e( 'Status', 'tutor' ); ?></td> |
| 95 | </tr> |
| 96 | </thead> |
| 97 | <tbody> |
| 98 | <?php |
| 99 | foreach ( $instructor_course as $course ) { |
| 100 | $enrolled = tutor_utils()->count_enrolled_users_by_course( $course->ID ); |
| 101 | $course_status = isset( $status_translations[ $course->post_status ] ) ? $status_translations[ $course->post_status ] : __( $course->post_status, 'tutor' ); |
| 102 | ?> |
| 103 | <tr> |
| 104 | <td> |
| 105 | <a href="<?php echo esc_url( get_the_permalink( $course->ID ) ); ?>" target="_blank"> |
| 106 | <?php echo $course->post_title; ?> |
| 107 | </a> |
| 108 | </td> |
| 109 | <td><?php echo $enrolled; ?></td> |
| 110 | <td> |
| 111 | <small class="label-course-status label-course-<?php echo $course->post_status; ?>"> |
| 112 | <?php echo $course_status; ?> |
| 113 | </small> |
| 114 | </td> |
| 115 | </tr> |
| 116 | <?php |
| 117 | } |
| 118 | ?> |
| 119 | </tbody> |
| 120 | </table> |
| 121 | </div> |
| 122 | <?php } ?> |
| 123 | |
| 124 | </div> |
| 125 |