course-filter
3 years ago
dashboard
3 years ago
email
3 years ago
global
3 years ago
instructor
3 years ago
loop
3 years ago
modal
3 years ago
profile
3 years ago
shortcode
3 years ago
single
3 years ago
template-part
3 years ago
widget
3 years ago
archive-course-init.php
3 years ago
archive-course.php
3 years ago
course-embed.php
3 years ago
course-none.php
3 years ago
dashboard.php
3 years ago
feature_disabled.php
3 years ago
instructor-setting.php
3 years ago
login-form.php
3 years ago
login.php
3 years ago
metabox-wrapper.php
3 years ago
permission-denied.php
3 years ago
public-profile.php
3 years ago
single-assignment.php
3 years ago
single-content-loader.php
3 years ago
single-course.php
3 years ago
single-lesson.php
3 years ago
single-preview-lesson.php
3 years ago
single-quiz.php
3 years ago
template.php
3 years ago
dashboard.php
294 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 | $is_by_short_code = isset( $is_shortcode ) && true === $is_shortcode; |
| 12 | if ( ! $is_by_short_code && ! defined( 'OTLMS_VERSION' ) ) { |
| 13 | tutor_utils()->tutor_custom_header(); |
| 14 | } |
| 15 | |
| 16 | global $wp_query; |
| 17 | |
| 18 | $dashboard_page_slug = ''; |
| 19 | $dashboard_page_name = ''; |
| 20 | if ( isset( $wp_query->query_vars['tutor_dashboard_page'] ) && $wp_query->query_vars['tutor_dashboard_page'] ) { |
| 21 | $dashboard_page_slug = $wp_query->query_vars['tutor_dashboard_page']; |
| 22 | $dashboard_page_name = $wp_query->query_vars['tutor_dashboard_page']; |
| 23 | } |
| 24 | /** |
| 25 | * Getting dashboard sub pages |
| 26 | */ |
| 27 | if ( isset( $wp_query->query_vars['tutor_dashboard_sub_page'] ) && $wp_query->query_vars['tutor_dashboard_sub_page'] ) { |
| 28 | $dashboard_page_name = $wp_query->query_vars['tutor_dashboard_sub_page']; |
| 29 | if ( $dashboard_page_slug ) { |
| 30 | $dashboard_page_name = $dashboard_page_slug . '/' . $dashboard_page_name; |
| 31 | } |
| 32 | } |
| 33 | $dashboard_page_name = apply_filters( 'tutor_dashboard_sub_page_template', $dashboard_page_name ); |
| 34 | |
| 35 | $user_id = get_current_user_id(); |
| 36 | $user = get_user_by( 'ID', $user_id ); |
| 37 | $enable_profile_completion = tutor_utils()->get_option( 'enable_profile_completion' ); |
| 38 | $is_instructor = tutor_utils()->is_instructor(); |
| 39 | |
| 40 | // URLS |
| 41 | $current_url = tutor()->current_url; |
| 42 | $footer_url_1 = trailingslashit( tutor_utils()->tutor_dashboard_url( $is_instructor ? 'my-courses' : '' ) ); |
| 43 | $footer_url_2 = trailingslashit( tutor_utils()->tutor_dashboard_url( $is_instructor ? 'question-answer' : 'my-quiz-attempts' ) ); |
| 44 | |
| 45 | // Footer links |
| 46 | $footer_links = array( |
| 47 | array( |
| 48 | 'title' => $is_instructor ? __( 'My Courses', 'tutor' ) : __( 'Dashboard', 'tutor' ), |
| 49 | 'url' => $footer_url_1, |
| 50 | 'is_active' => $footer_url_1 == $current_url, |
| 51 | 'icon_class' => 'ttr tutor-icon-dashboard', |
| 52 | ), |
| 53 | array( |
| 54 | 'title' => $is_instructor ? __( 'Q&A', 'tutor' ) : __( 'Quiz Attempts', 'tutor' ), |
| 55 | 'url' => $footer_url_2, |
| 56 | 'is_active' => $footer_url_2 == $current_url, |
| 57 | 'icon_class' => $is_instructor ? 'ttr tutor-icon-question' : 'ttr tutor-icon-quiz-attempt', |
| 58 | ), |
| 59 | array( |
| 60 | 'title' => __( 'Menu', 'tutor' ), |
| 61 | 'url' => '#', |
| 62 | 'is_active' => false, |
| 63 | 'icon_class' => 'ttr tutor-icon-hamburger-o tutor-dashboard-menu-toggler', |
| 64 | ), |
| 65 | ); |
| 66 | |
| 67 | do_action( 'tutor_dashboard/before/wrap' ); |
| 68 | ?> |
| 69 | |
| 70 | <div class="tutor-wrap tutor-wrap-parent tutor-dashboard tutor-frontend-dashboard tutor-dashboard-student tutor-pb-80"> |
| 71 | <div class="tutor-container"> |
| 72 | <div class="tutor-row tutor-d-flex tutor-justify-between tutor-frontend-dashboard-header"> |
| 73 | <div class="tutor-header-left-side tutor-dashboard-header tutor-col-md-6 tutor-d-flex tutor-align-center" style="border: none;"> |
| 74 | <div class="tutor-dashboard-header-avatar"> |
| 75 | <?php |
| 76 | echo wp_kses( |
| 77 | tutor_utils()->get_tutor_avatar( $user_id, 'xl' ), |
| 78 | tutor_utils()->allowed_avatar_tags() |
| 79 | ); |
| 80 | ?> |
| 81 | </div> |
| 82 | |
| 83 | <div class="tutor-user-info tutor-ml-24"> |
| 84 | <?php |
| 85 | $instructor_rating = tutor_utils()->get_instructor_ratings( $user->ID ); |
| 86 | |
| 87 | if ( current_user_can( tutor()->instructor_role ) ) { |
| 88 | ?> |
| 89 | <div class="tutor-fs-4 tutor-fw-medium tutor-color-black tutor-dashboard-header-username"> |
| 90 | <?php echo esc_html( $user->display_name ); ?> |
| 91 | </div> |
| 92 | <div class="tutor-dashboard-header-stats"> |
| 93 | <div class="tutor-dashboard-header-ratings"> |
| 94 | <?php tutor_utils()->star_rating_generator_v2( $instructor_rating->rating_avg, $instructor_rating->rating_count, true ); ?> |
| 95 | </div> |
| 96 | </div> |
| 97 | <?php |
| 98 | } else { |
| 99 | ?> |
| 100 | <div class="tutor-dashboard-header-display-name tutor-color-black"> |
| 101 | <div class="tutor-fs-5 tutor-dashboard-header-greetings"> |
| 102 | <?php esc_html_e( 'Hello', 'tutor' ); ?>, |
| 103 | </div> |
| 104 | <div class="tutor-fs-4 tutor-fw-medium tutor-dashboard-header-username"> |
| 105 | <?php echo esc_html( $user->display_name ); ?> |
| 106 | </div> |
| 107 | </div> |
| 108 | <?php |
| 109 | } |
| 110 | ?> |
| 111 | </div> |
| 112 | </div> |
| 113 | <div class="tutor-header-right-side tutor-col-md-6 tutor-d-flex tutor-justify-end tutor-mt-20 tutor-mt-md-0"> |
| 114 | <div class="tutor-d-flex tutor-align-center"> |
| 115 | <?php |
| 116 | do_action( 'tutor_dashboard/before_header_button' ); |
| 117 | $instructor_status = tutor_utils()->instructor_status( 0, false ); |
| 118 | $instructor_status = is_string( $instructor_status ) ? strtolower( $instructor_status ) : ''; |
| 119 | $rejected_on = get_user_meta( $user->ID, '_is_tutor_instructor_rejected', true ); |
| 120 | $info_style = 'vertical-align: middle; margin-right: 7px;'; |
| 121 | $info_message_style = 'display:inline-block; color:#7A7A7A; font-size: 15px;'; |
| 122 | |
| 123 | ob_start(); |
| 124 | if ( tutor_utils()->get_option( 'enable_become_instructor_btn' ) ) { |
| 125 | ?> |
| 126 | <a id="tutor-become-instructor-button" class="tutor-btn tutor-btn-outline-primary" href="<?php echo esc_url( tutor_utils()->instructor_register_url() ); ?>"> |
| 127 | <i class="tutor-icon-user-bold"></i> <?php esc_html_e( 'Become an instructor', 'tutor' ); ?> |
| 128 | </a> |
| 129 | <?php |
| 130 | } |
| 131 | $become_button = ob_get_clean(); |
| 132 | |
| 133 | if ( current_user_can( tutor()->instructor_role ) ) { |
| 134 | $course_type = tutor()->course_post_type; |
| 135 | ?> |
| 136 | <?php |
| 137 | /** |
| 138 | * Render create course button based on free & pro |
| 139 | * |
| 140 | * @since v2.0.7 |
| 141 | */ |
| 142 | if ( function_exists( 'tutor_pro' ) ) : |
| 143 | ?> |
| 144 | <?php do_action( 'tutor_course_create_button' ); ?> |
| 145 | <?php else : ?> |
| 146 | <a href="<?php echo esc_url( admin_url( "post-new.php?post_type=$course_type" ) ); ?>" class="tutor-btn tutor-btn-outline-primary"> |
| 147 | <i class="tutor-icon-plus-square tutor-my-n4 tutor-mr-8"></i> |
| 148 | <?php esc_html_e( 'Create a New Course', 'tutor' ); ?> |
| 149 | </a> |
| 150 | <?php endif; ?> |
| 151 | <?php |
| 152 | } elseif ( 'pending' == $instructor_status ) { |
| 153 | $on = get_user_meta( $user->ID, '_is_tutor_instructor', true ); |
| 154 | $on = date( 'd F, Y', $on ); |
| 155 | echo '<span style="' . esc_attr( $info_message_style ) . '"> |
| 156 | <i class="dashicons dashicons-info tutor-color-warning" style=" ' . esc_attr( $info_style ) . '"></i>', |
| 157 | esc_html__( 'Your Application is pending as of', 'tutor' ), ' <b>', esc_html( $on ), '</b>', |
| 158 | '</span>'; |
| 159 | } elseif ( $rejected_on || $instructor_status !== 'blocked' ) { |
| 160 | echo $become_button; //phpcs:ignore --data escaped above |
| 161 | } |
| 162 | ?> |
| 163 | </div> |
| 164 | </div> |
| 165 | </div> |
| 166 | |
| 167 | <div class="tutor-row tutor-frontend-dashboard-maincontent"> |
| 168 | <div class="tutor-col-12 tutor-col-md-4 tutor-col-lg-3 tutor-dashboard-left-menu"> |
| 169 | <ul class="tutor-dashboard-permalinks"> |
| 170 | <?php |
| 171 | $dashboard_pages = tutor_utils()->tutor_dashboard_nav_ui_items(); |
| 172 | // get reviews settings value. |
| 173 | $disable = ! get_tutor_option( 'enable_course_review' ); |
| 174 | foreach ( $dashboard_pages as $dashboard_key => $dashboard_page ) { |
| 175 | /** |
| 176 | * If not enable from settings then quit |
| 177 | * |
| 178 | * @since v2.0.0 |
| 179 | */ |
| 180 | if ( $disable && 'reviews' === $dashboard_key ) { |
| 181 | continue; |
| 182 | } |
| 183 | |
| 184 | $menu_title = $dashboard_page; |
| 185 | $menu_link = tutor_utils()->get_tutor_dashboard_page_permalink( $dashboard_key ); |
| 186 | $separator = false; |
| 187 | $menu_icon = ''; |
| 188 | |
| 189 | if ( is_array( $dashboard_page ) ) { |
| 190 | $menu_title = tutor_utils()->array_get( 'title', $dashboard_page ); |
| 191 | $menu_icon_name = tutor_utils()->array_get( 'icon', $dashboard_page, ( isset( $dashboard_page['icon'] ) ? $dashboard_page['icon'] : '' ) ); |
| 192 | if ( $menu_icon_name ) { |
| 193 | $menu_icon = "<span class='{$menu_icon_name} tutor-dashboard-menu-item-icon'></span>"; |
| 194 | } |
| 195 | // Add new menu item property "url" for custom link |
| 196 | if ( isset( $dashboard_page['url'] ) ) { |
| 197 | $menu_link = $dashboard_page['url']; |
| 198 | } |
| 199 | if ( isset( $dashboard_page['type'] ) && $dashboard_page['type'] == 'separator' ) { |
| 200 | $separator = true; |
| 201 | } |
| 202 | } |
| 203 | if ( $separator ) { |
| 204 | echo '<li class="tutor-dashboard-menu-divider"></li>'; |
| 205 | if ( $menu_title ) { |
| 206 | ?> |
| 207 | <li class='tutor-dashboard-menu-divider-header'> |
| 208 | <?php echo esc_html( $menu_title ); ?> |
| 209 | </li> |
| 210 | <?php |
| 211 | } |
| 212 | } else { |
| 213 | $li_class = "tutor-dashboard-menu-{$dashboard_key}"; |
| 214 | if ( 'index' === $dashboard_key ) { |
| 215 | $dashboard_key = ''; |
| 216 | } |
| 217 | $active_class = $dashboard_key == $dashboard_page_slug ? 'active' : ''; |
| 218 | $data_no_instant = 'logout' == $dashboard_key ? 'data-no-instant' : ''; |
| 219 | $menu_link = apply_filters( 'tutor_dashboard_menu_link', $menu_link, $menu_title ); |
| 220 | ?> |
| 221 | <li class='tutor-dashboard-menu-item <?php echo esc_attr( $li_class . ' ' . $active_class ); ?>'> |
| 222 | <a <?php echo esc_html( $data_no_instant ); ?> href="<?php echo esc_url( $menu_link ); ?>" class='tutor-dashboard-menu-item-link tutor-fs-6 tutor-color-black'> |
| 223 | <?php |
| 224 | echo wp_kses( |
| 225 | $menu_icon, |
| 226 | tutor_utils()->allowed_icon_tags() |
| 227 | ); |
| 228 | ?> |
| 229 | <span class='tutor-dashboard-menu-item-text tutor-ml-12'> |
| 230 | <?php echo esc_html( $menu_title ); ?> |
| 231 | </span> |
| 232 | </a> |
| 233 | </li> |
| 234 | <?php |
| 235 | } |
| 236 | } |
| 237 | ?> |
| 238 | </ul> |
| 239 | </div> |
| 240 | |
| 241 | <div class="tutor-col-12 tutor-col-md-8 tutor-col-lg-9"> |
| 242 | <div class="tutor-dashboard-content"> |
| 243 | <?php |
| 244 | |
| 245 | if ( $dashboard_page_name ) { |
| 246 | do_action( 'tutor_load_dashboard_template_before', $dashboard_page_name ); |
| 247 | |
| 248 | /** |
| 249 | * Load dashboard template part from other location |
| 250 | * |
| 251 | * This filter is basically added for adding templates from respective addons |
| 252 | * |
| 253 | * @since version 1.9.3 |
| 254 | */ |
| 255 | $other_location = ''; |
| 256 | $from_other_location = apply_filters( 'load_dashboard_template_part_from_other_location', $other_location ); |
| 257 | |
| 258 | if ( '' == $from_other_location ) { |
| 259 | tutor_load_template( 'dashboard.' . $dashboard_page_name ); |
| 260 | } else { |
| 261 | // Load template from other location full abspath. |
| 262 | include_once $from_other_location; |
| 263 | } |
| 264 | |
| 265 | do_action( 'tutor_load_dashboard_template_before', $dashboard_page_name ); |
| 266 | } else { |
| 267 | tutor_load_template( 'dashboard.dashboard' ); |
| 268 | } |
| 269 | ?> |
| 270 | </div> |
| 271 | </div> |
| 272 | </div> |
| 273 | </div> |
| 274 | <div id="tutor-dashboard-footer-mobile"> |
| 275 | <div class="tutor-container"> |
| 276 | <div class="tutor-row"> |
| 277 | <?php foreach ( $footer_links as $link ) : ?> |
| 278 | <a class="tutor-col-4 <?php echo $link['is_active'] ? 'active' : ''; ?>" href="<?php echo esc_url( $link['url'] ); ?>"> |
| 279 | <i class="<?php echo esc_attr( $link['icon_class'] ); ?>"></i> |
| 280 | <span><?php echo esc_html( $link['title'] ); ?></span> |
| 281 | </a> |
| 282 | <?php endforeach; ?> |
| 283 | </div> |
| 284 | </div> |
| 285 | </div> |
| 286 | </div> |
| 287 | |
| 288 | <?php do_action( 'tutor_dashboard/after/wrap' ); ?> |
| 289 | |
| 290 | <?php |
| 291 | if ( ! $is_by_short_code && ! defined( 'OTLMS_VERSION' ) ) { |
| 292 | tutor_utils()->tutor_custom_footer(); |
| 293 | } |
| 294 |