-
Notifications
You must be signed in to change notification settings - Fork 135
/
overview.php
188 lines (160 loc) · 5.82 KB
/
overview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
/**
* Single Course Tab: Overview Subtab
*
* @package LifterLMS/Templates/Admin
*
* @since 3.15.0
* @since 3.35.0 Access `$_GET` data via `llms_filter_input()`.
* @since 5.9.0 Stop using deprecated `FILTER_SANITIZE_STRING` and validate the period exists before attempting to use it.
* @version 5.9.0
*/
defined( 'ABSPATH' ) || exit;
is_admin() || exit;
$data = new LLMS_Course_Data( $course->get( 'id' ) );
$period = $data->parse_period();
$data->set_period( $period );
$period_text = strtolower( LLMS_Admin_Reporting::get_period_filters()[ $period ] );
$now = current_time( 'timestamp' );
?>
<div class="llms-reporting-tab-content">
<section class="llms-reporting-tab-main llms-reporting-widgets">
<header>
<?php
LLMS_Admin_Reporting::output_widget_range_filter(
$period,
'courses',
array(
'course_id' => $course->get( 'id' ),
)
);
?>
<h3><?php esc_html_e( 'Course Overview', 'lifterlms' ); ?></h3>
</header>
<?php
do_action( 'llms_reporting_single_course_overview_before_widgets', $course );
LLMS_Admin_Reporting::output_widget(
array(
'cols' => 'd-1of3',
'icon' => 'users',
'id' => 'llms-reporting-course-total-enrollments',
'data' => $course->get_student_count(),
'text' => __( 'Currently enrolled students', 'lifterlms' ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'cols' => 'd-1of3',
'icon' => 'line-chart',
'id' => 'llms-reporting-course-avg-progress',
'data' => $course->get( 'average_progress' ),
'data_type' => 'percentage',
'text' => __( 'Current average progress', 'lifterlms' ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'cols' => 'd-1of3',
'icon' => 'graduation-cap',
'id' => 'llms-reporting-course-avg-grade',
'data' => $course->get( 'average_grade' ),
'data_type' => 'percentage',
'text' => __( 'Current average grade', 'lifterlms' ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'icon' => 'shopping-cart',
'id' => 'llms-reporting-course-orders',
'data' => $data->get_orders( 'current' ),
'data_compare' => $data->get_orders( 'previous' ),
'text' => sprintf( __( 'New orders %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'icon' => 'money',
'id' => 'llms-reporting-course-revenue',
'data' => $data->get_revenue( 'current' ),
'data_compare' => $data->get_revenue( 'previous' ),
'data_type' => 'monetary',
'text' => sprintf( __( 'Total sales %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'icon' => 'smile-o',
'id' => 'llms-reporting-course-enrollments',
'data' => $data->get_enrollments( 'current' ),
'data_compare' => $data->get_enrollments( 'previous' ),
'text' => sprintf( __( 'New enrollments %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'icon' => 'frown-o',
'id' => 'llms-reporting-course-unenrollments',
'data' => $data->get_unenrollments( 'current' ),
'data_compare' => $data->get_unenrollments( 'previous' ),
'text' => sprintf( __( 'Unenrollments %s', 'lifterlms' ), $period_text ),
'impact' => 'negative',
)
);
LLMS_Admin_Reporting::output_widget(
array(
'icon' => 'check-circle',
'id' => 'llms-reporting-course-lessons-completed',
'data' => $data->get_lesson_completions( 'current' ),
'data_compare' => $data->get_lesson_completions( 'previous' ),
'text' => sprintf( __( 'Lessons completed %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'icon' => 'flag-checkered',
'id' => 'llms-reporting-course-course-completions',
'data' => $data->get_completions( 'current' ),
'data_compare' => $data->get_completions( 'previous' ),
'text' => sprintf( __( 'Course completions %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'cols' => 'd-1of3',
'icon' => 'trophy',
'id' => 'llms-reporting-course-achievements',
'data' => $data->get_engagements( 'achievement_earned', 'current' ),
'data_compare' => $data->get_engagements( 'achievement_earned', 'previous' ),
'text' => sprintf( __( 'Achievements earned %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'cols' => 'd-1of3',
'icon' => 'certificate',
'id' => 'llms-reporting-course-certificates',
'data' => $data->get_engagements( 'certificate_earned', 'current' ),
'data_compare' => $data->get_engagements( 'certificate_earned', 'previous' ),
'text' => sprintf( __( 'Certificates earned %s', 'lifterlms' ), $period_text ),
)
);
LLMS_Admin_Reporting::output_widget(
array(
'cols' => 'd-1of3',
'icon' => 'envelope',
'id' => 'llms-reporting-course-email',
'data' => $data->get_engagements( 'email_sent', 'current' ),
'data_compare' => $data->get_engagements( 'email_sent', 'previous' ),
'text' => sprintf( __( 'Emails sent %s', 'lifterlms' ), $period_text ),
)
);
do_action( 'llms_reporting_single_course_overview_after_widgets', $course );
?>
</section>
<aside class="llms-reporting-tab-side">
<h3><i class="fa fa-bolt" aria-hidden="true"></i> <?php esc_html_e( 'Recent events', 'lifterlms' ); ?></h3>
<?php foreach ( $data->recent_events() as $event ) : ?>
<?php LLMS_Admin_Reporting::output_event( $event, 'course' ); ?>
<?php endforeach; ?>
</aside>
</div>