course-filter
2 months ago
dashboard
1 day ago
ecommerce
1 day ago
email
1 day ago
global
1 week ago
instructor
3 years ago
learning-area
1 day ago
loop
1 day ago
modal
2 months ago
profile
3 years ago
shared
1 day ago
shortcode
2 months ago
single
1 day ago
template-part
1 day ago
widget
3 years ago
account-header.php
1 day ago
account.php
1 day ago
archive-course-init.php
9 months ago
archive-course.php
3 years ago
course-embed.php
2 months ago
course-none.php
3 years ago
dashboard-isolated.php
1 day ago
dashboard.php
1 day ago
feature_disabled.php
3 years ago
login-form-legacy.php
1 day ago
login-form.php
1 day ago
login.php
1 day ago
permission-denied.php
1 day ago
public-profile.php
1 day ago
single-assignment.php
3 years ago
single-content-loader.php
2 months ago
single-course.php
1 day ago
single-lesson.php
3 years ago
single-preview-lesson.php
3 years ago
single-quiz.php
1 year ago
template.php
3 years ago
user-profile.php
1 day ago
dashboard.php
163 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for displaying frontend dashboard |
| 4 | * |
| 5 | * @package Tutor\Templates |
| 6 | * @author Themeum <support@themeum.com> |
| 7 | * @link https://themeum.com |
| 8 | * @since 1.4.3 |
| 9 | */ |
| 10 | |
| 11 | defined( 'ABSPATH' ) || exit; |
| 12 | |
| 13 | use Tutor\Components\Alert; |
| 14 | use Tutor\Components\EmptyState; |
| 15 | use TUTOR\Dashboard; |
| 16 | use TUTOR\Icon; |
| 17 | use TUTOR\User; |
| 18 | |
| 19 | global $wp_query; |
| 20 | |
| 21 | $dashboard_page_slug = ''; |
| 22 | $dashboard_page_subslug = ''; |
| 23 | $dashboard_page_name = ''; |
| 24 | $page_data = array(); |
| 25 | |
| 26 | if ( isset( $wp_query->query_vars['tutor_dashboard_page'] ) && $wp_query->query_vars['tutor_dashboard_page'] ) { |
| 27 | $dashboard_page_slug = $wp_query->query_vars['tutor_dashboard_page']; |
| 28 | $dashboard_page_name = $wp_query->query_vars['tutor_dashboard_page']; |
| 29 | } |
| 30 | /** |
| 31 | * Getting dashboard sub pages |
| 32 | */ |
| 33 | if ( isset( $wp_query->query_vars['tutor_dashboard_sub_page'] ) && $wp_query->query_vars['tutor_dashboard_sub_page'] ) { |
| 34 | $dashboard_page_subslug = $wp_query->query_vars['tutor_dashboard_sub_page']; |
| 35 | $dashboard_page_name = $dashboard_page_subslug; |
| 36 | if ( $dashboard_page_slug ) { |
| 37 | $dashboard_page_name = $dashboard_page_slug . '/' . $dashboard_page_name; |
| 38 | } |
| 39 | } |
| 40 | $dashboard_page_name = apply_filters( 'tutor_dashboard_sub_page_template', $dashboard_page_name ); |
| 41 | |
| 42 | $dashboard_pages = tutor_utils()->tutor_dashboard_nav_ui_items(); |
| 43 | $dashboard_pages = array_merge( |
| 44 | array( |
| 45 | 'index' => array( |
| 46 | 'title' => __( 'Dashboard', 'tutor' ), |
| 47 | ), |
| 48 | ), |
| 49 | $dashboard_pages |
| 50 | ); |
| 51 | |
| 52 | $page_meta = Dashboard::get_page_meta_data( $dashboard_page_slug ? $dashboard_page_slug : 'index', $dashboard_page_subslug, $dashboard_pages ); |
| 53 | |
| 54 | $meta_title = $page_meta['meta_title']; |
| 55 | Dashboard::set_document_title( $meta_title ); |
| 56 | |
| 57 | $is_by_short_code = isset( $is_shortcode ) && true === $is_shortcode; |
| 58 | if ( ! $is_by_short_code && ! defined( 'OTLMS_VERSION' ) ) : |
| 59 | ?> |
| 60 | <!DOCTYPE html> |
| 61 | <html <?php language_attributes(); ?>> |
| 62 | <head> |
| 63 | <meta charset="UTF-8"> |
| 64 | <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| 65 | <?php wp_head(); ?> |
| 66 | </head> |
| 67 | <body <?php body_class( '' ); ?>> |
| 68 | <?php wp_body_open(); ?> |
| 69 | <?php |
| 70 | endif; |
| 71 | |
| 72 | $user_id = get_current_user_id(); |
| 73 | $user = get_user_by( 'ID', $user_id ); |
| 74 | $enable_profile_completion = tutor_utils()->get_option( 'enable_profile_completion' ); |
| 75 | $is_instructor = tutor_utils()->is_instructor(); |
| 76 | $is_tour_completed = get_user_meta( $user_id, User::TOUR_COMPLETED_META, true ); |
| 77 | |
| 78 | // URLS. |
| 79 | $current_url = tutor()->current_url; |
| 80 | $footer_url_1 = trailingslashit( tutor_utils()->tutor_dashboard_url( $is_instructor ? 'my-courses' : '' ) ); |
| 81 | $footer_url_2 = trailingslashit( tutor_utils()->tutor_dashboard_url( $is_instructor ? 'question-answer' : 'my-quiz-attempts' ) ); |
| 82 | |
| 83 | // Footer links. |
| 84 | $footer_links = array( |
| 85 | array( |
| 86 | 'title' => $is_instructor ? __( 'My Courses', 'tutor' ) : __( 'Dashboard', 'tutor' ), |
| 87 | 'url' => $footer_url_1, |
| 88 | 'is_active' => $footer_url_1 == $current_url, |
| 89 | 'icon_class' => 'ttr tutor-icon-dashboard', |
| 90 | ), |
| 91 | array( |
| 92 | 'title' => $is_instructor ? __( 'Q&A', 'tutor' ) : __( 'Quiz Attempts', 'tutor' ), |
| 93 | 'url' => $footer_url_2, |
| 94 | 'is_active' => $footer_url_2 == $current_url, |
| 95 | 'icon_class' => $is_instructor ? 'ttr tutor-icon-question' : 'ttr tutor-icon-quiz-attempt', |
| 96 | ), |
| 97 | array( |
| 98 | 'title' => __( 'Menu', 'tutor' ), |
| 99 | 'url' => '#', |
| 100 | 'is_active' => false, |
| 101 | 'icon_class' => 'ttr tutor-icon-hamburger-o tutor-dashboard-menu-toggler', |
| 102 | ), |
| 103 | ); |
| 104 | ?> |
| 105 | |
| 106 | <?php do_action( 'tutor_dashboard/before/wrap' ); ?> |
| 107 | <div class="tutor-dashboard-layout"> |
| 108 | <?php tutor_load_template( 'dashboard.components.sidebar' ); ?> |
| 109 | <div class="tutor-dashboard-main"> |
| 110 | <?php tutor_load_template( 'dashboard.components.header' ); ?> |
| 111 | <div class="tutor-dashboard-body" role="main"> |
| 112 | <div class="tutor-dashboard-page"> |
| 113 | <?php |
| 114 | if ( User::used_instructor_registration() && User::has_pending_instructor_application() && $dashboard_page_slug ) { |
| 115 | tutor_load_template( 'dashboard.instructor.instructor-request-alert' ); |
| 116 | |
| 117 | EmptyState::make() |
| 118 | ->title( __( 'Your application is under review', 'tutor' ) ) |
| 119 | ->subtitle( __( 'Only your dashboard home is available while your instructor application is pending.', 'tutor' ) ) |
| 120 | ->attr( 'class', 'tutor-surface-l1 tutor-border tutor-rounded-2xl' ) |
| 121 | ->render(); |
| 122 | } elseif ( $dashboard_page_name ) { |
| 123 | do_action( 'tutor_load_dashboard_template_before', $dashboard_page_name ); |
| 124 | |
| 125 | /** |
| 126 | * Load dashboard template part from other location |
| 127 | * |
| 128 | * This filter is basically added for adding templates from respective addons |
| 129 | * |
| 130 | * @since version 1.9.3 |
| 131 | */ |
| 132 | $other_location = ''; |
| 133 | $from_other_location = apply_filters( 'load_dashboard_template_part_from_other_location', $other_location ); |
| 134 | |
| 135 | if ( '' == $from_other_location ) { |
| 136 | tutor_load_template( 'dashboard.' . $dashboard_page_name ); |
| 137 | } else { |
| 138 | // Load template from other location full abspath. |
| 139 | include_once $from_other_location; |
| 140 | } |
| 141 | |
| 142 | do_action( 'tutor_load_dashboard_template_after', $dashboard_page_name ); |
| 143 | } elseif ( User::is_instructor_view() ) { |
| 144 | tutor_load_template( 'dashboard.dashboard' ); |
| 145 | } else { |
| 146 | tutor_load_template( 'dashboard.student.dashboard' ); |
| 147 | } |
| 148 | ?> |
| 149 | </div> |
| 150 | </div> |
| 151 | </div> |
| 152 | </div> |
| 153 | <?php if ( User::is_student_view() && ! $is_tour_completed ) : ?> |
| 154 | <?php tutor_load_template( 'shared.tour' ); ?> |
| 155 | <?php endif; ?> |
| 156 | |
| 157 | <?php do_action( 'tutor_dashboard/after/wrap' ); ?> |
| 158 | <?php if ( ! $is_by_short_code && ! defined( 'OTLMS_VERSION' ) ) : ?> |
| 159 | <?php wp_footer(); ?> |
| 160 | <?php endif; ?> |
| 161 | </body> |
| 162 | </html> |
| 163 |