PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.7
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.7
4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 4.2.1 All 138 releases
learnpress / templates / single-course / loop-section.php

loop-section.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.7, at templates/single-course/loop-section.php

124 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for displaying loop course of section.
4 *
5 * This template can be overridden by copying it to yourtheme/learnpress/single-course/loop-section.php.
6 *
7 * @author ThimPress
8 * @package Learnpress/Templates
9 * @version 4.0.2
10 */
11
12 defined( 'ABSPATH' ) || exit();
13
14 /**
15 * @var LP_Course_Section $section
16 */
17 if ( ! isset( $section ) || ! isset( $can_view_content_course )
18 || ! isset( $user_course ) || ! isset( $user ) ) {
19 return;
20 }
21
22 $course = learn_press_get_course();
23
24 if ( ! apply_filters( 'learn-press/section-visible', true, $section, $course ) ) {
25 return;
26 }
27
28 /**
29 * List items of section
30 *
31 * @var LP_Course_Item[]
32 */
33 $items = $section->get_items();
34 ?>
35
36 <li <?php $section->main_class(); ?>
37 id="section-<?php echo esc_attr( $section->get_slug() ); ?>"
38 data-id="<?php echo esc_attr( $section->get_slug() ); ?>"
39 data-section-id="<?php echo esc_attr( $section->get_id() ); ?>">
40 <?php do_action( 'learn-press/before-section-summary', $section, $course->get_id() ); ?>
41
42 <div class="section-header">
43 <div class="section-left">
44 <h5 class="section-title">
45 <?php
46 $title = $section->get_title();
47 echo wp_kses_post( ! $title ? _x( 'Untitled', 'template title empty', 'learnpress' ) : $title );
48 ?>
49
50 <?php $description = $section->get_description(); ?>
51
52 <?php if ( $description ) : ?>
53 <p class="section-desc"><?php echo wp_kses_post( $description ); ?></p>
54 <?php endif; ?>
55 </h5>
56
57 <span class="section-toggle">
58 <i class="lp-icon-caret-down"></i>
59 <i class="lp-icon-caret-up"></i>
60 </span>
61 </div>
62
63 <?php if ( $user->has_enrolled_or_finished( $section->get_course_id() ) ) : ?>
64 <?php $percent = $user_course->get_percent_completed_items( '', $section->get_id() ); ?>
65
66 <div class="section-meta">
67 <div class="learn-press-progress" title="<?php echo esc_attr( sprintf( __( 'Section progress %s%%', 'learnpress' ), round( $percent, 2 ) ) ); ?>">
68 <div class="learn-press-progress__active" data-value="<?php echo esc_attr( $percent ); ?>"></div>
69 </div>
70 </div>
71
72 <?php do_action( 'learnpress/single-course/section-header/after', $section ); ?>
73 <?php endif; ?>
74 </div>
75
76 <?php do_action( 'learn-press/before-section-content', $section, $course->get_id() ); ?>
77
78 <?php if ( ! $items ) : ?>
79 <?php learn_press_display_message( __( 'No items in this section', 'learnpress' ) ); ?>
80 <?php else : ?>
81
82 <ul class="section-content">
83
84 <?php
85 foreach ( $items as $item ) :
86 $can_view_item = $user->can_view_item( $item->get_id(), $can_view_content_course );
87 $class_item = implode( ' ', $item->get_class_v2( $course->get_id(), $item->get_id(), $can_view_item ) );
88 ?>
89 <li class="<?php echo esc_attr( $class_item ); ?>"
90 data-id="<?php echo esc_attr( $item->get_id() ); ?>">
91
92 <?php
93 do_action( 'learn-press/before-section-loop-item', $item, $section, $course );
94
95 $item_link = $can_view_item->flag ? $item->get_permalink() : false;
96 $item_link = apply_filters( 'learn-press/section-item-permalink', $item_link, $item, $section, $course );
97 ?>
98
99 <a class="section-item-link" href="<?php echo esc_url_raw( $item_link ? $item_link : 'javascript:void(0);' ); ?>">
100
101 <?php
102 do_action( 'learn-press/before-section-loop-item-title', $item, $section, $course );
103
104 learn_press_get_template(
105 'single-course/section/' . $item->get_template(),
106 array(
107 'item' => $item,
108 'section' => $section,
109 )
110 );
111
112 do_action( 'learn-press/after-section-loop-item-title', $item, $section, $course );
113 ?>
114 </a>
115
116 <?php do_action( 'learn-press/after-section-loop-item', $item, $section, $course ); ?>
117 </li>
118 <?php endforeach; ?>
119 </ul>
120 <?php endif; ?>
121
122 <?php do_action( 'learn-press/after-section-summary', $section, $course->get_id() ); ?>
123 </li>
124