course-filter
4 years ago
dashboard
4 years ago
email
4 years ago
global
4 years ago
loop
4 years ago
profile
4 years ago
shortcode
4 years ago
single
4 years ago
template-part
4 years ago
widget
4 years ago
archive-course-init.php
5 years ago
archive-course.php
4 years ago
course-none.php
5 years ago
dashboard.php
4 years ago
feature_disabled.php
4 years ago
instructor-setting.php
4 years ago
login.php
4 years ago
permission-denied.php
4 years ago
public-profile-setting.php
4 years ago
single-assignment.php
4 years ago
single-course-enrolled-announcements.php
4 years ago
single-course-enrolled-overview.php
4 years ago
single-course-enrolled-questions.php
4 years ago
single-course-enrolled-subpage.php
4 years ago
single-course-enrolled.php
4 years ago
single-course-instructor.php
4 years ago
single-course.php
4 years ago
single-lesson.php
4 years ago
single-preview-lesson.php
4 years ago
single-quiz.php
4 years ago
student-public-profile.php
4 years ago
template.php
4 years ago
dashboard.php
225 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Template for displaying frontend dashboard |
| 4 | * |
| 5 | * @since v.1.0.0 |
| 6 | * |
| 7 | * @author Themeum |
| 8 | * @url https://themeum.com |
| 9 | * |
| 10 | * @package TutorLMS/Templates |
| 11 | * @version 1.4.3 |
| 12 | */ |
| 13 | |
| 14 | $is_by_short_code = isset( $is_shortcode ) && $is_shortcode === true; |
| 15 | if ( ! $is_by_short_code && ! defined( 'OTLMS_VERSION' ) ) { |
| 16 | tutor_utils()->tutor_custom_header(); |
| 17 | } |
| 18 | |
| 19 | global $wp_query; |
| 20 | |
| 21 | $dashboard_page_slug = ''; |
| 22 | $dashboard_page_name = ''; |
| 23 | if ( isset( $wp_query->query_vars['tutor_dashboard_page'] ) && $wp_query->query_vars['tutor_dashboard_page'] ) { |
| 24 | $dashboard_page_slug = $wp_query->query_vars['tutor_dashboard_page']; |
| 25 | $dashboard_page_name = $wp_query->query_vars['tutor_dashboard_page']; |
| 26 | } |
| 27 | /** |
| 28 | * Getting dashboard sub pages |
| 29 | */ |
| 30 | if ( isset( $wp_query->query_vars['tutor_dashboard_sub_page'] ) && $wp_query->query_vars['tutor_dashboard_sub_page'] ) { |
| 31 | $dashboard_page_name = $wp_query->query_vars['tutor_dashboard_sub_page']; |
| 32 | if ( $dashboard_page_slug ) { |
| 33 | $dashboard_page_name = $dashboard_page_slug . '/' . $dashboard_page_name; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | $user_id = get_current_user_id(); |
| 38 | $user = get_user_by( 'ID', $user_id ); |
| 39 | $enable_profile_completion = tutils()->get_option( 'enable_profile_completion' ); |
| 40 | |
| 41 | do_action( 'tutor_dashboard/before/wrap' ); |
| 42 | ?> |
| 43 | |
| 44 | <div class="tutor-wrap tutor-dashboard tutor-dashboard-student"> |
| 45 | <div class="tutor-container"> |
| 46 | <div class="tutor-row"> |
| 47 | <div class="tutor-col-12"> |
| 48 | <div class="tutor-dashboard-header"> |
| 49 | <div class="tutor-dashboard-header-avatar"> |
| 50 | <img src="<?php echo esc_url( get_avatar_url( $user_id, array( 'size' => 150 ) ) ); ?>" /> |
| 51 | </div> |
| 52 | <div class="tutor-dashboard-header-info"> |
| 53 | <div class="tutor-dashboard-header-display-name"> |
| 54 | <h4> |
| 55 | <strong> |
| 56 | <?php echo $user->display_name; ?> |
| 57 | </strong> |
| 58 | </h4> |
| 59 | </div> |
| 60 | <?php $instructor_rating = tutils()->get_instructor_ratings( $user->ID ); ?> |
| 61 | <?php |
| 62 | if ( current_user_can( tutor()->instructor_role ) ) { |
| 63 | ?> |
| 64 | <div class="tutor-dashboard-header-stats"> |
| 65 | <div class="tutor-dashboard-header-ratings"> |
| 66 | <?php tutils()->star_rating_generator( $instructor_rating->rating_avg ); ?> |
| 67 | <span><?php echo esc_html( $instructor_rating->rating_avg ); ?></span> |
| 68 | <span> (<?php echo sprintf( __( '%d Ratings', 'tutor' ), $instructor_rating->rating_count ); ?>) </span> |
| 69 | </div> |
| 70 | <!--<div class="tutor-dashboard-header-notifications"> |
| 71 | <?php /*_e('Notification'); */ ?> <span>9</span> |
| 72 | </div>--> |
| 73 | </div> |
| 74 | <?php } ?> |
| 75 | </div> |
| 76 | |
| 77 | <div class="tutor-dashboard-header-button"> |
| 78 | <?php |
| 79 | do_action( 'tutor_dashboard/before_header_button' ); |
| 80 | $instructor_status = tutor_utils()->instructor_status(); |
| 81 | $instructor_status = is_string( $instructor_status ) ? strtolower( $instructor_status ) : ''; |
| 82 | $rejected_on = get_user_meta( $user->ID, '_is_tutor_instructor_rejected', true ); |
| 83 | $info_style = 'vertical-align: middle; margin-right: 7px;'; |
| 84 | $info_message_style = 'display:inline-block; color:#7A7A7A; font-size: 15px;'; |
| 85 | |
| 86 | ob_start(); |
| 87 | if ( tutils()->get_option( 'enable_become_instructor_btn' ) ) { |
| 88 | ?> |
| 89 | <a id="tutor-become-instructor-button" style="vertical-align:middle" class="tutor-btn bordered-btn" href="<?php echo esc_url( tutils()->instructor_register_url() ); ?>"> |
| 90 | <i class="tutor-icon-man-user"></i> <?php _e( 'Become an instructor', 'tutor' ); ?> |
| 91 | </a> |
| 92 | <?php |
| 93 | } |
| 94 | $become_button = ob_get_clean(); |
| 95 | |
| 96 | if ( current_user_can( tutor()->instructor_role ) ) { |
| 97 | $course_type = tutor()->course_post_type; |
| 98 | ?> |
| 99 | <a class="tutor-btn bordered-btn" href="<?php echo esc_url( apply_filters( 'frontend_course_create_url', admin_url( 'post-new.php?post_type=' . tutor()->course_post_type ) ) ); ?>"> |
| 100 | <i class="tutor-icon-checkbox-pen-outline"></i> <?php _e( 'Add A New Course', 'tutor' ); ?> |
| 101 | </a> |
| 102 | <?php |
| 103 | } elseif ( $instructor_status == 'pending' ) { |
| 104 | $on = get_user_meta( $user->ID, '_is_tutor_instructor', true ); |
| 105 | $on = date( 'd F, Y', $on ); |
| 106 | echo '<span style="' . $info_message_style . '"> |
| 107 | <i class="dashicons dashicons-info" style="color:#E53935; ' . $info_style . '"></i>'. |
| 108 | __( 'Your Application is pending from', 'tutor' ). |
| 109 | ' <b>'. |
| 110 | $on. |
| 111 | '</b>'. |
| 112 | '</span>'; |
| 113 | } elseif ( $rejected_on || $instructor_status !== 'blocked' ) { |
| 114 | echo $become_button; |
| 115 | } |
| 116 | ?> |
| 117 | </div> |
| 118 | |
| 119 | <?php |
| 120 | if ( $instructor_status != 'approved' |
| 121 | && $instructor_status != 'pending' |
| 122 | && $rejected_on |
| 123 | && get_user_meta( get_current_user_id(), 'tutor_instructor_show_rejection_message', true ) |
| 124 | ) { |
| 125 | ?> |
| 126 | <div class="tutor-instructor-rejection-notice"> |
| 127 | <?php |
| 128 | $on = date( 'd F, Y', $rejected_on ); |
| 129 | |
| 130 | echo '<span> |
| 131 | <i class="dashicons dashicons-info"></i>', |
| 132 | __( 'Your application to become an instructor was rejected on', 'tutor' ) . ' ' . $on . |
| 133 | '</span> |
| 134 | <a href="?tutor_action=hide_instructor_notice"> |
| 135 | ✕ |
| 136 | </a>'; |
| 137 | ?> |
| 138 | </div> |
| 139 | <?php |
| 140 | } |
| 141 | ?> |
| 142 | </div> |
| 143 | </div> |
| 144 | <?php do_action( 'tutor_dashboard/notification_area' ); ?> |
| 145 | </div> |
| 146 | |
| 147 | <div class="tutor-row"> |
| 148 | <div class="tutor-col-3 tutor-dashboard-left-menu"> |
| 149 | <ul class="tutor-dashboard-permalinks"> |
| 150 | <?php |
| 151 | $dashboard_pages = tutils()->tutor_dashboard_nav_ui_items(); |
| 152 | foreach ( $dashboard_pages as $dashboard_key => $dashboard_page ) { |
| 153 | $menu_title = $dashboard_page; |
| 154 | $menu_link = tutils()->get_tutor_dashboard_page_permalink( $dashboard_key ); |
| 155 | $separator = false; |
| 156 | if ( is_array( $dashboard_page ) ) { |
| 157 | $menu_title = tutils()->array_get( 'title', $dashboard_page ); |
| 158 | // Add new menu item property "url" for custom link |
| 159 | if ( isset( $dashboard_page['url'] ) ) { |
| 160 | $menu_link = $dashboard_page['url']; |
| 161 | } |
| 162 | if ( isset( $dashboard_page['type'] ) && $dashboard_page['type'] == 'separator' ) { |
| 163 | $separator = true; |
| 164 | } |
| 165 | } |
| 166 | if ( $separator ) { |
| 167 | echo '<li class="tutor-dashboard-menu-divider"></li>'; |
| 168 | if ( $menu_title ) { |
| 169 | echo '<li class="tutor-dashboard-menu-divider-header">' . $menu_title . '</li>'; |
| 170 | } |
| 171 | } else { |
| 172 | $li_class = 'tutor-dashboard-menu-' . $dashboard_key; |
| 173 | if ( $dashboard_key === 'index' ) { |
| 174 | $dashboard_key = ''; |
| 175 | } |
| 176 | $active_class = $dashboard_key == $dashboard_page_slug ? 'active' : ''; |
| 177 | echo '<li class="' . $li_class . ' ' . $active_class . '"><a href="' . esc_url( $menu_link ) . '"> ' . $menu_title . ' </a> </li>'; |
| 178 | } |
| 179 | } |
| 180 | ?> |
| 181 | </ul> |
| 182 | </div> |
| 183 | |
| 184 | <div class="tutor-col-9"> |
| 185 | <div class="tutor-dashboard-content"> |
| 186 | <?php |
| 187 | |
| 188 | if ( $dashboard_page_name ) { |
| 189 | do_action( 'tutor_load_dashboard_template_before', $dashboard_page_name ); |
| 190 | |
| 191 | /** |
| 192 | * Load dashboard template part from other location |
| 193 | * |
| 194 | * this filter is basically added for adding templates from respective addons |
| 195 | * |
| 196 | * @since version 1.9.3 |
| 197 | */ |
| 198 | $other_location = ''; |
| 199 | $from_other_location = apply_filters( 'load_dashboard_template_part_from_other_location', $other_location ); |
| 200 | |
| 201 | if ( $from_other_location == '' ) { |
| 202 | tutor_load_template( 'dashboard.' . $dashboard_page_name ); |
| 203 | } else { |
| 204 | // load template from other location full abspath |
| 205 | include_once $from_other_location; |
| 206 | } |
| 207 | |
| 208 | do_action( 'tutor_load_dashboard_template_before', $dashboard_page_name ); |
| 209 | } else { |
| 210 | tutor_load_template( 'dashboard.dashboard' ); |
| 211 | } |
| 212 | ?> |
| 213 | </div> |
| 214 | </div> |
| 215 | </div> |
| 216 | </div> |
| 217 | </div> |
| 218 | |
| 219 | <?php do_action( 'tutor_dashboard/after/wrap' ); ?> |
| 220 | |
| 221 | <?php |
| 222 | if ( ! $is_by_short_code && ! defined( 'OTLMS_VERSION' ) ) { |
| 223 | tutor_utils()->tutor_custom_footer(); |
| 224 | } |
| 225 |