-
Notifications
You must be signed in to change notification settings - Fork 139
Expand file tree
/
Copy pathLesson.js
More file actions
205 lines (193 loc) · 6.43 KB
/
Lesson.js
File metadata and controls
205 lines (193 loc) · 6.43 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
/**
* Lesson Schemas
*
* @since 3.17.0
* @version 3.25.4
*/
define( [], function() {
return window.llms.hooks.applyFilters( 'llms_define_lesson_schema', {
default: {
title: LLMS.l10n.translate( 'General Settings' ),
toggleable: true,
fields: [
[
{
attribute: 'permalink',
id: 'permalink',
type: 'permalink',
},
], [
{
attribute: 'video_embed',
id: 'video-embed',
label: LLMS.l10n.translate( 'Video Embed URL' ),
type: 'video_embed',
},
{
attribute: 'audio_embed',
id: 'audio-embed',
label: LLMS.l10n.translate( 'Audio Embed URL' ),
type: 'audio_embed',
},
], [
{
attribute: 'free_lesson',
id: 'free-lesson',
label: LLMS.l10n.translate( 'Free Lesson' ),
tip: LLMS.l10n.translate( 'Free lessons can be accessed without enrollment.' ),
type: 'switch',
},
{
attribute: 'require_passing_grade',
id: 'require-passing-grade',
label: LLMS.l10n.translate( 'Require Passing Grade on Quiz' ),
tip: LLMS.l10n.translate( 'When enabled, students must pass this quiz before the lesson can be completed.' ),
type: 'switch',
condition: function() {
return ( 'yes' === this.get( 'quiz_enabled' ) );
},
},
{
attribute: 'require_assignment_passing_grade',
id: 'require-assignment-passing-grade',
label: LLMS.l10n.translate( 'Require Passing Grade on Assignment' ),
tip: LLMS.l10n.translate( 'When enabled, students must pass this assignment before the lesson can be completed.' ),
type: 'switch',
condition: function() {
return ( 'undefined' !== window.llms_builder.assignments && 'yes' === this.get( 'assignment_enabled' ) );
},
},
{
attribute: 'points',
id: 'points',
label: LLMS.l10n.translate( 'Lesson Weight' ),
label_after: LLMS.l10n.translate( 'POINTS' ),
min: 0,
max: 99,
tip: LLMS.l10n.translate( 'Determines the weight of the lesson when calculating the overall grade of the course.' ),
tip_position: 'top-left',
type: 'number',
condition: function() {
return ( ( 'yes' === this.get( 'quiz_enabled' ) ) || ( 'undefined' !== window.llms_builder.assignments && 'yes' === this.get( 'assignment_enabled' ) ) );
},
},
], [
{
attribute: 'prerequisite',
condition: function() {
return ( false === this.is_first_in_course() );
},
id: 'prerequisite',
label: LLMS.l10n.translate( 'Prerequisite' ),
switch_attribute: 'has_prerequisite',
type: 'switch-select',
options: function() {
return this.get_available_prereq_options();
},
},
], [
{
label: LLMS.l10n.translate( 'Course Drip Method' ),
id: 'course-drip',
type: 'heading',
condition: function() {
return ( this.get_course() && 'yes' === this.get_course().get( 'lesson_drip' ) && this.get_course().get( 'drip_method' ) );
},
detail: LLMS.l10n.translate( 'Drip settings are currently set at the course level, under the Restrictions settings tab. Disable to allow lesson level drip settings.' ) + ' <a href=\"javascript:document.getElementById(\'llms-exit-button\').click()\">' + LLMS.l10n.translate( 'Edit Course' ) + '</a>',
},
], [
{
label: LLMS.l10n.translate( 'Course Drip Method' ),
id: 'course-drip',
type: 'heading',
condition: function() {
return ( ! this.get_course() || 'yes' !== this.get_course().get( 'lesson_drip' ) || ! this.get_course().get( 'drip_method' ) );
},
detail: LLMS.l10n.translate( 'Drip settings can be set at the course level to release course content at a specified interval, in the Restrictions settings tab.' ) + ' <a href=\"javascript:document.getElementById(\'llms-exit-button\').click()\">' + LLMS.l10n.translate( 'Edit Course' ) + '</a>',
},
], [
{
attribute: 'drip_method',
id: 'drip-method',
label: LLMS.l10n.translate( 'Drip Method' ),
switch_attribute: 'drip_method',
type: 'select',
condition: function() {
return ( ! this.get_course() || 'yes' !== this.get_course().get( 'lesson_drip' ) || ! this.get_course().get( 'drip_method' ) );
},
options: function() {
var options = [
{
key: '',
val: LLMS.l10n.translate( 'None' ),
},
{
key: 'date',
val: LLMS.l10n.translate( 'On a specific date' ),
},
{
key: 'enrollment',
val: LLMS.l10n.translate( '# of days after course enrollment' ),
},
];
if ( this.get_course() && this.get_course().get( 'start_date' ) ) {
options.push( {
key: 'start',
val: LLMS.l10n.translate( '# of days after course start date' ),
} );
}
if ( 'yes' === this.get( 'has_prerequisite' ) ) {
options.push( {
key: 'prerequisite',
val: LLMS.l10n.translate( '# of days after prerequisite lesson completion' ),
} );
}
return options;
},
},
{
attribute: 'days_before_available',
condition: function() {
if ( this.get_course() && 'yes' === this.get_course().get( 'lesson_drip' ) && this.get_course().get( 'drip_method' ) ) {
return false;
}
return ( -1 !== [ 'enrollment', 'start', 'prerequisite' ].indexOf( this.get( 'drip_method' ) ) );
},
id: 'days-before-available',
label: LLMS.l10n.translate( '# of days' ),
min: 0,
type: 'number',
},
{
attribute: 'date_available',
date_format: 'Y-m-d',
condition: function() {
if ( this.get_course() && 'yes' === this.get_course().get( 'lesson_drip' ) && this.get_course().get( 'drip_method' ) ) {
return false;
}
return ( 'date' === this.get( 'drip_method' ) );
},
id: 'date-available',
label: LLMS.l10n.translate( 'Date' ),
timepicker: 'false',
type: 'datepicker',
},
{
attribute: 'time_available',
condition: function() {
if ( this.get_course() && 'yes' === this.get_course().get( 'lesson_drip' ) && this.get_course().get( 'drip_method' ) ) {
return false;
}
return ( 'date' === this.get( 'drip_method' ) );
},
datepicker: 'false',
date_format: 'h:i A',
id: 'time-available',
label: LLMS.l10n.translate( 'Time' ),
type: 'datepicker',
},
],
],
},
} );
} );