| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying the Overview statistics dashboard tab. |
| 4 |
* |
| 5 |
* Data is rendered by assets/src/js/admin/statistics/tab-overview.js from the |
| 6 |
* `dashboard` key of the overviews-statistics endpoint. |
| 7 |
* |
| 8 |
* @since 4.4.2 |
| 9 |
*/ |
| 10 |
|
| 11 |
defined( 'ABSPATH' ) || exit(); |
| 12 |
|
| 13 |
$order_health_boxes = array( |
| 14 |
'completed' => __( 'Completed', 'learnpress' ), |
| 15 |
'processing' => __( 'Processing', 'learnpress' ), |
| 16 |
'pending' => __( 'Pending', 'learnpress' ), |
| 17 |
'cancelled_failed' => __( 'Cancelled / failed', 'learnpress' ), |
| 18 |
); |
| 19 |
|
| 20 |
$health_checks = array( |
| 21 |
'no_enrollment' => array( |
| 22 |
'label' => __( 'Published courses without any enrollment', 'learnpress' ), |
| 23 |
'url' => admin_url( 'edit.php?post_type=lp_course&post_status=publish' ), |
| 24 |
), |
| 25 |
'no_content' => array( |
| 26 |
'label' => __( 'Published courses with an empty curriculum', 'learnpress' ), |
| 27 |
'url' => admin_url( 'edit.php?post_type=lp_course&post_status=publish' ), |
| 28 |
), |
| 29 |
'pending_review' => array( |
| 30 |
'label' => __( 'Courses waiting for review', 'learnpress' ), |
| 31 |
'url' => admin_url( 'edit.php?post_type=lp_course&post_status=pending' ), |
| 32 |
), |
| 33 |
'quiz_low_pass' => array( |
| 34 |
'label' => __( 'Quizzes with a low pass rate', 'learnpress' ), |
| 35 |
'url' => admin_url( 'edit.php?post_type=lp_quiz' ), |
| 36 |
), |
| 37 |
'low_completion' => array( |
| 38 |
'label' => __( 'Courses below the completion target', 'learnpress' ), |
| 39 |
'url' => admin_url( 'admin.php?page=learn-press-statistics&tab=courses' ), |
| 40 |
), |
| 41 |
); |
| 42 |
|
| 43 |
$funnel_steps = array( |
| 44 |
'registered' => __( 'Registered', 'learnpress' ), |
| 45 |
'enrolled' => __( 'Enrolled', 'learnpress' ), |
| 46 |
'started' => __( 'Started learning', 'learnpress' ), |
| 47 |
'completed' => __( 'Completed', 'learnpress' ), |
| 48 |
); |
| 49 |
|
| 50 |
$kpi_cards = array( |
| 51 |
'net-sales' => __( 'Net sales', 'learnpress' ), |
| 52 |
'completed-orders' => __( 'Completed orders', 'learnpress' ), |
| 53 |
'enrollments' => __( 'Enrollments', 'learnpress' ), |
| 54 |
'completion-rate' => __( 'Completion rate', 'learnpress' ), |
| 55 |
'active-learners' => __( 'Active learners', 'learnpress' ), |
| 56 |
'failed-orders' => __( 'Failed orders', 'learnpress' ), |
| 57 |
); |
| 58 |
|
| 59 |
// Section config filters — add/remove/relabel cards and lists. @since 4.4.2 |
| 60 |
$kpi_cards = (array) apply_filters( 'learn-press/statistics/overview/kpi-cards', $kpi_cards ); |
| 61 |
$health_checks = (array) apply_filters( 'learn-press/statistics/overview/health-checks', $health_checks ); |
| 62 |
$funnel_steps = (array) apply_filters( 'learn-press/statistics/overview/funnel-steps', $funnel_steps ); |
| 63 |
$order_health_boxes = (array) apply_filters( 'learn-press/statistics/overview/order-health-boxes', $order_health_boxes ); |
| 64 |
?> |
| 65 |
<div class="lp-admin-statistics-tab-content lp-stats-tab-overview"> |
| 66 |
<?php |
| 67 |
/** |
| 68 |
* Fires at the top of the Overview statistics tab, inside the tab container. |
| 69 |
* |
| 70 |
* @since 4.4.2 |
| 71 |
*/ |
| 72 |
do_action( 'learn-press/statistics/overview/before' ); |
| 73 |
|
| 74 |
learn_press_admin_view( 'statistics/parts/filter-bar' ); |
| 75 |
?> |
| 76 |
|
| 77 |
<div class="lp-stats-dashboard-body"> |
| 78 |
<div class="lp-stats-kpi-grid"> |
| 79 |
<?php |
| 80 |
foreach ( $kpi_cards as $key => $title ) { |
| 81 |
learn_press_admin_view( |
| 82 |
'statistics/parts/kpi-card', |
| 83 |
array( |
| 84 |
'key' => $key, |
| 85 |
'title' => $title, |
| 86 |
) |
| 87 |
); |
| 88 |
} |
| 89 |
?> |
| 90 |
</div> |
| 91 |
|
| 92 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--chart"> |
| 93 |
<div class="lp-stats-section statistics-content"> |
| 94 |
<div class="lp-stats-section__header"> |
| 95 |
<div> |
| 96 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Revenue and enrollments', 'learnpress' ); ?></h3> |
| 97 |
<p class="lp-stats-section__description"><?php esc_html_e( 'Completed order revenue with enrollment volume for the selected range.', 'learnpress' ); ?></p> |
| 98 |
</div> |
| 99 |
</div> |
| 100 |
<div class="statistics-chart-wrapper"> |
| 101 |
<?php lp_skeleton_animation_html( 10, 100 ); ?> |
| 102 |
<canvas id="net-sales-chart-content" style="display: none;"></canvas> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|
| 106 |
<div class="lp-stats-section"> |
| 107 |
<div class="lp-stats-section__header"> |
| 108 |
<div> |
| 109 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Learner funnel', 'learnpress' ); ?></h3> |
| 110 |
<p class="lp-stats-section__description"><?php esc_html_e( 'Registered users to completed courses.', 'learnpress' ); ?></p> |
| 111 |
</div> |
| 112 |
</div> |
| 113 |
<?php lp_skeleton_animation_html( 4, 100 ); ?> |
| 114 |
<div class="lp-stats-funnel"> |
| 115 |
<?php foreach ( $funnel_steps as $step => $label ) : ?> |
| 116 |
<div class="lp-stats-funnel__step" data-step="<?php echo esc_attr( $step ); ?>"> |
| 117 |
<span class="lp-stats-funnel__label"><?php echo esc_html( $label ); ?></span> |
| 118 |
<span class="lp-stats-funnel__track"><span class="lp-stats-funnel__bar" style="width: 0;"></span></span> |
| 119 |
<span class="lp-stats-funnel__count">–</span> |
| 120 |
</div> |
| 121 |
<?php endforeach; ?> |
| 122 |
</div> |
| 123 |
</div> |
| 124 |
</div> |
| 125 |
|
| 126 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--tables"> |
| 127 |
<div class="lp-stats-section"> |
| 128 |
<div class="lp-stats-section__header"> |
| 129 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Top course performance', 'learnpress' ); ?></h3> |
| 130 |
<button type="button" class="button-link lp-stats-section__action lp-stats-view-all-courses"><?php esc_html_e( 'View all courses', 'learnpress' ); ?></button> |
| 131 |
</div> |
| 132 |
<?php lp_skeleton_animation_html( 5, 100 ); ?> |
| 133 |
<div class="lp-stats-table-top-courses"></div> |
| 134 |
</div> |
| 135 |
|
| 136 |
<div class="lp-stats-section"> |
| 137 |
<div class="lp-stats-section__header"> |
| 138 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Instructor performance', 'learnpress' ); ?></h3> |
| 139 |
<a class="lp-stats-section__action" href="<?php echo esc_url( admin_url( 'users.php?role=lp_teacher' ) ); ?>"><?php esc_html_e( 'Manage instructors', 'learnpress' ); ?></a> |
| 140 |
</div> |
| 141 |
<?php lp_skeleton_animation_html( 5, 100 ); ?> |
| 142 |
<div class="lp-stats-table-instructors"></div> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
|
| 146 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--health"> |
| 147 |
<div class="lp-stats-section"> |
| 148 |
<div class="lp-stats-section__header"> |
| 149 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Order health', 'learnpress' ); ?></h3> |
| 150 |
</div> |
| 151 |
<div class="lp-stats-health-grid lp-stats-order-health"> |
| 152 |
<?php foreach ( $order_health_boxes as $status => $label ) : ?> |
| 153 |
<a class="lp-stats-health-box" data-status="<?php echo esc_attr( $status ); ?>" |
| 154 |
href="<?php echo esc_url( admin_url( 'admin.php?page=learn-press-statistics&tab=orders&order_status=' . $status ) ); ?>"> |
| 155 |
<span class="lp-stats-health-box__count">–</span> |
| 156 |
<span class="lp-stats-health-box__label"><?php echo esc_html( $label ); ?></span> |
| 157 |
</a> |
| 158 |
<?php endforeach; ?> |
| 159 |
</div> |
| 160 |
</div> |
| 161 |
|
| 162 |
<div class="lp-stats-section"> |
| 163 |
<div class="lp-stats-section__header"> |
| 164 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Course health checks', 'learnpress' ); ?></h3> |
| 165 |
</div> |
| 166 |
<ul class="lp-stats-health-checks"> |
| 167 |
<?php foreach ( $health_checks as $check => $item ) : ?> |
| 168 |
<li> |
| 169 |
<a href="<?php echo esc_url( $item['url'] ); ?>"> |
| 170 |
<span class="lp-stats-health-check__count" data-check="<?php echo esc_attr( $check ); ?>">–</span> |
| 171 |
<?php echo esc_html( $item['label'] ); ?> |
| 172 |
</a> |
| 173 |
</li> |
| 174 |
<?php endforeach; ?> |
| 175 |
</ul> |
| 176 |
</div> |
| 177 |
</div> |
| 178 |
</div> |
| 179 |
|
| 180 |
<?php |
| 181 |
learn_press_admin_view( 'statistics/parts/report-modal' ); |
| 182 |
|
| 183 |
/** |
| 184 |
* Fires at the bottom of the Overview statistics tab, inside the tab container. |
| 185 |
* |
| 186 |
* @since 4.4.2 |
| 187 |
*/ |
| 188 |
do_action( 'learn-press/statistics/overview/after' ); |
| 189 |
?> |
| 190 |
</div> |
| 191 |
|