ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilObjCourseGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
20
22use ILIAS\News\Service as News;
25
48{
49 public const BREADCRUMB_DEFAULT = 0;
50 public const BREADCRUMB_CRS_ONLY = 1;
51 public const BREADCRUMB_FULL_PATH = 2;
52 protected News $news;
53
56
58 protected Factory $refinery;
59 protected ilHelpGUI $help;
61
62 public function __construct($a_data, int $a_id, bool $a_call_by_reference = true, bool $a_prepare_output = true)
63 {
64 global $DIC;
65
66 $this->type = "crs";
67 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
68
69 $this->help = $DIC->help();
70 $this->logger = $DIC->logger()->crs();
71 $this->navigation_history = $DIC['ilNavigationHistory'];
72 $this->ctrl->saveParameter($this, ['ref_id']);
73 $this->lng->loadLanguageModule('crs');
74 $this->lng->loadLanguageModule('cert');
75 $this->lng->loadLanguageModule('obj');
76
77 $this->refinery = $DIC->refinery();
78 $this->news = $DIC->news();
79 }
80
84 public function gatewayObject(): void
85 {
86 $this->viewObject();
87 }
88
89 protected function afterImport(ilObject $new_object): void
90 {
92 $part->add($this->user->getId(), ilCourseConstants::CRS_ADMIN);
93 $part->updateNotification(
94 $this->user->getId(),
95 (bool) $this->settings->get('mail_crs_admin_notification', '1')
96 );
97 parent::afterImport($new_object);
98 }
99
100 public function renderObject(): void
101 {
102 $this->viewObject();
103 }
104
105 public function viewObject(): void
106 {
107 if (strtolower($this->std_request->getBaseClass()) === "iladministrationgui") {
108 parent::viewObject();
109 return;
110 }
111
112 $this->tabs_gui->setTabActive('view_content');
113 $this->checkPermission('read', 'view');
114
115 if (strtolower($this->std_request->getBaseClass()) === "iladministrationgui") {
116 parent::viewObject();
117 return;
118 }
119
120 // Trac access
121 if ($this->ctrl->getNextClass() != "ilcolumngui") {
123 $this->user->getId(),
124 $this->object->getId(),
125 $this->object->getRefId(),
126 'crs'
127 );
128 }
129
130 if (!$this->checkAgreement()) {
131 $this->ctrl->redirectByClass(ilMemberAgreementGUI::class);
132 }
133
134 if (!$this->__checkStartObjects()) {
136 $obj = $this->object;
137 $stgui = new ilContainerStartObjectsContentGUI($this, $obj);
138 $stgui->enableDesktop($this->object->getAboStatus(), $this);
139 $stgui->getHTML();
140 return;
141 }
142 // views handled by general container logic
143 if (
144 $this->object->getViewMode() == ilContainer::VIEW_SIMPLE ||
145 $this->object->getViewMode() == ilContainer::VIEW_BY_TYPE ||
146 $this->object->getViewMode() == ilContainer::VIEW_SESSIONS ||
147 $this->object->getViewMode() == ilContainer::VIEW_TIMING ||
148 $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
149 ) {
150 parent::renderObject();
151 }
152
153 if ($this->isActiveAdministrationPanel()) {
155 }
156 }
157
158 public function deleteObject(bool $error = false): void
159 {
160 $this->tabs_gui->activateTab('view_content');
161 parent::deleteObject($error);
162 }
163
164 public function renderContainer(): void
165 {
166 parent::renderObject();
167 }
168
175 public function infoScreenObject(): void
176 {
177 $this->ctrl->redirectByClass([
178 static::class,
179 ilInfoScreenGUI::class
180 ]);
181 }
182
183 public function infoScreen(): void
184 {
185 if (!$this->checkPermissionBool('read')) {
186 $this->checkPermission('visible');
187 }
188
189 $this->tabs_gui->setTabActive('info_short');
190 $files = ilCourseFile::_readFilesByCourse($this->object->getId());
191
192 $info = new ilInfoScreenGUI($this);
193 $info->enablePrivateNotes();
194 $info->enableFeedback();
195 $info->enableNews();
196 $info->enableBookingInfo(true);
197 if ($this->access->checkAccess("write", "", $this->ref_id)) {
198 $info->enableNewsEditing();
199 }
200
201 if (
202 strlen($this->object->getImportantInformation()) ||
203 strlen($this->object->getSyllabus()) ||
204 strlen((string) $this->object->getTargetGroup()) ||
205 count($files)) {
206 $info->addSection($this->lng->txt('crs_general_informations'));
207 }
208
209 if (strlen($this->object->getImportantInformation())) {
210 $info->addProperty(
211 $this->lng->txt('crs_important_info'),
212 "<strong>" . nl2br(
213 ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>"
214 )
215 );
216 }
217 if (strlen($this->object->getSyllabus())) {
218 $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(
219 ilUtil::makeClickable($this->object->getSyllabus(), true)
220 ));
221 }
222 if (strlen((string) $this->object->getTargetGroup())) {
223 $info->addProperty(
224 $this->lng->txt('crs_target_group'),
225 nl2br(
226 \ilUtil::makeClickable($this->object->getTargetGroup(), true)
227 )
228 );
229 }
230 // files
231 if ($files !== []) {
232 $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'components/ILIAS/Course');
233
234 foreach ($files as $file) {
235 $tpl->setCurrentBlock("files");
236 $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
237 $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile'));
238 $tpl->setVariable("DOWN_NAME", $file->getFileName());
239 $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info'));
240 $tpl->setVariable("DOWN_SIZE", $file->getFileSize());
241 $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes'));
243 }
244 $info->addProperty(
245 $this->lng->txt('crs_file_download'),
246 $tpl->get()
247 );
248 }
249
250 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId());
251 $record_gui->setInfoObject($info);
253
254 // meta data
255 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
256
257 // contact
258 if ($this->object->hasContactData()) {
259 $info->addSection($this->lng->txt("crs_contact"));
260 }
261 if (strlen($this->object->getContactName())) {
262 $info->addProperty(
263 $this->lng->txt("crs_contact_name"),
264 $this->object->getContactName()
265 );
266 }
267 if (strlen($this->object->getContactResponsibility())) {
268 $info->addProperty(
269 $this->lng->txt("crs_contact_responsibility"),
270 $this->object->getContactResponsibility()
271 );
272 }
273 if (strlen($this->object->getContactPhone())) {
274 $info->addProperty(
275 $this->lng->txt("crs_contact_phone"),
276 $this->object->getContactPhone()
277 );
278 }
279 if ($this->object->getContactEmail()) {
280 /* needs to be rbacsystem, does not work with ilAccess */
281 $has_mail_access = $this->rbacsystem->checkAccessOfUser(
282 $this->user->getId(),
283 'internal_mail',
285 );
286 $emails = explode(",", $this->object->getContactEmail());
287 $mailString = '';
288 foreach ($emails as $email) {
289 $email = trim($email);
290 if (!$has_mail_access) {
291 $mailString .= $email . "<br />";
292 continue;
293 }
294 $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'components/ILIAS/Course');
295 $etpl->setVariable(
296 "EMAIL_LINK",
298 $info,
299 'showSummary',
300 array(),
301 array(
302 'type' => 'new',
303 'rcp_to' => $email,
304 'sig' => $this->createMailSignature()
305 ),
306 array(
308 'ref_id' => $this->object->getRefId(),
309 'ts' => time()
310 )
311 )
312 );
313 $etpl->setVariable("CONTACT_EMAIL", $email);
314 $mailString .= $etpl->get() . "<br />";
315 }
316 $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
317 }
318 if (strlen($this->object->getContactConsultation())) {
319 $info->addProperty(
320 $this->lng->txt("crs_contact_consultation"),
321 nl2br($this->object->getContactConsultation())
322 );
323 }
324 // support contacts
326 $conts = $parts->getContacts();
327 if ($conts !== []) {
328 $info->addSection($this->lng->txt("crs_mem_contacts"));
329 foreach ($conts as $c) {
330 $pgui = new PublicProfileGUI($c);
331 $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
332 $pgui->setEmbedded(true);
333 $info->addProperty("", $pgui->getHTML());
334 }
335 }
336
337 // #10360
338 $info->enableAvailability(false);
339 $this->lng->loadLanguageModule("rep");
340 $info->addSection($this->lng->txt("rep_activation_availability"));
341 $info->showLDAPRoleGroupMappingInfo();
342
343 // activation
344 $info->addAccessPeriodProperty();
345
346 $txt = '';
347 switch ($this->object->getSubscriptionLimitationType()) {
349 $txt = $this->lng->txt("crs_info_reg_deactivated");
350 break;
351
352 default:
353 switch ($this->object->getSubscriptionType()) {
355 $txt = $this->lng->txt("crs_info_reg_confirmation");
356 break;
358 $txt = $this->lng->txt("crs_info_reg_direct");
359 break;
361 $txt = $this->lng->txt("crs_info_reg_password");
362 break;
363 }
364 }
365
366 // subscription
367 $info->addProperty($this->lng->txt("crs_info_reg"), $txt);
368 if ($this->object->getSubscriptionLimitationType() != ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED) {
369 if ($this->object->getSubscriptionUnlimitedStatus()) {
370 $info->addProperty(
371 $this->lng->txt("crs_reg_until"),
372 $this->lng->txt('crs_unlimited')
373 );
374 } elseif ($this->object->getSubscriptionStart() < time()) {
375 $info->addProperty(
376 $this->lng->txt("crs_reg_until"),
377 $this->lng->txt('crs_to') . ' ' .
378 ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX))
379 );
380 } elseif ($this->object->getSubscriptionStart() > time()) {
381 $info->addProperty(
382 $this->lng->txt("crs_reg_until"),
383 $this->lng->txt('crs_from') . ' ' .
384 ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX))
385 );
386 }
387 if ($this->object->isSubscriptionMembershipLimited()) {
388 if ($this->object->getSubscriptionMinMembers()) {
389 $info->addProperty(
390 $this->lng->txt("mem_min_users"),
391 $this->object->getSubscriptionMinMembers()
392 );
393 }
394 if ($this->object->getSubscriptionMaxMembers()) {
395 $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->object->getId());
396 $info->addProperty(
397 $this->lng->txt('mem_free_places'),
398 (string) ($reg_info['reg_info_free_places'] ?? '0')
399 );
400 }
401 }
402 }
403
404 if ($this->object->getCancellationEnd()) {
405 $info->addProperty(
406 $this->lng->txt('crs_cancellation_end'),
407 ilDatePresentation::formatDate($this->object->getCancellationEnd())
408 );
409 }
410
411 if (
412 $this->object->getCourseStart() instanceof ilDateTime &&
413 !$this->object->getCourseStart()->isNull()
414 ) {
415 $info->addProperty(
416 $this->lng->txt('crs_period'),
418 $this->object->getCourseStart(),
419 $this->object->getCourseEnd()
420 )
421 );
422 }
423
424 // Confirmation
426
427 if ($privacy->courseConfirmationRequired() || ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) || $privacy->enabledCourseExport()) {
428 $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
429
430 $this->lng->loadLanguageModule('ps');
431 $info->addSection($this->lng->txt('crs_user_agreement_info'));
432 $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
433
434 if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
435 $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields);
436 }
437 }
438 $info->enableLearningProgress(true);
439
440 // forward the command
441 $this->ctrl->forwardCommand($info);
442 }
443
444 public function saveNotificationObject(): void
445 {
446 $noti = new ilMembershipNotifications($this->ref_id);
447 if ($noti->canCurrentUserEdit()) {
448 $crs_ntf = false;
449 if ($this->http->wrapper()->query()->has('crs_ntf')) {
450 $crs_ntf = $this->http->wrapper()->query()->retrieve(
451 'crs_ntf',
452 $this->refinery->kindlyTo()->bool()
453 );
454 }
455 if ($crs_ntf) {
456 $noti->activateUser();
457 } else {
458 $noti->deactivateUser();
459 }
460 }
461 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
462 $this->ctrl->redirect($this, "");
463 }
464
465 public function editInfoObject(?ilPropertyFormGUI $a_form = null): void
466 {
467 $this->checkPermission('write');
468 $this->setSubTabs('properties');
469 $this->tabs_gui->setTabActive('settings');
470 $this->tabs_gui->setSubTabActive('crs_info_settings');
471
472 if (!$a_form) {
473 $a_form = $this->initInfoEditor();
474 }
475 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.edit_info.html', 'components/ILIAS/Course');
476 $this->tpl->setVariable('INFO_TABLE', $a_form->getHTML());
477
478 if (!count($files = ilCourseFile::_readFilesByCourse($this->object->getId()))) {
479 return;
480 }
481 $rows = array();
482 foreach ($files as $file) {
483 $table_data['id'] = $file->getFileId();
484 $table_data['filename'] = $file->getFileName();
485 $table_data['filetype'] = $file->getFileType();
486 $table_data['filesize'] = $file->getFileSize();
487
488 $rows[] = $table_data;
489 }
490 $table_gui = new ilCourseInfoFileTableGUI($this, 'editInfo');
491 $table_gui->setTitle($this->lng->txt("crs_info_download"));
492 $table_gui->setData($rows);
493 $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
494 $table_gui->addMultiCommand("confirmDeleteInfoFiles", $this->lng->txt("delete"));
495 $table_gui->setSelectAllCheckbox("file_id");
496 $this->tpl->setVariable('INFO_FILE_TABLE', $table_gui->getHTML());
497 }
498
499 public function confirmDeleteInfoFilesObject(): void
500 {
501 $file_ids = [];
502 if ($this->http->wrapper()->post()->has('file_id')) {
503 $file_ids = $this->http->wrapper()->post()->retrieve(
504 'file_id',
505 $this->refinery->kindlyTo()->listOf(
506 $this->refinery->kindlyTo()->int()
507 )
508 );
509 }
510 if (count($file_ids) === 0) {
511 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
512 $this->editInfoObject();
513 return;
514 }
515
516 $this->setSubTabs('properties');
517 $this->tabs_gui->setTabActive('settings');
518 $this->tabs_gui->setSubTabActive('crs_info_settings');
519
520 $c_gui = new ilConfirmationGUI();
521
522 // set confirm/cancel commands
523 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteInfoFiles"));
524 $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
525 $c_gui->setCancel($this->lng->txt("cancel"), "editInfo");
526 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteInfoFiles");
527
528 // add items to delete
529 foreach ($file_ids as $file_id) {
530 $file = new ilCourseFile($file_id);
531 $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
532 }
533 $this->tpl->setContent($c_gui->getHTML());
534 }
535
536 public function deleteInfoFilesObject(): void
537 {
538 $file_ids = [];
539 if ($this->http->wrapper()->post()->has('file_id')) {
540 $file_ids = $this->http->wrapper()->post()->retrieve(
541 'file_id',
542 $this->refinery->kindlyTo()->listOf(
543 $this->refinery->kindlyTo()->int()
544 )
545 );
546 }
547
548 if (count($file_ids) === 0) {
549 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
550 $this->editInfoObject();
551 return;
552 }
553
554 foreach ($file_ids as $file_id) {
555 $file = new ilCourseFile($file_id);
556 if ($this->object->getId() == $file->getCourseId()) {
557 $file->delete();
558 }
559 }
560 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'));
561 $this->editInfoObject();
562 }
563
565 {
566 $form = new ilPropertyFormGUI();
567 $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
568 $form->setMultipart(true);
569 $form->setTitle($this->lng->txt('crs_general_info'));
570 $form->addCommandButton('updateInfo', $this->lng->txt('save'));
571 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
572
573 $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'), 'important');
574 $area->setValue($this->object->getImportantInformation());
575 $area->setRows(6);
576 $area->setCols(80);
577 $form->addItem($area);
578
579 $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'), 'syllabus');
580 $area->setValue($this->object->getSyllabus());
581 $area->setRows(6);
582 $area->setCols(80);
583 $form->addItem($area);
584
585 $tg = new \ilTextAreaInputGUI($this->lng->txt('crs_target_group'), 'target_group');
586 $tg->setValue($this->object->getTargetGroup() ?? "");
587 $tg->setRows(6);
588 $form->addItem($tg);
589
590 $section = new ilFormSectionHeaderGUI();
591 $section->setTitle($this->lng->txt('crs_info_download'));
592 $form->addItem($section);
593
594 $file = new ilFileInputGUI($this->lng->txt('crs_file'), 'file');
595 $file->enableFileNameSelection('file_name');
596 $form->addItem($file);
597
598 $section = new ilFormSectionHeaderGUI();
599 $section->setTitle($this->lng->txt('crs_contact'));
600 $form->addItem($section);
601
602 $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'), 'contact_name');
603 $text->setValue($this->object->getContactName());
604 $text->setSize(40);
605 $text->setMaxLength(70);
606 $form->addItem($text);
607
608 $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'), 'contact_responsibility');
609 $text->setValue($this->object->getContactResponsibility());
610 $text->setSize(40);
611 $text->setMaxLength(70);
612 $form->addItem($text);
613
614 $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'), 'contact_phone');
615 $text->setValue($this->object->getContactPhone());
616 $text->setSize(40);
617 $text->setMaxLength(40);
618 $form->addItem($text);
619
620 $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'), 'contact_email');
621 $text->setValue($this->object->getContactEmail());
622 $text->setInfo($this->lng->txt('crs_contact_email_info'));
623 $text->setSize(40);
624 $text->setMaxLength(255);
625 $form->addItem($text);
626
627 $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'), 'contact_consultation');
628 $area->setValue($this->object->getContactConsultation());
629 $area->setRows(6);
630 $area->setCols(80);
631 $form->addItem($area);
632
633 $this->record_gui = new ilAdvancedMDRecordGUI(
635 'crs',
636 $this->object->getId()
637 );
638 $this->record_gui->setPropertyForm($form);
639 $this->record_gui->parse();
640 return $form;
641 }
642
646 public function updateInfoObject(): void
647 {
648 $this->checkPermission('write');
649
650 $form = $this->initInfoEditor();
651 if ($form->checkInput()) {
652 $this->object->setImportantInformation((string) $form->getInput('important'));
653 $this->object->setSyllabus((string) $form->getInput('syllabus'));
654 $this->object->setTargetGroup((string) $form->getInput('target_group'));
655 $this->object->setContactName((string) $form->getInput('contact_name'));
656 $this->object->setContactResponsibility((string) $form->getInput('contact_responsibility'));
657 $this->object->setContactPhone((string) $form->getInput('contact_phone'));
658 $this->object->setContactEmail((string) $form->getInput('contact_email'));
659 $this->object->setContactConsultation((string) $form->getInput('contact_consultation'));
660
661 $file_info = $form->getInput('file');
662 $file_name = $form->getItemByPostVar('file')->getFilename();
663 $file_name = ilFileUtils::getValidFilename($file_name);
664
665 $file_obj = new ilCourseFile();
666 $file_obj->setCourseId($this->object->getId());
667 $file_obj->setFileName((string) $file_name);
668 $file_obj->setFileSize((int) $file_info['size']);
669 $file_obj->setFileType((string) $file_info['type']);
670 $file_obj->setTemporaryName((string) $file_info['tmp_name']);
671 $file_obj->setErrorCode((int) $file_info['error']);
672
673 $error = false;
674 $this->error->setMessage('');
675 $file_obj->validate();
676 $this->object->validateInfoSettings();
677 if (strlen($this->error->getMessage())) {
678 $error = $this->error->getMessage();
679 }
680 if (!$this->record_gui->importEditFormPostValues()) {
681 $error = true;
682 }
683 if ($error) {
684 if ($error !== true) {
685 $this->tpl->setOnScreenMessage('failure', $this->error->getMessage());
686 }
688 $this->editInfoObject($form);
689 return;
690 }
691 $this->object->update();
692 $file_obj->create();
693 $this->record_gui->writeEditForm();
694
695 // Update ecs content
696 $ecs = new ilECSCourseSettings($this->object);
697 $ecs->handleContentUpdate();
698
699 $this->tpl->setOnScreenMessage('success', $this->lng->txt("crs_settings_saved"));
700 $this->editInfoObject();
701 } else {
702 $this->tpl->setOnScreenMessage(
704 $this->lng->txt('settings_saved')
705 );
706 }
707 }
708
709 public function updateObject(): void
710 {
711 $obj_service = $this->getObjectService();
712 $setting = $this->settings;
713
714 $form = $this->initEditForm();
715
716 if (!$form->checkInput()) {
718 $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
719 $this->editObject($form);
720 return;
721 }
722
723 // Additional checks: subsription min/max
724 if (
725 $form->getInput('subscription_max') &&
726 $form->getInput('subscription_min') &&
727 ($form->getInput('subscription_max') < $form->getInput('subscription_min'))
728 ) {
729 $min = $form->getItemByPostVar('subscription_min');
730 $min->setAlert($this->lng->txt('crs_subscription_min_members_err'));
731 $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
732 $this->editObject($form);
733 return;
734 }
735
736 // Additional checks: both tile and objective view activated (not supported)
737 if (
738 $form->getInput('list_presentation') == "tile" &&
740 $this->tpl->setOnScreenMessage(
741 'failure',
742 $GLOBALS['DIC']->language()->txt('crs_tile_and_objective_view_not_supported')
743 );
744 $this->editObject($form);
745 return;
746 }
747
748 // Additional checks: both tile and session limitation activated (not supported)
749 if ($form->getInput('sl') == "1" &&
750 $form->getInput('list_presentation') == "tile") {
751 $this->tpl->setOnScreenMessage(
752 'failure',
753 $GLOBALS['DIC']->language()->txt('crs_tile_and_session_limit_not_supported')
754 );
755 $this->editObject($form);
756 return;
757 }
758
759 // check successful
760 // title/desc
761 $this->object->setTitle($form->getInput('title'));
762 $this->object->setDescription($form->getInput('desc'));
763
764 // period
765 $crs_period = $form->getItemByPostVar("period");
766
767 $this->object->setCoursePeriod(
768 $crs_period->getStart(),
769 $crs_period->getEnd()
770 );
771
772 // activation period
773 $period = $form->getItemByPostVar("access_period");
774 if ($period->getStart() && $period->getEnd()) {
775 $this->object->setActivationStart($period->getStart()->get(IL_CAL_UNIX));
776 $this->object->setActivationEnd($period->getEnd()->get(IL_CAL_UNIX));
777 $this->object->setActivationVisibility((int) $form->getInput('activation_visibility'));
778 } else {
779 $this->object->setActivationStart(0);
780 $this->object->setActivationEnd(0);
781 }
782
783 // subscription settings
784 $this->object->setSubscriptionPassword($form->getInput('subscription_password'));
785 $this->object->setSubscriptionStart(0);
786 $this->object->setSubscriptionEnd(0);
787
788 $sub_type = (int) $form->getInput('subscription_type');
789 $sub_reg_type = (int) $form->getInput('subscription_limitation_type');
790 $sub_period = $form->getItemByPostVar('subscription_period');
791
792 $this->object->setSubscriptionType(
794 ? $sub_type
796 );
798 if ($sub_period->getStart() && $sub_period->getEnd()) {
799 $this->object->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_LIMITED);
800 $this->object->setSubscriptionStart($sub_period->getStart()->get(IL_CAL_UNIX));
801 $this->object->setSubscriptionEnd($sub_period->getEnd()->get(IL_CAL_UNIX));
802 } else {
803 $this->object->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_UNLIMITED);
804 }
805 } else {
806 $this->object->setSubscriptionType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DIRECT);
807 $this->object->setSubscriptionLimitationType(ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED);
808 }
809
810 // registration code
811 $this->object->enableRegistrationAccessCode((bool) $form->getInput('reg_code_enabled'));
812 $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
813
814 // cancellation end
815 $this->object->setCancellationEnd($form->getItemByPostVar("cancel_end")->getDate());
816
817 // waiting list
818 $this->object->enableSubscriptionMembershipLimitation((bool) $form->getInput('subscription_membership_limitation'));
819 $this->object->setSubscriptionMaxMembers((int) $form->getInput('subscription_max'));
820 $this->object->setSubscriptionMinMembers((int) $form->getInput('subscription_min'));
821 switch ((int) $form->getInput('waiting_list')) {
822 case 2:
823 $this->object->enableWaitingList(true);
824 $this->object->setWaitingListAutoFill(true);
825 break;
826
827 case 1:
828 $this->object->enableWaitingList(true);
829 $this->object->setWaitingListAutoFill(false);
830 break;
831
832 default:
833 $this->object->enableWaitingList(false);
834 $this->object->setWaitingListAutoFill(false);
835 break;
836 }
837 $this->object->handleAutoFill();
838
839 $property_online = $this->object->getObjectProperties()->getPropertyIsOnline();
840 $online = $form->getInput('activation_online') ? $property_online->withOnline() : $property_online->withOffline();
841 $this->object->getObjectProperties()->storePropertyIsOnline($online);
842
843 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
844 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTopActionsVisibility();
845 ilContainer::_writeContainerSetting($this->object->getId(), "rep_breacrumb", $form->getInput('rep_breacrumb'));
846 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
847 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
849
850 $this->object->setViewMode((int) $form->getInput('view_mode'));
851 if ($this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_TIMING) {
852 $this->object->setOrderType(ilContainer::SORT_ACTIVATION);
853 $this->object->setTimingMode((int) $form->getInput('timing_mode'));
854 }
855 $this->object->setTimingMode((int) $form->getInput('timing_mode'));
856 $this->object->setOrderType((int) $form->getInput('sorting'));
858
859 $this->log->debug(
860 "\n\n\nValue: " . (int) $form->getInput('tutorial_support_block_checkbox') . "\n\n\n"
861 );
862 $this->object->setTutorialSupportBlockSettingValue(
863 (int) $form->getInput('tutorial_support_block_checkbox')
864 );
865
866 $this->object->setAboStatus((bool) $form->getInput('abo'));
867 $this->object->setShowMembers((bool) $form->getInput('show_members'));
868
869 if (\ilPrivacySettings::getInstance()->participantsListInCoursesEnabled()) {
870 $this->object->setShowMembersExport((bool) $form->getInput('show_members_export'));
871 }
872 $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
873
874 $this->object->enableSessionLimit((int) $form->getInput('sl'));
875
876 $session_sp = $form->getInput('sp');
877 $this->object->setNumberOfPreviousSessions(is_numeric($session_sp) ? (int) $session_sp : -1);
878 $session_sn = $form->getInput('sn');
879 $this->object->setNumberOfnextSessions(is_numeric($session_sn) ? (int) $session_sn : -1);
880 $this->object->setAutoNotification($form->getInput('auto_notification') == 1 ? true : false);
881
882 // lp sync
883 $show_lp_sync_confirmation = false;
884
885 // could be hidden in form
886 if ($this->http->wrapper()->post()->has('status_dt')) {
887 $status_dt = $this->http->wrapper()->post()->retrieve(
888 'status_dt',
889 $this->refinery->kindlyTo()->int()
890 );
891 if (
892 $this->object->getStatusDetermination() != ilObjCourse::STATUS_DETERMINATION_LP &&
894 ) {
895 $show_lp_sync_confirmation = true;
896 } else {
897 $this->object->setStatusDetermination($status_dt);
898 }
899 }
900
901 $this->object->update();
902
904 $this->object->getId(),
905 $form,
906 $this->getSubServices()
907 );
908
909 ilChangeEvent::_recordWriteEvent($this->object->getId(), $this->user->getId(), 'update');
910 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $this->user->getId());
911
912 // lp sync confirmation required
913 if ($show_lp_sync_confirmation) {
914 $this->confirmLPSync();
915 return;
916 }
917
918 // Update ecs export settings
919 $ecs = new ilECSCourseSettings($this->object);
920 if (!$ecs->handleSettingsUpdate($form)) {
922 $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
923 $this->editObject($form);
924 return;
925 }
926
927 // 29589
928 if (
930 (
931 !is_null($sub_period->getStart()) ||
932 !is_null($sub_period->getEnd())
933 )
934 ) {
935 $this->tpl->setOnScreenMessage(
936 'failure',
937 $this->lng->txt('crs_msg_no_self_registration_period_if_self_enrolment_disabled'),
938 true
939 );
941 $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']->language()->txt('err_check_input'));
942 $this->editObject($form);
943 return;
944 }
945
946 $this->afterUpdate();
947 }
948
949 protected function getSubServices(): array
950 {
951 $subs = array(
961 );
962 if ($this->news->isGloballyActivated()) {
964 }
965
966 return $subs;
967 }
968
969 protected function confirmLPSync(): void
970 {
971 $cgui = new ilConfirmationGUI();
972 $cgui->setFormAction($this->ctrl->getFormAction($this, "setLPSync"));
973 $cgui->setHeaderText($this->lng->txt("crs_status_determination_sync"));
974 $cgui->setCancel($this->lng->txt("cancel"), "edit");
975 $cgui->setConfirm($this->lng->txt("confirm"), "setLPSync");
976 $this->tpl->setContent($cgui->getHTML());
977 }
978
979 protected function setLPSyncObject(): void
980 {
981 $this->object->setStatusDetermination(ilObjCourse::STATUS_DETERMINATION_LP);
982 $this->object->update();
983 $this->object->syncMembersStatusWithLP();
984 $this->tpl->setOnScreenMessage('success', $this->lng->txt("settings_saved"), true);
985 $this->ctrl->redirect($this, "edit");
986 }
987
988 public function editObject(?ilPropertyFormGUI $form = null): void
989 {
990 $this->setSubTabs('properties');
991 $this->tabs_gui->setSubTabActive('general');
992
993 if ($form instanceof ilPropertyFormGUI) {
994 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
995 } else {
996 parent::editObject();
997 }
998 }
999
1004 protected function getEditFormValues(): array
1005 {
1006 return [];
1007 }
1008
1009 protected function initEditForm(): ilPropertyFormGUI
1010 {
1011 $obj_service = $this->getObjectService();
1012 $setting = $this->settings;
1013
1014 $form = new ilPropertyFormGUI();
1015 $form->setTitle($this->lng->txt('crs_edit'));
1016
1017 $form->addCommandButton('update', $this->lng->txt('save'));
1018 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1019
1020 $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
1021
1022 // title and description
1023 $this->initFormTitleDescription($form);
1024
1025 // Show didactic template type
1027
1028 // period
1029 $cdur = new ilDateDurationInputGUI($this->lng->txt('crs_period'), 'period');
1030 $this->lng->loadLanguageModule('mem');
1031 $cdur->enableToggleFullTime(
1032 $this->lng->txt('mem_period_without_time'),
1033 !$this->object->getCourseStartTimeIndication()
1034 );
1035 $cdur->setShowTime(true);
1036 $cdur->setInfo($this->lng->txt('crs_period_info'));
1037 $cdur->setStart($this->object->getCourseStart());
1038 $cdur->setEnd($this->object->getCourseEnd());
1039 $form->addItem($cdur);
1040
1041 // activation/availability
1042
1043 $this->lng->loadLanguageModule('rep');
1044
1045 $section = new ilFormSectionHeaderGUI();
1046 $section->setTitle($this->lng->txt('rep_activation_availability'));
1047 $form->addItem($section);
1048
1049 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
1050 $online->setChecked(!$this->object->getOfflineStatus());
1051 $online->setInfo($this->lng->txt('crs_activation_online_info'));
1052 $form->addItem($online);
1053
1054 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
1055 $dur->setShowTime(true);
1056 $dur->setStart(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX));
1057 $dur->setEnd(new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX));
1058 $form->addItem($dur);
1059
1060 $visible = new ilCheckboxInputGUI(
1061 $this->lng->txt('rep_activation_limited_visibility'),
1062 'activation_visibility'
1063 );
1064 $visible->setInfo($this->lng->txt('crs_activation_limited_visibility_info'));
1065 $visible->setChecked((bool) $this->object->getActivationVisibility());
1066 $dur->addSubItem($visible);
1067
1068 $section = new ilFormSectionHeaderGUI();
1069 $section->setTitle($this->lng->txt('crs_reg'));
1070 $form->addItem($section);
1071
1072 // time limit
1073 $sdur = new ilDateDurationInputGUI($this->lng->txt('crs_registration_limited'), "subscription_period");
1074 $sdur->setShowTime(true);
1075 if ($this->object->getSubscriptionStart()) {
1076 $sdur->setStart(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX));
1077 }
1078 if ($this->object->getSubscriptionEnd()) {
1079 $sdur->setEnd(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX));
1080 }
1081
1082 $reg_proc = new ilRadioGroupInputGUI('', 'subscription_type');
1083 $reg_proc->setValue(
1084 ($this->object->getSubscriptionLimitationType() != ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED)
1085 ? (string) $this->object->getSubscriptionType()
1087 );
1088
1089 $opt = new ilRadioOption(
1090 $this->lng->txt('crs_subscription_options_direct'),
1091 (string) ilCourseConstants::IL_CRS_SUBSCRIPTION_DIRECT
1092 );
1093 $reg_proc->addOption($opt);
1094
1095 $opt = new ilRadioOption(
1096 $this->lng->txt('crs_subscription_options_password'),
1098 );
1099
1100 $pass = new ilTextInputGUI($this->lng->txt("password"), 'subscription_password');
1101 $pass->setRequired(true);
1102 $pass->setInfo($this->lng->txt('crs_reg_password_info'));
1103 $pass->setSubmitFormOnEnter(true);
1104 $pass->setSize(32);
1105 $pass->setMaxLength(32);
1106 $pass->setValue($this->object->getSubscriptionPassword());
1107
1108 $opt->addSubItem($pass);
1109 $reg_proc->addOption($opt);
1110
1111 $opt = new ilRadioOption(
1112 $this->lng->txt('crs_subscription_options_confirmation'),
1114 );
1115 $opt->setInfo($this->lng->txt('crs_registration_confirmation_info'));
1116 $reg_proc->addOption($opt);
1117
1118 $opt_self_enrollment_enabled = new ilRadioOption(
1119 $this->lng->txt('crs_reg_selfreg'),
1121 );
1122 $opt_self_enrollment_enabled->addSubItem($reg_proc);
1123 $opt_self_enrollment_enabled->addSubItem($sdur);
1124 $opt_self_enrollment_disabled = new ilRadioOption(
1125 $this->lng->txt('crs_reg_no_selfreg'),
1127 );
1128 $opt_self_enrollment_disabled->setInfo($this->lng->txt('crs_registration_deactivated'));
1129 $reg_proc_subscription_reg_type = new ilRadioGroupInputGUI(
1130 $this->lng->txt('crs_registration_type'),
1131 'subscription_limitation_type'
1132 );
1133 $reg_proc_subscription_reg_type->setValue(
1134 $this->object->getSubscriptionLimitationType() !== ilCourseConstants::IL_CRS_SUBSCRIPTION_DEACTIVATED
1137 );
1138 $reg_proc_subscription_reg_type->addOption($opt_self_enrollment_enabled);
1139 $reg_proc_subscription_reg_type->addOption($opt_self_enrollment_disabled);
1140 $form->addItem($reg_proc_subscription_reg_type);
1141
1142 // Registration codes
1143 $reg_code = new ilCheckboxInputGUI($this->lng->txt('crs_reg_code'), 'reg_code_enabled');
1144 $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1145 $reg_code->setValue('1');
1146 $reg_code->setInfo($this->lng->txt('crs_reg_code_enabled_info'));
1147
1148 // Create default access code
1149 if (!$this->object->getRegistrationAccessCode()) {
1150 $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1151 }
1152 $reg_link = new ilHiddenInputGUI('reg_code');
1153 $reg_link->setValue($this->object->getRegistrationAccessCode());
1154 $form->addItem($reg_link);
1155
1156 $link = new ilCustomInputGUI($this->lng->txt('crs_reg_code_link'));
1157 $val = ilLink::_getLink(
1158 $this->object->getRefId(),
1159 $this->object->getType(),
1160 array(),
1161 'rcode' . $this->object->getRegistrationAccessCode()
1162 );
1163 $link->setHtml('<span class="small">' . $val . '</span>');
1164 $reg_code->addSubItem($link);
1165
1166 $form->addItem($reg_code);
1167
1168 // cancellation limit
1169 $cancel = new ilDateTimeInputGUI($this->lng->txt('crs_cancellation_end'), 'cancel_end');
1170 $cancel->setInfo($this->lng->txt('crs_cancellation_end_info'));
1171 $cancel_end = $this->object->getCancellationEnd();
1172 if ($cancel_end) {
1173 $cancel->setDate($cancel_end);
1174 }
1175 $form->addItem($cancel);
1176
1177 // Max members
1178 $lim = new ilCheckboxInputGUI(
1179 $this->lng->txt('crs_subscription_max_members_short'),
1180 'subscription_membership_limitation'
1181 );
1182 $lim->setInfo($this->lng->txt('crs_subscription_max_members_short_info'));
1183 $lim->setValue((string) 1);
1184 $lim->setChecked($this->object->isSubscriptionMembershipLimited());
1185
1186 $min = new ilTextInputGUI('', 'subscription_min');
1187 $min->setSubmitFormOnEnter(true);
1188 $min->setSize(4);
1189 $min->setMaxLength(4);
1190 $min->setValue($this->object->getSubscriptionMinMembers() ?: '');
1191 $min->setTitle($this->lng->txt('crs_subscription_min_members'));
1192 $min->setInfo($this->lng->txt('crs_subscription_min_members_info'));
1193 $lim->addSubItem($min);
1194
1195 $max = new ilTextInputGUI('', 'subscription_max');
1196 $max->setSubmitFormOnEnter(true);
1197 $max->setSize(4);
1198 $max->setMaxLength(4);
1199 $max->setValue($this->object->getSubscriptionMaxMembers() ?: '');
1200 $max->setTitle($this->lng->txt('crs_subscription_max_members'));
1201 $max->setInfo($this->lng->txt('crs_reg_max_info'));
1202
1203 $lim->addSubItem($max);
1204
1205 $wait = new ilRadioGroupInputGUI($this->lng->txt('crs_waiting_list'), 'waiting_list');
1206 $option = new ilRadioOption($this->lng->txt('none'), '0');
1207 $wait->addOption($option);
1208
1209 $option = new ilRadioOption($this->lng->txt('crs_waiting_list_no_autofill'), '1');
1210 $option->setInfo($this->lng->txt('crs_wait_info'));
1211 $wait->addOption($option);
1212
1213 $option = new ilRadioOption($this->lng->txt('crs_waiting_list_autofill'), '2');
1214 $option->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1215 $wait->addOption($option);
1216
1217 if ($this->object->hasWaitingListAutoFill()) {
1218 $wait->setValue('2');
1219 } elseif ($this->object->enabledWaitingList()) {
1220 $wait->setValue('1');
1221 } else {
1222 $wait->setValue('0');
1223 }
1224 $lim->addSubItem($wait);
1225 $form->addItem($lim);
1226 $pres = new ilFormSectionHeaderGUI();
1227 $pres->setTitle($this->lng->txt('crs_view_mode'));
1228
1229 $form->addItem($pres);
1230
1231 // title and icon visibility
1232 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
1233
1234 // top actions visibility
1235 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
1236
1237 // breadcrumbs
1238 if ($setting->get("rep_breadcr_crs") && $setting->get("rep_breadcr_crs_overwrite")) {
1239 $add = $setting->get("rep_breadcr_crs_default")
1240 ? " (" . $this->lng->txt("crs_breadcrumb_crs_only") . ")"
1241 : " (" . $this->lng->txt("crs_breadcrumb_full_path") . ")";
1242 $options = array(
1243 self::BREADCRUMB_DEFAULT => $this->lng->txt("crs_sys_default") . $add,
1244 self::BREADCRUMB_CRS_ONLY => $this->lng->txt("crs_breadcrumb_crs_only"),
1245 self::BREADCRUMB_FULL_PATH => $this->lng->txt("crs_breadcrumb_full_path")
1246 );
1247 $si = new ilSelectInputGUI($this->lng->txt("crs_shorten_breadcrumb"), "rep_breacrumb");
1248 $si->setValue((int) ilContainer::_lookupContainerSetting($this->object->getId(), "rep_breacrumb"));
1249 $si->setOptions($options);
1250 $form->addItem($si);
1251 }
1252
1253 // custom icon
1254 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
1255
1256 // tile image
1257 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
1258
1259 // list presentation
1261
1262 // presentation type
1263 $view_type = new ilRadioGroupInputGUI($this->lng->txt('crs_presentation_type'), 'view_mode');
1264 $view_type->setValue($this->object->getViewMode());
1265
1266 $opts = new ilRadioOption(
1267 $this->lng->txt('cntr_view_sessions'),
1269 );
1270 $opts->setInfo($this->lng->txt('cntr_view_info_sessions'));
1271 $view_type->addOption($opts);
1272
1273 // Limited sessions
1274 $sess = new ilCheckboxInputGUI($this->lng->txt('sess_limit'), 'sl');
1275 $sess->setValue('1');
1276 $sess->setChecked($this->object->isSessionLimitEnabled());
1277 $sess->setInfo($this->lng->txt('sess_limit_info'));
1278
1279 $prev = new ilNumberInputGUI($this->lng->txt('sess_num_prev'), 'sp');
1280 #$prev->setSubmitFormOnEnter(true);
1281 $prev->setMinValue(0);
1282 $prev->setValue(
1283 $this->object->getNumberOfPreviousSessions() == -1 ?
1284 '' :
1285 $this->object->getNumberOfPreviousSessions()
1286 );
1287 $prev->setSize(2);
1288 $prev->setMaxLength(3);
1289 $sess->addSubItem($prev);
1290
1291 $next = new ilNumberInputGUI($this->lng->txt('sess_num_next'), 'sn');
1292 #$next->setSubmitFormOnEnter(true);
1293 $next->setMinValue(0);
1294 $next->setValue(
1295 $this->object->getNumberOfNextSessions() == -1 ?
1296 '' :
1297 $this->object->getNumberOfnextSessions()
1298 );
1299 $next->setSize(2);
1300 $next->setMaxLength(3);
1301 $sess->addSubItem($next);
1302
1303 $opts->addSubItem($sess);
1304
1305 $optsi = new ilRadioOption($this->lng->txt('cntr_view_simple'), (string) ilCourseConstants::IL_CRS_VIEW_SIMPLE);
1306 $optsi->setInfo($this->lng->txt('cntr_view_info_simple'));
1307 $view_type->addOption($optsi);
1308
1309 $optbt = new ilRadioOption(
1310 $this->lng->txt('cntr_view_by_type'),
1312 );
1313 $optbt->setInfo($this->lng->txt('cntr_view_info_by_type'));
1314 $view_type->addOption($optbt);
1315
1316 $opto = new ilRadioOption(
1317 $this->lng->txt('crs_view_objective'),
1319 );
1320 $opto->setInfo($this->lng->txt('crs_view_info_objective'));
1321 $view_type->addOption($opto);
1322
1323 $optt = new ilRadioOption($this->lng->txt('crs_view_timing'), (string) ilCourseConstants::IL_CRS_VIEW_TIMING);
1324 $optt->setInfo($this->lng->txt('crs_view_info_timing'));
1325
1326 // cognos-blu-patch: begin
1327 $timing = new ilRadioGroupInputGUI($this->lng->txt('crs_view_timings'), "timing_mode");
1328 $timing->setValue($this->object->getTimingMode());
1329
1330 $absolute = new ilRadioOption(
1331 $this->lng->txt('crs_view_timing_absolute'),
1333 );
1334 $absolute->setInfo($this->lng->txt('crs_view_info_timing_absolute'));
1335 $timing->addOption($absolute);
1336
1337 $relative = new ilRadioOption(
1338 $this->lng->txt('crs_view_timing_relative'),
1340 );
1341 $relative->setInfo($this->lng->txt('crs_view_info_timing_relative'));
1342 $timing->addOption($relative);
1343
1344 $optt->addSubItem($timing);
1345 // cognos-blu-patch: end
1346
1347 $view_type->addOption($optt);
1348
1349 $form->addItem($view_type);
1350
1351 $this->initSortingForm(
1352 $form,
1353 array(
1358 )
1359 );
1360
1361 $tutorial_support_panel_checkbox = new ilCheckboxInputGUI(
1362 $this->lng->txt('tutorial_support_block_setting_title'),
1363 'tutorial_support_block_checkbox'
1364 );
1365 //$tutorial_support_panel_checkbox->setValue($this->object->getTutorialSupportBlockSettingValue());
1366 $tutorial_support_panel_checkbox->setChecked((bool) $this->object->getTutorialSupportBlockSettingValue());
1367 $tutorial_support_panel_checkbox->setInfo($this->lng->txt('tutorial_support_block_byline'));
1368 $form->addItem($tutorial_support_panel_checkbox);
1369
1370 // lp vs. course status
1372 $olp = ilObjectLP::getInstance($this->object->getId());
1373 if ($olp->getCurrentMode()) {
1374 $lp_status = new ilFormSectionHeaderGUI();
1375 $lp_status->setTitle($this->lng->txt('crs_course_status_of_users'));
1376 $form->addItem($lp_status);
1377
1378 $lp_status_options = new ilRadioGroupInputGUI($this->lng->txt('crs_status_determination'), "status_dt");
1379 // $lp_status_options->setRequired(true);
1380 $lp_status_options->setValue($this->object->getStatusDetermination());
1381
1382 $lp_option = new ilRadioOption(
1383 $this->lng->txt('crs_status_determination_lp'),
1385 $this->lng->txt('crs_status_determination_lp_info')
1386 );
1387 $lp_status_options->addOption($lp_option);
1388 $lp_status_options->addOption(new ilRadioOption(
1389 $this->lng->txt('crs_status_determination_manual'),
1391 ));
1392
1393 $form->addItem($lp_status_options);
1394 }
1395 }
1396
1397 // additional features
1398 $feat = new ilFormSectionHeaderGUI();
1399 $feat->setTitle($this->lng->txt('obj_features'));
1400 $form->addItem($feat);
1401
1403 $this->object->getId(),
1404 $form,
1405 $this->getSubServices()
1406 );
1407
1408 $mem = new ilCheckboxInputGUI($this->lng->txt('crs_show_members'), 'show_members');
1409 $mem->setChecked($this->object->getShowMembers());
1410 $mem->setInfo($this->lng->txt('crs_show_members_info'));
1411 $form->addItem($mem);
1412
1413 // check privacy
1414 if (\ilPrivacySettings::getInstance()->participantsListInCoursesEnabled()) {
1415 $part_list = new ilCheckboxInputGUI($this->lng->txt('crs_show_member_export'), 'show_members_export');
1416 $part_list->setChecked($this->object->getShowMembersExport());
1417 $part_list->setInfo($this->lng->txt('crs_show_member_export_info'));
1418 $mem->addSubItem($part_list);
1419 }
1420
1421 // Show members type
1422 $mail_type = new ilRadioGroupInputGUI($this->lng->txt('crs_mail_type'), 'mail_type');
1423 $mail_type->setValue($this->object->getMailToMembersType());
1424
1425 $mail_tutors = new ilRadioOption(
1426 $this->lng->txt('crs_mail_tutors_only'),
1428 $this->lng->txt('crs_mail_tutors_only_info')
1429 );
1430 $mail_type->addOption($mail_tutors);
1431
1432 $mail_all = new ilRadioOption(
1433 $this->lng->txt('crs_mail_all'),
1435 $this->lng->txt('crs_mail_all_info')
1436 );
1437 $mail_type->addOption($mail_all);
1438 $form->addItem($mail_type);
1439
1440 // Notification Settings
1441 /*$notification = new ilFormSectionHeaderGUI();
1442 $notification->setTitle($this->lng->txt('crs_notification'));
1443 $form->addItem($notification);*/
1444
1445 // Self notification
1446 $not = new ilCheckboxInputGUI($this->lng->txt('crs_auto_notification'), 'auto_notification');
1447 $not->setValue('1');
1448 $not->setInfo($this->lng->txt('crs_auto_notification_info'));
1449 $not->setChecked($this->object->getAutoNotification());
1450 $form->addItem($not);
1451
1452 $desk = new ilCheckboxInputGUI($this->lng->txt('crs_add_remove_from_desktop'), 'abo');
1453 $desk->setChecked($this->object->getAboStatus());
1454 $desk->setInfo($this->lng->txt('crs_add_remove_from_desktop_info'));
1455 $form->addItem($desk);
1456
1457 // Edit ecs export settings
1458 $ecs = new ilECSCourseSettings($this->object);
1459 $ecs->addSettingsToForm($form, 'crs');
1460 return $form;
1461 }
1462
1463 public function sendFileObject(): void
1464 {
1465 $file_id = 0;
1466 if ($this->http->wrapper()->query()->has('file_id')) {
1467 $file_id = $this->http->wrapper()->query()->retrieve(
1468 'file_id',
1469 $this->refinery->kindlyTo()->int()
1470 );
1471 }
1472 $file = new ilCourseFile($file_id);
1473 ilFileDelivery::deliverFileLegacy($file->getAbsolutePath(), $file->getFileName(), $file->getFileType());
1474 }
1475
1476 public function setSubTabs(string $a_tab): void
1477 {
1478 switch ($a_tab) {
1479 case "properties":
1480 $this->tabs_gui->addSubTabTarget(
1481 "crs_settings",
1482 $this->ctrl->getLinkTarget($this, 'edit'),
1483 "edit",
1484 get_class($this)
1485 );
1486
1487 $this->tabs_gui->addSubTabTarget(
1488 "crs_info_settings",
1489 $this->ctrl->getLinkTarget($this, 'editInfo'),
1490 "editInfo",
1491 get_class($this)
1492 );
1493
1494 $this->tabs_gui->addSubTabTarget(
1495 "preconditions",
1496 $this->ctrl->getLinkTargetByClass('ilConditionHandlerGUI', 'listConditions'),
1497 "",
1498 "ilConditionHandlerGUI"
1499 );
1500
1501 $this->tabs_gui->addSubTabTarget(
1502 "crs_start_objects",
1503 $this->ctrl->getLinkTargetByClass('ilContainerStartObjectsGUI', 'listStructure'),
1504 "listStructure",
1505 get_class($this)
1506 );
1507
1508 $this->tabs_gui->addSubTabTarget(
1509 'groupings',
1510 $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'),
1511 'listGroupings',
1512 get_class($this)
1513 );
1514 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1515 if ($lti_settings->hasSettingsAccess()) {
1516 $this->tabs_gui->addSubTabTarget(
1517 'lti_provider',
1518 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1519 );
1520 }
1521
1522 // map settings
1523 if (ilMapUtil::isActivated()) {
1524 $this->tabs_gui->addSubTabTarget(
1525 "crs_map_settings",
1526 $this->ctrl->getLinkTarget($this, 'editMapSettings'),
1527 "editMapSettings",
1528 get_class($this)
1529 );
1530 }
1531
1532 // only show if export permission is granted
1533 if (ilPrivacySettings::getInstance()->checkExportAccess($this->object->getRefId()) || ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
1534 $this->tabs_gui->addSubTabTarget(
1535 'crs_custom_user_fields',
1536 $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1537 '',
1538 'ilobjectcustomuserfieldsgui'
1539 );
1540 }
1541
1542 // certificates
1543 $validator = new ilCertificateActiveValidator();
1544 if (true === $validator->validate()) {
1545 $this->tabs_gui->addSubTabTarget(
1546 "certificate",
1547 $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
1548 "",
1549 "ilcertificategui"
1550 );
1551 }
1552 // news settings
1553 if ($this->object->getUseNews()) {
1554 $this->tabs_gui->addSubTab(
1555 'obj_news_settings',
1556 $this->lng->txt("cont_news_settings"),
1557 $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui')
1558 );
1559 }
1560 if ($this->object->getShowMembersExport()) {
1561 $this->tabs_gui->addSubTab(
1562 'export_members',
1563 $this->lng->txt('crs_show_member_export_settings'),
1564 $this->ctrl->getLinkTargetByClass('ilmemberexportsettingsgui', '')
1565 );
1566 }
1567 $this->tabs_gui->addSubTabTarget(
1568 "obj_multilinguality",
1569 $this->ctrl->getLinkTargetByClass(TranslationGUI::class, ""),
1570 "",
1571 TranslationGUI::class
1572 );
1573 break;
1574 }
1575 }
1576
1580 protected function showPossibleSubObjects(): void
1581 {
1582 if (
1583 $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE &&
1584 !$this->isActiveAdministrationPanel()) {
1585 return;
1586 }
1587 $this->renderAddNewItem();
1588 }
1589
1590 public function renderAddNewItem(string ...$disabled_object_types): void
1591 {
1592 $createble_object_types = $this->getCreatableObjectTypes();
1593
1594 foreach ($disabled_object_types as $type) {
1595 unset($createble_object_types[$type]);
1596 }
1597
1599 $this->buildAddNewItemElements($createble_object_types)
1600 );
1601 $gui->render();
1602 }
1603
1607 protected function afterSave(ilObject $new_object): void
1608 {
1609 $new_object->getMemberObject()->add($this->user->getId(), ilParticipants::IL_CRS_ADMIN);
1610 $new_object->getMemberObject()->updateNotification(
1611 $this->user->getId(),
1612 $this->settings->get('mail_crs_admin_notification', '1')
1613 );
1614 $new_object->getMemberObject()->updateContact($this->user->getId(), 1);
1615 $new_object->update();
1616
1617 ilChangeEvent::_recordWriteEvent($new_object->getId(), $this->user->getId(), 'create');
1618 // END ChangeEvent: Record write event.
1619
1620 // always send a message
1621 $this->tpl->setOnScreenMessage('success', $this->lng->txt("crs_added"), true);
1622 $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
1624 "save",
1625 $this->ctrl->getLinkTarget($this, "edit", "")
1626 ));
1627 }
1628
1629 public function readMemberData(array $ids, ?array $selected_columns = null, bool $skip_names = false): array
1630 {
1631 $show_tracking =
1632 (
1635 );
1636 if ($show_tracking) {
1637 $olp = ilObjectLP::getInstance($this->object->getId());
1638 $show_tracking = $olp->isActive();
1639 }
1640
1641 if ($show_tracking) {
1642 $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
1643 $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
1644 $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
1645 }
1646 $privacy = ilPrivacySettings::getInstance();
1647
1648 if ($privacy->enabledCourseAccessTimes()) {
1649 $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
1650 }
1651
1652 $do_prtf = (is_array($selected_columns) &&
1653 in_array('prtf', $selected_columns) &&
1654 is_array($ids));
1655 if ($do_prtf) {
1657 $ids,
1658 $this->ctrl->getLinkTarget($this, "members")
1659 );
1660 }
1661
1662 $members = [];
1663 foreach ($ids as $usr_id) {
1671 if (!$skip_names) {
1672 $name = ilObjUser::_lookupName($usr_id);
1673 $tmp_data['firstname'] = $name['firstname'];
1674 $tmp_data['lastname'] = $name['lastname'];
1675 $tmp_data['login'] = $name['login'];
1676 }
1677 $tmp_data['passed'] = $this->object->getMembersObject()->hasPassed($usr_id) ? 1 : 0;
1678 if ($this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
1679 $tmp_data['passed_info'] = $this->object->getMembersObject()->getPassedInfo($usr_id);
1680 }
1681 $tmp_data['notification'] = $this->object->getMembersObject()->isNotificationEnabled($usr_id) ? 1 : 0;
1682 $tmp_data['blocked'] = $this->object->getMembersObject()->isBlocked($usr_id) ? 1 : 0;
1683 $tmp_data['contact'] = $this->object->getMembersObject()->isContact($usr_id) ? 1 : 0;
1684
1685 $tmp_data['usr_id'] = $usr_id;
1686
1687 if ($show_tracking) {
1688 if (in_array($usr_id, $completed)) {
1689 $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
1690 } elseif (in_array($usr_id, $in_progress)) {
1691 $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
1692 } elseif (in_array($usr_id, $failed)) {
1693 $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
1694 } else {
1695 $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
1696 }
1697 }
1698
1699 if ($privacy->enabledCourseAccessTimes()) {
1700 if (isset($progress[$usr_id]['ts']) && $progress[$usr_id]['ts']) {
1701 $tmp_data['access_ut'] = $progress[$usr_id]['ts'];
1702 $tmp_data['access_time'] = ilDatePresentation::formatDate(new ilDateTime(
1703 $progress[$usr_id]['ts'],
1705 ));
1706 } else {
1707 $tmp_data['access_ut'] = 0;
1708 $tmp_data['access_time'] = $this->lng->txt('no_date');
1709 }
1710 }
1711
1712 if ($do_prtf) {
1713 $tmp_data['prtf'] = $all_prtf[$usr_id] ?? null;
1714 }
1715
1716 $members[$usr_id] = $tmp_data;
1717 }
1718 return $members;
1719 }
1720
1724 public function updateLPFromStatus(int $a_member_id, bool $a_has_passed): void
1725 {
1727 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
1728 $olp = ilObjectLP::getInstance($this->object->getId());
1729 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) {
1730 $marks = new ilLPMarks($this->object->getId(), $a_member_id);
1731
1732 // only if status has changed
1733 if ($marks->getCompleted() !== $a_has_passed) {
1734 $marks->setCompleted($a_has_passed);
1735 $marks->update();
1736
1737 // as course is origin of LP status change, block syncing
1739 ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id);
1740 }
1741 }
1742 }
1743 }
1744
1745 public function autoFillObject(): bool
1746 {
1747 $this->checkPermission('write');
1748 if (
1749 $this->object->isSubscriptionMembershipLimited() &&
1750 $this->object->getSubscriptionMaxMembers() &&
1751 $this->object->getSubscriptionMaxMembers() <= $this->object->getMembersObject()->getCountMembers()
1752 ) {
1753 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("crs_max_members_reached"));
1754 $this->membersObject();
1755 return false;
1756 }
1757 if ($number = $this->object->getMembersObject()->autoFillSubscribers()) {
1758 $this->tpl->setOnScreenMessage('success', $this->lng->txt("crs_number_users_added") . " " . $number);
1759 } else {
1760 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("crs_no_users_added"));
1761 }
1762 $this->membersObject();
1763 return true;
1764 }
1765
1766 public function leaveObject(): void
1767 {
1768 $this->checkPermission('leave');
1769
1770 if ($this->object->getMembersObject()->isLastAdmin($this->user->getId())) {
1771 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('crs_min_one_admin'));
1772 $this->viewObject();
1773 return;
1774 }
1775
1776 $this->tabs_gui->setTabActive('crs_unsubscribe');
1777 $cgui = new ilConfirmationGUI();
1778 $cgui->setHeaderText($this->lng->txt('crs_unsubscribe_sure'));
1779 $cgui->setFormAction($this->ctrl->getFormAction($this));
1780 $cgui->setCancel($this->lng->txt("cancel"), "cancel");
1781 $cgui->setConfirm($this->lng->txt("crs_unsubscribe"), "performUnsubscribe");
1782 $this->tpl->setContent($cgui->getHTML());
1783 }
1784
1785 public function unsubscribeObject(): void
1786 {
1787 $this->leaveObject();
1788 }
1789
1791 {
1792 $this->checkPermission('leave');
1793 $this->getObject()->getMembersObject()->delete($this->user->getId());
1794 $this->getObject()->getMembersObject()->sendUnsubscribeNotificationToAdmins($this->user->getId());
1795 $this->getObject()->getMembersObject()->sendNotification(
1797 $this->user->getId()
1798 );
1799 $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_unsubscribed_from_crs'), true);
1800
1801 $this->ctrl->setParameterByClass("ilrepositorygui", "ref_id", $this->tree->getParentId($this->ref_id));
1802 $this->ctrl->redirectByClass("ilrepositorygui", "");
1803 }
1804
1805
1806 protected function getAgreementTabs(): void
1807 {
1808 if ($this->access->checkAccess('visible', '', $this->ref_id)) {
1809 $this->tabs->addTarget(
1810 "info_short",
1811 $this->ctrl->getLinkTargetByClass(
1812 array("ilobjcoursegui", "ilinfoscreengui"),
1813 "showSummary"
1814 ),
1815 "infoScreen"
1816 );
1817 }
1818 if (
1819 $this->access->checkAccess('leave', '', $this->object->getRefId()) &&
1820 $this->object->getMemberObject()->isMember()
1821 ) {
1822 $this->tabs->addTarget(
1823 "crs_unsubscribe",
1824 $this->ctrl->getLinkTarget($this, "unsubscribe"),
1825 'leave',
1826 ""
1827 );
1828 }
1829 }
1830
1831 public function addContentTab(): void
1832 {
1833 $this->tabs_gui->addTab(
1834 "view_content",
1835 $this->lng->txt("content"),
1836 $this->ctrl->getLinkTarget($this, "view")
1837 );
1838 }
1839
1840 protected function getTabs(): void
1841 {
1842 $this->help->setScreenIdComponent("crs");
1843 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
1844
1845 if ($this->access->checkAccess('read', '', $this->ref_id)) {
1846 // default activation
1847 $this->tabs_gui->activateTab('view_content');
1848 if ($this->object->isNewsTimelineEffective()) {
1849 if (!$this->object->isNewsTimelineLandingPageEffective()) {
1850 $this->addContentTab();
1851 }
1852 $this->tabs_gui->addTab(
1853 "news_timeline",
1854 $this->lng->txt("cont_news_timeline_tab"),
1855 $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show")
1856 );
1857 if ($this->object->isNewsTimelineLandingPageEffective()) {
1858 $this->addContentTab();
1859 }
1860 } else {
1861 $this->addContentTab();
1862 }
1863 }
1864
1865 if ($this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_TIMING && $this->access->checkAccess('write', '', $this->ref_id)
1866 ) {
1867 $this->tabs->addTab(
1868 'timings_timings',
1869 $this->lng->txt('timings_timings'),
1870 $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'manageTimings')
1871 );
1872 } elseif (
1873 $this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_TIMING && $this->object->getMemberObject()->isParticipant() && $this->access->checkAccess('read', '', $this->ref_id)) {
1874 $this->tabs->addTab(
1875 'timings_timings',
1876 $this->lng->txt('timings_timings'),
1877 $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'managePersonalTimings')
1878 );
1879 }
1880
1881 // learning objectives
1882 if ($this->access->checkAccess('write', '', $this->ref_id)) {
1883 if ($this->object->getViewMode() == ilCourseConstants::IL_CRS_VIEW_OBJECTIVE or ilCourseObjective::_getCountObjectives($this->object->getId())) {
1884 $this->tabs_gui->addTarget(
1885 'crs_objectives',
1886 $this->ctrl->getLinkTargetByClass('illoeditorgui', ''),
1887 'illoeditorgui'
1888 );
1889 }
1890 }
1891
1892 if (
1893 $this->access->checkAccess('visible', '', $this->ref_id) ||
1894 $this->access->checkAccess('join', '', $this->ref_id) ||
1895 $this->access->checkAccess('read', '', $this->ref_id)
1896 ) {
1897 $force_active =
1898 strcasecmp($this->ctrl->getCmdClass(), ilInfoScreenGUI::class) === 0 ||
1899 strcasecmp($this->ctrl->getCmdClass(), ilNoteGUI::class) === 0;
1900 $this->tabs_gui->addTarget(
1901 "info_short",
1902 $this->ctrl->getLinkTargetByClass(
1903 array("ilobjcoursegui", "ilinfoscreengui"),
1904 "showSummary"
1905 ),
1906 "infoScreen",
1907 "",
1908 "",
1909 $force_active
1910 );
1911 }
1912 if ($this->access->checkAccess('write', '', $this->ref_id)) {
1913 $force_active =
1914 strcasecmp($this->ctrl->getCmdClass(), ilConditionHandlerGUI::class) &&
1915 !$this->http->wrapper()->query()->has('item_id');
1916 $this->tabs_gui->addTarget(
1917 "settings",
1918 $this->ctrl->getLinkTarget($this, "edit"),
1919 array("edit", "editMapSettings", "editCourseIcons", "listStructure"),
1920 "",
1921 "",
1922 $force_active
1923 );
1924 }
1925
1926 $is_participant = ilCourseParticipants::_isParticipant($this->ref_id, $this->user->getId());
1927 $mail = new ilMail($this->user->getId());
1928
1929 $membership_gui = new ilCourseMembershipGUI($this, $this->object);
1930 $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
1931
1932 // badges
1933 if ($this->access->checkAccess('write', '', $this->ref_id)) {
1934 if (ilBadgeHandler::getInstance()->isObjectActive($this->object->getId())) {
1935 $this->tabs_gui->addTarget(
1936 "obj_tool_setting_badges",
1937 $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
1938 "",
1939 "ilbadgemanagementgui"
1940 );
1941 }
1942 }
1943
1944 // skills
1945 if (ilContSkillPresentationGUI::isAccessible($this->ref_id)) {
1946 $this->tabs_gui->addTarget(
1947 "obj_tool_setting_skills",
1948 $this->ctrl->getLinkTargetByClass(array("ilcontainerskillgui", "ilcontskillpresentationgui"), ""),
1949 "",
1950 array("ilcontainerskillgui", "ilcontskillpresentationgui", "ilcontskilladmingui")
1951 );
1952 }
1953
1954 // booking
1955 if ($this->access->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
1956 $this->object->getId(),
1958 '0'
1959 )) {
1960 $this->tabs_gui->addTarget(
1961 "obj_tool_setting_booking",
1962 $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
1963 );
1964 }
1965
1966 // learning progress
1967 if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
1968 $this->tabs_gui->addTarget(
1969 'learning_progress',
1970 $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui', 'illearningprogressgui'), ''),
1971 '',
1972 array('illplistofobjectsgui', 'illplistofsettingsgui', 'illearningprogressgui', 'illplistofprogressgui')
1973 );
1974 }
1975
1976 // meta data
1977 if ($this->access->checkAccess('write', '', $this->ref_id)) {
1978 $mdgui = new ilObjectMetaDataGUI($this->object);
1979 $mdtab = $mdgui->getTab();
1980 if ($mdtab) {
1981 $this->tabs_gui->addTarget(
1982 "meta_data",
1983 $mdtab,
1984 "",
1985 "ilobjectmetadatagui"
1986 );
1987 }
1988 }
1989
1990 if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
1991 $this->tabs_gui->addTarget(
1992 'export',
1993 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
1994 'export',
1995 'ilexportgui'
1996 );
1997 }
1998
1999 if ($this->access->checkAccess('edit_permission', '', $this->ref_id)) {
2000 $this->tabs_gui->addTarget(
2001 "perm_settings",
2002 $this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilpermissiongui'), "perm"),
2003 array("perm", "info", "owner"),
2004 'ilpermissiongui'
2005 );
2006 }
2007
2008 // Join/Leave
2009 if ($this->access->checkAccess('join', '', $this->ref_id) && !$this->object->getMemberObject()->isAssigned()) {
2010 if (ilCourseWaitingList::_isOnList($this->user->getId(), $this->object->getId())) {
2011 $this->tabs_gui->addTab(
2012 'leave',
2013 $this->lng->txt('membership_leave'),
2014 $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', 'show', '')
2015 );
2016 } else {
2017 $this->tabs_gui->addTarget(
2018 "join",
2019 $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', "show"),
2020 'show',
2021 ""
2022 );
2023 }
2024 }
2025 if ($this->access->checkAccess('leave', '', $this->object->getRefId()) && $this->object->getMemberObject()->isMember()) {
2026 $this->tabs_gui->addTarget(
2027 "crs_unsubscribe",
2028 $this->ctrl->getLinkTarget($this, "unsubscribe"),
2029 'leave',
2030 ""
2031 );
2032 }
2033 }
2034
2035 public function executeCommand(): void
2036 {
2037 $next_class = $this->ctrl->getNextClass($this);
2038 $cmd = $this->ctrl->getCmd();
2039
2040 $this->prepareOutput();
2041
2042 // add entry to navigation history
2043 if (!$this->getCreationMode() &&
2044 $this->access->checkAccess('read', '', $this->ref_id)) {
2045 $this->navigation_history->addItem(
2046 $this->ref_id,
2047 ilLink::_getLink($this->ref_id, "crs"),
2048 "crs"
2049 );
2050 }
2051 $header_action = true;
2052 switch ($next_class) {
2053 case strtolower(ilRepositoryTrashGUI::class):
2054 $ru = new \ilRepositoryTrashGUI($this);
2055 $this->ctrl->setReturn($this, 'trash');
2056 $this->ctrl->forwardCommand($ru);
2057 break;
2058
2059 case 'illtiproviderobjectsettinggui':
2060
2061 $this->setSubTabs('properties');
2062 $this->tabs_gui->activateTab('settings');
2063 $this->tabs_gui->activateSubTab('lti_provider');
2064 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
2065 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
2066 $lti_gui->offerLTIRolesForSelection(false);
2067 $this->ctrl->forwardCommand($lti_gui);
2068 break;
2069
2070 case 'ilcoursemembershipgui':
2071
2072 $this->tabs_gui->activateTab('members');
2073
2074 $mem_gui = new ilCourseMembershipGUI($this, $this->object);
2075 $this->ctrl->forwardCommand($mem_gui);
2076 break;
2077
2078 case "ilinfoscreengui":
2079 $this->infoScreen(); // forwards command
2080 break;
2081
2082 case 'ilobjectmetadatagui':
2083 if (!$this->access->checkAccess('write', '', $this->object->getRefId())) {
2084 $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->WARNING);
2085 }
2086 $this->tabs_gui->setTabActive('meta_data');
2087 $md_gui = new ilObjectMetaDataGUI($this->object);
2088 $this->ctrl->forwardCommand($md_gui);
2089 break;
2090
2091 case 'ilcourseregistrationgui':
2092 $this->ctrl->setReturn($this, '');
2093 $this->tabs_gui->setTabActive('join');
2094 $registration = new ilCourseRegistrationGUI($this->object, $this);
2095 $this->ctrl->forwardCommand($registration);
2096 break;
2097
2098 case 'ilobjectcustomuserfieldsgui':
2099 $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
2100 $this->setSubTabs('properties');
2101 $this->tabs_gui->activateTab('settings');
2102 $this->tabs_gui->activateSubTab('crs_custom_user_fields');
2103 $this->ctrl->forwardCommand($cdf_gui);
2104 break;
2105
2106 case "ilcourseobjectivesgui":
2107
2108 $this->ctrl->setReturn($this, "");
2109 $reg_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2110 $this->ctrl->forwardCommand($reg_gui);
2111 break;
2112
2113 case 'ilobjcoursegroupinggui':
2114
2115 $this->ctrl->setReturn($this, 'edit');
2116 $this->setSubTabs('properties');
2117 $this->tabs_gui->activateTab('settings');
2118 $this->tabs_gui->activateSubTab('groupings');
2119
2120 $grouping_id = 0;
2121 if ($this->http->wrapper()->query()->has('obj_id')) {
2122 $grouping_id = $this->http->wrapper()->query()->retrieve(
2123 'obj_id',
2124 $this->refinery->kindlyTo()->int()
2125 );
2126 }
2127 $crs_grp_gui = new ilObjCourseGroupingGUI($this->object, $grouping_id);
2128 $this->ctrl->forwardCommand($crs_grp_gui);
2129 break;
2130
2131 case "ilpropertyformgui":
2132 // only case is currently adv metadata internal link in info settings, see #24497
2133 $form = $this->initInfoEditor();
2134 $this->ctrl->forwardCommand($form);
2135 break;
2136
2137 case "ilcolumngui":
2138 $this->ctrl->setReturn($this, "");
2139 $this->tabs_gui->setTabActive('none');
2140 $this->checkPermission("read");
2141 //$this->prepareOutput();
2142 //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2143 // ilObjStyleSheet::getContentStylePath(0));
2144 //$this->renderObject();
2145 $this->viewObject();
2146 break;
2147
2148 case "ilconditionhandlergui":
2149 // preconditions for whole course
2150 $this->setSubTabs("properties");
2151 $this->tabs_gui->activateTab('settings');
2152 $this->tabs_gui->activateSubTab('preconditions');
2153 $new_gui = new ilConditionHandlerGUI($this->object->getRefId());
2154 $this->ctrl->forwardCommand($new_gui);
2155 break;
2156
2157 case "illearningprogressgui":
2158
2159 $user_id = $this->user->getId();
2160 if ($this->http->wrapper()->query()->has('user_id')) {
2161 $user_id = $this->http->wrapper()->query()->retrieve(
2162 'user_id',
2163 $this->refinery->kindlyTo()->int()
2164 );
2165 }
2166 $new_gui = new ilLearningProgressGUI(
2168 $this->object->getRefId(),
2169 $user_id
2170 );
2171 $this->ctrl->forwardCommand($new_gui);
2172 $this->tabs_gui->setTabActive('learning_progress');
2173 break;
2174
2175 case 'ilpermissiongui':
2176 $this->tabs_gui->setTabActive('perm_settings');
2177 $perm_gui = new ilPermissionGUI($this);
2178 $this->ctrl->forwardCommand($perm_gui);
2179 break;
2180
2181 case 'ilcalendarpresentationgui':
2182 $cal = new ilCalendarPresentationGUI($this->object->getRefId());
2183 $ret = $this->ctrl->forwardCommand($cal);
2184 $header_action = false;
2185 break;
2186
2187 case 'ilcoursecontentgui':
2188 $this->ctrl->setReturn($this, 'members');
2189 $course_content_obj = new ilCourseContentGUI($this);
2190 $this->ctrl->forwardCommand($course_content_obj);
2191 break;
2192
2193 case strtolower(PublicProfileGUI::class):
2194 $this->tpl->enableDragDropFileUpload(null);
2195 $this->setSubTabs('members');
2196 $this->tabs_gui->setTabActive('members');
2197
2198 $user_id = $this->user->getId();
2199 if ($this->http->wrapper()->query()->has('user_id')) {
2200 $user_id = $this->http->wrapper()->query()->retrieve(
2201 'user_id',
2202 $this->refinery->kindlyTo()->int()
2203 );
2204 }
2205 $profile_gui = new PublicProfileGUI($user_id);
2206 $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilCourseMembershipGUI",
2207 "ilUsersGalleryGUI"
2208 ], 'view'));
2209 $this->tabs_gui->setSubTabActive('crs_members_gallery');
2210 $html = $this->ctrl->forwardCommand($profile_gui);
2211 $this->tpl->setVariable("ADM_CONTENT", $html);
2212 break;
2213
2214 case 'ilmemberagreementgui':
2215 $this->tabs_gui->clearTargets();
2216
2217 $this->ctrl->setReturn($this, '');
2218 $agreement = new ilMemberAgreementGUI($this->object->getRefId());
2219 $this->ctrl->forwardCommand($agreement);
2220 break;
2221
2222 // container page editing
2223 case "ilcontainerpagegui":
2224 $ret = $this->forwardToPageObject();
2225 if ($ret != "") {
2226 $this->tpl->setContent($ret);
2227 }
2228 $header_action = false;
2229 break;
2230
2231 case "ilcontainerstartobjectspagegui":
2232 // file downloads, etc. (currently not active)
2233 $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
2234 $ret = $this->ctrl->forwardCommand($pgui);
2235 if ($ret) {
2236 $this->tpl->setContent($ret);
2237 }
2238 break;
2239
2240 case 'ilobjectcopygui':
2241 $cp = new ilObjectCopyGUI($this);
2242 $cp->setType('crs');
2243 $this->ctrl->forwardCommand($cp);
2244 break;
2245
2246 case "ilobjectcontentstylesettingsgui":
2247
2248 global $DIC;
2249
2250 $this->checkPermission("write");
2251 $this->setTitleAndDescription();
2252 $this->showContainerPageTabs();
2253 $settings_gui = $DIC->contentStyle()->gui()
2254 ->objectSettingsGUIForRefId(
2255 null,
2256 $this->object->getRefId()
2257 );
2258 $this->ctrl->forwardCommand($settings_gui);
2259 break;
2260
2261 case 'ilexportgui':
2262 $this->tabs_gui->setTabActive('export');
2263 $exp = new ilExportGUI($this);
2264 $exp->addFormat('xml');
2265 $this->ctrl->forwardCommand($exp);
2266 break;
2267
2268 case "ilcommonactiondispatchergui":
2270 $this->ctrl->forwardCommand($gui);
2271 break;
2272
2273 case 'ildidactictemplategui':
2274 $this->ctrl->setReturn($this, 'edit');
2275 $did = new ilDidacticTemplateGUI($this);
2276 $this->ctrl->forwardCommand($did);
2277 break;
2278
2279 case "ilcertificategui":
2280 $this->tabs_gui->activateTab("settings");
2281 $this->setSubTabs("properties");
2282 $this->tabs_gui->activateSubTab('certificate');
2283
2284 $guiFactory = new ilCertificateGUIFactory();
2285 $output_gui = $guiFactory->create($this->object);
2286 $this->ctrl->forwardCommand($output_gui);
2287 break;
2288
2289 case 'illoeditorgui':
2290 #$this->tabs_gui->clearTargets();
2291 #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
2292 $this->tabs_gui->activateTab('crs_objectives');
2293
2294 $editor = new ilLOEditorGUI($this);
2295 $this->ctrl->forwardCommand($editor);
2296 if (strtolower($this->ctrl->getCmdClass()) === "illopagegui") {
2297 $header_action = false;
2298 }
2299 break;
2300
2301 case 'ilcontainerstartobjectsgui':
2302 $this->ctrl->setReturn($this, 'edit');
2303 $this->tabs_gui->clearTargets();
2304 $this->tabs_gui->setBackTarget(
2305 $this->lng->txt("back_to_crs_content"),
2306 $this->ctrl->getLinkTarget($this, "edit")
2307 );
2308 $this->tabs_gui->addTab(
2309 "start",
2310 $this->lng->txt("crs_start_objects"),
2311 $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure")
2312 );
2313 $this->tabs_gui->activateTab("start");
2314 if (strtolower($this->ctrl->getCmdClass()) ==
2315 "ilcontainerstartobjectspagegui") {
2316 $header_action = false;
2317 }
2318 global $DIC;
2319
2320 $ilHelp = $DIC['ilHelp'];
2321 $this->help->setScreenIdComponent("crs");
2322 $stgui = new ilContainerStartObjectsGUI($this->object);
2323 $this->ctrl->forwardCommand($stgui);
2324 break;
2325
2326 case 'illomembertestresultgui':
2327 $GLOBALS['DIC']['ilCtrl']->setReturn($this, 'members');
2328 $GLOBALS['DIC']['ilTabs']->clearTargets();
2329 $GLOBALS['DIC']['ilTabs']->setBackTarget(
2330 $GLOBALS['DIC']['lng']->txt('back'),
2331 $GLOBALS['DIC']['ilCtrl']->getLinkTarget($this, 'members')
2332 );
2333
2334 $uid = 0;
2335 if ($this->http->wrapper()->query()->has('uid')) {
2336 $uid = $this->http->wrapper()->query()->retrieve(
2337 'uid',
2338 $this->refinery->kindlyTo()->int()
2339 );
2340 }
2341 $result_view = new ilLOMemberTestResultGUI($this, $this->object, $uid);
2342 $this->ctrl->forwardCommand($result_view);
2343 break;
2344
2345 case 'ilmailmembersearchgui':
2346 $mail = new ilMail($this->user->getId());
2347
2348 if (
2349 !($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
2350 $this->access->checkAccess('manage_members', "", $this->object->getRefId())) &&
2351 $this->rbac_system->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
2352 $this->error->raiseError($this->lng->txt("msg_no_perm_read"), $this->error->MESSAGE);
2353 }
2354
2355 $this->tabs_gui->setTabActive('members');
2356
2357 $mail_search = new ilMailMemberSearchGUI(
2358 $this,
2359 $this->object->getRefId(),
2361 );
2362 $mail_search->setObjParticipants(
2364 );
2365 $this->ctrl->forwardCommand($mail_search);
2366 break;
2367
2368 case 'ilbadgemanagementgui':
2369 $this->tabs_gui->setTabActive('obj_tool_setting_badges');
2370 $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'crs');
2371 $this->ctrl->forwardCommand($bgui);
2372 break;
2373
2374 case "ilcontainernewssettingsgui":
2375 $this->setSubTabs("properties");
2376 $this->tabs_gui->activateTab('settings');
2377 $this->tabs_gui->activateSubTab('obj_news_settings');
2378 $news_set_gui = new ilContainerNewsSettingsGUI($this);
2379 $news_set_gui->setTimeline(true);
2380 $news_set_gui->setCronNotifications(true);
2381 $news_set_gui->setHideByDate(true);
2382 $this->ctrl->forwardCommand($news_set_gui);
2383 break;
2384
2385 case "ilnewstimelinegui":
2386 if (!$this->__checkStartObjects()) { // see #37236
2387 $this->ctrl->redirectByClass(self::class, "view");
2388 }
2389 $this->tabs_gui->setTabActive('news_timeline');
2391 $this->object->getRefId(),
2392 $this->object->getNewsTimelineAutoEntries()
2393 );
2394 $t->setUserEditAll($this->access->checkAccess('write', '', $this->object->getRefId(), 'grp'));
2395 $this->showPermanentLink();
2396 $this->ctrl->forwardCommand($t);
2398 $this->user->getId(),
2399 $this->object->getId(),
2400 $this->object->getRefId(),
2401 'crs'
2402 );
2403 break;
2404
2405 case 'ilmemberexportsettingsgui':
2406 $this->setSubTabs('properties');
2407 $this->tabs_gui->activateTab('properties');
2408 $this->tabs_gui->activateSubTab('export_members');
2409 $settings_gui = new ilMemberExportSettingsGUI($this->object->getType(), $this->object->getId());
2410 $this->ctrl->forwardCommand($settings_gui);
2411 break;
2412
2413 case "ilcontainerskillgui":
2414 $this->tabs_gui->activateTab('obj_tool_setting_skills');
2415 $gui = new ilContainerSkillGUI($this);
2416 $this->ctrl->forwardCommand($gui);
2417 break;
2418
2419 case strtolower(TranslationGUI::class):
2420 $this->checkPermissionBool("write");
2421 $this->setSubTabs("properties");
2422 $this->tabs_gui->activateTab("settings");
2423 $this->tabs_gui->activateSubTab("obj_multilinguality");
2424 $transgui = new TranslationGUI(
2425 $this->getObject(),
2426 $this->lng,
2427 $this->access,
2428 $this->user,
2429 $this->ctrl,
2430 $this->tpl,
2431 $this->ui_factory,
2432 $this->ui_renderer,
2433 $this->http,
2434 $this->refinery,
2435 $this->toolbar
2436 );
2437 $this->ctrl->forwardCommand($transgui);
2438 break;
2439
2440 case "ilbookinggatewaygui":
2441 $this->tabs_gui->activateTab('obj_tool_setting_booking');
2442 $gui = new ilBookingGatewayGUI($this);
2443 $this->ctrl->forwardCommand($gui);
2444 break;
2445
2446 default:
2447 // #9401 - see also ilStartupGUI::_checkGoto()
2448 if ($cmd == 'infoScreenGoto') {
2449 if (ilObjCourse::_isActivated($this->object->getId()) &&
2450 ilObjCourse::_registrationEnabled($this->object->getId())) {
2451 $cmd = 'join';
2452 } else {
2453 $cmd = 'infoScreen';
2454 }
2455 }
2456
2457 if (!$this->creation_mode) {
2458 if ($cmd == "infoScreen") {
2459 $this->checkPermission("visible");
2460 } else {
2461 // $this->checkPermission("read");
2462 }
2463 }
2464
2465 if (!$this->creation_mode
2466 && $cmd != 'infoScreen'
2467 && $cmd != 'sendfile'
2468 && $cmd != 'unsubscribe'
2469 && $cmd != 'deliverCertificate'
2470 && $cmd != 'performUnsubscribe'
2471 && $cmd != 'removeFromDesk'
2472 && $cmd !== 'leave'
2473 && !$this->access->checkAccess("read", '', $this->object->getRefId())
2474 || $cmd == 'join'
2475 || $cmd == 'subscribe'
2476 || $cmd === 'leaveWaitList') {
2477 if ($this->rbac_system->checkAccess('join', $this->object->getRefId()) &&
2478 !ilCourseParticipants::_isParticipant($this->object->getRefId(), $this->user->getId())) {
2479 $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
2480 } else {
2481 $this->infoScreenObject();
2482 break;
2483 }
2484 }
2485
2486 if ($cmd == 'listObjectives') {
2487 $this->ctrl->setReturn($this, "");
2488 $obj_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2489 $this->ctrl->forwardCommand($obj_gui);
2490 break;
2491 }
2492 // if news timeline is landing page, redirect if necessary
2493 if ($cmd == "" && $this->object->isNewsTimelineLandingPageEffective()) {
2494 $this->ctrl->redirectByClass("ilnewstimelinegui");
2495 }
2496
2497 if (!$cmd) {
2498 $cmd = 'view';
2499 }
2500 $cmd .= 'Object';
2501 $this->$cmd();
2502 break;
2503 }
2504
2505 if ($header_action) {
2506 $this->addHeaderAction();
2507 }
2508 }
2509
2510 private function checkAgreement(): bool
2511 {
2512 if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
2513 return true;
2514 }
2515
2516 // Disable aggrement if is not member of course
2517 if (!$this->object->getMemberObject()->isAssigned()) {
2518 return true;
2519 }
2520
2521 if (ilMemberViewSettings::getInstance()->isActive()) {
2522 return true;
2523 }
2524
2525 $privacy = ilPrivacySettings::getInstance();
2526
2527 // Check agreement
2528 if (
2529 (
2530 $privacy->courseConfirmationRequired() || ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())
2531 ) &&
2532 !ilMemberAgreement::_hasAccepted($this->user->getId(), $this->object->getId())
2533 ) {
2534 $this->logger->warning('Missing course confirmation.');
2535 return false;
2536 }
2537 // Check required fields
2538 if (!ilCourseUserData::_checkRequired($this->user->getId(), $this->object->getId())) {
2539 $this->logger->warning('Missing required fields');
2540 return false;
2541 }
2542 return true;
2543 }
2544
2545 public static function _forwards(): array
2546 {
2547 return array("ilCourseRegisterGUI", 'ilConditionHandlerGUI');
2548 }
2549
2550 protected function membersObject(): void
2551 {
2552 $this->ctrl->redirectByClass('ilcoursemembershipgui');
2553 }
2554
2555 public static function _goto($a_target, string $a_add = ""): void
2556 {
2557 global $DIC;
2558 $main_tpl = $DIC->ui()->mainTemplate();
2559 $ilAccess = $DIC['ilAccess'];
2560 $ilErr = $DIC['ilErr'];
2561 $lng = $DIC['lng'];
2562 $ilUser = $DIC['ilUser'];
2563 $http = $DIC->http();
2564 $refinery = $DIC->refinery();
2565
2566 $a_target = (int) $a_target;
2567
2568 if (substr($a_add, 0, 5) == 'rcode') {
2569 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
2570 $target = '';
2571 if ($http->wrapper()->query()->has('target')) {
2572 $target = $http->wrapper()->query()->retrieve(
2573 'target',
2574 $refinery->kindlyTo()->string()
2575 );
2576 }
2577 // Redirect to login for anonymous
2579 "login.php?target=" . $target . "&cmd=force_login&lang=" .
2580 $ilUser->getCurrentLanguage()
2581 );
2582 }
2583
2584 // Redirects to target location after assigning user to course
2586 $a_target,
2588 substr($a_add, 5)
2589 );
2590 }
2591
2592 if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target)) {
2593 ilObjectGUI::_gotoRepositoryNode($a_target, "members");
2594 }
2595
2596 if ($a_add == "comp" && ilContSkillPresentationGUI::isAccessible($a_target)) {
2597 ilObjectGUI::_gotoRepositoryNode($a_target, "competences");
2598 }
2599
2600 if ($ilAccess->checkAccess("read", "", $a_target)) {
2602 } else {
2603 // to do: force flat view
2604 if ($ilAccess->checkAccess("visible", "", $a_target)) {
2605 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
2606 } else {
2607 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2608 $main_tpl->setOnScreenMessage('failure', sprintf(
2609 $lng->txt("msg_no_perm_read_item"),
2611 ), true);
2613 }
2614 }
2615 }
2616 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2617 }
2618
2619 public function editMapSettingsObject(): void
2620 {
2621 $this->setSubTabs("properties");
2622 $this->tabs_gui->activateTab('settings');
2623 $this->tabs_gui->activateSubTab('crs_map_settings');
2624
2625 if (!ilMapUtil::isActivated() ||
2626 !$this->access->checkAccess("write", "", $this->object->getRefId())) {
2627 return;
2628 }
2629
2630 $latitude = $this->object->getLatitude();
2631 $longitude = $this->object->getLongitude();
2632 $zoom = $this->object->getLocationZoom();
2633
2634 // Get Default settings, when nothing is set
2635 if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
2637 $latitude = $def["latitude"];
2638 $longitude = $def["longitude"];
2639 $zoom = $def["zoom"];
2640 }
2641
2642 $form = new ilPropertyFormGUI();
2643 $form->setFormAction($this->ctrl->getFormAction($this));
2644 $form->setTitle($this->lng->txt("crs_map_settings"));
2645
2646 // enable map
2647 $public = new ilCheckboxInputGUI(
2648 $this->lng->txt("crs_enable_map"),
2649 "enable_map"
2650 );
2651 $public->setValue("1");
2652 $public->setChecked($this->object->getEnableCourseMap());
2653 $form->addItem($public);
2654
2655 // map location
2656 $loc_prop = new ilLocationInputGUI(
2657 $this->lng->txt("crs_map_location"),
2658 "location"
2659 );
2660 $loc_prop->setLatitude((float) $latitude);
2661 $loc_prop->setLongitude((float) $longitude);
2662 $loc_prop->setZoom((int) $zoom);
2663 $form->addItem($loc_prop);
2664
2665 $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
2666
2667 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
2668 //$this->tpl->show();
2669 }
2670
2674 public function saveMapSettingsObject(): void
2675 {
2676 $location = [];
2677 if ($this->http->wrapper()->post()->has('location')) {
2678 $custom_transformer = $this->refinery->custom()->transformation(
2679 fn($array) => $array
2680 );
2681 $location = $this->http->wrapper()->post()->retrieve(
2682 'location',
2683 $custom_transformer
2684 );
2685 }
2686 $enable_map = false;
2687 if ($this->http->wrapper()->post()->has('enable_map')) {
2688 $enable_map = $this->http->wrapper()->post()->retrieve(
2689 'enable_map',
2690 $this->refinery->kindlyTo()->bool()
2691 );
2692 }
2693 $this->object->setLatitude($location['latitude']);
2694 $this->object->setLongitude($location['longitude']);
2695 $this->object->setLocationZoom($location['zoom']);
2696 $this->object->setEnableCourseMap($enable_map);
2697 $this->object->update();
2698 $this->ctrl->redirect($this, "editMapSettings");
2699 }
2700
2704 public function modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data): void
2705 {
2707 $a_item_list_gui,
2708 'ilcoursecontentgui',
2709 $a_item_data,
2710 $this->object->getAboStatus(),
2711 $this->object->getRefId(),
2712 $this->object->getId()
2713 );
2714 }
2715
2716 public static function _modifyItemGUI(
2717 ilObjectListGUI $a_item_list_gui,
2718 string $a_cmd_class,
2719 array $a_item_data,
2720 bool $a_abo_status,
2721 int $a_course_ref_id,
2722 int $a_course_obj_id,
2723 int $a_parent_ref_id = 0
2724 ): void {
2725 global $DIC;
2726 $lng = $DIC->language();
2727 $ilAccess = $DIC->access();
2728
2729 // this is set for folders within the course
2730 if ($a_parent_ref_id == 0) {
2731 $a_parent_ref_id = $a_course_ref_id;
2732 }
2733
2734 // Special handling for tests in courses with learning objectives
2735 if ($a_item_data['type'] == 'tst' && ilObjCourse::_lookupViewMode($a_course_obj_id) == ilContainer::VIEW_OBJECTIVE) {
2736 $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id));
2737 }
2738
2739 $a_item_list_gui->enableSubscribe($a_abo_status);
2740
2741 $is_tutor = ($ilAccess->checkAccess(
2742 'write',
2743 '',
2744 $a_course_ref_id,
2745 'crs',
2746 $a_course_obj_id
2747 ));
2748 }
2749
2753 public function setContentSubTabs(): void
2754 {
2755 global $DIC;
2756
2757 $ilAccess = $DIC['ilAccess'];
2758 $lng = $DIC['lng'];
2759 $ilCtrl = $DIC['ilCtrl'];
2760
2761 if ($this->object->getType() != 'crs') {
2762 return;
2763 }
2764 if (!$this->access->checkAccess(
2765 'write',
2766 '',
2767 $this->object->getRefId(),
2768 'crs',
2769 $this->object->getId()
2770 )) {
2771 $is_tutor = false;
2772 // No further tabs if objective view or archives
2773 if ($this->object->enabledObjectiveView()) {
2774 return;
2775 }
2776 } else {
2777 $is_tutor = true;
2778 }
2779
2780 if (!$this->isActiveAdministrationPanel()) {
2781 $this->tabs_gui->addSubTab(
2782 "view_content",
2783 $lng->txt("view"),
2784 $this->ctrl->getLinkTargetByClass("ilobjcoursegui", "view")
2785 );
2786 } else {
2787 $this->tabs_gui->addSubTab(
2788 "view_content",
2789 $lng->txt("view"),
2790 $this->ctrl->getLinkTargetByClass("ilobjcoursegui", "disableAdministrationPanel")
2791 );
2792 }
2793 //}
2794
2795 $this->addStandardContainerSubTabs(false);
2796 }
2797
2798 public function askResetObject(): void
2799 {
2800 //$this->tpl->setOnScreenMessage('question', $this->lng->txt('crs_objectives_reset_sure'));
2801 $confirm = new ilConfirmationGUI();
2802 $confirm->setHeaderText($this->lng->txt('crs_objectives_reset_sure'));
2803 $confirm->setFormAction($this->ctrl->getFormAction($this));
2804 $confirm->setConfirm($this->lng->txt('reset'), 'reset');
2805 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
2806 $this->tpl->setContent($confirm->getHTML());
2807 }
2808
2809 public function resetObject(): void
2810 {
2811 $usr_results = new ilLOUserResults($this->object->getId(), $GLOBALS['DIC']['ilUser']->getId());
2812 $usr_results->delete();
2814 $this->object->getId(),
2815 $GLOBALS['DIC']['ilUser']->getId()
2816 );
2817
2818 $tmp_obj_res = new ilCourseObjectiveResult($this->user->getId());
2819 $tmp_obj_res->reset($this->object->getId());
2820
2821 $this->user->deletePref('crs_objectives_force_details_' . $this->object->getId());
2822 $this->tpl->setOnScreenMessage('success', $this->lng->txt('crs_objectives_reseted'));
2823 $this->viewObject();
2824 }
2825
2826 public function __checkStartObjects(): bool
2827 {
2828 if ($this->access->checkAccess('write', '', $this->object->getRefId())) {
2829 return true;
2830 }
2831 $this->start_obj = new ilContainerStartObjects(
2832 $this->object->getRefId(),
2833 $this->object->getId()
2834 );
2835 if (count($this->start_obj->getStartObjects()) &&
2836 !$this->start_obj->allFullfilled($this->user->getId())) {
2837 return false;
2838 }
2839 return true;
2840 }
2841
2846 public function createMailSignature(): string
2847 {
2848 $link = chr(13) . chr(10) . chr(13) . chr(10);
2849 $link .= $this->lng->txt('crs_mail_permanent_link');
2850 $link .= chr(13) . chr(10) . chr(13) . chr(10);
2851 $link .= ilLink::_getLink($this->object->getRefId());
2852 return rawurlencode(base64_encode($link));
2853 }
2854
2855 protected function initHeaderAction(?string $sub_type = null, ?int $sub_id = null): ?ilObjectListGUI
2856 {
2857 $lg = parent::initHeaderAction($sub_type, $sub_id);
2858
2859 if ($lg && $this->ref_id && ilCourseParticipants::_isParticipant($this->ref_id, $this->user->getId())) {
2860 // certificate
2861
2862 $validator = new ilCertificateDownloadValidator();
2863 if ($validator->isCertificateDownloadable($this->user->getId(), $this->object->getId())) {
2864 $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
2865
2866 $this->lng->loadLanguageModule("certificate");
2867 $lg->addCustomCommand($cert_url, "download_certificate");
2868
2869 $lg->addHeaderIcon(
2870 "cert_icon",
2871 ilUtil::getImagePath("standard/icon_cert.svg"),
2872 $this->lng->txt("download_certificate"),
2873 null,
2874 null,
2875 $cert_url
2876 );
2877 }
2878
2879 // notification
2881 $noti = new ilMembershipNotifications($this->ref_id);
2882 if (!$noti->isCurrentUserActive()) {
2883 $lg->addHeaderIcon(
2884 "not_icon",
2885 ilUtil::getImagePath("object/notification_off.svg"),
2886 $this->lng->txt("crs_notification_deactivated")
2887 );
2888
2889 $this->ctrl->setParameter($this, "crs_ntf", 1);
2890 $caption = "crs_activate_notification";
2891 } else {
2892 $lg->addHeaderIcon(
2893 "not_icon",
2894 ilUtil::getImagePath("object/notification_on.svg"),
2895 $this->lng->txt("crs_notification_activated")
2896 );
2897
2898 $this->ctrl->setParameter($this, "crs_ntf", 0);
2899 $caption = "crs_deactivate_notification";
2900 }
2901
2902 if ($noti->canCurrentUserEdit()) {
2903 $lg->addCustomCommand(
2904 $this->ctrl->getLinkTarget($this, "saveNotification"),
2905 $caption
2906 );
2907 }
2908
2909 $this->ctrl->setParameter($this, "crs_ntf", "");
2910 }
2911 }
2912
2913 return $lg;
2914 }
2915
2919 public function deliverCertificateObject(): void
2920 {
2921 $user_id = null;
2922 if ($this->access->checkAccess('manage_members', '', $this->ref_id)) {
2923 $user_id = 0;
2924 if ($this->http->wrapper()->query()->has('member_id')) {
2925 $user_id = $this->http->wrapper()->query()->retrieve(
2926 'member_id',
2927 $this->refinery->kindlyTo()->int()
2928 );
2929 }
2930 }
2931 if (!$user_id) {
2932 $user_id = $this->user->getId();
2933 }
2934
2935 $objId = $this->object->getId();
2936
2937 $validator = new ilCertificateDownloadValidator();
2938
2939 if (false === $validator->isCertificateDownloadable($user_id, $objId)) {
2940 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("permission_denied"), true);
2941 $this->ctrl->redirect($this);
2942 }
2943
2944 $repository = new ilUserCertificateRepository();
2945
2946 $pdfGenerator = new ilPdfGenerator($repository);
2947
2948 $pdfAction = new ilCertificatePdfAction(
2949 $pdfGenerator,
2951 $this->lng->txt('error_creating_certificate_pdf')
2952 );
2953 $pdfAction->downloadPdf((int) $user_id, $objId);
2954 }
2955
2956 protected function afterSaveCallback(): void
2957 {
2958 $this->ctrl->redirectByClass(array('ilrepositorygui', 'ilobjcoursegui', 'illoeditorgui'), 'materials');
2959 }
2960
2961 public function saveSortingObject(): void
2962 {
2963 $post_position = (array) ($this->http->request()->getParsedBody()['position'] ?? []);
2964 if (isset($post_position['lobj'])) {
2965 $lobj = $post_position['lobj'];
2966 $objective_order = array();
2967 foreach ($lobj as $objective_id => $materials) {
2968 $objective_order[$objective_id] = $materials[0];
2969 unset($lobj[$objective_id][0]);
2970 }
2971 // objective order
2972 asort($objective_order);
2973 $pos = 0;
2974 foreach (array_keys($objective_order) as $objective_id) {
2975 $obj = new ilCourseObjective($this->object, $objective_id);
2976 $obj->writePosition(++$pos);
2977 }
2978
2979 // material order
2980 foreach ($lobj as $objective_id => $materials) {
2981 $objmat = new ilCourseObjectiveMaterials($objective_id);
2982
2983 asort($materials);
2984 $pos = 0;
2985 foreach (array_keys($materials) as $ass_id) {
2986 $objmat->writePosition($ass_id, ++$pos);
2987 }
2988 }
2989 }
2990 parent::saveSortingObject();
2991 }
2992
2993 protected function redirectLocToTestConfirmedObject(): void
2994 {
2995 $tid = 0;
2996 if ($this->http->wrapper()->query()->has('tid')) {
2997 $tid = $this->http->wrapper()->query()->retrieve(
2998 'tid',
2999 $this->refinery->kindlyTo()->int()
3000 );
3001 } elseif ($this->http->wrapper()->post()->has('tid')) {
3002 $tid = $this->http->wrapper()->post()->retrieve(
3003 'tid',
3004 $this->refinery->kindlyTo()->int()
3005 );
3006 }
3007 ilUtil::redirect(ilLink::_getLink($tid));
3008 }
3009
3010 protected function redirectLocToTestObject($a_force_new_run = null): void
3011 {
3012 $tid = 0;
3013 if ($this->http->wrapper()->query()->has('tid')) {
3014 $tid = $this->http->wrapper()->query()->retrieve(
3015 'tid',
3016 $this->refinery->kindlyTo()->int()
3017 );
3018 }
3019 $objective_id = 0;
3020 if ($this->http->wrapper()->query()->has('objective_id')) {
3021 $objective_id = $this->http->wrapper()->query()->retrieve(
3022 'objective_id',
3023 $this->refinery->kindlyTo()->int()
3024 );
3025 }
3026
3027 $res = new ilLOUserResults(
3028 $this->object->getId(),
3029 $this->user->getId()
3030 );
3031 $passed = $res->getCompletedObjectiveIds();
3032
3033 $has_completed = false;
3034 if ($objective_id) {
3035 $objective_ids = array($objective_id);
3036 if (in_array($objective_id, $passed)) {
3037 $has_completed = true;
3038 $passed = array();
3039 }
3040 } else {
3041 $objective_ids = ilCourseObjective::_getObjectiveIds($this->object->getId(), true);
3042
3043 // do not disable objective question if all are passed
3044 if (count($objective_ids) === count($passed)) {
3045 $has_completed = true;
3046 $passed = array();
3047 }
3048 }
3049
3050 if ($has_completed) {
3051 // show confirmation
3052 $this->redirectLocToTestConfirmation($objective_id, $tid);
3053 return;
3054 }
3055 ilUtil::redirect(ilLink::_getLink($tid));
3056 }
3057
3061 protected function redirectLocToTestConfirmation(int $a_objective_id, int $a_test_id): void
3062 {
3063 $confirm = new ilConfirmationGUI();
3064 $confirm->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
3065
3066 if ($a_objective_id) {
3067 $question = $this->lng->txt('crs_loc_objective_passed_confirmation');
3068 } else {
3069 $question = $this->lng->txt('crs_loc_objectives_passed_confirmation');
3070 }
3071
3072 $confirm->setHeaderText($question);
3073 $confirm->addHiddenItem('objective_id', (string) $a_objective_id);
3074 $confirm->addHiddenItem('tid', (string) $a_test_id);
3075 $confirm->setConfirm($this->lng->txt('crs_loc_tst_start'), 'redirectLocToTestConfirmed');
3076 $confirm->setCancel($this->lng->txt('cancel'), 'view');
3077
3078 //$this->tpl->setOnScreenMessage('question', $question);
3079 $this->tpl->setContent($confirm->getHTML());
3080 }
3081
3087 public function getLocalRoles(array $a_exclude = array()): array
3088 {
3089 $crs_admin = $this->object->getDefaultAdminRole();
3090 $crs_member = $this->object->getDefaultMemberRole();
3091 $local_roles = $this->object->getLocalCourseRoles(false);
3092 $crs_roles = [];
3093
3094 //put the course member role to the top of the crs_roles array
3095 if (in_array($crs_member, $local_roles)) {
3096 #$crs_roles[$crs_member] = ilObjRole::_getTranslation(array_search ($crs_member, $local_roles));
3097 #unset($local_roles[$crs_roles[$crs_member]]);
3098 }
3099
3100 foreach ($local_roles as $title => $role_id) {
3101 if ($role_id == $crs_admin && !$this->hasAdminPermission()) {
3102 continue;
3103 }
3104
3105 $crs_roles[$role_id] = ilObjRole::_getTranslation($title);
3106 }
3107
3108 if ($a_exclude !== []) {
3109 foreach ($a_exclude as $excluded_role) {
3110 if (isset($crs_roles[$excluded_role])) {
3111 unset($crs_roles[$excluded_role]);
3112 }
3113 }
3114 }
3115 return $crs_roles;
3116 }
3117
3118 protected function hasAdminPermission(): bool
3119 {
3120 return
3121 ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $this->user->getId())->isAdmin() ||
3122 $this->checkPermissionBool('edit_permission');
3123 }
3124
3125 protected function jump2UsersGalleryObject(): void
3126 {
3127 $this->ctrl->redirectByClass(ilUsersGalleryGUI::class);
3128 }
3129
3133 public function setSideColumnReturn(): void
3134 {
3135 $this->ctrl->setReturn($this, "view");
3136 }
3137} // END class.ilObjCourseGUI
$location
Definition: buildRTE.php:22
Builds data types.
Definition: Factory.php:36
Render add new item selector.
kindlyTo()
Combined validations and transformations for primitive data types that establish a baseline for furth...
Definition: Factory.php:55
GUI class for public user profile presentation.
const IL_CAL_UNIX
error(string $a_errmsg)
setInfoObject(ilInfoScreenGUI $info)
get info sections
@ilCtrl_Calls ilBadgeManagementGUI: ilPropertyFormGUI
This class is used for integration of the booking manager as a service into other repository objects,...
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
static _catchupWriteEvents(int $obj_id, int $usr_id, ?string $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _recordWriteEvent(int $obj_id, int $usr_id, string $action, ?int $parent_obj_id=null)
Records a write event.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
class ilConditionHandlerGUI
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder,...
ILIAS Container InternalGUIService $gui
afterUpdate()
Post (successful) object update hook.
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
ilPropertyFormGUI $form
ilErrorHandling $error
saveListPresentation(ilPropertyFormGUI $form)
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
saveSortingSettings(ilPropertyFormGUI $form)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Skills for container (course/group) (top gui class)
Class ilContainerStartObjectsGUI.
Container start objects page GUI class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeContainerSetting(int $a_id, string $a_keyword, string $a_value)
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
static setBlockedForLP(bool $a_status)
Toggle LP blocking property status.
Class ilCourseContentGUI.
static _getFields(int $a_container_id, $a_sort=self::IL_CDF_SORT_NAME)
Get all fields of a container.
static _hasFields(int $a_container_id)
Check if there are any define fields.
static _readFilesByCourse(int $a_course_id)
class ilCourseObjectiveMaterials
class ilcourseobjective
static _getCountObjectives(int $a_obj_id, bool $a_activated_only=false)
static _getObjectiveIds(int $course_id, bool $a_activated_only=false)
class ilobjcourseobjectivesgui
static _getInstanceByObjId(int $a_obj_id, int $a_usr_id)
static _getInstanceByObjId(int $a_obj_id)
GUI class for course registrations.
static _checkRequired(int $a_usr_id, int $a_obj_id)
This class represents a custom property in a property form.
input GUI for a time span (start and end date)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
This class represents a date/time property in a property form.
@classDescription Date and time handling
isNull()
Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...)
GUI class for didactic template settings inside repository objects.
Class ilECSCourseSettings.
static _getInstanceByType(string $a_type)
Get Singleton Instance.
Export User Interface Class.
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
This class represents a file property in a property form.
static getValidFilename(string $a_filename)
setFormAction(string $a_formaction)
setMultipart(bool $a_multipart)
This class represents a section header in a property form.
Help GUI class.
This class represents a hidden form property in a property form.
Class ilInfoScreenGUI.
Class ilLOEditorGUI.
static deleteRuns(int $a_container_id, int $a_user_id)
static _lookupCompletedForObject(int $a_obj_id, ?array $a_user_ids=null)
static _lookupFailedForObject(int $a_obj_id, ?array $a_user_ids=null)
static _lookupInProgressForObject(int $a_obj_id, ?array $a_user_ids=null)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
const LP_STATUS_COMPLETED
const LP_STATUS_FAILED
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
GUI class for LTI provider object settings.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static _lookupProgressByObjId(int $a_obj_id)
lookup progress for a specific object
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
This class represents a location property in a property form.
Component logger with individual log levels by component id.
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
final const string CONTEXT_KEY
Class ilMailMemberCourseRoles.
static isActivated()
Checks whether Map feature is activated.
static getDefaultSettings()
Get default longitude, latitude and zoom.
static _hasAccepted(int $a_usr_id, int $a_obj_id)
Check if user has accepted agreement.
Membership notification settings.
static generateCode()
Generate new registration key.
static handleCode(int $a_ref_id, string $a_type, string $a_code)
Last visited history for repository items.
static getInstance(int $a_ref_id, bool $a_include_auto_entries)
This class represents a number property in a property form.
static lookupRegistrationInfo(int $a_obj_id)
Class ilObjCourseGUI.
editInfoObject(?ilPropertyFormGUI $a_form=null)
readMemberData(array $ids, ?array $selected_columns=null, bool $skip_names=false)
setSubTabs(string $a_tab)
modifyItemGUI(ilObjectListGUI $a_item_list_gui, array $a_item_data)
@inheritDoc
renderAddNewItem(string ... $disabled_object_types)
setContentSubTabs()
@inheritDoc
static _modifyItemGUI(ilObjectListGUI $a_item_list_gui, string $a_cmd_class, array $a_item_data, bool $a_abo_status, int $a_course_ref_id, int $a_course_obj_id, int $a_parent_ref_id=0)
__construct($a_data, int $a_id, bool $a_call_by_reference=true, bool $a_prepare_output=true)
ilContainerStartObjects $start_obj
ilNavigationHistory $navigation_history
afterImport(ilObject $new_object)
Post (successful) object import hook.
static _goto($a_target, string $a_add="")
createMailSignature()
Create a course mail signature.
setSideColumnReturn()
@inheritDoc
redirectLocToTestObject($a_force_new_run=null)
updateLPFromStatus(int $a_member_id, bool $a_has_passed)
sync course status and lp status
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
ilAdvancedMDRecordGUI $record_gui
getTabs()
@abstract overwrite in derived GUI class of your object type
updateObject()
updates object entry in object_data
redirectLocToTestConfirmation(int $a_objective_id, int $a_test_id)
Show confirmation whether user wants to start a new run or resume a previous run.
afterSave(ilObject $new_object)
@inheritDoc
editObject(?ilPropertyFormGUI $form=null)
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
Add header action menu.
deleteObject(bool $error=false)
Display deletion confirmation screen.
getLocalRoles(array $a_exclude=array())
showPossibleSubObjects()
@inheritDoc
getEditFormValues()
values are already set in initEditForm Returning an empty array avoid overriding these values.
Class ilObjCourseGroupingGUI.
static _lookupViewMode(int $a_id)
const int STATUS_DETERMINATION_MANUAL
const int STATUS_DETERMINATION_LP
static _registrationEnabled(int $a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
static _isActivated(int $a_obj_id)
Is activated.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, ?string $a_back_url=null)
static _getTranslation(string $a_role_title)
static _lookupName(int $a_user_id)
GUI class for the workflow of copying objects.
buildAddNewItemElements(array $subtypes, string $create_target_class=ilRepositoryGUI::class, ?int $redirect_target_ref_id=null,)
ilGlobalTemplateInterface $tpl
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
GlobalHttpState $http
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
initDidacticTemplate(ilPropertyFormGUI $form)
ilSetting $settings
addHeaderAction()
Add header action menu.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
prepareOutput(bool $show_sub_objects=true)
getReturnLocation(string $cmd, string $default_location="")
Get return location for command (command is method name without "Object", e.g.
ilLanguage $lng
static getInstance(int $obj_id)
enableSubscribe(bool $status)
Class ilObjectMetaDataGUI.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
Class ilObject Basic functions for all objects.
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
static _isParticipant(int $a_ref_id, int $a_usr_id)
Static function to check if a user is a participant of the container object.
This class represents a property form user interface.
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
getItemByPostVar(string $a_post_var)
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static makeClickable(string $a_text, bool $detectGotoLinks=false, ?string $ilias_http_path=null)
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static redirect(string $a_script)
static _isOnList(int $a_usr_id, int $a_obj_id)
const ANONYMOUS_USER_ID
Definition: constants.php:27
const ROOT_FOLDER_ID
Definition: constants.php:32
$c
Definition: deliver.php:25
$info
Definition: entry_point.php:21
$txt
Definition: error.php:31
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
$res
Definition: ltiservices.php:69
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:61
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
$ilErr
Definition: raiseError.php:33
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54
$objId
Definition: xapitoken.php:57