| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying user time on course. |
| 4 |
* |
| 5 |
* @author ThimPress |
| 6 |
* @package LearnPress/Templates |
| 7 |
* @version 4.0.1 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
/** |
| 13 |
* @var string $status |
| 14 |
* @var LP_Datetime $start_time |
| 15 |
* @var LP_Datetime $end_time |
| 16 |
* @var LP_Datetime $expiration_time |
| 17 |
*/ |
| 18 |
$time = current_time( 'mysql', true ); |
| 19 |
$user = learn_press_get_current_user(); |
| 20 |
$course = learn_press_get_course(); |
| 21 |
?> |
| 22 |
|
| 23 |
<div class="course-time"> |
| 24 |
<p class="course-time-row"> |
| 25 |
<strong><?php esc_html_e( 'You started on:', 'learnpress' ); ?></strong> |
| 26 |
<time class="entry-date enrolled"><?php echo esc_html( $start_time->format( 'i18n' ) ); ?></time> |
| 27 |
</p> |
| 28 |
<?php if ( in_array( $status, array( learn_press_user_item_in_progress_slug(), 'enrolled' ) ) ) : ?> |
| 29 |
<?php if ( $expiration_time ) : ?> |
| 30 |
<p class="course-time-row"> |
| 31 |
<strong><?php esc_html_e( 'Course will end:', 'learnpress' ); ?></strong> |
| 32 |
<time class="entry-date expire"><?php echo esc_html( $expiration_time->format( 'i18n' ) ); ?></time> |
| 33 |
</p> |
| 34 |
<?php else : ?> |
| 35 |
<p class="course-time-row"> |
| 36 |
<strong><?php esc_html_e( 'Duration:', 'learnpress' ); ?></strong> |
| 37 |
<?php esc_html_e( 'Lifetime', 'learnpress' ); ?> |
| 38 |
</p> |
| 39 |
<?php endif; ?> |
| 40 |
<?php elseif ( $status === 'finished' && $end_time ) : ?> |
| 41 |
<p class="course-time-row"> |
| 42 |
<strong><?php esc_html_e( 'You finished on:', 'learnpress' ); ?></strong> |
| 43 |
<time class="entry-date finished"><?php echo esc_html( $end_time->format( 'i18n' ) ); ?></time> |
| 44 |
</p> |
| 45 |
<?php endif; ?> |
| 46 |
</div> |
| 47 |
|