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