|
1
|
|
|
<?php |
|
2
|
|
|
/* For licensing terms, see /license.txt */ |
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Code to display the course settings form (for the course admin) |
|
6
|
|
|
* and activate the changes. |
|
7
|
|
|
* |
|
8
|
|
|
* See ./inc/conf/course_info.conf.php for settings |
|
9
|
|
|
* |
|
10
|
|
|
* @todo Take those config settings into account in this script |
|
11
|
|
|
* |
|
12
|
|
|
* @author Patrick Cool <[email protected]> |
|
13
|
|
|
* @author Roan Embrechts, refactoring and improved course visibility|subscribe|unsubscribe options |
|
14
|
|
|
* @author Julio Montoya <[email protected]> Jquery support + lots of fixes |
|
15
|
|
|
* |
|
16
|
|
|
* @package chamilo.course_info |
|
17
|
|
|
*/ |
|
18
|
|
|
require_once __DIR__.'/../inc/global.inc.php'; |
|
19
|
|
|
$current_course_tool = TOOL_COURSE_SETTING; |
|
20
|
|
|
$this_section = SECTION_COURSES; |
|
21
|
|
|
$nameTools = get_lang('ModifInfo'); |
|
22
|
|
|
api_protect_course_script(true); |
|
23
|
|
|
api_block_anonymous_users(); |
|
24
|
|
|
$_course = api_get_course_info(); |
|
25
|
|
|
$currentCourseRepository = $_course['path']; |
|
26
|
|
|
$isAllowToEdit = api_is_course_admin() || api_is_platform_admin(); |
|
27
|
|
|
$course_code = api_get_course_id(); |
|
28
|
|
|
$courseId = api_get_course_int_id(); |
|
29
|
|
|
$isEditable = true; |
|
30
|
|
|
|
|
31
|
|
|
if (!$isAllowToEdit) { |
|
32
|
|
|
api_not_allowed(true); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
$show_delete_watermark_text_message = false; |
|
36
|
|
|
if (api_get_setting('pdf_export_watermark_by_course') == 'true') { |
|
37
|
|
|
if (isset($_GET['delete_watermark'])) { |
|
38
|
|
|
PDF::delete_watermark($course_code); |
|
|
|
|
|
|
39
|
|
|
$show_delete_watermark_text_message = true; |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
$categories = CourseCategory::getCategoriesCanBeAddedInCourse($_course['categoryCode']); |
|
44
|
|
|
|
|
45
|
|
|
// Build the form |
|
46
|
|
|
$form = new FormValidator( |
|
47
|
|
|
'update_course', |
|
48
|
|
|
'post', |
|
49
|
|
|
api_get_self().'?'.api_get_cidreq() |
|
50
|
|
|
); |
|
51
|
|
|
|
|
52
|
|
|
$form->addHtml('<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">'); |
|
53
|
|
|
|
|
54
|
|
|
// COURSE SETTINGS |
|
55
|
|
|
$form->addHtml('<div class="panel panel-default">'); |
|
56
|
|
|
$form->addHtml(' |
|
57
|
|
|
<div class="panel-heading" role="tab" id="heading-course-settings"> |
|
58
|
|
|
<h4 class="panel-title"> |
|
59
|
|
|
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-course-settings" |
|
60
|
|
|
aria-expanded="true" aria-controls="collapse-course-settings"> |
|
61
|
|
|
'); |
|
62
|
|
|
$form->addHtml( |
|
63
|
|
|
Display::return_icon('settings.png', get_lang('CourseSettings')).' '.get_lang('CourseSettings') |
|
64
|
|
|
); |
|
65
|
|
|
$form->addHtml(' |
|
66
|
|
|
</a> |
|
67
|
|
|
</h4> |
|
68
|
|
|
</div> |
|
69
|
|
|
'); |
|
70
|
|
|
$form->addHtml(' |
|
71
|
|
|
<div id="collapse-course-settings" class="panel-collapse collapse in" role="tabpanel" |
|
72
|
|
|
aria-labelledby="heading-course-settings"> |
|
73
|
|
|
<div class="panel-body"> |
|
74
|
|
|
'); |
|
75
|
|
|
|
|
76
|
|
|
$image = ''; |
|
77
|
|
|
// Display course picture |
|
78
|
|
|
$course_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository; // course path |
|
79
|
|
|
if (file_exists($course_path.'/course-pic85x85.png')) { |
|
80
|
|
|
$course_web_path = api_get_path(WEB_COURSE_PATH).$currentCourseRepository; // course web path |
|
81
|
|
|
$course_medium_image = $course_web_path.'/course-pic85x85.png?'.rand(1, 1000); // redimensioned image 85x85 |
|
82
|
|
|
$image = '<div class="row"><label class="col-md-2 control-label">'.get_lang('Image').'</label> |
|
83
|
|
|
<div class="col-md-8"><img src="'.$course_medium_image.'" /></div></div>'; |
|
84
|
|
|
} |
|
85
|
|
|
$form->addHtml($image); |
|
86
|
|
|
$form->addText('title', get_lang('Title'), true); |
|
87
|
|
|
$form->applyFilter('title', 'html_filter'); |
|
88
|
|
|
$form->applyFilter('title', 'trim'); |
|
89
|
|
|
|
|
90
|
|
|
$form->addElement( |
|
91
|
|
|
'select', |
|
92
|
|
|
'category_code', |
|
93
|
|
|
get_lang('Fac'), |
|
94
|
|
|
$categories, |
|
95
|
|
|
['style' => 'width:350px', 'id' => 'category_code'] |
|
96
|
|
|
); |
|
97
|
|
|
$form->addSelectLanguage( |
|
98
|
|
|
'course_language', |
|
99
|
|
|
[get_lang('Ln'), get_lang('TipLang')] |
|
100
|
|
|
); |
|
101
|
|
|
|
|
102
|
|
|
$group = [ |
|
103
|
|
|
$form->createElement('radio', 'show_course_in_user_language', null, get_lang('Yes'), 1), |
|
104
|
|
|
$form->createElement('radio', 'show_course_in_user_language', null, get_lang('No'), 2), |
|
105
|
|
|
]; |
|
106
|
|
|
|
|
107
|
|
|
$form->addGroup($group, '', [get_lang('ShowCourseInUserLanguage')]); |
|
108
|
|
|
|
|
109
|
|
|
$form->addText('department_name', get_lang('Department'), false); |
|
110
|
|
|
$form->applyFilter('department_name', 'html_filter'); |
|
111
|
|
|
$form->applyFilter('department_name', 'trim'); |
|
112
|
|
|
|
|
113
|
|
|
$form->addText('department_url', get_lang('DepartmentUrl'), false); |
|
114
|
|
|
$form->applyFilter('department_url', 'html_filter'); |
|
115
|
|
|
|
|
116
|
|
|
// Extra fields |
|
117
|
|
|
$extra_field = new ExtraField('course'); |
|
118
|
|
|
|
|
119
|
|
|
$extraFieldAdminPermissions = false; |
|
120
|
|
|
$showOnlyTheseFields = ['tags', 'video_url', 'course_hours_duration']; |
|
121
|
|
|
$extra = $extra_field->addElements( |
|
122
|
|
|
$form, |
|
123
|
|
|
$courseId, |
|
124
|
|
|
[], |
|
125
|
|
|
false, |
|
126
|
|
|
false, |
|
127
|
|
|
$showOnlyTheseFields, |
|
128
|
|
|
[], |
|
129
|
|
|
false |
|
130
|
|
|
); |
|
131
|
|
|
|
|
132
|
|
|
//Tags ExtraField |
|
133
|
|
|
$htmlHeadXtra[] = ' |
|
134
|
|
|
<script> |
|
135
|
|
|
$(function() { |
|
136
|
|
|
'.$extra['jquery_ready_content'].' |
|
137
|
|
|
}); |
|
138
|
|
|
</script>'; |
|
139
|
|
|
|
|
140
|
|
|
// Picture |
|
141
|
|
|
$form->addFile( |
|
142
|
|
|
'picture', |
|
143
|
|
|
get_lang('AddPicture'), |
|
144
|
|
|
['id' => 'picture', 'class' => 'picture-form', 'crop_image' => true] |
|
145
|
|
|
); |
|
146
|
|
|
|
|
147
|
|
|
$allowed_picture_types = api_get_supported_image_extensions(false); |
|
148
|
|
|
$form->addRule( |
|
149
|
|
|
'picture', |
|
150
|
|
|
get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
151
|
|
|
'filetype', |
|
152
|
|
|
$allowed_picture_types |
|
153
|
|
|
); |
|
154
|
|
|
$form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture')); |
|
155
|
|
|
|
|
156
|
|
|
if (api_get_setting('pdf_export_watermark_by_course') == 'true') { |
|
157
|
|
|
$url = PDF::get_watermark($course_code); |
|
158
|
|
|
$form->addText('pdf_export_watermark_text', get_lang('PDFExportWatermarkTextTitle'), false, ['size' => '60']); |
|
159
|
|
|
$form->addElement('file', 'pdf_export_watermark_path', get_lang('AddWaterMark')); |
|
160
|
|
|
if ($url != false) { |
|
|
|
|
|
|
161
|
|
|
$delete_url = '<a href="?delete_watermark">'.Display::return_icon('delete.png', get_lang('DelImage')).'</a>'; |
|
162
|
|
|
$form->addElement( |
|
163
|
|
|
'html', |
|
164
|
|
|
'<div class="row"><div class="formw"><a href="'.$url.'">'.$url.' '.$delete_url.'</a></div></div>' |
|
165
|
|
|
); |
|
166
|
|
|
} |
|
167
|
|
|
$form->addRule( |
|
168
|
|
|
'pdf_export_watermark_path', |
|
169
|
|
|
get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', |
|
170
|
|
|
'filetype', |
|
171
|
|
|
$allowed_picture_types |
|
172
|
|
|
); |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
if (api_get_setting('allow_course_theme') == 'true') { |
|
176
|
|
|
$group = []; |
|
177
|
|
|
$group[] = $form->createElement( |
|
178
|
|
|
'SelectTheme', |
|
179
|
|
|
'course_theme', |
|
180
|
|
|
null, |
|
181
|
|
|
['id' => 'course_theme_id'] |
|
182
|
|
|
); |
|
183
|
|
|
$form->addGroup($group, '', [get_lang('Stylesheets')]); |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
$form->addElement('label', get_lang('DocumentQuota'), format_file_size(DocumentManager::get_course_quota())); |
|
187
|
|
|
|
|
188
|
|
|
$scoreModels = ExerciseLib::getScoreModels(); |
|
189
|
|
|
if (!empty($scoreModels)) { |
|
190
|
|
|
$options = ['' => get_lang('None')]; |
|
191
|
|
|
foreach ($scoreModels['models'] as $item) { |
|
192
|
|
|
$options[$item['id']] = get_lang($item['name']); |
|
193
|
|
|
} |
|
194
|
|
|
$form->addSelect('score_model_id', get_lang('ScoreModel'), $options); |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); |
|
198
|
|
|
$form->addHtml(' |
|
199
|
|
|
</div> |
|
200
|
|
|
</div> |
|
201
|
|
|
'); |
|
202
|
|
|
$form->addHtml('</div>'); |
|
203
|
|
|
|
|
204
|
|
|
// COURSE ACCESS |
|
205
|
|
|
$group = []; |
|
206
|
|
|
$group[] = $form->createElement( |
|
207
|
|
|
'radio', |
|
208
|
|
|
'visibility', |
|
209
|
|
|
get_lang('CourseAccess'), |
|
210
|
|
|
get_lang('OpenToTheWorld'), |
|
211
|
|
|
COURSE_VISIBILITY_OPEN_WORLD |
|
212
|
|
|
); |
|
213
|
|
|
$group[] = $form->createElement( |
|
214
|
|
|
'radio', |
|
215
|
|
|
'visibility', |
|
216
|
|
|
null, |
|
217
|
|
|
get_lang('OpenToThePlatform'), |
|
218
|
|
|
COURSE_VISIBILITY_OPEN_PLATFORM |
|
219
|
|
|
); |
|
220
|
|
|
$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED); |
|
221
|
|
|
$group[] = $form->createElement( |
|
222
|
|
|
'radio', |
|
223
|
|
|
'visibility', |
|
224
|
|
|
null, |
|
225
|
|
|
get_lang('CourseVisibilityClosed'), |
|
226
|
|
|
COURSE_VISIBILITY_CLOSED |
|
227
|
|
|
); |
|
228
|
|
|
|
|
229
|
|
|
// The "hidden" visibility is only available to portal admins |
|
230
|
|
|
if (api_is_platform_admin()) { |
|
231
|
|
|
$group[] = $form->createElement( |
|
232
|
|
|
'radio', |
|
233
|
|
|
'visibility', |
|
234
|
|
|
null, |
|
235
|
|
|
get_lang('CourseVisibilityHidden'), |
|
236
|
|
|
COURSE_VISIBILITY_HIDDEN |
|
237
|
|
|
); |
|
238
|
|
|
} |
|
239
|
|
|
|
|
240
|
|
|
$groupElement = $form->addGroup( |
|
241
|
|
|
$group, |
|
242
|
|
|
'', |
|
243
|
|
|
[get_lang('CourseAccess'), get_lang('CourseAccessConfigTip')], |
|
244
|
|
|
null, |
|
245
|
|
|
null, |
|
246
|
|
|
true |
|
247
|
|
|
); |
|
248
|
|
|
|
|
249
|
|
|
$url = api_get_path(WEB_CODE_PATH)."auth/inscription.php?c=$course_code&e=1"; |
|
250
|
|
|
$url = Display::url($url, $url); |
|
251
|
|
|
$label = $form->addLabel(get_lang('DirectLink'), sprintf(get_lang('CourseSettingsRegisterDirectLink'), $url), true); |
|
252
|
|
|
|
|
253
|
|
|
$group2 = []; |
|
254
|
|
|
$group2[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1); |
|
255
|
|
|
$group2[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0); |
|
256
|
|
|
|
|
257
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
258
|
|
|
|
|
259
|
|
|
$group3[] = $form->createElement( |
|
260
|
|
|
'radio', |
|
261
|
|
|
'unsubscribe', |
|
262
|
|
|
get_lang('Unsubscription'), |
|
263
|
|
|
get_lang('AllowedToUnsubscribe'), |
|
264
|
|
|
1 |
|
265
|
|
|
); |
|
266
|
|
|
$group3[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0); |
|
267
|
|
|
|
|
268
|
|
|
$text = $form->createElement( |
|
269
|
|
|
'text', |
|
270
|
|
|
'course_registration_password', |
|
271
|
|
|
get_lang('CourseRegistrationPassword'), |
|
272
|
|
|
false, |
|
273
|
|
|
['size' => '60'] |
|
274
|
|
|
); |
|
275
|
|
|
|
|
276
|
|
|
$checkBoxActiveLegal = $form->createElement( |
|
277
|
|
|
'checkbox', |
|
278
|
|
|
'activate_legal', |
|
279
|
|
|
[null, get_lang('ShowALegalNoticeWhenEnteringTheCourse')], |
|
280
|
|
|
get_lang('ActivateLegal') |
|
281
|
|
|
); |
|
282
|
|
|
$textAreaLegal = $form->createElement('textarea', 'legal', get_lang('CourseLegalAgreement'), ['rows' => 8]); |
|
283
|
|
|
|
|
284
|
|
|
$elements = [ |
|
285
|
|
|
$groupElement, |
|
286
|
|
|
$label, |
|
287
|
|
|
get_lang('Subscription') => $group2, |
|
288
|
|
|
get_lang('Unsubscription') => $group3, |
|
289
|
|
|
$text, |
|
290
|
|
|
$checkBoxActiveLegal, |
|
291
|
|
|
$textAreaLegal, |
|
292
|
|
|
$myButton, |
|
293
|
|
|
]; |
|
294
|
|
|
|
|
295
|
|
|
$form->addPanelOption( |
|
296
|
|
|
'course-access', |
|
297
|
|
|
Display::return_icon('course.png', get_lang('CourseAccess')).' '.get_lang('CourseAccess'), |
|
298
|
|
|
$elements |
|
299
|
|
|
); |
|
300
|
|
|
|
|
301
|
|
|
// Documents |
|
302
|
|
|
$globalGroup = []; |
|
303
|
|
|
if (api_get_setting('documents_default_visibility_defined_in_course') == 'true') { |
|
304
|
|
|
$group = [ |
|
305
|
|
|
$form->createElement('radio', 'documents_default_visibility', null, get_lang('Visible'), 'visible'), |
|
306
|
|
|
$form->createElement('radio', 'documents_default_visibility', null, get_lang('Invisible'), 'invisible'), |
|
307
|
|
|
]; |
|
308
|
|
|
$globalGroup[get_lang('DocumentsDefaultVisibility')] = $group; |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
$group = [ |
|
312
|
|
|
$form->createElement('radio', 'show_system_folders', null, get_lang('Yes'), 1), |
|
313
|
|
|
$form->createElement('radio', 'show_system_folders', null, get_lang('No'), 2), |
|
314
|
|
|
]; |
|
315
|
|
|
|
|
316
|
|
|
$globalGroup[get_lang('ShowSystemFolders')] = $group; |
|
317
|
|
|
|
|
318
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
319
|
|
|
|
|
320
|
|
|
$group = []; |
|
321
|
|
|
$group[] = $form->createElement( |
|
322
|
|
|
'radio', |
|
323
|
|
|
'enable_document_auto_launch', |
|
324
|
|
|
get_lang('DocumentAutoLaunch'), |
|
325
|
|
|
get_lang('RedirectToTheDocumentList'), |
|
326
|
|
|
1 |
|
327
|
|
|
); |
|
328
|
|
|
$group[] = $form->createElement('radio', 'enable_document_auto_launch', null, get_lang('Deactivate'), 0); |
|
329
|
|
|
$globalGroup[get_lang('DocumentAutoLaunch')] = $group; |
|
330
|
|
|
|
|
331
|
|
|
$globalGroup[] = $myButton; |
|
332
|
|
|
|
|
333
|
|
|
$form->addPanelOption( |
|
334
|
|
|
'documents', |
|
335
|
|
|
Display::return_icon('folder.png', get_lang('Documents')).' '.get_lang('Documents'), |
|
336
|
|
|
$globalGroup |
|
337
|
|
|
); |
|
338
|
|
|
|
|
339
|
|
|
// EMAIL NOTIFICATIONS |
|
340
|
|
|
|
|
341
|
|
|
$globalGroup = []; |
|
342
|
|
|
|
|
343
|
|
|
$group = []; |
|
344
|
|
|
$group[] = $form->createElement( |
|
345
|
|
|
'radio', |
|
346
|
|
|
'email_alert_to_teacher_on_new_user_in_course', |
|
347
|
|
|
get_lang('NewUserEmailAlert'), |
|
348
|
|
|
get_lang('NewUserEmailAlertEnable'), |
|
349
|
|
|
1 |
|
350
|
|
|
); |
|
351
|
|
|
$group[] = $form->createElement( |
|
352
|
|
|
'radio', |
|
353
|
|
|
'email_alert_to_teacher_on_new_user_in_course', |
|
354
|
|
|
null, |
|
355
|
|
|
get_lang('NewUserEmailAlertToTeacharAndTutor'), |
|
356
|
|
|
2 |
|
357
|
|
|
); |
|
358
|
|
|
$group[] = $form->createElement( |
|
359
|
|
|
'radio', |
|
360
|
|
|
'email_alert_to_teacher_on_new_user_in_course', |
|
361
|
|
|
null, |
|
362
|
|
|
get_lang('NewUserEmailAlertDisable'), |
|
363
|
|
|
0 |
|
364
|
|
|
); |
|
365
|
|
|
$globalGroup[get_lang('NewUserEmailAlert')] = $group; |
|
366
|
|
|
|
|
367
|
|
|
$group = []; |
|
368
|
|
|
$group[] = $form->createElement( |
|
369
|
|
|
'radio', |
|
370
|
|
|
'email_alert_students_on_new_homework', |
|
371
|
|
|
get_lang('NewHomeworkEmailAlert'), |
|
372
|
|
|
get_lang('NewHomeworkEmailAlertEnable'), |
|
373
|
|
|
1 |
|
374
|
|
|
); |
|
375
|
|
|
$group[] = $form->createElement( |
|
376
|
|
|
'radio', |
|
377
|
|
|
'email_alert_students_on_new_homework', |
|
378
|
|
|
null, |
|
379
|
|
|
get_lang('NewHomeworkEmailAlertToHrmEnable'), |
|
380
|
|
|
2 |
|
381
|
|
|
); |
|
382
|
|
|
$group[] = $form->createElement( |
|
383
|
|
|
'radio', |
|
384
|
|
|
'email_alert_students_on_new_homework', |
|
385
|
|
|
null, |
|
386
|
|
|
get_lang('NewHomeworkEmailAlertDisable'), |
|
387
|
|
|
0 |
|
388
|
|
|
); |
|
389
|
|
|
$globalGroup[get_lang('NewHomeworkEmailAlert')] = $group; |
|
390
|
|
|
|
|
391
|
|
|
$group = []; |
|
392
|
|
|
$group[] = $form->createElement( |
|
393
|
|
|
'radio', |
|
394
|
|
|
'email_alert_manager_on_new_doc', |
|
395
|
|
|
get_lang('WorkEmailAlert'), |
|
396
|
|
|
get_lang('WorkEmailAlertActivate'), |
|
397
|
|
|
1 |
|
398
|
|
|
); |
|
399
|
|
|
$group[] = $form->createElement( |
|
400
|
|
|
'radio', |
|
401
|
|
|
'email_alert_manager_on_new_doc', |
|
402
|
|
|
null, |
|
403
|
|
|
get_lang('WorkEmailAlertActivateOnlyForTeachers'), |
|
404
|
|
|
3 |
|
405
|
|
|
); |
|
406
|
|
|
$group[] = $form->createElement( |
|
407
|
|
|
'radio', |
|
408
|
|
|
'email_alert_manager_on_new_doc', |
|
409
|
|
|
null, |
|
410
|
|
|
get_lang('WorkEmailAlertActivateOnlyForStudents'), |
|
411
|
|
|
2 |
|
412
|
|
|
); |
|
413
|
|
|
$group[] = $form->createElement( |
|
414
|
|
|
'radio', |
|
415
|
|
|
'email_alert_manager_on_new_doc', |
|
416
|
|
|
null, |
|
417
|
|
|
get_lang('WorkEmailAlertDeactivate'), |
|
418
|
|
|
0 |
|
419
|
|
|
); |
|
420
|
|
|
|
|
421
|
|
|
$globalGroup[get_lang('WorkEmailAlert')] = $group; |
|
422
|
|
|
|
|
423
|
|
|
$group = []; |
|
424
|
|
|
$group[] = $form->createElement( |
|
425
|
|
|
'radio', |
|
426
|
|
|
'email_alert_on_new_doc_dropbox', |
|
427
|
|
|
get_lang('DropboxEmailAlert'), |
|
428
|
|
|
get_lang('DropboxEmailAlertActivate'), |
|
429
|
|
|
1 |
|
430
|
|
|
); |
|
431
|
|
|
$group[] = $form->createElement( |
|
432
|
|
|
'radio', |
|
433
|
|
|
'email_alert_on_new_doc_dropbox', |
|
434
|
|
|
null, |
|
435
|
|
|
get_lang('DropboxEmailAlertDeactivate'), |
|
436
|
|
|
0 |
|
437
|
|
|
); |
|
438
|
|
|
|
|
439
|
|
|
$globalGroup[get_lang('DropboxEmailAlert')] = $group; |
|
440
|
|
|
|
|
441
|
|
|
// Exercises notifications |
|
442
|
|
|
$emailAlerts = ExerciseLib::getNotificationSettings(); |
|
443
|
|
|
$group = []; |
|
444
|
|
|
foreach ($emailAlerts as $itemId => $label) { |
|
445
|
|
|
$group[] = $form->createElement( |
|
446
|
|
|
'checkbox', |
|
447
|
|
|
'email_alert_manager_on_new_quiz[]', |
|
448
|
|
|
null, |
|
449
|
|
|
$label, |
|
450
|
|
|
['value' => $itemId] |
|
451
|
|
|
); |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
$globalGroup[get_lang('Exercises')] = $group; |
|
455
|
|
|
|
|
456
|
|
|
$group = []; |
|
457
|
|
|
$group[] = $form->createElement( |
|
458
|
|
|
'radio', |
|
459
|
|
|
'email_to_teachers_on_new_work_feedback', |
|
460
|
|
|
get_lang('EmailToTeachersWhenNewWorkFeedback'), |
|
461
|
|
|
get_lang('Yes'), |
|
462
|
|
|
1 |
|
463
|
|
|
); |
|
464
|
|
|
$group[] = $form->createElement( |
|
465
|
|
|
'radio', |
|
466
|
|
|
'email_to_teachers_on_new_work_feedback', |
|
467
|
|
|
null, |
|
468
|
|
|
get_lang('No'), |
|
469
|
|
|
2 |
|
470
|
|
|
); |
|
471
|
|
|
|
|
472
|
|
|
$globalGroup[get_lang('EmailToTeachersWhenNewWorkFeedback')] = $group; |
|
473
|
|
|
|
|
474
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
475
|
|
|
$globalGroup[] = $myButton; |
|
476
|
|
|
|
|
477
|
|
|
$form->addPanelOption( |
|
478
|
|
|
'email-notifications', |
|
479
|
|
|
Display::return_icon('mail.png', get_lang('EmailNotifications')).' '.get_lang('EmailNotifications'), |
|
480
|
|
|
$globalGroup |
|
481
|
|
|
); |
|
482
|
|
|
|
|
483
|
|
|
$group = []; |
|
484
|
|
|
$group[] = $form->createElement( |
|
485
|
|
|
'radio', |
|
486
|
|
|
'allow_user_edit_agenda', |
|
487
|
|
|
get_lang('AllowUserEditAgenda'), |
|
488
|
|
|
get_lang('AllowUserEditAgendaActivate'), |
|
489
|
|
|
1 |
|
490
|
|
|
); |
|
491
|
|
|
$group[] = $form->createElement('radio', 'allow_user_edit_agenda', null, get_lang('AllowUserEditAgendaDeactivate'), 0); |
|
492
|
|
|
|
|
493
|
|
|
$group2 = []; |
|
494
|
|
|
$group2[] = $form->createElement( |
|
495
|
|
|
'radio', |
|
496
|
|
|
'allow_user_edit_announcement', |
|
497
|
|
|
get_lang('AllowUserEditAnnouncement'), |
|
498
|
|
|
get_lang('AllowUserEditAnnouncementActivate'), |
|
499
|
|
|
1 |
|
500
|
|
|
); |
|
501
|
|
|
$group2[] = $form->createElement( |
|
502
|
|
|
'radio', |
|
503
|
|
|
'allow_user_edit_announcement', |
|
504
|
|
|
null, |
|
505
|
|
|
get_lang('AllowUserEditAnnouncementDeactivate'), |
|
506
|
|
|
0 |
|
507
|
|
|
); |
|
508
|
|
|
|
|
509
|
|
|
$group3 = []; |
|
510
|
|
|
$group3[] = $form->createElement( |
|
511
|
|
|
'radio', |
|
512
|
|
|
'allow_user_image_forum', |
|
513
|
|
|
get_lang('AllowUserImageForum'), |
|
514
|
|
|
get_lang('AllowUserImageForumActivate'), |
|
515
|
|
|
1 |
|
516
|
|
|
); |
|
517
|
|
|
$group3[] = $form->createElement('radio', 'allow_user_image_forum', null, get_lang('AllowUserImageForumDeactivate'), 0); |
|
518
|
|
|
|
|
519
|
|
|
$group4 = []; |
|
520
|
|
|
$group4[] = $form->createElement( |
|
521
|
|
|
'radio', |
|
522
|
|
|
'allow_user_view_user_list', |
|
523
|
|
|
get_lang('AllowUserViewUserList'), |
|
524
|
|
|
get_lang('AllowUserViewUserListActivate'), |
|
525
|
|
|
1 |
|
526
|
|
|
); |
|
527
|
|
|
$group4[] = $form->createElement( |
|
528
|
|
|
'radio', |
|
529
|
|
|
'allow_user_view_user_list', |
|
530
|
|
|
null, |
|
531
|
|
|
get_lang('AllowUserViewUserListDeactivate'), |
|
532
|
|
|
0 |
|
533
|
|
|
); |
|
534
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
535
|
|
|
|
|
536
|
|
|
$globalGroup = [ |
|
537
|
|
|
get_lang('AllowUserEditAgenda') => $group, |
|
538
|
|
|
get_lang('AllowUserEditAnnouncement') => $group2, |
|
539
|
|
|
get_lang('AllowUserImageForum') => $group3, |
|
540
|
|
|
get_lang('AllowUserViewUserList') => $group4, |
|
541
|
|
|
'' => $myButton, |
|
542
|
|
|
]; |
|
543
|
|
|
// CHAT SETTINGS |
|
544
|
|
|
$form->addPanelOption( |
|
545
|
|
|
'users', |
|
546
|
|
|
Display::return_icon('user.png', get_lang('UserRights')).' '.get_lang('UserRights'), |
|
547
|
|
|
$globalGroup |
|
548
|
|
|
); |
|
549
|
|
|
|
|
550
|
|
|
$group = []; |
|
551
|
|
|
$group[] = $form->createElement( |
|
552
|
|
|
'radio', |
|
553
|
|
|
'allow_open_chat_window', |
|
554
|
|
|
get_lang('AllowOpenchatWindow'), |
|
555
|
|
|
get_lang('AllowOpenChatWindowActivate'), |
|
556
|
|
|
1 |
|
557
|
|
|
); |
|
558
|
|
|
$group[] = $form->createElement('radio', 'allow_open_chat_window', null, get_lang('AllowOpenChatWindowDeactivate'), 0); |
|
559
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
560
|
|
|
|
|
561
|
|
|
$globalGroup = [ |
|
562
|
|
|
get_lang('AllowOpenchatWindow') => $group, |
|
563
|
|
|
'' => $myButton, |
|
564
|
|
|
]; |
|
565
|
|
|
|
|
566
|
|
|
$form->addPanelOption( |
|
567
|
|
|
'chat', |
|
568
|
|
|
Display::return_icon('chat.png', get_lang('ConfigChat'), '', ICON_SIZE_SMALL).' '.get_lang('ConfigChat'), |
|
569
|
|
|
$globalGroup |
|
570
|
|
|
); |
|
571
|
|
|
|
|
572
|
|
|
// LEARNING PATH |
|
573
|
|
|
$form->addHtml('<div class="panel panel-default">'); |
|
574
|
|
|
$form->addHtml(' |
|
575
|
|
|
<div class="panel-heading" role="tab" id="heading-learning-path"> |
|
576
|
|
|
<h4 class="panel-title"> |
|
577
|
|
|
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" |
|
578
|
|
|
href="#collapse-learning-path" aria-expanded="false" aria-controls="collapse-learning-path"> |
|
579
|
|
|
'); |
|
580
|
|
|
$form->addHtml( |
|
581
|
|
|
Display::return_icon('scorms.png', get_lang('ConfigLearnpath')).' '.get_lang('ConfigLearnpath') |
|
582
|
|
|
); |
|
583
|
|
|
$form->addHtml(' |
|
584
|
|
|
</a> |
|
585
|
|
|
</h4> |
|
586
|
|
|
</div> |
|
587
|
|
|
'); |
|
588
|
|
|
$form->addHtml(' |
|
589
|
|
|
<div id="collapse-learning-path" class="panel-collapse collapse" role="tabpanel" |
|
590
|
|
|
aria-labelledby="heading-learning-path"> |
|
591
|
|
|
<div class="panel-body"> |
|
592
|
|
|
'); |
|
593
|
|
|
|
|
594
|
|
|
// Auto launch LP |
|
595
|
|
|
$group = []; |
|
596
|
|
|
$group[] = $form->createElement( |
|
597
|
|
|
'radio', |
|
598
|
|
|
'enable_lp_auto_launch', |
|
599
|
|
|
get_lang('LPAutoLaunch'), |
|
600
|
|
|
get_lang('RedirectToALearningPath'), |
|
601
|
|
|
1 |
|
602
|
|
|
); |
|
603
|
|
|
$group[] = $form->createElement( |
|
604
|
|
|
'radio', |
|
605
|
|
|
'enable_lp_auto_launch', |
|
606
|
|
|
get_lang('LPAutoLaunch'), |
|
607
|
|
|
get_lang('RedirectToTheLearningPathList'), |
|
608
|
|
|
2 |
|
609
|
|
|
); |
|
610
|
|
|
$group[] = $form->createElement('radio', 'enable_lp_auto_launch', null, get_lang('Deactivate'), 0); |
|
611
|
|
|
$form->addGroup($group, '', [get_lang('LPAutoLaunch')]); |
|
612
|
|
|
|
|
613
|
|
|
if (api_get_setting('allow_course_theme') == 'true') { |
|
614
|
|
|
// Allow theme into Learning path |
|
615
|
|
|
$group = []; |
|
616
|
|
|
$group[] = $form->createElement( |
|
617
|
|
|
'radio', |
|
618
|
|
|
'allow_learning_path_theme', |
|
619
|
|
|
get_lang('AllowLearningPathTheme'), |
|
620
|
|
|
get_lang('AllowLearningPathThemeAllow'), |
|
621
|
|
|
1 |
|
622
|
|
|
); |
|
623
|
|
|
$group[] = $form->createElement( |
|
624
|
|
|
'radio', |
|
625
|
|
|
'allow_learning_path_theme', |
|
626
|
|
|
null, |
|
627
|
|
|
get_lang('AllowLearningPathThemeDisallow'), |
|
628
|
|
|
0 |
|
629
|
|
|
); |
|
630
|
|
|
$form->addGroup($group, '', [get_lang("AllowLearningPathTheme")]); |
|
631
|
|
|
} |
|
632
|
|
|
|
|
633
|
|
|
$allowLPReturnLink = api_get_setting('allow_lp_return_link'); |
|
634
|
|
|
if ($allowLPReturnLink === 'true') { |
|
635
|
|
|
$group = [ |
|
636
|
|
|
$form->createElement( |
|
637
|
|
|
'radio', |
|
638
|
|
|
'lp_return_link', |
|
639
|
|
|
get_lang('LpReturnLink'), |
|
640
|
|
|
get_lang('RedirectToTheLearningPathList'), |
|
641
|
|
|
1 |
|
642
|
|
|
), |
|
643
|
|
|
$form->createElement( |
|
644
|
|
|
'radio', |
|
645
|
|
|
'lp_return_link', |
|
646
|
|
|
null, |
|
647
|
|
|
get_lang('RedirectToCourseHome'), |
|
648
|
|
|
0 |
|
649
|
|
|
), |
|
650
|
|
|
$form->createElement( |
|
651
|
|
|
'radio', |
|
652
|
|
|
'lp_return_link', |
|
653
|
|
|
null, |
|
654
|
|
|
get_lang('MyCourses'), |
|
655
|
|
|
2 |
|
656
|
|
|
), |
|
657
|
|
|
]; |
|
658
|
|
|
$form->addGroup($group, '', [get_lang("LpReturnLink")]); |
|
659
|
|
|
} |
|
660
|
|
|
|
|
661
|
|
|
$exerciseInvisible = api_get_setting('exercise_invisible_in_session'); |
|
662
|
|
|
$configureExerciseVisibility = api_get_setting('configure_exercise_visibility_in_course'); |
|
663
|
|
|
|
|
664
|
|
|
if ($exerciseInvisible === 'true' && |
|
665
|
|
|
$configureExerciseVisibility === 'true' |
|
666
|
|
|
) { |
|
667
|
|
|
$group = [ |
|
668
|
|
|
$form->createElement( |
|
669
|
|
|
'radio', |
|
670
|
|
|
'exercise_invisible_in_session', |
|
671
|
|
|
get_lang('ExerciseInvisibleInSession'), |
|
672
|
|
|
get_lang('Yes'), |
|
673
|
|
|
1 |
|
674
|
|
|
), |
|
675
|
|
|
$form->createElement( |
|
676
|
|
|
'radio', |
|
677
|
|
|
'exercise_invisible_in_session', |
|
678
|
|
|
null, |
|
679
|
|
|
get_lang('No'), |
|
680
|
|
|
0 |
|
681
|
|
|
), |
|
682
|
|
|
]; |
|
683
|
|
|
$form->addGroup($group, '', [get_lang('ExerciseInvisibleInSession')]); |
|
684
|
|
|
} |
|
685
|
|
|
|
|
686
|
|
|
if ($isEditable) { |
|
687
|
|
|
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); |
|
688
|
|
|
} else { |
|
689
|
|
|
// Is it allowed to edit the course settings? |
|
690
|
|
|
if (!$isEditable) { |
|
691
|
|
|
$disabled_output = "disabled"; |
|
692
|
|
|
} |
|
693
|
|
|
$form->freeze(); |
|
694
|
|
|
} |
|
695
|
|
|
$form->addHtml(' |
|
696
|
|
|
</div> |
|
697
|
|
|
</div> |
|
698
|
|
|
'); |
|
699
|
|
|
$form->addHtml('</div>'); |
|
700
|
|
|
|
|
701
|
|
|
// Exercise |
|
702
|
|
|
if (api_get_configuration_value('allow_exercise_auto_launch')) { |
|
703
|
|
|
$form->addHtml('<div class="panel panel-default">'); |
|
704
|
|
|
$form->addHtml(' |
|
705
|
|
|
<div class="panel-heading" role="tab" id="heading-exercise"> |
|
706
|
|
|
<h4 class="panel-title"> |
|
707
|
|
|
<a class="collapsed" |
|
708
|
|
|
role="button" data-toggle="collapse" |
|
709
|
|
|
data-parent="#accordion" |
|
710
|
|
|
href="#collapse-exercise" aria-expanded="false" aria-controls="collapse-exercise"> |
|
711
|
|
|
'); |
|
712
|
|
|
$form->addHtml( |
|
713
|
|
|
Display::return_icon('quiz.png', get_lang('Exercise')).' '.get_lang('Exercise') |
|
714
|
|
|
); |
|
715
|
|
|
$form->addHtml(' |
|
716
|
|
|
</a> |
|
717
|
|
|
</h4> |
|
718
|
|
|
</div> |
|
719
|
|
|
'); |
|
720
|
|
|
$form->addHtml(' |
|
721
|
|
|
<div id="collapse-exercise" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-exercise"> |
|
722
|
|
|
<div class="panel-body"> |
|
723
|
|
|
'); |
|
724
|
|
|
|
|
725
|
|
|
// Auto launch exercise |
|
726
|
|
|
$group = []; |
|
727
|
|
|
$group[] = $form->createElement( |
|
728
|
|
|
'radio', |
|
729
|
|
|
'enable_exercise_auto_launch', |
|
730
|
|
|
get_lang('ExerciseAutoLaunch'), |
|
731
|
|
|
get_lang('RedirectToExercise'), |
|
732
|
|
|
1 |
|
733
|
|
|
); |
|
734
|
|
|
$group[] = $form->createElement( |
|
735
|
|
|
'radio', |
|
736
|
|
|
'enable_exercise_auto_launch', |
|
737
|
|
|
get_lang('ExerciseAutoLaunch'), |
|
738
|
|
|
get_lang('RedirectToTheExerciseList'), |
|
739
|
|
|
2 |
|
740
|
|
|
); |
|
741
|
|
|
$group[] = $form->createElement('radio', 'enable_exercise_auto_launch', null, get_lang('Deactivate'), 0); |
|
742
|
|
|
$form->addGroup($group, '', [get_lang('ExerciseAutoLaunch')]); |
|
743
|
|
|
|
|
744
|
|
|
if ($isEditable) { |
|
745
|
|
|
$form->addButtonSave(get_lang('SaveSettings'), 'submit_save'); |
|
746
|
|
|
} else { |
|
747
|
|
|
// Is it allowed to edit the course settings? |
|
748
|
|
|
if (!$isEditable) { |
|
749
|
|
|
$disabled_output = "disabled"; |
|
750
|
|
|
} |
|
751
|
|
|
$form->freeze(); |
|
752
|
|
|
} |
|
753
|
|
|
$form->addHtml(' |
|
754
|
|
|
</div> |
|
755
|
|
|
</div> |
|
756
|
|
|
'); |
|
757
|
|
|
$form->addHtml('</div>'); |
|
758
|
|
|
} |
|
759
|
|
|
|
|
760
|
|
|
$group = []; |
|
761
|
|
|
$group[] = $form->createElement( |
|
762
|
|
|
'radio', |
|
763
|
|
|
'display_info_advance_inside_homecourse', |
|
764
|
|
|
get_lang('InfoAboutAdvanceInsideHomeCourse'), |
|
765
|
|
|
get_lang('DisplayAboutLastDoneAdvance'), |
|
766
|
|
|
1 |
|
767
|
|
|
); |
|
768
|
|
|
$group[] = $form->createElement( |
|
769
|
|
|
'radio', |
|
770
|
|
|
'display_info_advance_inside_homecourse', |
|
771
|
|
|
null, |
|
772
|
|
|
get_lang('DisplayAboutNextAdvanceNotDone'), |
|
773
|
|
|
2 |
|
774
|
|
|
); |
|
775
|
|
|
$group[] = $form->createElement( |
|
776
|
|
|
'radio', |
|
777
|
|
|
'display_info_advance_inside_homecourse', |
|
778
|
|
|
null, |
|
779
|
|
|
get_lang('DisplayAboutNextAdvanceNotDoneAndLastDoneAdvance'), |
|
780
|
|
|
3 |
|
781
|
|
|
); |
|
782
|
|
|
$group[] = $form->createElement( |
|
783
|
|
|
'radio', |
|
784
|
|
|
'display_info_advance_inside_homecourse', |
|
785
|
|
|
null, |
|
786
|
|
|
get_lang('DoNotDisplayAnyAdvance'), |
|
787
|
|
|
0 |
|
788
|
|
|
); |
|
789
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
790
|
|
|
|
|
791
|
|
|
$globalGroup = [ |
|
792
|
|
|
get_lang('InfoAboutAdvanceInsideHomeCourse') => $group, |
|
793
|
|
|
'' => $myButton, |
|
794
|
|
|
]; |
|
795
|
|
|
// Certificate settings |
|
796
|
|
|
$form->addPanelOption( |
|
797
|
|
|
'thematic', |
|
798
|
|
|
Display::return_icon( |
|
799
|
|
|
'course_progress.png', |
|
800
|
|
|
get_lang('ThematicAdvanceConfiguration') |
|
801
|
|
|
) |
|
802
|
|
|
.' ' |
|
803
|
|
|
.get_lang('ThematicAdvanceConfiguration'), |
|
804
|
|
|
$globalGroup |
|
805
|
|
|
); |
|
806
|
|
|
|
|
807
|
|
|
// Certificate settings |
|
808
|
|
|
if (api_get_setting('allow_public_certificates') === 'true') { |
|
809
|
|
|
$group = []; |
|
810
|
|
|
$group[] = $form->createElement( |
|
811
|
|
|
'radio', |
|
812
|
|
|
'allow_public_certificates', |
|
813
|
|
|
get_lang('AllowPublicCertificates'), |
|
814
|
|
|
get_lang('Yes'), |
|
815
|
|
|
1 |
|
816
|
|
|
); |
|
817
|
|
|
$group[] = $form->createElement('radio', 'allow_public_certificates', null, get_lang('No'), 0); |
|
818
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
819
|
|
|
|
|
820
|
|
|
$globalGroup = [ |
|
821
|
|
|
get_lang('AllowPublicCertificates') => $group, |
|
822
|
|
|
'' => $myButton, |
|
823
|
|
|
]; |
|
824
|
|
|
|
|
825
|
|
|
$form->addPanelOption( |
|
826
|
|
|
'certificate', |
|
827
|
|
|
Display::return_icon('certificate.png', get_lang('Certificates')).' '.get_lang('Certificates'), |
|
828
|
|
|
$globalGroup |
|
829
|
|
|
); |
|
830
|
|
|
} |
|
831
|
|
|
|
|
832
|
|
|
$group = [ |
|
833
|
|
|
$form->createElement('radio', 'enable_forum_auto_launch', null, get_lang('RedirectToForumList'), 1), |
|
834
|
|
|
$form->createElement('radio', 'enable_forum_auto_launch', null, get_lang('Disabled'), 2), |
|
835
|
|
|
]; |
|
836
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
837
|
|
|
|
|
838
|
|
|
$globalGroup = [ |
|
839
|
|
|
get_lang('EnableForumAutoLaunch') => $group, |
|
840
|
|
|
'' => $myButton, |
|
841
|
|
|
]; |
|
842
|
|
|
|
|
843
|
|
|
$form->addPanelOption( |
|
844
|
|
|
'forum', |
|
845
|
|
|
Display::return_icon('forum.png', get_lang('Forum')).' '.get_lang('Forum'), |
|
846
|
|
|
$globalGroup |
|
847
|
|
|
); |
|
848
|
|
|
|
|
849
|
|
|
// Student publication |
|
850
|
|
|
$group = [ |
|
851
|
|
|
$form->createElement('radio', 'show_score', null, get_lang('NewVisible'), 0), |
|
852
|
|
|
$form->createElement('radio', 'show_score', null, get_lang('NewUnvisible'), 1), |
|
853
|
|
|
]; |
|
854
|
|
|
$group2 = [ |
|
855
|
|
|
$form->createElement('radio', 'student_delete_own_publication', null, get_lang('Yes'), 1), |
|
856
|
|
|
$form->createElement('radio', 'student_delete_own_publication', null, get_lang('No'), 0), |
|
857
|
|
|
]; |
|
858
|
|
|
$myButton = $form->addButtonSave(get_lang('SaveSettings'), 'submit_save', true); |
|
859
|
|
|
|
|
860
|
|
|
$globalGroup = [ |
|
861
|
|
|
get_lang('DefaultUpload') => $group, |
|
862
|
|
|
get_lang('StudentAllowedToDeleteOwnPublication') => $group2, |
|
863
|
|
|
'' => $myButton, |
|
864
|
|
|
]; |
|
865
|
|
|
|
|
866
|
|
|
$form->addPanelOption( |
|
867
|
|
|
'student-publication', |
|
868
|
|
|
Display::return_icon('work.png', get_lang('StudentPublications')).' '.get_lang('StudentPublications'), |
|
869
|
|
|
$globalGroup |
|
870
|
|
|
); |
|
871
|
|
|
|
|
872
|
|
|
// Plugin course settings |
|
873
|
|
|
$appPlugin = new AppPlugin(); |
|
874
|
|
|
$appPlugin->add_course_settings_form($form); |
|
875
|
|
|
|
|
876
|
|
|
$form->addHtml('</div>'); |
|
877
|
|
|
|
|
878
|
|
|
// Get all the course information |
|
879
|
|
|
$all_course_information = CourseManager::get_course_information($_course['sysCode']); |
|
|
|
|
|
|
880
|
|
|
|
|
881
|
|
|
// Set the default values of the form |
|
882
|
|
|
$values = []; |
|
883
|
|
|
$values['title'] = $_course['name']; |
|
884
|
|
|
$values['category_code'] = $_course['categoryCode']; |
|
885
|
|
|
$values['course_language'] = $_course['language']; |
|
886
|
|
|
$values['department_name'] = $_course['extLink']['name']; |
|
887
|
|
|
$values['department_url'] = $_course['extLink']['url']; |
|
888
|
|
|
$values['visibility'] = $_course['visibility']; |
|
889
|
|
|
$values['subscribe'] = $_course['subscribe']; |
|
890
|
|
|
$values['unsubscribe'] = $_course['unsubscribe']; |
|
891
|
|
|
$values['course_registration_password'] = $all_course_information['registration_code']; |
|
892
|
|
|
$values['legal'] = $all_course_information['legal']; |
|
893
|
|
|
$values['activate_legal'] = $all_course_information['activate_legal']; |
|
894
|
|
|
$values['show_score'] = $all_course_information['show_score']; |
|
895
|
|
|
|
|
896
|
|
|
$courseSettings = CourseManager::getCourseSettingVariables($appPlugin); |
|
897
|
|
|
|
|
898
|
|
|
foreach ($courseSettings as $setting) { |
|
899
|
|
|
$result = api_get_course_setting($setting); |
|
900
|
|
|
if ($result != '-1') { |
|
901
|
|
|
$values[$setting] = $result; |
|
902
|
|
|
} |
|
903
|
|
|
} |
|
904
|
|
|
// make sure new settings have a clear default value |
|
905
|
|
|
if (!isset($values['student_delete_own_publication'])) { |
|
906
|
|
|
$values['student_delete_own_publication'] = 0; |
|
907
|
|
|
} |
|
908
|
|
|
$form->setDefaults($values); |
|
909
|
|
|
|
|
910
|
|
|
// Validate form |
|
911
|
|
|
if ($form->validate() && $isEditable) { |
|
912
|
|
|
$updateValues = $form->getSubmitValues(); |
|
913
|
|
|
|
|
914
|
|
|
// update course picture |
|
915
|
|
|
$picture = $_FILES['picture']; |
|
916
|
|
|
if (!empty($picture['name'])) { |
|
917
|
|
|
$picture_uri = CourseManager::update_course_picture( |
|
918
|
|
|
$_course, |
|
919
|
|
|
$picture['name'], |
|
920
|
|
|
$picture['tmp_name'], |
|
921
|
|
|
$updateValues['picture_crop_result'] |
|
922
|
|
|
); |
|
923
|
|
|
} |
|
924
|
|
|
|
|
925
|
|
|
$visibility = $updateValues['visibility']; |
|
926
|
|
|
$deletePicture = isset($updateValues['delete_picture']) ? $updateValues['delete_picture'] : ''; |
|
927
|
|
|
|
|
928
|
|
|
if ($deletePicture) { |
|
929
|
|
|
CourseManager::deleteCoursePicture($course_code); |
|
930
|
|
|
} |
|
931
|
|
|
|
|
932
|
|
|
global $_configuration; |
|
933
|
|
|
$urlId = api_get_current_access_url_id(); |
|
934
|
|
|
if (isset($_configuration[$urlId]) && |
|
935
|
|
|
isset($_configuration[$urlId]['hosting_limit_active_courses']) && |
|
936
|
|
|
$_configuration[$urlId]['hosting_limit_active_courses'] > 0 |
|
937
|
|
|
) { |
|
938
|
|
|
$courseInfo = api_get_course_info_by_id($courseId); |
|
939
|
|
|
|
|
940
|
|
|
// Check if |
|
941
|
|
|
if ($courseInfo['visibility'] == COURSE_VISIBILITY_HIDDEN && |
|
942
|
|
|
$visibility != $courseInfo['visibility'] |
|
943
|
|
|
) { |
|
944
|
|
|
$num = CourseManager::countActiveCourses($urlId); |
|
945
|
|
|
if ($num >= $_configuration[$urlId]['hosting_limit_active_courses']) { |
|
946
|
|
|
api_warn_hosting_contact('hosting_limit_active_courses'); |
|
947
|
|
|
|
|
948
|
|
|
Display::addFlash( |
|
949
|
|
|
Display::return_message(get_lang('PortalActiveCoursesLimitReached')) |
|
950
|
|
|
); |
|
951
|
|
|
|
|
952
|
|
|
$url = api_get_path(WEB_CODE_PATH).'course_info/infocours.php?'.api_get_cidreq(); |
|
953
|
|
|
header("Location: $url"); |
|
954
|
|
|
exit; |
|
955
|
|
|
} |
|
956
|
|
|
} |
|
957
|
|
|
} |
|
958
|
|
|
|
|
959
|
|
|
$pdf_export_watermark_path = isset($_FILES['pdf_export_watermark_path']) |
|
960
|
|
|
? $_FILES['pdf_export_watermark_path'] |
|
961
|
|
|
: null; |
|
962
|
|
|
|
|
963
|
|
|
if (!empty($pdf_export_watermark_path['name'])) { |
|
964
|
|
|
$pdf_export_watermark_path_result = PDF::upload_watermark( |
|
|
|
|
|
|
965
|
|
|
$pdf_export_watermark_path['name'], |
|
966
|
|
|
$pdf_export_watermark_path['tmp_name'], |
|
967
|
|
|
$course_code |
|
968
|
|
|
); |
|
969
|
|
|
unset($updateValues['pdf_export_watermark_path']); |
|
970
|
|
|
} |
|
971
|
|
|
|
|
972
|
|
|
$activeLegal = isset($updateValues['activate_legal']) ? $updateValues['activate_legal'] : 0; |
|
973
|
|
|
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); |
|
974
|
|
|
|
|
975
|
|
|
$params = [ |
|
976
|
|
|
'title' => $updateValues['title'], |
|
977
|
|
|
'course_language' => $updateValues['course_language'], |
|
978
|
|
|
'category_code' => $updateValues['category_code'], |
|
979
|
|
|
'department_name' => $updateValues['department_name'], |
|
980
|
|
|
'department_url' => $updateValues['department_url'], |
|
981
|
|
|
'visibility' => $updateValues['visibility'], |
|
982
|
|
|
'subscribe' => $updateValues['subscribe'], |
|
983
|
|
|
'unsubscribe' => $updateValues['unsubscribe'], |
|
984
|
|
|
'legal' => $updateValues['legal'], |
|
985
|
|
|
'activate_legal' => $activeLegal, |
|
986
|
|
|
'registration_code' => $updateValues['course_registration_password'], |
|
987
|
|
|
'show_score' => $updateValues['show_score'], |
|
988
|
|
|
]; |
|
989
|
|
|
Database::update($table_course, $params, ['id = ?' => $courseId]); |
|
990
|
|
|
|
|
991
|
|
|
// Insert/Updates course_settings table |
|
992
|
|
|
foreach ($courseSettings as $setting) { |
|
993
|
|
|
$value = isset($updateValues[$setting]) ? $updateValues[$setting] : null; |
|
994
|
|
|
CourseManager::saveCourseConfigurationSetting( |
|
995
|
|
|
$appPlugin, |
|
996
|
|
|
$setting, |
|
997
|
|
|
$value, |
|
998
|
|
|
api_get_course_int_id() |
|
999
|
|
|
); |
|
1000
|
|
|
} |
|
1001
|
|
|
// update the extra fields |
|
1002
|
|
|
$courseFieldValue = new ExtraFieldValue('course'); |
|
1003
|
|
|
$courseFieldValue->saveFieldValues($updateValues); |
|
1004
|
|
|
|
|
1005
|
|
|
$appPlugin->saveCourseSettingsHook($updateValues); |
|
1006
|
|
|
$courseParams = api_get_cidreq(); |
|
1007
|
|
|
$cidReset = true; |
|
1008
|
|
|
$cidReq = $course_code; |
|
1009
|
|
|
Display::addFlash(Display::return_message(get_lang('Updated'))); |
|
1010
|
|
|
require '../inc/local.inc.php'; |
|
1011
|
|
|
$url = api_get_path(WEB_CODE_PATH).'course_info/infocours.php?'.$courseParams; |
|
1012
|
|
|
header("Location: $url"); |
|
1013
|
|
|
exit; |
|
1014
|
|
|
} |
|
1015
|
|
|
|
|
1016
|
|
|
if ($show_delete_watermark_text_message) { |
|
1017
|
|
|
Display::addFlash( |
|
1018
|
|
|
Display::return_message(get_lang('FileDeleted'), 'normal') |
|
1019
|
|
|
); |
|
1020
|
|
|
} |
|
1021
|
|
|
|
|
1022
|
|
|
Display::display_header($nameTools, 'Settings'); |
|
1023
|
|
|
|
|
1024
|
|
|
echo '<div id="course_settings">'; |
|
1025
|
|
|
$form->display(); |
|
1026
|
|
|
echo '</div>'; |
|
1027
|
|
|
|
|
1028
|
|
|
Display::display_footer(); |
|
1029
|
|
|
|