| @@ -1,86 +1,88 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Template for displaying own courses in courses tab of user profile page. | |
| 4 | - * Edit by Nhamdv | |
| 5 | - * | |
| 6 | - * @author ThimPress | |
| 7 | - * @package Learnpress/Templates | |
| 8 | - * @version 4.0.13 | |
| 9 | - */ | |
| 10 | - | |
| 11 | -use LearnPress\Models\CourseModel; | |
| 12 | -use LearnPress\Models\UserItems\UserCourseModel; | |
| 13 | -use LearnPress\TemplateHooks\Course\SingleCourseTemplate; | |
| 14 | -use LearnPress\TemplateHooks\UserItem\UserCourseTemplate; | |
| 15 | - | |
| 16 | -defined( 'ABSPATH' ) || exit(); | |
| 17 | - | |
| 18 | -if ( ! isset( $user ) || ! isset( $course_ids ) || ! isset( $current_page ) || ! isset( $num_pages ) ) { | |
| 19 | - return; | |
| 20 | -} | |
| 21 | - | |
| 22 | -$userCourseTemplate = UserCourseTemplate::instance(); | |
| 23 | -$singleCourseTemplate = SingleCourseTemplate::instance(); | |
| 24 | -?> | |
| 25 | - | |
| 26 | -<?php if ( $current_page === 1 ) : ?> | |
| 27 | -<table class="lp_profile_course_progress lp-list-table"> | |
| 28 | - <thead> | |
| 29 | - <tr class="lp_profile_course_progress__item lp_profile_course_progress__header"> | |
| 30 | - <th></th> | |
| 31 | - <th><?php esc_html_e( 'Name', 'learnpress' ); ?></th> | |
| 32 | - <th><?php esc_html_e( 'Result', 'learnpress' ); ?></th> | |
| 33 | - <th><?php esc_html_e( 'Expiration time', 'learnpress' ); ?></th> | |
| 34 | - <th><?php esc_html_e( 'End time', 'learnpress' ); ?></th> | |
| 35 | - </tr> | |
| 36 | - </thead> | |
| 37 | - <?php endif; ?> | |
| 38 | - <tbody> | |
| 39 | - <?php | |
| 40 | - foreach ( $course_ids as $id ) { | |
| 41 | - $courseModel = CourseModel::find( $id, true ); | |
| 42 | - if ( ! $courseModel ) { | |
| 43 | - continue; | |
| 44 | - } | |
| 45 | - | |
| 46 | - $userCourseModel = UserCourseModel::find( $user->get_id(), $id, true ); | |
| 47 | - if ( ! $userCourseModel ) { | |
| 48 | - continue; | |
| 49 | - } | |
| 50 | - | |
| 51 | - $course_result = $userCourseModel->calculate_course_results(); | |
| 52 | - ?> | |
| 53 | - <tr class="lp_profile_course_progress__item"> | |
| 54 | - <td> | |
| 55 | - <a href="<?php echo $courseModel->get_permalink(); ?>" title="<?php echo $courseModel->get_title(); ?>"> | |
| 56 | - <?php echo wp_kses_post( $singleCourseTemplate->html_image( $courseModel ) ); ?> | |
| 57 | - </a> | |
| 58 | - </td> | |
| 59 | - <td> | |
| 60 | - <a href="<?php echo $courseModel->get_permalink(); ?>" | |
| 61 | - title="<?php echo $courseModel->get_title(); ?>"> | |
| 62 | - <?php echo wp_kses_post( $singleCourseTemplate->html_title( $courseModel ) ); ?> | |
| 63 | - </a> | |
| 64 | - </td> | |
| 65 | - <td><?php echo esc_html( $course_result['result'] ); ?>%</td> | |
| 66 | - <td> | |
| 67 | - <?php echo $userCourseTemplate->html_expire_date_time( $userCourseModel ); ?> | |
| 68 | - </td> | |
| 69 | - <td><?php echo $userCourseTemplate->html_end_date_time( $userCourseModel ); ?></td> | |
| 70 | - </tr> | |
| 71 | - <?php | |
| 72 | - } | |
| 73 | - ?> | |
| 74 | - </tbody> | |
| 75 | - <?php if ( $current_page === 1 ) : ?> | |
| 76 | -</table> | |
| 77 | -<?php endif; ?> | |
| 78 | - | |
| 79 | -<?php if ( $num_pages > 1 && $current_page < $num_pages && $current_page === 1 ) : ?> | |
| 80 | - <div class="lp_profile_course_progress__nav"> | |
| 81 | - <button class="lp-button" | |
| 82 | - data-paged="<?php echo absint( $current_page + 1 ); ?>" | |
| 83 | - data-number="<?php echo absint( $num_pages ); ?>"><?php esc_html_e( 'View more', 'learnpress' ); ?> | |
| 84 | - </button> | |
| 85 | - </div> | |
| 86 | -<?php endif; ?> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Template for displaying own courses in courses tab of user profile page. | |
| 4 | + * Edit by Nhamdv | |
| 5 | + * | |
| 6 | + * @author ThimPress | |
| 7 | + * @package Learnpress/Templates | |
| 8 | + * @version 4.0.13 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +use LearnPress\Models\CourseModel; | |
| 12 | +use LearnPress\Models\UserItems\UserCourseModel; | |
| 13 | +use LearnPress\TemplateHooks\Course\SingleCourseTemplate; | |
| 14 | +use LearnPress\TemplateHooks\UserItem\UserCourseTemplate; | |
| 15 | + | |
| 16 | +defined( 'ABSPATH' ) || exit(); | |
| 17 | + | |
| 18 | +if ( ! isset( $user ) || ! isset( $course_ids ) || ! isset( $current_page ) || ! isset( $num_pages ) ) { | |
| 19 | + return; | |
| 20 | +} | |
| 21 | + | |
| 22 | +$userCourseTemplate = UserCourseTemplate::instance(); | |
| 23 | +$singleCourseTemplate = SingleCourseTemplate::instance(); | |
| 24 | +?> | |
| 25 | + | |
| 26 | +<?php if ( $current_page === 1 ) : ?> | |
| 27 | +<div class="lp-table-wrap"> | |
| 28 | + <table class="lp_profile_course_progress lp-list-table"> | |
| 29 | + <thead> | |
| 30 | + <tr class="lp_profile_course_progress__item lp_profile_course_progress__header"> | |
| 31 | + <th></th> | |
| 32 | + <th><?php esc_html_e( 'Name', 'learnpress' ); ?></th> | |
| 33 | + <th><?php esc_html_e( 'Result', 'learnpress' ); ?></th> | |
| 34 | + <th><?php esc_html_e( 'Expiration time', 'learnpress' ); ?></th> | |
| 35 | + <th><?php esc_html_e( 'End time', 'learnpress' ); ?></th> | |
| 36 | + </tr> | |
| 37 | + </thead> | |
| 38 | + <?php endif; ?> | |
| 39 | + <tbody> | |
| 40 | + <?php | |
| 41 | + foreach ( $course_ids as $id ) { | |
| 42 | + $courseModel = CourseModel::find( $id, true ); | |
| 43 | + if ( ! $courseModel ) { | |
| 44 | + continue; | |
| 45 | + } | |
| 46 | + | |
| 47 | + $userCourseModel = UserCourseModel::find( $user->get_id(), $id, true ); | |
| 48 | + if ( ! $userCourseModel ) { | |
| 49 | + continue; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $course_result = $userCourseModel->calculate_course_results(); | |
| 53 | + ?> | |
| 54 | + <tr class="lp_profile_course_progress__item"> | |
| 55 | + <td style="max-width: 100px"> | |
| 56 | + <a href="<?php echo $courseModel->get_permalink(); ?>" title="<?php echo $courseModel->get_title(); ?>"> | |
| 57 | + <?php echo wp_kses_post( $singleCourseTemplate->html_image( $courseModel ) ); ?> | |
| 58 | + </a> | |
| 59 | + </td> | |
| 60 | + <td> | |
| 61 | + <a href="<?php echo $courseModel->get_permalink(); ?>" | |
| 62 | + title="<?php echo $courseModel->get_title(); ?>"> | |
| 63 | + <?php echo wp_kses_post( $singleCourseTemplate->html_title( $courseModel ) ); ?> | |
| 64 | + </a> | |
| 65 | + </td> | |
| 66 | + <td><?php echo esc_html( $course_result['result'] ); ?>%</td> | |
| 67 | + <td> | |
| 68 | + <?php echo $userCourseTemplate->html_expire_date_time( $userCourseModel ); ?> | |
| 69 | + </td> | |
| 70 | + <td><?php echo $userCourseTemplate->html_end_date_time( $userCourseModel ); ?></td> | |
| 71 | + </tr> | |
| 72 | + <?php | |
| 73 | + } | |
| 74 | + ?> | |
| 75 | + </tbody> | |
| 76 | + <?php if ( $current_page === 1 ) : ?> | |
| 77 | + </table> | |
| 78 | +</div> | |
| 79 | +<?php endif; ?> | |
| 80 | + | |
| 81 | +<?php if ( $num_pages > 1 && $current_page < $num_pages && $current_page === 1 ) : ?> | |
| 82 | + <div class="lp_profile_course_progress__nav"> | |
| 83 | + <button class="lp-button" | |
| 84 | + data-paged="<?php echo absint( $current_page + 1 ); ?>" | |
| 85 | + data-number="<?php echo absint( $num_pages ); ?>"><?php esc_html_e( 'View more', 'learnpress' ); ?> | |
| 86 | + </button> | |
| 87 | + </div> | |
| 88 | +<?php endif; ?> | |