| 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.10 |
| 9 |
*/ |
| 10 |
|
| 11 |
defined( 'ABSPATH' ) || exit(); |
| 12 |
|
| 13 |
if ( ! isset( $user ) || ! isset( $course_ids ) || ! isset( $current_page ) || ! isset( $num_pages ) ) { |
| 14 |
return; |
| 15 |
} |
| 16 |
?> |
| 17 |
|
| 18 |
<?php if ( $current_page === 1 ) : ?> |
| 19 |
<div class="lp_profile_course_progress"> |
| 20 |
<div class="lp_profile_course_progress__item lp_profile_course_progress__header"> |
| 21 |
<div></div> |
| 22 |
<div><?php esc_html_e( 'Name', 'learnpress' ); ?></div> |
| 23 |
<div><?php esc_html_e( 'Result', 'learnpress' ); ?></div> |
| 24 |
<div><?php esc_html_e( 'Expiration time', 'learnpress' ); ?></div> |
| 25 |
<div><?php esc_html_e( 'End time', 'learnpress' ); ?></div> |
| 26 |
</div> |
| 27 |
<?php endif; ?> |
| 28 |
|
| 29 |
<?php |
| 30 |
global $post; |
| 31 |
|
| 32 |
foreach ( $course_ids as $id ) { |
| 33 |
$course = learn_press_get_course( $id ); |
| 34 |
|
| 35 |
if ( ! $course ) { |
| 36 |
continue; |
| 37 |
} |
| 38 |
|
| 39 |
$post = get_post( $id ); |
| 40 |
setup_postdata( $post ); |
| 41 |
|
| 42 |
$course_data = $user->get_course_data( $id ); |
| 43 |
$course_result = $course_data->get_result(); |
| 44 |
?> |
| 45 |
<div class="lp_profile_course_progress__item"> |
| 46 |
<div> |
| 47 |
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> |
| 48 |
<?php echo wp_kses_post( $course->get_image( 'course_thumbnail' ) ); ?> |
| 49 |
</a> |
| 50 |
</div> |
| 51 |
<div><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></div> |
| 52 |
<div><?php echo esc_html( $course_result['result'] ); ?>%</div> |
| 53 |
<div><?php echo ! empty( $course_data->get_expiration_time() ) ? $course_data->get_expiration_time() : '-'; ?></div> |
| 54 |
<div><?php echo ! empty( $course_data->get_end_time() ) ? $course_data->get_end_time() : '-'; ?></div> |
| 55 |
</div> |
| 56 |
<?php |
| 57 |
} |
| 58 |
|
| 59 |
wp_reset_postdata(); |
| 60 |
?> |
| 61 |
|
| 62 |
<?php if ( $current_page === 1 ) : ?> |
| 63 |
</div> |
| 64 |
<?php endif; ?> |
| 65 |
|
| 66 |
<?php if ( $num_pages > 1 && $current_page < $num_pages && $current_page === 1 ) : ?> |
| 67 |
<div class="lp_profile_course_progress__nav"> |
| 68 |
<button data-paged="<?php echo absint( $current_page + 1 ); ?>" |
| 69 |
data-number="<?php echo absint( $num_pages ); ?>"><?php esc_html_e( 'View more', 'learnpress' ); ?></button> |
| 70 |
</div> |
| 71 |
<?php endif; ?> |
| 72 |
|