listing.php
8.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
<?php
/**
* LearnDash LD30 Displays a lesson content (topics and quizzes)
*
* Available Variables:
*
* $user_id : The current user ID
* $course_id : The current course ID
*
* $lesson : The current lesson
*
* $topics : An array of the associated topics
*
* @since 3.0.0
*
* @package LearnDash\Templates\LD30
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $course_pager_results;
$lesson_progress = learndash_lesson_progress( $lesson['post'], $course_id );
$is_sample = learndash_is_sample( $lesson['post'] );
$has_pagination = ( isset( $course_pager_results[ $lesson['post']->ID ]['pager'] ) ? true : false );
$table_class = 'ld-table-list ld-topic-list'
. ( true === $is_sample ? ' is_sample' : '' )
. ( ! $has_pagination ? ' ld-no-pagination' : '' );
/**
* Fires before the topic list.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-topic-list-before', $lesson['post']->ID, $course_id, $user_id ); ?>
<div class="
<?php
/**
* Filters lesson listing table CSS class.
*
* @since 3.0.0
*
* @param string $table_class Lesson table CSS class list.
*/
echo esc_attr( apply_filters( 'ld-lesson-table-class', $table_class ) );
?> <?php echo esc_attr( 'ld-expand-' . $lesson['post']->ID ); ?>" id="<?php echo esc_attr( 'ld-expand-' . $lesson['post']->ID ); ?>">
<div class="ld-table-list-header ld-primary-background">
<?php
/**
* Fires before the topic listing header.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-topic-list-heading-before', $lesson['post']->ID, $course_id, $user_id );
?>
<div class="ld-table-list-title">
<span class="ld-item-icon">
<span class="ld-icon ld-icon-content"></span>
</span>
<span class="ld-text">
<?php
// translators: Course Status Label.
echo sprintf( esc_html_x( '%s Content', 'Lesson Content Label', 'learndash' ), esc_attr( LearnDash_Custom_Label::get_label( 'lesson' ) ) );
?>
</span>
</div> <!--/.ld-tablet-list-title-->
<div class="ld-table-list-lesson-details">
<?php
/**
* Fires before the lesson progress stats.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-topic-list-progress-before', $lesson['post']->ID, $course_id, $user_id );
?>
<?php if ( $lesson_progress ) : ?>
<?php
/**
* Filters whether to show lesson progress in lesson listing.
*
* @since 3.0.7.1
*
* @param boolean $show_progress Whether to show lesson progress.
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID
* @param int $user_id User ID
*/
if ( true === (bool) apply_filters( 'learndash_show_lesson_list_progress', true, $lesson['post']->ID, $course_id, $user_id ) ) {
?>
<span class="ld-lesson-list-progress">
<?php
echo sprintf(
// translators: placeholder: Lesson Complete Percentage.
esc_html_x( '%s%% Complete', 'Lesson Complete Percentage', 'learndash' ),
esc_html( $lesson_progress['percentage'] )
);
?>
</span>
<?php } ?>
<?php
/**
* Filters whether to show lesson steps in lesson listing.
*
* @since 3.0.7.1
*
* @param boolean $show_steps Whether to show lesson steps.
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID
* @param int $user_id User ID
*/
if ( true === (bool) apply_filters( 'learndash_show_lesson_list_steps', true, $lesson['post']->ID, $course_id, $user_id ) ) {
?>
<span class="ld-lesson-list-steps">
<?php
echo sprintf(
// translators: placeholder: %1$s: Lesson Steps Complete %2$s: Total lesson steps.
esc_html_x( '%1$d/%2$d Steps', '%1$s: Lesson Steps Complete %2$s: Total lesson steps', 'learndash' ),
esc_html( $lesson_progress['completed'] ),
esc_html( $lesson_progress['total'] )
);
?>
</span>
<?php } ?>
<?php endif; ?>
<?php
/**
* Fires after the lesson progress stats.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-topic-list-progress-after', $lesson['post']->ID, $course_id, $user_id );
?>
<?php if ( 'sfwd-lesson' === get_post_type() ) : ?>
<span class="ld-expand-button" data-ld-expands="<?php echo esc_attr( 'ld-topic-list-' . $lesson['post']->ID ); ?>">
<span class="icon-simple-arrow-down ld-icon">
<span class="ld-text"><?php esc_html_e( 'Expand', 'learndash' ); ?></span>
</span> <!--/.ld-expand-button-->
<?php endif; ?>
</div> <!--/.ld-table-list-lesson-details-->
<?php
/**
* Fires after topic listing header.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-topic-list-heading-after', $lesson['post']->ID, $course_id, $user_id );
?>
</div> <!--/.ld-table-list-header-->
<div class="ld-table-list-items <?php echo esc_attr( 'ld-topic-list-' . $lesson['post']->ID ); ?>" id="<?php echo esc_attr( 'ld-topic-list-' . $lesson['post']->ID ); ?>" data-ld-expand-list>
<?php
if ( $topics && ! empty( $topics ) ) :
foreach ( $topics as $key => $topic ) :
learndash_get_template_part(
'topic/partials/row.php',
array(
'topic' => $topic,
'user_id' => $user_id,
'course_id' => $course_id,
),
true
);
endforeach;
endif;
$show_lesson_quizzes = true;
if ( isset( $course_pager_results[ $lesson['post']->ID ]['pager'] ) && ! empty( $course_pager_results[ $lesson['post']->ID ]['pager'] ) ) :
$show_lesson_quizzes = ( $course_pager_results[ $lesson['post']->ID ]['pager']['paged'] == $course_pager_results[ $lesson['post']->ID ]['pager']['total_pages'] ? true : false );
endif;
/** This filter is documented in themes/ld30/includes/helpers.php */
$show_lesson_quizzes = apply_filters( 'learndash-show-lesson-quizzes', $show_lesson_quizzes, $lesson['post']->ID, $course_id, $user_id );
if ( ! empty( $quizzes ) && $show_lesson_quizzes ) :
foreach ( $quizzes as $quiz ) :
learndash_get_template_part(
'quiz/partials/row.php',
array(
'quiz' => $quiz,
'user_id' => $user_id,
'course_id' => $course_id,
'lesson' => $lesson,
'context' => 'lesson',
),
true
);
endforeach;
endif;
?>
</div> <!--/.ld-table-list-items-->
<div class="ld-table-list-footer">
<?php
/**
* Fires before the course pagination.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-lesson-pagination-before', $lesson['post']->ID, $course_id, $user_id );
if ( isset( $course_pager_results[ $lesson['post']->ID ]['pager'] ) ) {
learndash_get_template_part(
'modules/pagination.php',
array(
'pager_results' => $course_pager_results[ $lesson['post']->ID ]['pager'],
'pager_context' => 'course_topics',
'href_query_arg' => 'ld-topic-page',
'lesson_id' => $lesson['post']->ID,
'course_id' => $course_id,
'href_val_prefix' => $lesson['post']->ID . '-',
),
true
);
}
/**
* Fires after the lesson pagination.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-lesson-pagination-after', $lesson['post']->ID, $course_id, $user_id );
?>
</div> <!--/.ld-table-list-footer-->
</div> <!--/.ld-table-list-->
<?php
/**
* Fires after topic list.
*
* @since 3.0.0
*
* @param int $lesson_id Lesson ID.
* @param int $course_id Course ID.
* @param int $user_id User ID.
*/
do_action( 'learndash-topic-list-after', $lesson['post']->ID, $course_id, $user_id ); ?>