|
1
|
|
|
<?php |
|
2
|
|
|
if ( ! defined( 'ABSPATH' ) ) exit; |
|
3
|
|
|
/** |
|
4
|
|
|
* List the Course Modules and Lesson in these modules |
|
5
|
|
|
* |
|
6
|
|
|
* Template is hooked into Single Course sensei_single_main_content. It will |
|
7
|
|
|
* only be shown if the course contains modules. |
|
8
|
|
|
* |
|
9
|
|
|
* All lessons shown here will not be included in the list of other lessons. |
|
10
|
|
|
* |
|
11
|
|
|
* @author Automattic |
|
12
|
|
|
* @package Sensei |
|
13
|
|
|
* @category Templates |
|
14
|
|
|
* @version 1.9.0 |
|
15
|
|
|
*/ |
|
16
|
|
|
?> |
|
17
|
|
|
|
|
18
|
|
|
<?php |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Hook runs inside single-course/course-modules.php |
|
22
|
|
|
* |
|
23
|
|
|
* It runs before the modules are shown. This hook fires on the single course page. It will show |
|
24
|
|
|
* irrespective of irrespective the course has any modules or not. |
|
25
|
|
|
* |
|
26
|
|
|
* @since 1.8.0 |
|
27
|
|
|
* |
|
28
|
|
|
*/ |
|
29
|
|
|
do_action('sensei_single_course_modules_before'); |
|
30
|
|
|
|
|
31
|
|
|
?> |
|
32
|
|
|
|
|
33
|
|
|
<?php if( sensei_have_modules() ): ?> |
|
34
|
|
|
|
|
35
|
|
|
<?php while ( sensei_have_modules() ): sensei_setup_module(); ?> |
|
36
|
|
|
<?php if( sensei_module_has_lessons() ): ?> |
|
37
|
|
|
|
|
38
|
|
|
<article class="module"> |
|
39
|
|
|
|
|
40
|
|
|
<?php |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Hook runs inside single-course/course-modules.php |
|
44
|
|
|
* |
|
45
|
|
|
* It runs inside the if statement after the article tag opens just before the modules are shown. This hook will NOT fire if there |
|
46
|
|
|
* are no modules to show. |
|
47
|
|
|
* |
|
48
|
|
|
* @since 1.9.0 |
|
49
|
|
|
* |
|
50
|
|
|
* @hooked Sensei()->modules->course_modules_title - 20 |
|
51
|
|
|
*/ |
|
52
|
|
|
do_action('sensei_single_course_modules_inside_before'); |
|
53
|
|
|
|
|
54
|
|
|
?> |
|
55
|
|
|
|
|
56
|
|
|
<header> |
|
57
|
|
|
|
|
58
|
|
|
<h2> |
|
59
|
|
|
|
|
60
|
|
|
<a href="<?php sensei_the_module_permalink(); ?>" title="<?php sensei_the_module_title_attribute();?>"> |
|
61
|
|
|
|
|
62
|
|
|
<?php sensei_the_module_title(); ?> |
|
63
|
|
|
|
|
64
|
|
|
</a> |
|
65
|
|
|
|
|
66
|
|
|
</h2> |
|
67
|
|
|
|
|
68
|
|
|
</header> |
|
69
|
|
|
|
|
70
|
|
|
<section class="entry"> |
|
71
|
|
|
|
|
72
|
|
|
<?php sensei_the_module_status(); ?> |
|
73
|
|
|
|
|
74
|
|
|
<section class="module-lessons"> |
|
75
|
|
|
|
|
76
|
|
|
<header> |
|
77
|
|
|
|
|
78
|
|
|
<h3><?php _e('Lessons', 'woothemes-sensei') ?></h3> |
|
79
|
|
|
|
|
80
|
|
|
</header> |
|
81
|
|
|
|
|
82
|
|
|
<ul class="lessons-list" > |
|
83
|
|
|
|
|
84
|
|
|
<?php while( sensei_module_has_lessons() ): the_post(); ?> |
|
85
|
|
|
|
|
86
|
|
|
<li class="<?php sensei_the_lesson_status_class();?>"> |
|
87
|
|
|
|
|
88
|
|
|
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute() ?>" > |
|
89
|
|
|
|
|
90
|
|
|
<?php the_title(); ?> |
|
91
|
|
|
|
|
92
|
|
|
<?php |
|
93
|
|
|
$course_id = Sensei()->lesson->get_course_id( get_the_ID() ); |
|
94
|
|
|
if ( Sensei_Utils::is_preview_lesson( get_the_ID() ) && ! Sensei_Utils::user_started_course( $course_id, get_current_user_id() ) ) { ?> |
|
|
|
|
|
|
95
|
|
|
|
|
96
|
|
|
<span class="preview-label">Free Preview</span> |
|
97
|
|
|
|
|
98
|
|
|
<?php } ?> |
|
99
|
|
|
|
|
100
|
|
|
</a> |
|
101
|
|
|
|
|
102
|
|
|
</li> |
|
103
|
|
|
|
|
104
|
|
|
<?php endwhile; ?> |
|
105
|
|
|
|
|
106
|
|
|
</ul> |
|
107
|
|
|
|
|
108
|
|
|
</section><!-- .module-lessons --> |
|
109
|
|
|
|
|
110
|
|
|
</section> |
|
111
|
|
|
|
|
112
|
|
|
<?php |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Hook runs inside single-course/course-modules.php |
|
116
|
|
|
* |
|
117
|
|
|
* It runs inside the if statement before the closing article tag directly after the modules were shown. |
|
118
|
|
|
* This hook will not trigger if there are no modules to show. |
|
119
|
|
|
* |
|
120
|
|
|
* @since 1.9.0 |
|
121
|
|
|
* |
|
122
|
|
|
*/ |
|
123
|
|
|
do_action('sensei_single_course_modules_inside_after'); |
|
124
|
|
|
|
|
125
|
|
|
?> |
|
126
|
|
|
|
|
127
|
|
|
</article> |
|
128
|
|
|
|
|
129
|
|
|
<?php endif; //sensei_module_has_lessons ?> |
|
130
|
|
|
|
|
131
|
|
|
<?php endwhile; // sensei_have_modules ?> |
|
132
|
|
|
|
|
133
|
|
|
<?php endif; // sensei_have_modules ?> |
|
134
|
|
|
|
|
135
|
|
|
<?php |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* Hook runs inside single-course/course-modules.php |
|
139
|
|
|
* |
|
140
|
|
|
* It runs after the modules are shown. This hook fires on the single course page,but only if the course has modules. |
|
141
|
|
|
* |
|
142
|
|
|
* @since 1.8.0 |
|
143
|
|
|
*/ |
|
144
|
|
|
do_action('sensei_single_course_modules_after'); |
|
145
|
|
|
|
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.