| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying the Courses statistics dashboard tab. |
| 4 |
* |
| 5 |
* Data is rendered by assets/src/js/admin/statistics/tab-courses.js from the |
| 6 |
* `dashboard` key of the course-statistics endpoint. |
| 7 |
* |
| 8 |
* @since 4.4.2 |
| 9 |
*/ |
| 10 |
|
| 11 |
defined( 'ABSPATH' ) || exit(); |
| 12 |
|
| 13 |
$kpi_cards = array( |
| 14 |
'published' => __( 'Published courses', 'learnpress' ), |
| 15 |
'pending-review' => __( 'Pending review', 'learnpress' ), |
| 16 |
'future' => __( 'Future courses', 'learnpress' ), |
| 17 |
'enrollments' => __( 'Enrollments', 'learnpress' ), |
| 18 |
'avg-completion' => __( 'Avg. completion', 'learnpress' ), |
| 19 |
'courses-without-enrollment' => __( 'Courses without enrollment', 'learnpress' ), |
| 20 |
); |
| 21 |
|
| 22 |
$health_checks = array( |
| 23 |
'no_curriculum' => array( |
| 24 |
'label' => __( 'Published courses with an empty curriculum', 'learnpress' ), |
| 25 |
'url' => admin_url( 'edit.php?post_type=lp_course&post_status=publish' ), |
| 26 |
), |
| 27 |
'no_students' => array( |
| 28 |
'label' => __( 'Published courses without any enrollment', 'learnpress' ), |
| 29 |
'url' => admin_url( 'edit.php?post_type=lp_course&post_status=publish' ), |
| 30 |
), |
| 31 |
'low_completion' => array( |
| 32 |
'label' => __( 'Courses below the completion target', 'learnpress' ), |
| 33 |
'url' => admin_url( 'admin.php?page=learn-press-statistics&tab=courses' ), |
| 34 |
), |
| 35 |
'low_quiz_pass' => array( |
| 36 |
'label' => __( 'Quizzes with a low pass rate', 'learnpress' ), |
| 37 |
'url' => admin_url( 'edit.php?post_type=lp_quiz' ), |
| 38 |
), |
| 39 |
'pending_review' => array( |
| 40 |
'label' => __( 'Courses waiting for review', 'learnpress' ), |
| 41 |
'url' => admin_url( 'edit.php?post_type=lp_course&post_status=pending' ), |
| 42 |
), |
| 43 |
); |
| 44 |
|
| 45 |
// Section config filters — add/remove/relabel cards and lists. @since 4.4.2 |
| 46 |
$kpi_cards = (array) apply_filters( 'learn-press/statistics/courses/kpi-cards', $kpi_cards ); |
| 47 |
$health_checks = (array) apply_filters( 'learn-press/statistics/courses/health-checks', $health_checks ); |
| 48 |
?> |
| 49 |
<div class="lp-admin-statistics-tab-content lp-stats-tab-courses"> |
| 50 |
<?php |
| 51 |
/** |
| 52 |
* Fires at the top of the Courses statistics tab, inside the tab container. |
| 53 |
* |
| 54 |
* @since 4.4.2 |
| 55 |
*/ |
| 56 |
do_action( 'learn-press/statistics/courses/before' ); |
| 57 |
|
| 58 |
learn_press_admin_view( 'statistics/parts/filter-bar' ); |
| 59 |
?> |
| 60 |
|
| 61 |
<div class="lp-stats-dashboard-body"> |
| 62 |
<div class="lp-stats-kpi-grid"> |
| 63 |
<?php foreach ( $kpi_cards as $key => $title ) : ?> |
| 64 |
<?php if ( 'avg-completion' === $key ) : ?> |
| 65 |
<div class="lp-kpi-card lp-kpi-<?php echo esc_attr( $key ); ?>"> |
| 66 |
<span class="lp-kpi-title"><?php echo esc_html( $title ); ?></span> |
| 67 |
<span class="lp-kpi-value">–</span> |
| 68 |
<span class="lp-kpi-delta"></span> |
| 69 |
<span class="lp-kpi-subline"></span> |
| 70 |
<span class="lp-kpi-progress"><span class="lp-kpi-progress__bar" style="width: 0;"></span></span> |
| 71 |
</div> |
| 72 |
<?php else : ?> |
| 73 |
<?php |
| 74 |
learn_press_admin_view( |
| 75 |
'statistics/parts/kpi-card', |
| 76 |
array( |
| 77 |
'key' => $key, |
| 78 |
'title' => $title, |
| 79 |
) |
| 80 |
); |
| 81 |
?> |
| 82 |
<?php endif; ?> |
| 83 |
<?php endforeach; ?> |
| 84 |
</div> |
| 85 |
|
| 86 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--chart"> |
| 87 |
<div class="lp-stats-section statistics-content"> |
| 88 |
<div class="lp-stats-section__header"> |
| 89 |
<div> |
| 90 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Course publishing and enrollment', 'learnpress' ); ?></h3> |
| 91 |
<p class="lp-stats-section__description"><?php esc_html_e( 'Course creation, enrollment, and completion trend for content operations.', 'learnpress' ); ?></p> |
| 92 |
</div> |
| 93 |
</div> |
| 94 |
<div id="course-chart" class="statistics-chart-wrapper"> |
| 95 |
<?php lp_skeleton_animation_html( 10, 100 ); ?> |
| 96 |
<canvas id="course-chart-content" style="display: none;"></canvas> |
| 97 |
</div> |
| 98 |
</div> |
| 99 |
|
| 100 |
<div class="lp-stats-section"> |
| 101 |
<div class="lp-stats-section__header"> |
| 102 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Course health checks', 'learnpress' ); ?></h3> |
| 103 |
</div> |
| 104 |
<ul class="lp-stats-health-checks"> |
| 105 |
<?php foreach ( $health_checks as $check => $item ) : ?> |
| 106 |
<li> |
| 107 |
<a href="<?php echo esc_url( $item['url'] ); ?>"> |
| 108 |
<span class="lp-stats-health-check__count" data-check="<?php echo esc_attr( $check ); ?>">–</span> |
| 109 |
<?php echo esc_html( $item['label'] ); ?> |
| 110 |
</a> |
| 111 |
</li> |
| 112 |
<?php endforeach; ?> |
| 113 |
</ul> |
| 114 |
</div> |
| 115 |
</div> |
| 116 |
|
| 117 |
<div class="lp-stats-overview-grid lp-stats-overview-grid--tables"> |
| 118 |
<div class="lp-stats-section"> |
| 119 |
<div class="lp-stats-section__header"> |
| 120 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Course performance', 'learnpress' ); ?></h3> |
| 121 |
<button type="button" class="button-link lp-stats-section__action lp-stats-view-all-performance"><?php esc_html_e( 'Open report', 'learnpress' ); ?></button> |
| 122 |
</div> |
| 123 |
<?php lp_skeleton_animation_html( 5, 100 ); ?> |
| 124 |
<div class="lp-stats-table-course-performance"></div> |
| 125 |
</div> |
| 126 |
|
| 127 |
<div class="lp-stats-section"> |
| 128 |
<div class="lp-stats-section__header"> |
| 129 |
<h3 class="lp-stats-section__title"><?php esc_html_e( 'Content inventory', 'learnpress' ); ?></h3> |
| 130 |
</div> |
| 131 |
<?php lp_skeleton_animation_html( 4, 100 ); ?> |
| 132 |
<div class="lp-stats-table-content-inventory"></div> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
</div> |
| 136 |
|
| 137 |
<?php |
| 138 |
learn_press_admin_view( 'statistics/parts/report-modal' ); |
| 139 |
|
| 140 |
/** |
| 141 |
* Fires at the bottom of the Courses statistics tab, inside the tab container. |
| 142 |
* |
| 143 |
* @since 4.4.2 |
| 144 |
*/ |
| 145 |
do_action( 'learn-press/statistics/courses/after' ); |
| 146 |
?> |
| 147 |
</div> |
| 148 |
|