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