| @@ -1,73 +1,126 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Template for displaying orders statistics tab Users statistics page. | |
| 3 | + * Template for displaying the Users statistics dashboard tab. | |
| 4 | + * | |
| 5 | + * Data is rendered by assets/src/js/admin/statistics/tab-users.js from the | |
| 6 | + * `dashboard` key of the user-statistics endpoint. | |
| 7 | + * | |
| 8 | + * @since 4.4.2 | |
| 4 | 9 | */ |
| 10 | + | |
| 11 | +defined( 'ABSPATH' ) || exit(); | |
| 12 | + | |
| 13 | +$kpi_cards = array( | |
| 14 | + 'users-activated' => __( 'Users activated', 'learnpress' ), | |
| 15 | + 'students' => __( 'Students', 'learnpress' ), | |
| 16 | + 'instructors' => __( 'Instructors', 'learnpress' ), | |
| 17 | + 'not-started' => __( 'Not started', 'learnpress' ), | |
| 18 | + 'in-progress' => __( 'In progress', 'learnpress' ), | |
| 19 | + 'finished' => __( 'Finished', 'learnpress' ), | |
| 20 | +); | |
| 21 | + | |
| 22 | +$funnel_steps = array( | |
| 23 | + 'registered' => __( 'Registered', 'learnpress' ), | |
| 24 | + 'enrolled' => __( 'Enrolled', 'learnpress' ), | |
| 25 | + 'started' => __( 'Started learning', 'learnpress' ), | |
| 26 | + 'completed' => __( 'Completed', 'learnpress' ), | |
| 27 | + 'failed' => __( 'Failed', 'learnpress' ), | |
| 28 | +); | |
| 29 | + | |
| 30 | +// Section config filters — add/remove/relabel cards and lists. @since 4.4.2 | |
| 31 | +$kpi_cards = (array) apply_filters( 'learn-press/statistics/users/kpi-cards', $kpi_cards ); | |
| 32 | +$funnel_steps = (array) apply_filters( 'learn-press/statistics/users/funnel-steps', $funnel_steps ); | |
| 5 | 33 | ?> |
| 34 | +<div class="lp-admin-statistics-tab-content lp-stats-tab-users"> | |
| 35 | + <?php | |
| 36 | + /** | |
| 37 | + * Fires at the top of the Users statistics tab, inside the tab container. | |
| 38 | + * | |
| 39 | + * @since 4.4.2 | |
| 40 | + */ | |
| 41 | + do_action( 'learn-press/statistics/users/before' ); | |
| 6 | 42 | |
| 7 | -<div class="lp-admin-statistics-tab-content"> | |
| 8 | - <div class="btn-group btn-group-filter"> | |
| 9 | - <button class="btn-filter-time active" type="button" data-filter="today" ><?php _e( 'Today', 'learnpress' ); ?></button> | |
| 10 | - <!-- <button class="btn-filter-time" type="button" data-filter="yesterday" ><?php _e( 'Yesterday', 'learnpress' ); ?></button> --> | |
| 11 | - <button class="btn-filter-time" type="button" data-filter="last7days" ><?php _e( 'Last 7 days', 'learnpress' ); ?></button> | |
| 12 | - <button class="btn-filter-time" type="button" data-filter="last30days" ><?php _e( 'Last 30 days', 'learnpress' ); ?></button> | |
| 13 | - <!-- <button class="btn-filter-time" type="button" data-filter="thismonth" ><?php _e( 'This month', 'learnpress' ); ?></button> --> | |
| 14 | - <button class="btn-filter-time" type="button" data-filter="last12months"><?php _e( 'Last 12 months', 'learnpress' ); ?></button> | |
| 15 | - <button class="btn-filter-time" type="button" data-filter="thisyear" ><?php _e( 'This year', 'learnpress' ); ?></button> | |
| 16 | - <button class="btn-filter-time" type="button" data-filter="custom" ><?php _e( 'Custom', 'learnpress' ); ?></button> | |
| 17 | - <div class="custom-filter-time"> | |
| 18 | - <input type="date" id="ct-filter-1" /> | |
| 19 | - <input type="date" id="ct-filter-2"> | |
| 20 | - <button class="custom-filter-btn button button-primary" type="button"><?php _e( 'Filter', 'learnpress' ); ?></button> | |
| 43 | + learn_press_admin_view( 'statistics/parts/filter-bar' ); | |
| 44 | + ?> | |
| 45 | + | |
| 46 | + <div class="lp-stats-dashboard-body"> | |
| 47 | + <div class="lp-stats-kpi-grid"> | |
| 48 | + <?php | |
| 49 | + foreach ( $kpi_cards as $key => $title ) { | |
| 50 | + learn_press_admin_view( | |
| 51 | + 'statistics/parts/kpi-card', | |
| 52 | + array( | |
| 53 | + 'key' => $key, | |
| 54 | + 'title' => $title, | |
| 55 | + ) | |
| 56 | + ); | |
| 57 | + } | |
| 58 | + ?> | |
| 21 | 59 | </div> |
| 22 | - </div> | |
| 23 | - <div class="statistics-content"> | |
| 24 | - <input class="statistics-type" type="hidden" value="users-statistics"> | |
| 25 | - <div class="statistics-group"> | |
| 26 | - <div class="statistics-item"> | |
| 27 | - <span class="statistics-item-title"><?php _e( 'Users activated', 'learnpress' ); ?></span> | |
| 28 | - <span class="statistics-item-count statistics-user-actived">0</span> | |
| 60 | + | |
| 61 | + <div class="lp-stats-overview-grid lp-stats-overview-grid--chart"> | |
| 62 | + <div class="lp-stats-section statistics-content"> | |
| 63 | + <div class="lp-stats-section__header"> | |
| 64 | + <div> | |
| 65 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Learner registration and progress', 'learnpress' ); ?></h3> | |
| 66 | + <p class="lp-stats-section__description"><?php esc_html_e( 'Registration, enrollment, and graduation activity across the learning lifecycle.', 'learnpress' ); ?></p> | |
| 67 | + </div> | |
| 68 | + </div> | |
| 69 | + <div id="user-chart" class="statistics-chart-wrapper"> | |
| 70 | + <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 71 | + <canvas id="user-chart-content" style="display: none;"></canvas> | |
| 72 | + </div> | |
| 29 | 73 | </div> |
| 30 | - <div class="statistics-item"> | |
| 31 | - <span class="statistics-item-title"><?php _e( 'Instructors', 'learnpress' ); ?></span> | |
| 32 | - <span class="statistics-item-count statistics-instructors">0</span> | |
| 74 | + | |
| 75 | + <div class="lp-stats-section"> | |
| 76 | + <div class="lp-stats-section__header"> | |
| 77 | + <div> | |
| 78 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Learner funnel', 'learnpress' ); ?></h3> | |
| 79 | + <p class="lp-stats-section__description"><?php esc_html_e( 'Registered users to completed courses.', 'learnpress' ); ?></p> | |
| 80 | + </div> | |
| 81 | + </div> | |
| 82 | + <?php lp_skeleton_animation_html( 5, 100 ); ?> | |
| 83 | + <div class="lp-stats-funnel"> | |
| 84 | + <?php foreach ( $funnel_steps as $step => $label ) : ?> | |
| 85 | + <div class="lp-stats-funnel__step" data-step="<?php echo esc_attr( $step ); ?>"> | |
| 86 | + <span class="lp-stats-funnel__label"><?php echo esc_html( $label ); ?></span> | |
| 87 | + <span class="lp-stats-funnel__track"><span class="lp-stats-funnel__bar" style="width: 0;"></span></span> | |
| 88 | + <span class="lp-stats-funnel__count">–</span> | |
| 89 | + </div> | |
| 90 | + <?php endforeach; ?> | |
| 91 | + </div> | |
| 33 | 92 | </div> |
| 34 | - <div class="statistics-item"> | |
| 35 | - <span class="statistics-item-title"><?php _e( 'Students', 'learnpress' ); ?></span> | |
| 36 | - <span class="statistics-item-count statistics-students">0</span> | |
| 37 | - </div> | |
| 38 | - <div class="statistics-item"> | |
| 39 | - <span class="statistics-item-title"><?php _e( 'Inprogress', 'learnpress' ); ?></span> | |
| 40 | - <span class="statistics-item-count statistics-graduration in-progress">0</span> | |
| 41 | - </div> | |
| 42 | - <div class="statistics-item"> | |
| 43 | - <span class="statistics-item-title"><?php _e( 'Finished', 'learnpress' ); ?></span> | |
| 44 | - <span class="statistics-item-count statistics-graduration finished">0</span> | |
| 45 | - </div> | |
| 46 | - <div class="statistics-item"> | |
| 47 | - <span class="statistics-item-title"><?php _e( 'Not Started', 'learnpress' ); ?></span> | |
| 48 | - <span class="statistics-item-count statistics-not-started">0</span> | |
| 49 | - </div> | |
| 50 | 93 | </div> |
| 51 | - <h3 class="statistics-title"><?php _e( 'Registed Users', 'learnpress' ); ?></h3> | |
| 52 | - <div id="user-chart" class="statistics-chart-wrapper"> | |
| 53 | - <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 54 | - <canvas id="user-chart-content" style="display: none;"></canvas> | |
| 55 | - </div> | |
| 56 | - <div class="sold-course-analytics"> | |
| 57 | - <div class="col-50"> | |
| 58 | - <div class="col-50-contents"> | |
| 59 | - <h4 class="top-course-analytics-title"><?php _e( 'Top Courses By Students', 'learnpress' ); ?></h4> | |
| 60 | - <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 61 | - <ul class="top-course-by-student"></ul> | |
| 94 | + | |
| 95 | + <div class="lp-stats-overview-grid lp-stats-overview-grid--tables"> | |
| 96 | + <div class="lp-stats-section"> | |
| 97 | + <div class="lp-stats-section__header"> | |
| 98 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Top students', 'learnpress' ); ?></h3> | |
| 99 | + <button type="button" class="button-link lp-stats-section__action lp-stats-view-all-students"><?php esc_html_e( 'Open report', 'learnpress' ); ?></button> | |
| 62 | 100 | </div> |
| 101 | + <?php lp_skeleton_animation_html( 5, 100 ); ?> | |
| 102 | + <div class="lp-stats-table-top-students"></div> | |
| 63 | 103 | </div> |
| 64 | - <div class="col-50"> | |
| 65 | - <div class="col-50-contents"> | |
| 66 | - <h4 class="top-course-analytics-title"><?php _e( 'Top Instructors By Students Enrolled Times', 'learnpress' ); ?></h4> | |
| 67 | - <?php lp_skeleton_animation_html( 10, 100 ); ?> | |
| 68 | - <ul class="top-intructor-by-student"></ul> | |
| 104 | + | |
| 105 | + <div class="lp-stats-section"> | |
| 106 | + <div class="lp-stats-section__header"> | |
| 107 | + <h3 class="lp-stats-section__title"><?php esc_html_e( 'Top courses by students', 'learnpress' ); ?></h3> | |
| 108 | + <button type="button" class="button-link lp-stats-section__action lp-stats-view-all-courses-by-students"><?php esc_html_e( 'Open report', 'learnpress' ); ?></button> | |
| 69 | 109 | </div> |
| 110 | + <?php lp_skeleton_animation_html( 5, 100 ); ?> | |
| 111 | + <div class="lp-stats-table-courses-by-students"></div> | |
| 70 | 112 | </div> |
| 71 | 113 | </div> |
| 72 | 114 | </div> |
| 115 | + | |
| 116 | + <?php | |
| 117 | + learn_press_admin_view( 'statistics/parts/report-modal' ); | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Fires at the bottom of the Users statistics tab, inside the tab container. | |
| 121 | + * | |
| 122 | + * @since 4.4.2 | |
| 123 | + */ | |
| 124 | + do_action( 'learn-press/statistics/users/after' ); | |
| 125 | + ?> | |
| 73 | 126 | </div> |