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