account
1 day ago
components
1 day ago
courses
1 day ago
discussions
1 day ago
elements
1 day ago
instructor
1 day ago
my-courses
1 year ago
my-quiz-attempts
1 day ago
quiz-attempts
1 day ago
student
1 day ago
wishlist
1 day ago
announcements.php
1 day ago
courses.php
1 day ago
create-course.php
1 day ago
dashboard.php
1 day ago
discussions.php
1 day ago
index.php
3 years ago
logged-in.php
3 years ago
my-courses.php
1 day ago
my-quiz-attempts.php
1 day ago
quiz-attempts.php
1 day ago
registration.php
1 day ago
wishlist.php
1 day ago
dashboard.php
56 lines
| 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 | defined( 'ABSPATH' ) || exit; |
| 13 | |
| 14 | use Tutor\Components\Alert; |
| 15 | use Tutor\Components\Button; |
| 16 | use Tutor\Components\Constants\Size; |
| 17 | use Tutor\Components\Constants\Variant; |
| 18 | use Tutor\Models\CourseModel; |
| 19 | use TUTOR\Icon; |
| 20 | use TUTOR\Instructors_List; |
| 21 | use TUTOR\User; |
| 22 | |
| 23 | $user_id = get_current_user_id(); |
| 24 | $instructor_status = tutor_utils()->instructor_status( 0, false ); |
| 25 | $instructor_status = is_string( $instructor_status ) ? strtolower( $instructor_status ) : ''; |
| 26 | $is_instructor_pending = Instructors_List::STATUS_PENDING === $instructor_status; |
| 27 | $is_instructor_approved = Instructors_List::STATUS_APPROVED === $instructor_status; |
| 28 | $used_instructor_registration = User::used_instructor_registration( $user_id ); |
| 29 | |
| 30 | do_action( 'tutor_before_dashboard_content' ); |
| 31 | tutor_load_template( 'dashboard.components.profile-completion' ); |
| 32 | |
| 33 | if ( $is_instructor_pending ) { |
| 34 | tutor_load_template( 'dashboard.instructor.instructor-request-alert' ); |
| 35 | |
| 36 | tutor_load_template( 'dashboard.instructor.dashboard-empty' ); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | if ( $is_instructor_approved && $used_instructor_registration ) { |
| 41 | $hide_notice_url = add_query_arg( 'tutor_action', 'hide_instructor_approval_notice' ); |
| 42 | |
| 43 | if ( get_user_meta( $user_id, User::INSTRUCTOR_APPROVAL_NOTICE_META, true ) ) { |
| 44 | tutor_load_template( 'dashboard.instructor.instructor-request-alert', array( 'variant' => 'success' ) ); |
| 45 | } |
| 46 | |
| 47 | $course_count = (int) CourseModel::get_courses_by_instructor( $user_id, CourseModel::get_status_list(), 0, PHP_INT_MAX, true ); |
| 48 | |
| 49 | if ( ! $course_count ) { |
| 50 | tutor_load_template( 'dashboard.instructor.dashboard-empty' ); |
| 51 | return; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | tutor_load_template( 'dashboard.instructor.home' ); |
| 56 |