Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor/templates/dashboard/dashboard.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
/**
3
+
* Frontend Dashboard Template
4
+
*
5
+
* @package Tutor\Templates
6
+
* @subpackage Dashboard
7
+
* @author Themeum <support@themeum.com>
8
+
* @link https://themeum.com
9
+
* @since 1.4.3
10
+
*/
11
+
12
+
use Tutor\Models\CourseModel;
13
+
use Tutor\Models\WithdrawModel;
14
+
15
+
if ( tutor_utils()->get_option( 'enable_profile_completion' ) ) {
16
+
$profile_completion = tutor_utils()->user_profile_completion();
17
+
$is_instructor = tutor_utils()->is_instructor( null, true );
18
+
$total_count = count( $profile_completion );
19
+
$incomplete_count = count(
20
+
array_filter(
21
+
$profile_completion,
22
+
function( $data ) {
23
+
return ! $data['is_set'];
24
+
}
25
+
)
26
+
);
27
+
$complete_count = $total_count - $incomplete_count;
28
+
29
+
if ( $is_instructor ) {
30
+
if ( isset( $total_count ) && isset( $incomplete_count ) && $incomplete_count <= $total_count ) {
31
+
?>
32
+
<div class="tutor-profile-completion tutor-card tutor-px-32 tutor-py-24 tutor-mb-40">
33
+
<div class="tutor-row tutor-gx-0">
34
+
<div class="tutor-col-lg-7 <?php echo tutor_utils()->is_instructor() ? 'tutor-profile-completion-content-admin' : ''; ?>">
35
+
<div class="tutor-fs-5 tutor-fw-medium tutor-color-black">
36
+
<?php esc_html_e( 'Complete Your Profile', 'tutor' ); ?>
37
+
</div>
38
+
39
+
<div class="tutor-row tutor-align-center tutor-mt-12">
40
+
<div class="tutor-col">
41
+
<div class="tutor-row tutor-gx-1">
42
+
<?php for ( $i = 1; $i <= $total_count; $i++ ) : ?>
43
+
<div class="tutor-col">
44
+
<div class="tutor-progress-bar" style="--tutor-progress-value: <?php echo $i > $complete_count ? 0 : 100; ?>%; height: 8px;"><div class="tutor-progress-value" area-hidden="true"></div></div>
45
+
</div>
46
+
<?php endfor; ?>
47
+
</div>
48
+
</div>
49
+
50
+
<div class="tutor-col-auto">
51
+
<span class="tutor-round-box tutor-my-n20">
52
+
<i class="tutor-icon-trophy" area-hidden="true"></i>
53
+
</span>
54
+
</div>
55
+
</div>
56
+
57
+
<div class="tutor-fs-6 tutor-mt-20">
58
+
<?php
59
+
$profile_complete_text = __( 'Please complete profile', 'tutor' );
60
+
if ( $complete_count > ( $total_count / 2 ) && $complete_count < $total_count ) {
61
+
$profile_complete_text = __( 'You are almost done', 'tutor' );
62
+
} elseif ( $complete_count === $total_count ) {
63
+
$profile_complete_text = __( 'Thanks for completing your profile', 'tutor' );
64
+
}
65
+
$profile_complete_status = $profile_complete_text;
66
+
?>
67
+
68
+
<span class="tutor-color-muted"><?php echo esc_html( $profile_complete_status ); ?>:</span>
69
+
<span><?php echo esc_html( $complete_count . '/' . $total_count ); ?></span>
70
+
</div>
71
+
</div>
72
+
73
+
<div class="tutor-col-lg-1 tutor-text-center tutor-my-24 tutor-my-lg-n24">
74
+
<div class="tutor-vr tutor-d-none tutor-d-lg-inline-flex"></div>
75
+
<div class="tutor-hr tutor-d-flex tutor-d-lg-none"></div>
76
+
</div>
77
+
78
+
<div class="tutor-col-lg-4 tutor-d-flex tutor-flex-column tutor-justify-center">
79
+
<?php
80
+
$i = 0;
81
+
$monetize_by = tutils()->get_option( 'monetize_by' );
82
+
foreach ( $profile_completion as $key => $data ) {
83
+
if ( '_tutor_withdraw_method_data' === $key ) {
84
+
if ( 'free' === $monetize_by ) {
85
+
continue;
86
+
}
87
+
}
88
+
$is_set = $data['is_set']; // Whether the step is done or not.
89
+
?>
90
+
<div class="tutor-d-flex tutor-align-center<?php echo $i < ( count( $profile_completion ) - 1 ) ? ' tutor-mb-8' : ''; ?>">
91
+
<?php if ( $is_set ) : ?>
92
+
<span class="tutor-icon-circle-mark-line tutor-color-success tutor-mr-8"></span>
93
+
<?php else : ?>
94
+
<span class="tutor-icon-circle-times-line tutor-color-warning tutor-mr-8"></span>
95
+
<?php endif; ?>
96
+
97
+
<span class="<?php echo $is_set ? 'tutor-color-secondary' : 'tutor-color-muted'; ?>">
98
+
<a class="tutor-btn tutor-btn-ghost tutor-has-underline" href="<?php echo esc_url( $data['url'] ); ?>">
99
+
<?php echo esc_html( $data['text'] ); ?>
100
+
</a>
101
+
</span>
102
+
</div>
103
+
<?php
104
+
$i++;
105
+
}
106
+
?>
107
+
</div>
108
+
</div>
109
+
</div>
110
+
<?php
111
+
}
112
+
} else {
113
+
if ( ! $profile_completion['_tutor_profile_photo']['is_set'] ) {
114
+
$alert_message = sprintf(
115
+
'<div class="tutor-alert tutor-primary tutor-mb-20">
116
+
<div class="tutor-alert-text">
117
+
<span class="tutor-alert-icon tutor-fs-4 tutor-icon-circle-info tutor-mr-12"></span>
118
+
<span>
119
+
%s
120
+
</span>
121
+
</div>
122
+
<div class="alert-btn-group">
123
+
<a href="%s" class="tutor-btn tutor-btn-sm">' . __( 'Click Here', 'tutor' ) . '</a>
124
+
</div>
125
+
</div>',
126
+
$profile_completion['_tutor_profile_photo']['text'],
127
+
tutor_utils()->tutor_dashboard_url( 'settings' )
128
+
);
129
+
130
+
echo $alert_message; //phpcs:ignore
131
+
}
132
+
}
133
+
}
134
+
?>
135
+
<?php do_action( 'tutor_before_dashboard_content' ); ?>
136
+
<div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-text-capitalize tutor-mb-24 tutor-dashboard-title"><?php esc_html_e( 'Dashboard', 'tutor' ); ?></div>
137
+
<div class="tutor-dashboard-content-inner">
138
+
<?php
139
+
$user_id = get_current_user_id();
140
+
$enrolled_course = CourseModel::get_enrolled_courses_by_user( $user_id, array( 'private', 'publish' ) );
141
+
$completed_courses = tutor_utils()->get_completed_courses_ids_by_user();
142
+
$total_students = tutor_utils()->get_total_students_by_instructor( $user_id );
143
+
$my_courses = CourseModel::get_courses_by_instructor( $user_id, CourseModel::STATUS_PUBLISH );
144
+
$earning_sum = WithdrawModel::get_withdraw_summary( $user_id );
145
+
$active_courses = CourseModel::get_active_courses_by_user( $user_id );
146
+
147
+
$enrolled_course_count = $enrolled_course ? $enrolled_course->post_count : 0;
148
+
$completed_course_count = count( $completed_courses );
149
+
$active_course_count = is_object( $active_courses ) && $active_courses->have_posts() ? $active_courses->post_count : 0;
150
+
151
+
$status_translations = array(
152
+
'publish' => __( 'Published', 'tutor' ),
153
+
'pending' => __( 'Pending', 'tutor' ),
154
+
'trash' => __( 'Trash', 'tutor' ),
155
+
);
156
+
157
+
?>
158
+
<div class="tutor-row tutor-gx-lg-4">
159
+
<div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
160
+
<div class="tutor-card">
161
+
<div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
162
+
<span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
163
+
<i class="tutor-icon-book-open" area-hidden="true"></i>
164
+
</span>
165
+
<div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $enrolled_course_count ); ?></div>
166
+
<div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Enrolled Courses', 'tutor' ); ?></div>
167
+
<div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $enrolled_course_count ); ?></div>
168
+
</div>
169
+
</div>
170
+
</div>
171
+
172
+
<div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
173
+
<div class="tutor-card">
174
+
<div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
175
+
<span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
176
+
<i class="tutor-icon-mortarboard-o" area-hidden="true"></i>
177
+
</span>
178
+
<div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $active_course_count ); ?></div>
179
+
<div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Active Courses', 'tutor' ); ?></div>
180
+
<div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $active_course_count ); ?></div>
181
+
</div>
182
+
</div>
183
+
</div>
184
+
185
+
<div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
186
+
<div class="tutor-card">
187
+
<div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
188
+
<span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
189
+
<i class="tutor-icon-trophy" area-hidden="true"></i>
190
+
</span>
191
+
<div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $completed_course_count ); ?></div>
192
+
<div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Completed Courses', 'tutor' ); ?></div>
193
+
<div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $completed_course_count ); ?></div>
194
+
</div>
195
+
</div>
196
+
</div>
197
+
198
+
<?php
199
+
if ( current_user_can( tutor()->instructor_role ) ) :
200
+
?>
201
+
<div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
202
+
<div class="tutor-card">
203
+
<div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
204
+
<span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
205
+
<i class="tutor-icon-user-graduate" area-hidden="true"></i>
206
+
</span>
207
+
<div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( $total_students ); ?></div>
208
+
<div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Total Students', 'tutor' ); ?></div>
209
+
<div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( $total_students ); ?></div>
210
+
</div>
211
+
</div>
212
+
</div>
213
+
214
+
<div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
215
+
<div class="tutor-card">
216
+
<div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
217
+
<span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
218
+
<i class="tutor-icon-box-open" area-hidden="true"></i>
219
+
</span>
220
+
<div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo esc_html( count( $my_courses ) ); ?></div>
221
+
<div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Total Courses', 'tutor' ); ?></div>
222
+
<div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo esc_html( count( $my_courses ) ); ?></div>
223
+
</div>
224
+
</div>
225
+
</div>
226
+
227
+
<div class="tutor-col-lg-6 tutor-col-xl-4 tutor-mb-16 tutor-mb-lg-32">
228
+
<div class="tutor-card">
229
+
<div class="tutor-d-flex tutor-flex-lg-column tutor-align-center tutor-text-lg-center tutor-px-12 tutor-px-lg-24 tutor-py-8 tutor-py-lg-32">
230
+
<span class="tutor-round-box tutor-mr-12 tutor-mr-lg-0 tutor-mb-lg-12">
231
+
<i class="tutor-icon-coins" area-hidden="true"></i>
232
+
</span>
233
+
<div class="tutor-fs-3 tutor-fw-bold tutor-d-none tutor-d-lg-block"><?php echo wp_kses_post( tutor_utils()->tutor_price( $earning_sum->total_income ) ); ?></div>
234
+
<div class="tutor-fs-7 tutor-color-secondary"><?php esc_html_e( 'Total Earnings', 'tutor' ); ?></div>
235
+
<div class="tutor-fs-4 tutor-fw-bold tutor-d-block tutor-d-lg-none tutor-ml-auto"><?php echo wp_kses_post( tutor_utils()->tutor_price( $earning_sum->total_income ) ); ?></div>
236
+
</div>
237
+
</div>
238
+
</div>
239
+
<?php
240
+
endif;
241
+
?>
242
+
</div>
243
+
</div>
244
+
245
+
<?php
246
+
/**
247
+
* Active users in progress courses
248
+
*/
249
+
$placeholder_img = tutor()->url . 'assets/images/placeholder.svg';
250
+
$courses_in_progress = CourseModel::get_active_courses_by_user( get_current_user_id() );
251
+
?>
252
+
253
+
<?php if ( $courses_in_progress && $courses_in_progress->have_posts() ) : ?>
254
+
<div class="tutor-frontend-dashboard-course-progress">
255
+
<div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-text-capitalize tutor-mb-24">
256
+
<?php esc_html_e( 'In Progress Courses', 'tutor' ); ?>
257
+
</div>
258
+
<?php
259
+
while ( $courses_in_progress->have_posts() ) :
260
+
$courses_in_progress->the_post();
261
+
$tutor_course_img = get_tutor_course_thumbnail_src();
262
+
$course_rating = tutor_utils()->get_course_rating( get_the_ID() );
263
+
$course_progress = tutor_utils()->get_course_completed_percent( get_the_ID(), 0, true );
264
+
$completed_number = 0 === (int) $course_progress['completed_count'] ? 1 : (int) $course_progress['completed_count'];
265
+
?>
266
+
<div class="tutor-course-progress-item tutor-card tutor-mb-20">
267
+
<div class="tutor-row tutor-gx-0">
268
+
<div class="tutor-col-lg-4">
269
+
<div class="tutor-ratio tutor-ratio-3x2">
270
+
<img class="tutor-card-image-left" src="<?php echo empty( $tutor_course_img ) ? esc_url( $placeholder_img ) : esc_url( $tutor_course_img ); ?>" alt="<?php the_title(); ?>" loading="lazy">
271
+
</div>
272
+
</div>
273
+
274
+
<div class="tutor-col-lg-8 tutor-align-self-center">
275
+
<div class="tutor-card-body">
276
+
<?php if ( $course_rating ) : ?>
277
+
<div class="tutor-ratings tutor-mb-4">
278
+
<?php tutor_utils()->star_rating_generator( $course_rating->rating_avg ); ?>
279
+
<div class="tutor-ratings-count">
280
+
<?php echo esc_html( number_format( $course_rating->rating_avg, 2 ) ); ?>
281
+
</div>
282
+
</div>
283
+
<?php endif; ?>
284
+
285
+
<div class="tutor-course-progress-item-title tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12">
286
+
<?php the_title(); ?>
287
+
</div>
288
+
289
+
<div class="tutor-d-flex tutor-fs-7 tutor-mb-32">
290
+
<span class="tutor-color-muted tutor-mr-4"><?php esc_html_e( 'Completed Lessons:', 'tutor' ); ?></span>
291
+
<span class="tutor-fw-medium tutor-color-black">
292
+
<span>
293
+
<?php echo esc_html( $course_progress['completed_count'] ); ?>
294
+
</span>
295
+
<?php esc_html_e( 'of', 'tutor' ); ?>
296
+
<span>
297
+
<?php echo esc_html( $course_progress['total_count'] ); ?>
298
+
</span>
299
+
<?php echo esc_html( _n( 'lesson', 'lessons', $completed_number, 'tutor' ) ); ?>
300
+
</span>
301
+
</div>
302
+
303
+
<div class="tutor-row tutor-align-center">
304
+
<div class="tutor-col">
305
+
<div class="tutor-progress-bar tutor-mr-16" style="--tutor-progress-value:<?php echo esc_attr( $course_progress['completed_percent'] ); ?>%"><span class="tutor-progress-value" area-hidden="true"></span></div>
306
+
</div>
307
+
308
+
<div class="tutor-col-auto">
309
+
<span class="progress-percentage tutor-fs-7 tutor-color-muted">
310
+
<span class="tutor-fw-medium tutor-color-black ">
311
+
<?php echo esc_html( $course_progress['completed_percent'] . '%' ); ?>
312
+
</span><?php esc_html_e( 'Complete', 'tutor' ); ?>
313
+
</span>
314
+
</div>
315
+
</div>
316
+
</div>
317
+
</div>
318
+
<a class="tutor-stretched-link" href="<?php the_permalink(); ?>"></a>
319
+
</div>
320
+
</div>
321
+
<?php endwhile; ?>
322
+
<?php wp_reset_postdata(); ?>
323
+
</div>
324
+
<?php endif; ?>
325
+
326
+
<?php
327
+
$instructor_course = tutor_utils()->get_courses_for_instructors( get_current_user_id() );
328
+
329
+
if ( count( $instructor_course ) ) {
330
+
$course_badges = array(
331
+
'publish' => 'success',
332
+
'pending' => 'warning',
333
+
'trash' => 'danger',
334
+
);
335
+
336
+
?>
337
+
<div class="popular-courses-heading-dashboard tutor-d-flex tutor-justify-between tutor-mb-24 tutor-mt-md-40 tutor-mt-0">
338
+
<span class="tutor-fs-5 tutor-fw-medium tutor-color-black"><?php esc_html_e( 'My Courses', 'tutor' ); ?></span>
339
+
<a class="tutor-btn tutor-btn-ghost" href="<?php echo esc_url( tutor_utils()->tutor_dashboard_url( 'my-courses' ) ); ?>">
340
+
<?php esc_html_e( 'View All', 'tutor' ); ?>
341
+
</a>
342
+
</div>
343
+
344
+
<div class="tutor-dashboard-content-inner">
345
+
<div class="tutor-table-responsive">
346
+
<table class="tutor-table table-popular-courses">
347
+
<thead>
348
+
<tr>
349
+
<th>
350
+
<?php esc_html_e( 'Course Name', 'tutor' ); ?>
351
+
</th>
352
+
<th>
353
+
<?php esc_html_e( 'Enrolled', 'tutor' ); ?>
354
+
</th>
355
+
<th>
356
+
<?php esc_html_e( 'Rating', 'tutor' ); ?>
357
+
</th>
358
+
</tr>
359
+
</thead>
360
+
361
+
<tbody>
362
+
<?php if ( is_array( $instructor_course ) && count( $instructor_course ) ) : ?>
363
+
<?php
364
+
foreach ( $instructor_course as $course ) :
365
+
$enrolled = tutor_utils()->count_enrolled_users_by_course( $course->ID );
366
+
$course_status = isset( $status_translations[ $course->post_status ] ) ? $status_translations[ $course->post_status ] : __( $course->post_status, 'tutor' ); //phpcs:ignore
367
+
$course_rating = tutor_utils()->get_course_rating( $course->ID );
368
+
$course_badge = isset( $course_badges[ $course->post_status ] ) ? $course_badges[ $course->post_status ] : 'dark';
369
+
?>
370
+
<tr>
371
+
<td>
372
+
<a href="<?php echo esc_url( get_the_permalink( $course->ID ) ); ?>" target="_blank">
373
+
<?php echo esc_html( $course->post_title ); ?>
374
+
</a>
375
+
</td>
376
+
<td>
377
+
<?php echo esc_html( $enrolled ); ?>
378
+
</td>
379
+
<td>
380
+
<?php tutor_utils()->star_rating_generator_v2( $course_rating->rating_avg, null, true ); ?>
381
+
</td>
382
+
</tr>
383
+
<?php endforeach; ?>
384
+
<?php else : ?>
385
+
<tr>
386
+
<td colspan="100%" class="column-empty-state">
387
+
<?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?>
388
+
</td>
389
+
</tr>
390
+
<?php endif; ?>
391
+
</tbody>
392
+
</table>
393
+
</div>
394
+
</div>
395
+
<?php
396
+
}
397
+
?>
398
+