course-filter
4 years ago
dashboard
4 years ago
email
4 years ago
global
4 years ago
loop
4 years ago
profile
5 years ago
shortcode
4 years ago
single
4 years ago
template-part
4 years ago
widget
5 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
5 years ago
login.php
5 years ago
permission-denied.php
4 years ago
public-profile-setting.php
5 years ago
single-assignment.php
5 years ago
single-course-enrolled-announcements.php
5 years ago
single-course-enrolled-overview.php
5 years ago
single-course-enrolled-questions.php
5 years ago
single-course-enrolled-subpage.php
5 years ago
single-course-enrolled.php
5 years ago
single-course-instructor.php
5 years ago
single-course.php
4 years ago
single-lesson.php
5 years ago
single-preview-lesson.php
4 years ago
single-quiz.php
4 years ago
student-public-profile.php
5 years ago
template.php
5 years ago
dashboard.php
216 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 | get_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 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><strong><?php echo $user->display_name; ?></strong> </h4> |
| 55 | </div> |
| 56 | <?php $instructor_rating = tutils()->get_instructor_ratings($user->ID); ?> |
| 57 | <?php |
| 58 | if (current_user_can(tutor()->instructor_role)){ |
| 59 | ?> |
| 60 | <div class="tutor-dashboard-header-stats"> |
| 61 | <div class="tutor-dashboard-header-ratings"> |
| 62 | <?php tutils()->star_rating_generator($instructor_rating->rating_avg); ?> |
| 63 | <span><?php echo esc_html($instructor_rating->rating_avg); ?></span> |
| 64 | <span> (<?php echo sprintf(__('%d Ratings', 'tutor'), $instructor_rating->rating_count); ?>) </span> |
| 65 | </div> |
| 66 | <!--<div class="tutor-dashboard-header-notifications"> |
| 67 | <?php /*_e('Notification'); */?> <span>9</span> |
| 68 | </div>--> |
| 69 | </div> |
| 70 | <?php } ?> |
| 71 | </div> |
| 72 | |
| 73 | <div class="tutor-dashboard-header-button"> |
| 74 | <?php |
| 75 | do_action( 'tutor_dashboard/before_header_button' ); |
| 76 | $instructor_status = tutor_utils()->instructor_status(); |
| 77 | $instructor_status = is_string($instructor_status) ? strtolower($instructor_status) : ''; |
| 78 | $rejected_on = get_user_meta($user->ID , '_is_tutor_instructor_rejected', true); |
| 79 | $info_style = 'vertical-align: middle; margin-right: 7px;'; |
| 80 | $info_message_style = 'display:inline-block; color:#7A7A7A; font-size: 15px;'; |
| 81 | |
| 82 | ob_start(); |
| 83 | if (tutils()->get_option('enable_become_instructor_btn')) { |
| 84 | ?> |
| 85 | <a id="tutor-become-instructor-button" style="vertical-align:middle" class="tutor-btn bordered-btn" href="<?php echo esc_url(tutils()->instructor_register_url()); ?>"> |
| 86 | <i class="tutor-icon-man-user"></i> <?php _e("Become an instructor", 'tutor'); ?> |
| 87 | </a> |
| 88 | <?php |
| 89 | } |
| 90 | $become_button = ob_get_clean(); |
| 91 | |
| 92 | if(current_user_can(tutor()->instructor_role)){ |
| 93 | $course_type = tutor()->course_post_type; |
| 94 | ?> |
| 95 | <a class="tutor-btn bordered-btn" href="<?php echo apply_filters('frontend_course_create_url', admin_url("post-new.php?post_type=".tutor()->course_post_type)); ?>"> |
| 96 | <i class="tutor-icon-checkbox-pen-outline"></i> <?php _e('Add A New Course', 'tutor'); ?> |
| 97 | </a> |
| 98 | <?php |
| 99 | } |
| 100 | else if($instructor_status=='pending'){ |
| 101 | $on = get_user_meta($user->ID, '_is_tutor_instructor', true); |
| 102 | $on = date('d F, Y', $on); |
| 103 | echo '<span style="'.$info_message_style.'"> |
| 104 | <i class="dashicons dashicons-info" style="color:#E53935; '.$info_style.'"></i>', |
| 105 | __('Your Application is pending from', 'tutor'), ' <b>', $on, '</b>', |
| 106 | '</span>'; |
| 107 | } |
| 108 | else if($rejected_on || $instructor_status!=='blocked'){ |
| 109 | echo $become_button; |
| 110 | } |
| 111 | ?> |
| 112 | </div> |
| 113 | |
| 114 | <?php |
| 115 | if( |
| 116 | $instructor_status != 'approved' && |
| 117 | $instructor_status != 'pending' && |
| 118 | $rejected_on && |
| 119 | get_user_meta( get_current_user_id(), 'tutor_instructor_show_rejection_message', true ) |
| 120 | ) { |
| 121 | ?> |
| 122 | <div class="tutor-instructor-rejection-notice"> |
| 123 | <?php |
| 124 | $on = date('d F, Y', $rejected_on); |
| 125 | echo '<span> |
| 126 | <i class="dashicons dashicons-info"></i>', |
| 127 | __('Your application to become an instructor was rejected on', 'tutor') . ' ' . $on . |
| 128 | '</span> |
| 129 | <a href="?tutor_action=hide_instructor_notice">✕</a>'; |
| 130 | ?> |
| 131 | </div> |
| 132 | <?php |
| 133 | } |
| 134 | ?> |
| 135 | </div> |
| 136 | </div> |
| 137 | <?php do_action('tutor_dashboard/notification_area'); ?> |
| 138 | </div> |
| 139 | |
| 140 | <div class="tutor-row"> |
| 141 | <div class="tutor-col-3 tutor-dashboard-left-menu"> |
| 142 | <ul class="tutor-dashboard-permalinks"> |
| 143 | <?php |
| 144 | $dashboard_pages = tutils()->tutor_dashboard_nav_ui_items(); |
| 145 | foreach ($dashboard_pages as $dashboard_key => $dashboard_page) { |
| 146 | $menu_title = $dashboard_page; |
| 147 | $menu_link = tutils()->get_tutor_dashboard_page_permalink($dashboard_key); |
| 148 | $separator = false; |
| 149 | if (is_array($dashboard_page)){ |
| 150 | $menu_title = tutils()->array_get('title', $dashboard_page); |
| 151 | //Add new menu item property "url" for custom link |
| 152 | if (isset($dashboard_page['url'])) { |
| 153 | $menu_link = $dashboard_page['url']; |
| 154 | } |
| 155 | if (isset($dashboard_page['type']) && $dashboard_page['type'] == 'separator') { |
| 156 | $separator = true; |
| 157 | } |
| 158 | } |
| 159 | if ($separator) { |
| 160 | echo '<li class="tutor-dashboard-menu-divider"></li>'; |
| 161 | if ($menu_title) { |
| 162 | echo "<li class='tutor-dashboard-menu-divider-header'>{$menu_title}</li>"; |
| 163 | } |
| 164 | } else { |
| 165 | $li_class = "tutor-dashboard-menu-{$dashboard_key}"; |
| 166 | if ($dashboard_key === 'index') |
| 167 | $dashboard_key = ''; |
| 168 | $active_class = $dashboard_key == $dashboard_page_slug ? 'active' : ''; |
| 169 | echo "<li class='{$li_class} {$active_class}'><a href='".$menu_link."'> {$menu_title} </a> </li>"; |
| 170 | } |
| 171 | } |
| 172 | ?> |
| 173 | </ul> |
| 174 | </div> |
| 175 | |
| 176 | <div class="tutor-col-9"> |
| 177 | <div class="tutor-dashboard-content"> |
| 178 | <?php |
| 179 | |
| 180 | if ($dashboard_page_name){ |
| 181 | do_action('tutor_load_dashboard_template_before', $dashboard_page_name); |
| 182 | |
| 183 | /** |
| 184 | * Load dashboard template part from other location |
| 185 | * |
| 186 | * this filter is basically added for adding templates from respective addons |
| 187 | * |
| 188 | * @since version 1.9.3 |
| 189 | */ |
| 190 | $other_location = ''; |
| 191 | $from_other_location = apply_filters( 'load_dashboard_template_part_from_other_location', $other_location ); |
| 192 | |
| 193 | if ( $from_other_location == '' ) { |
| 194 | tutor_load_template("dashboard.".$dashboard_page_name); |
| 195 | } else { |
| 196 | //load template from other location full abspath |
| 197 | include_once $from_other_location; |
| 198 | } |
| 199 | |
| 200 | do_action('tutor_load_dashboard_template_before', $dashboard_page_name); |
| 201 | } else { |
| 202 | tutor_load_template("dashboard.dashboard"); |
| 203 | } |
| 204 | ?> |
| 205 | </div> |
| 206 | </div> |
| 207 | </div> |
| 208 | </div> |
| 209 | </div> |
| 210 | |
| 211 | <?php do_action('tutor_dashboard/after/wrap'); ?> |
| 212 | |
| 213 | <?php |
| 214 | if(!$is_by_short_code && !defined( 'OTLMS_VERSION' )) { |
| 215 | get_footer(); |
| 216 | } |