announcements
4 years ago
assignments
4 years ago
elements
4 years ago
enrolled-courses
4 years ago
instructor
4 years ago
my-courses
4 years ago
my-quiz-attempts
4 years ago
notifications
4 years ago
question-answer
4 years ago
quiz-attempts
4 years ago
reviews
4 years ago
settings
4 years ago
withdraw-method-fields
4 years ago
announcements.php
4 years ago
assignments.php
4 years ago
create-course.php
4 years ago
dashboard-menu.php
4 years ago
dashboard.php
4 years ago
enrolled-courses.php
4 years ago
index.php
4 years ago
logged-in.php
4 years ago
my-courses.php
4 years ago
my-profile.php
4 years ago
my-quiz-attempts.php
4 years ago
purchase_history.php
4 years ago
question-answer.php
4 years ago
quiz-attempts.php
4 years ago
registration.php
4 years ago
reviews.php
4 years ago
settings.php
4 years ago
wishlist.php
4 years ago
withdraw.php
4 years ago
dashboard.php
392 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package TutorLMS/Templates |
| 5 | * @version 1.4.3 |
| 6 | */ |
| 7 | |
| 8 | if ( tutor_utils()->get_option( 'enable_profile_completion' ) ) { |
| 9 | $profile_completion = tutor_utils()->user_profile_completion(); |
| 10 | $is_instructor = tutor_utils()->is_instructor(null, true); |
| 11 | $total_count = count( $profile_completion ); |
| 12 | $incomplete_count = count( |
| 13 | array_filter( |
| 14 | $profile_completion, |
| 15 | function( $data ) { |
| 16 | return ! $data['is_set']; |
| 17 | } |
| 18 | ) |
| 19 | ); |
| 20 | $complete_count = $total_count - $incomplete_count; |
| 21 | |
| 22 | if ( $is_instructor ) { |
| 23 | if ( isset($total_count) && isset($incomplete_count) && $incomplete_count <= $total_count ) { |
| 24 | ?> |
| 25 | <div class="profile-completion tutor-mb-40"> |
| 26 | <div class="tutor-row tutor-align-items-center"> |
| 27 | <div class="tutor-col-lg-7 profile-completion-content <?php echo tutor_utils()->is_instructor() ? 'tutor-profile-completion-content-admin' : ''; ?>"> |
| 28 | <div class="list-item-title tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 29 | <?php esc_html_e( 'Complete Your Profile', 'tutor' ); ?> |
| 30 | </div> |
| 31 | <div class="tutor-mt-12 tutor-align-items-center" style="display: grid; grid-template-columns: repeat(<?php echo $total_count + 1; ?>, 1fr); "> |
| 32 | <?php |
| 33 | for ( $i = 1; $i <= $total_count; $i++ ) { |
| 34 | $class = $i > $complete_count ? |
| 35 | 'tutor-btn tutor-btn-sm tutor-btn-disable tutor-no-hover tutor-btn-full' : |
| 36 | 'tutor-btn tutor-btn-sm tutor-btn-full' |
| 37 | ?> |
| 38 | <li class="<?php echo "tutor-profile-complete-dash-{$total_count}"; ?> tutor-mr-8"> |
| 39 | <span class="<?php echo $class; ?>"></span> |
| 40 | </li> |
| 41 | <?php |
| 42 | } |
| 43 | ?> |
| 44 | <li> |
| 45 | <span class="tutor-round-icon"> |
| 46 | <i class="tutor-icon-award-filled"></i> |
| 47 | </span> |
| 48 | </li> |
| 49 | </div> |
| 50 | <div class="list-item-title tutor-fs-6 tutor-fw-normal tutor-mt-20"> |
| 51 | <?php |
| 52 | $profile_complete_text = "Please complete profile"; |
| 53 | if($complete_count > ( $total_count / 2 ) && $complete_count < $total_count) { |
| 54 | $profile_complete_text = 'You are almost done'; |
| 55 | } else if($complete_count === $total_count) { |
| 56 | $profile_complete_text = 'Thanks for completing your profile'; |
| 57 | } |
| 58 | $profile_complete_status = _e($profile_complete_text, 'tutor'); |
| 59 | |
| 60 | ?> |
| 61 | <span class="tutor-color-muted"><?php $profile_complete_status ?></span>: |
| 62 | <span class="tutor-color-black"> |
| 63 | <?php echo $complete_count . '/' . $total_count; ?> |
| 64 | </span> |
| 65 | </div> |
| 66 | </div> |
| 67 | <div class="tutor-col-lg-5 profile-completion-items warning"> |
| 68 | <ul class="tutor-m-0 tutor-p-0"> |
| 69 | <?php |
| 70 | foreach ( $profile_completion as $key => $data ) { |
| 71 | $is_set = $data['is_set']; // Whether the step is done or not |
| 72 | ?> |
| 73 | <li class="tutor-d-flex tutor-align-items-center"> |
| 74 | <?php if ( $is_set ) : ?> |
| 75 | <span class="icon tutor-icon-tick-circle-outline-filled not-empty tutor-mr-8"></span> |
| 76 | <?php else : ?> |
| 77 | <span class="tutor-icon-cross-circle-outline-filled empty tutor-mr-4"></span> |
| 78 | <?php endif; ?> |
| 79 | |
| 80 | <span class="<?php echo $is_set ? 'tutor-color-black-70' : 'tutor-color-muted'; ?>"> |
| 81 | <?php echo $data['label_html']; ?> |
| 82 | </span> |
| 83 | </li> |
| 84 | <?php |
| 85 | } |
| 86 | ?> |
| 87 | </ul> |
| 88 | </div> |
| 89 | </div> |
| 90 | </div> |
| 91 | <?php |
| 92 | } |
| 93 | } else { |
| 94 | if ( ! $profile_completion['_tutor_profile_photo']['is_set'] ) { |
| 95 | $alert_message = sprintf( |
| 96 | '<div class="tutor-alert tutor-primary"> |
| 97 | <div class="tutor-alert-text"> |
| 98 | <span class="tutor-alert-icon tutor-icon-34 tutor-icon-circle-outline-info-filled tutor-mr-12"></span> |
| 99 | <span> |
| 100 | %s |
| 101 | </span> |
| 102 | </div> |
| 103 | <div class="tutor-alert-btns"> |
| 104 | <div class="alert-btn-group"> |
| 105 | <a href="%s" class="tutor-btn tutor-btn-sm">Click Here</a> |
| 106 | </div> |
| 107 | </div> |
| 108 | </div>', |
| 109 | $profile_completion['_tutor_profile_photo']['label_html'], |
| 110 | tutor_utils()->tutor_dashboard_url( 'settings' ) |
| 111 | ); |
| 112 | |
| 113 | echo $alert_message; |
| 114 | // echo '<div class="tutor-alert tutor-warning"> |
| 115 | // <div class="tutor-alert-text"> |
| 116 | // <span class="tutor-alert-icon tutor-icon-34 tutor-icon-circle-outline-info-filled tutor-mr-12"></span> |
| 117 | // <span> |
| 118 | // {$profile_completion["_tutor_profile_photo"]["label_html"]} |
| 119 | // </span> |
| 120 | // </div> |
| 121 | // <div class="tutor-alert-btns"> |
| 122 | // <span class="tutor-alert-close tutor-icon-28 tutor-color-black-40 tutor-icon-cross-filled"></span> |
| 123 | // </div> |
| 124 | // </div>'; |
| 125 | |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | ?> |
| 130 | |
| 131 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-capitalize-text tutor-mb-24 tutor-dashboard-title"><?php _e( 'Dashboard', 'tutor' ); ?></div> |
| 132 | <!-- <h3 class="tutor-dashboard-title"><?php // _e('Dashboard', 'tutor'); ?></h3> --> |
| 133 | |
| 134 | <div class="tutor-dashboard-content-inner"> |
| 135 | |
| 136 | <?php |
| 137 | $enrolled_course = tutor_utils()->get_enrolled_courses_by_user(); |
| 138 | $completed_courses = tutor_utils()->get_completed_courses_ids_by_user(); |
| 139 | $total_students = tutor_utils()->get_total_students_by_instructor( get_current_user_id() ); |
| 140 | $my_courses = tutor_utils()->get_courses_by_instructor( get_current_user_id(), 'publish' ); |
| 141 | $earning_sum = tutor_utils()->get_earning_sum(); |
| 142 | |
| 143 | $enrolled_course_count = $enrolled_course ? $enrolled_course->post_count : 0; |
| 144 | $completed_course_count = count( $completed_courses ); |
| 145 | $active_course_count = $enrolled_course_count - $completed_course_count; |
| 146 | $active_course_count < 0 ? $active_course_count = 0 : 0; |
| 147 | |
| 148 | $status_translations = array( |
| 149 | 'publish' => __( 'Published', 'tutor' ), |
| 150 | 'pending' => __( 'Pending', 'tutor' ), |
| 151 | 'trash' => __( 'Trash', 'tutor' ), |
| 152 | ); |
| 153 | |
| 154 | ?> |
| 155 | |
| 156 | <div class="tutor-row tutor-dashboard-cards-container"> |
| 157 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-6 tutor-col-lg-4"> |
| 158 | <p> |
| 159 | <span class="tutor-dashboard-round-icon"> |
| 160 | <i class="tutor-icon-book-open-filled"></i> |
| 161 | </span> |
| 162 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $enrolled_course_count ); ?></span> |
| 163 | <span><?php esc_html_e( 'Enrolled Courses', 'tutor' ); ?></span> |
| 164 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $enrolled_course_count ); ?></span> |
| 165 | </p> |
| 166 | </div> |
| 167 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-6 tutor-col-lg-4"> |
| 168 | <p> |
| 169 | <span class="tutor-dashboard-round-icon"> |
| 170 | <i class="tutor-icon-college-graduation-filled"></i> |
| 171 | </span> |
| 172 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $active_course_count ); ?></span> |
| 173 | <span><?php esc_html_e( 'Active Courses', 'tutor' ); ?></span> |
| 174 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $active_course_count ); ?></span> |
| 175 | </p> |
| 176 | </div> |
| 177 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-6 tutor-col-lg-4"> |
| 178 | <p> |
| 179 | <span class="tutor-dashboard-round-icon"> |
| 180 | <i class="tutor-icon-award-filled"></i> |
| 181 | </span> |
| 182 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $completed_course_count ); ?></span> |
| 183 | <span><?php esc_html_e( 'Completed Courses', 'tutor' ); ?></span> |
| 184 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $completed_course_count ); ?></span> |
| 185 | </p> |
| 186 | </div> |
| 187 | |
| 188 | <?php |
| 189 | if ( current_user_can( tutor()->instructor_role ) ) : |
| 190 | ?> |
| 191 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-6 tutor-col-lg-4"> |
| 192 | <p> |
| 193 | <span class="tutor-dashboard-round-icon"> |
| 194 | <i class="tutor-icon-user-graduate-filled"></i> |
| 195 | </span> |
| 196 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $total_students ); ?></span> |
| 197 | <span><?php esc_html_e( 'Total Students', 'tutor' ); ?></span> |
| 198 | <span class="tutor-dashboard-info-val"><?php echo esc_html( $total_students ); ?></span> |
| 199 | </p> |
| 200 | </div> |
| 201 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-6 tutor-col-lg-4"> |
| 202 | <p> |
| 203 | <span class="tutor-dashboard-round-icon"> |
| 204 | <i class="tutor-icon-box-open-filled"></i> |
| 205 | </span> |
| 206 | <span class="tutor-dashboard-info-val"><?php echo esc_html( count( $my_courses ) ); ?></span> |
| 207 | <span><?php esc_html_e( 'Total Courses', 'tutor' ); ?></span> |
| 208 | <span class="tutor-dashboard-info-val"><?php echo esc_html( count( $my_courses ) ); ?></span> |
| 209 | </p> |
| 210 | </div> |
| 211 | <div class="tutor-col-12 tutor-col-sm-6 tutor-col-md-6 tutor-col-lg-4"> |
| 212 | <p> |
| 213 | <span class="tutor-dashboard-round-icon"> |
| 214 | <i class="tutor-icon-coins-filled"></i> |
| 215 | </span> |
| 216 | <span class="tutor-dashboard-info-val"><?php echo tutor_utils()->tutor_price( $earning_sum->instructor_amount ); ?></span> |
| 217 | <span><?php esc_html_e( 'Total Earnings', 'tutor' ); ?></span> |
| 218 | <span class="tutor-dashboard-info-val"><?php echo tutor_utils()->tutor_price( $earning_sum->instructor_amount ); ?></span> |
| 219 | </p> |
| 220 | </div> |
| 221 | <?php |
| 222 | endif; |
| 223 | ?> |
| 224 | </div> |
| 225 | </div> |
| 226 | |
| 227 | <?php |
| 228 | /** |
| 229 | * Active users in progress courses |
| 230 | */ |
| 231 | $placeholder_img = tutor()->url . 'assets/images/placeholder.png'; |
| 232 | $courses_in_progress = tutor_utils()->get_active_courses_by_user( get_current_user_id() ); |
| 233 | ?> |
| 234 | |
| 235 | |
| 236 | <?php if ( tutor_utils()->is_instructor() ) : ?> |
| 237 | <div class="tutor-frontend-dashboard-course-porgress"> |
| 238 | <div class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-capitalize-text tutor-mb-24"> |
| 239 | <?php esc_html_e( 'In Progress Course', 'tutor' ); ?> |
| 240 | </div> |
| 241 | <?php if ( $courses_in_progress && $courses_in_progress->have_posts() ) : ?> |
| 242 | <?php |
| 243 | while ( $courses_in_progress->have_posts() ) : |
| 244 | $courses_in_progress->the_post(); |
| 245 | $tutor_course_img = get_tutor_course_thumbnail_src(); |
| 246 | $course_rating = tutor_utils()->get_course_rating( get_the_ID() ); |
| 247 | $course_progress = tutor_utils()->get_course_completed_percent( get_the_ID(), 0, true ); |
| 248 | $completed_number = 0 === (int) $course_progress['completed_count'] ? 1 : (int) $course_progress['completed_count']; |
| 249 | ?> |
| 250 | <div class="tutor-frontend-dashboard-course-porgress-cards tutor-mb-20"> |
| 251 | <div class="tutor-frontend-dashboard-course-porgress-card tutor-frontend-dashboard-course-porgress-card-horizontal tutor-course-listing-item tutor-course-listing-item-sm tutor-justify-content-start"> |
| 252 | <div class="tutor-course-listing-item-head tutor-d-flex"> |
| 253 | <a href="<?php the_permalink(); ?>" class="tutor-course-listing-thumb-permalink"> |
| 254 | <div class="tutor-course-listing-thumbnail" style="background-image:url(<?php echo empty( esc_url( $tutor_course_img ) ) ? $placeholder_img : esc_url( $tutor_course_img ); ?>)"></div> |
| 255 | </a> |
| 256 | </div> |
| 257 | <div class="tutor-course-listing-item-body tutor-px-32 tutor-pt-24 tutor-pb-20"> |
| 258 | <?php if ( $course_rating ) : ?> |
| 259 | <div class="list-item-rating tutor-d-flex"> |
| 260 | <div class="tutor-ratings tutor-is-sm"> |
| 261 | <?php tutor_utils()->star_rating_generator( $course_rating->rating_avg ); ?> |
| 262 | <div class="tutor-rating-text tutor-color-black-60 tutor-fs-6 tutor-fw-normal"> |
| 263 | <?php echo esc_html( number_format( $course_rating->rating_avg, 2 ) ); ?> |
| 264 | </div> |
| 265 | </div> |
| 266 | </div> |
| 267 | <?php endif; ?> |
| 268 | <div class="list-item-title tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mt-8"> |
| 269 | <a href="<?php the_permalink(); ?>"> |
| 270 | <?php the_title(); ?> |
| 271 | </a> |
| 272 | </div> |
| 273 | <div class="list-item-steps tutor-mt-16"> |
| 274 | <span class="tutor-fs-7 tutor-fw-normal tutor-color-muted"> |
| 275 | <?php esc_html_e( 'Completed Lessons:', 'tutor' ); ?> |
| 276 | </span> |
| 277 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"> |
| 278 | <span> |
| 279 | <?php echo esc_html( $course_progress['completed_count'] ); ?> |
| 280 | </span> |
| 281 | <?php esc_html_e( 'of', 'tutor' ); ?> |
| 282 | <span> |
| 283 | <?php echo esc_html( $course_progress['total_count'] ); ?> |
| 284 | </span> |
| 285 | <?php echo esc_html( _n( 'lesson', 'lessons', $completed_number, 'tutor' ) ); ?> |
| 286 | </span> |
| 287 | </div> |
| 288 | <div class="list-item-progress tutor-mt-32"> |
| 289 | <div class="tutor-fs-6 tutor-fw-normal tutor-color-black-60 tutor-d-flex tutor-align-items-center tutor-justify-content-between"> |
| 290 | <div class="progress-bar tutor-mr-16" style="--progress-value:<?php echo esc_attr( $course_progress['completed_percent'] ); ?>%"><span class="progress-value"></span></div> |
| 291 | <span class="progress-percentage tutor-fs-7 tutor-fw-normal tutor-color-muted"> |
| 292 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black "> |
| 293 | <?php echo esc_html( $course_progress['completed_percent'] . '%' ); ?> |
| 294 | </span><?php esc_html_e( 'Complete', 'tutor' ); ?> |
| 295 | </span> |
| 296 | </div> |
| 297 | </div> |
| 298 | </div> |
| 299 | </div> |
| 300 | </div> |
| 301 | <?php endwhile; ?> |
| 302 | <?php wp_reset_postdata(); ?> |
| 303 | <?php else : ?> |
| 304 | <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?> |
| 305 | <?php endif; ?> |
| 306 | </div> |
| 307 | <?php endif; ?> |
| 308 | |
| 309 | <?php |
| 310 | $instructor_course = tutor_utils()->get_courses_for_instructors( get_current_user_id() ); |
| 311 | |
| 312 | if ( count( $instructor_course ) ) { |
| 313 | $course_badges = array( |
| 314 | 'publish' => 'success', |
| 315 | 'pending' => 'warning', |
| 316 | 'trash' => 'danger', |
| 317 | ); |
| 318 | |
| 319 | ?> |
| 320 | <div class="popular-courses-heading-dashboard tutor-fs-5 tutor-fw-medium tutor-color-black tutor-capitalize-text tutor-mb-24 tutor-mt-md-42 tutor-mt-0"> |
| 321 | <?php esc_html_e( 'My Courses', 'tutor' ); ?> |
| 322 | <a style="float:right" class="tutor-view-all-course" href="<?php echo esc_url( tutor_utils()->tutor_dashboard_url( 'my-courses' ) ); ?>"> |
| 323 | <?php esc_html_e( 'View All', 'tutor' ); ?> |
| 324 | </a> |
| 325 | </div> |
| 326 | <div class="tutor-dashboard-content-inner"> |
| 327 | <table class="tutor-ui-table tutor-ui-table-responsive table-popular-courses"> |
| 328 | <thead> |
| 329 | <tr> |
| 330 | <th> |
| 331 | <span class="text-regular-small tutor-color-black-60"> |
| 332 | <?php esc_html_e( 'Course Name', 'tutor' ); ?> |
| 333 | </span> |
| 334 | </th> |
| 335 | <th class="tutor-table-rows-sorting"> |
| 336 | <div class="inline-flex-center tutor-color-black-60"> |
| 337 | <span class="text-regular-small"><?php esc_html_e( 'Enrolled', 'tutor' ); ?></span> |
| 338 | <span class="tutor-icon-ordering-a-to-z-filled a-to-z-sort-icon tutor-icon-22"></span> |
| 339 | </div> |
| 340 | </th> |
| 341 | <th class="tutor-table-rows-sorting"> |
| 342 | <div class="inline-flex-center tutor-color-black-60"> |
| 343 | <span class="text-regular-small"><?php esc_html_e( 'Rating', 'tutor' ); ?></span> |
| 344 | <span class="tutor-icon-ordering-a-to-z-filled a-to-z-sort-icon tutor-icon-22"></span> |
| 345 | </div> |
| 346 | </th> |
| 347 | </tr> |
| 348 | </thead> |
| 349 | <tbody> |
| 350 | <?php if ( is_array( $instructor_course ) && count( $instructor_course ) ) : ?> |
| 351 | <?php |
| 352 | foreach ( $instructor_course as $course ) : |
| 353 | $enrolled = tutor_utils()->count_enrolled_users_by_course( $course->ID ); |
| 354 | $course_status = isset( $status_translations[ $course->post_status ] ) ? $status_translations[ $course->post_status ] : __( $course->post_status, 'tutor' ); |
| 355 | $course_rating = tutor_utils()->get_course_rating( $course->ID ); |
| 356 | $course_badge = isset( $course_badges[ $course->post_status ] ) ? $course_badges[ $course->post_status ] : 'dark'; |
| 357 | |
| 358 | ?> |
| 359 | <tr> |
| 360 | <td data-th="<?php esc_html_e( 'Course Name', 'tutor' ); ?>" class="column-fullwidth"> |
| 361 | <div class="td-course tutor-fs-6 tutor-fw-medium tutor-color-black"> |
| 362 | <a href="<?php echo esc_url( get_the_permalink( $course->ID ) ); ?>" target="_blank"> |
| 363 | <?php esc_html_e( $course->post_title ); ?> |
| 364 | </a> |
| 365 | </div> |
| 366 | </td> |
| 367 | <td data-th="<?php esc_html_e( 'Enrolled', 'tutor' ); ?>"> |
| 368 | <span class="tutor-fs-7 tutor-fw-medium tutor-color-black"> |
| 369 | <?php esc_html_e( $enrolled ); ?> |
| 370 | </span> |
| 371 | </td> |
| 372 | <td data-th="<?php esc_html_e( 'Rating', 'tutor' ); ?>"> |
| 373 | <div class="td-tutor-rating tutor-fs-6 tutor-fw-normal tutor-color-black-60"> |
| 374 | <?php tutor_utils()->star_rating_generator_v2( $course_rating->rating_avg, null, true ); ?> |
| 375 | </div> |
| 376 | </td> |
| 377 | </tr> |
| 378 | <?php endforeach; ?> |
| 379 | <?php else : ?> |
| 380 | <tr> |
| 381 | <td colspan="100%" class="column-empty-state"> |
| 382 | <?php tutor_utils()->tutor_empty_state( tutor_utils()->not_found_text() ); ?> |
| 383 | </td> |
| 384 | </tr> |
| 385 | <?php endif; ?> |
| 386 | </tbody> |
| 387 | </table> |
| 388 | </div> |
| 389 | <?php |
| 390 | } |
| 391 | ?> |
| 392 |