| 1 |
<?php |
| 2 |
/** |
| 3 |
* Template for displaying curriculum tab of single course. |
| 4 |
* |
| 5 |
* @author ThimPress |
| 6 |
* @package Learnpress/Templates |
| 7 |
* @version 4.0.3 |
| 8 |
*/ |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit(); |
| 11 |
|
| 12 |
if ( empty( $args ) ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
if ( isset( $args['section'] ) ) { |
| 17 |
$section = $args['section']; |
| 18 |
} else { |
| 19 |
return; |
| 20 |
} |
| 21 |
?> |
| 22 |
|
| 23 |
<li id="section-<?php echo esc_attr( $section['section_id'] ); ?>" class="section" data-section-id="<?php echo esc_attr( $section['section_id'] ); ?>"> |
| 24 |
<div class="section-header"> |
| 25 |
<div class="section-left"> |
| 26 |
<div class="wrapper-section-title"> |
| 27 |
<h3 class="section-title"> |
| 28 |
<?php echo ! empty( $section['section_name'] ) ? esc_html( $section['section_name'] ) : _x( 'Untitled', 'template title empty', 'learnpress' ); ?> |
| 29 |
</h3> |
| 30 |
<?php if ( ! empty( $section['section_description'] ) ) : ?> |
| 31 |
<p class="section-desc"><?php echo wp_kses_post( $section['section_description'] ); ?></p> |
| 32 |
<?php endif; ?> |
| 33 |
</div> |
| 34 |
|
| 35 |
<span class="section-toggle"> |
| 36 |
<i class="fas fa-caret-down"></i> |
| 37 |
<i class="fas fa-caret-up"></i> |
| 38 |
</span> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
|
| 42 |
<?php |
| 43 |
$controller = new LP_REST_Lazy_Load_Controller(); |
| 44 |
$request = new WP_REST_Request(); |
| 45 |
$request->set_param( 'sectionId', $section['section_id'] ); |
| 46 |
$response = $controller->course_curriculum_items( $request ); |
| 47 |
$object_data = $response->get_data(); |
| 48 |
?> |
| 49 |
<div class="section-item" data-section-id="<?php echo esc_attr( $section['section_id'] ); ?>"> |
| 50 |
<ul class="section-content"> |
| 51 |
<?php echo wp_kses_post( $object_data->data->content ?? $object_data->data ?? $object_data ? $object_data->data->content : '' ); ?> |
| 52 |
</ul> |
| 53 |
|
| 54 |
<?php if ( isset( $object_data ) && ! empty( $object_data->data->pages ) && $object_data->data->pages > 1 ) : ?> |
| 55 |
<div class="section-item__loadmore" data-page="1"> |
| 56 |
<button><?php esc_html_e( 'Show more items', 'learnpress' ); ?></button> |
| 57 |
</div> |
| 58 |
<?php endif; ?> |
| 59 |
</div> |
| 60 |
</li> |
| 61 |
|