| @@ -1,72 +1,72 @@ | ||
| 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.12 | |
| 9 | - */ | |
| 10 | - | |
| 11 | -use LearnPress\Helpers\Template; | |
| 12 | -use LearnPress\Models\CourseModel; | |
| 13 | -use LearnPress\TemplateHooks\Course\ListCoursesTemplate; | |
| 14 | - | |
| 15 | -defined( 'ABSPATH' ) || exit(); | |
| 16 | - | |
| 17 | -if ( ! isset( $user ) || ! isset( $course_ids ) || ! isset( $current_page ) || ! isset( $num_pages ) ) { | |
| 18 | - return; | |
| 19 | -} | |
| 20 | -?> | |
| 21 | - | |
| 22 | -<?php if ( $current_page === 1 ) : ?> | |
| 23 | -<div class="lp-archive-courses"> | |
| 24 | - <ul <?php lp_item_course_class( array( 'profile-courses-list' ) ); ?> data-layout="grid" data-size="3"> | |
| 25 | - <?php endif; ?> | |
| 26 | - | |
| 27 | - <?php | |
| 28 | - $template_is_override = Template::check_template_is_override( 'content-course.php' ); | |
| 29 | - $listCoursesTemplate = ListCoursesTemplate::instance(); | |
| 30 | - if ( $template_is_override ) { | |
| 31 | - global $post; | |
| 32 | - } | |
| 33 | - | |
| 34 | - foreach ( $course_ids as $id ) { | |
| 35 | - $course = CourseModel::find( $id, true ); | |
| 36 | - if ( ! $course ) { | |
| 37 | - continue; | |
| 38 | - } | |
| 39 | - | |
| 40 | - if ( $template_is_override ) { | |
| 41 | - $post = get_post( $id ); | |
| 42 | - setup_postdata( $post ); | |
| 43 | - | |
| 44 | - learn_press_get_template( 'content-course.php' ); | |
| 45 | - } else { | |
| 46 | - echo $listCoursesTemplate::render_course( | |
| 47 | - $course, | |
| 48 | - [ | |
| 49 | - 'show_view_students' => true, | |
| 50 | - ] | |
| 51 | - ); | |
| 52 | - } | |
| 53 | - } | |
| 54 | - | |
| 55 | - if ( $template_is_override ) { | |
| 56 | - wp_reset_postdata(); | |
| 57 | - } | |
| 58 | - ?> | |
| 59 | - | |
| 60 | - <?php if ( $current_page === 1 ) : ?> | |
| 61 | - </ul> | |
| 62 | -</div> | |
| 63 | -<?php endif; ?> | |
| 64 | - | |
| 65 | -<?php if ( $num_pages > 1 && $current_page < $num_pages && $current_page === 1 ) : ?> | |
| 66 | - <div class="lp_profile_course_progress__nav"> | |
| 67 | - <button class="lp-button" data-paged="<?php echo absint( $current_page + 1 ); ?>" | |
| 68 | - data-number="<?php echo absint( $num_pages ); ?>"> | |
| 69 | - <?php esc_html_e( 'View more', 'learnpress' ); ?> | |
| 70 | - </button> | |
| 71 | - </div> | |
| 72 | -<?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.12 | |
| 9 | + */ | |
| 10 | + | |
| 11 | +use LearnPress\Helpers\Template; | |
| 12 | +use LearnPress\Models\CourseModel; | |
| 13 | +use LearnPress\TemplateHooks\Course\ListCoursesTemplate; | |
| 14 | + | |
| 15 | +defined( 'ABSPATH' ) || exit(); | |
| 16 | + | |
| 17 | +if ( ! isset( $user ) || ! isset( $course_ids ) || ! isset( $current_page ) || ! isset( $num_pages ) ) { | |
| 18 | + return; | |
| 19 | +} | |
| 20 | +?> | |
| 21 | + | |
| 22 | +<?php if ( $current_page === 1 ) : ?> | |
| 23 | +<div class="lp-archive-courses"> | |
| 24 | + <ul <?php lp_item_course_class( array( 'profile-courses-list' ) ); ?> data-layout="grid" data-size="3"> | |
| 25 | + <?php endif; ?> | |
| 26 | + | |
| 27 | + <?php | |
| 28 | + $template_is_override = Template::check_template_is_override( 'content-course.php' ); | |
| 29 | + $listCoursesTemplate = ListCoursesTemplate::instance(); | |
| 30 | + if ( $template_is_override ) { | |
| 31 | + global $post; | |
| 32 | + } | |
| 33 | + | |
| 34 | + foreach ( $course_ids as $id ) { | |
| 35 | + $course = CourseModel::find( $id, true ); | |
| 36 | + if ( ! $course ) { | |
| 37 | + continue; | |
| 38 | + } | |
| 39 | + | |
| 40 | + if ( $template_is_override ) { | |
| 41 | + $post = get_post( $id ); | |
| 42 | + setup_postdata( $post ); | |
| 43 | + | |
| 44 | + learn_press_get_template( 'content-course.php' ); | |
| 45 | + } else { | |
| 46 | + echo $listCoursesTemplate::render_course( | |
| 47 | + $course, | |
| 48 | + [ | |
| 49 | + 'show_view_students' => true, | |
| 50 | + ] | |
| 51 | + ); | |
| 52 | + } | |
| 53 | + } | |
| 54 | + | |
| 55 | + if ( $template_is_override ) { | |
| 56 | + wp_reset_postdata(); | |
| 57 | + } | |
| 58 | + ?> | |
| 59 | + | |
| 60 | + <?php if ( $current_page === 1 ) : ?> | |
| 61 | + </ul> | |
| 62 | +</div> | |
| 63 | +<?php endif; ?> | |
| 64 | + | |
| 65 | +<?php if ( $num_pages > 1 && $current_page < $num_pages && $current_page === 1 ) : ?> | |
| 66 | + <div class="lp_profile_course_progress__nav"> | |
| 67 | + <button class="lp-button" data-paged="<?php echo absint( $current_page + 1 ); ?>" | |
| 68 | + data-number="<?php echo absint( $num_pages ); ?>"> | |
| 69 | + <?php esc_html_e( 'View more', 'learnpress' ); ?> | |
| 70 | + </button> | |
| 71 | + </div> | |
| 72 | +<?php endif; ?> | |