ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjCourseGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
5require_once "./Services/Container/classes/class.ilContainerGUI.php";
6
32{
39 protected $news;
40
45 public function __construct()
46 {
47 global $DIC;
48
49 $ilCtrl = $DIC['ilCtrl'];
50 $ilHelp = $DIC['ilHelp'];
51
52 // CONTROL OPTIONS
53 $this->ctrl = $ilCtrl;
54 $this->ctrl->saveParameter($this, array("ref_id","cmdClass"));
55
56 $this->type = "crs";
57 parent::__construct('', (int) $_GET['ref_id'], true, false);
58
59 $this->lng->loadLanguageModule('crs');
60 $this->lng->loadLanguageModule('cert');
61 $this->lng->loadLanguageModule('obj');
62
63 $this->SEARCH_USER = 1;
64 $this->SEARCH_GROUP = 2;
65 $this->SEARCH_COURSE = 3;
66 $this->news = $DIC->news();
67 }
68
69 public function gatewayObject()
70 {
71 switch ($_POST["action"]) {
72
73 case "deleteSubscribers":
74 $this->deleteSubscribers();
75 break;
76
77 case "addSubscribers":
78 $this->addSubscribers();
79 break;
80
81 case "addFromWaitingList":
82 $this->addFromWaitingList();
83 break;
84
85 case "removeFromWaitingList":
86 $this->removeFromWaitingList();
87 break;
88
89 default:
90 $this->viewObject();
91 break;
92 }
93 return true;
94 }
95
100 protected function afterImport(ilObject $a_new_object)
101 {
102 global $DIC;
103
104 $ilUser = $DIC['ilUser'];
105 $ilSetting = $DIC['ilSetting'];
106
107 // #11895
108 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
109 $part = ilCourseParticipants::_getInstanceByObjId($a_new_object->getId());
110 $part->add($ilUser->getId(), ilCourseConstants::CRS_ADMIN);
111 $part->updateNotification($ilUser->getId(), $ilSetting->get('mail_crs_admin_notification', true));
112
113 parent::afterImport($a_new_object);
114 }
115
116 public function renderObject()
117 {
118 $this->ctrl->setCmd("view");
119 $this->viewObject();
120 }
121
122 public function viewObject()
123 {
124 global $DIC;
125
126 $rbacsystem = $DIC['rbacsystem'];
127 $ilUser = $DIC['ilUser'];
128 $ilCtrl = $DIC['ilCtrl'];
129
130 $this->tabs_gui->setTabActive('view_content');
131
132 // CHECK ACCESS
133 $this->checkPermission('read', 'view');
134 /*
135 if(!$rbacsystem->checkAccess("read",$this->object->getRefId()))
136 {
137 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
138 }
139 */
140 if (strtolower($_GET["baseClass"]) == "iladministrationgui") {
141 parent::viewObject();
142 return true;
143 }
144
145 // Fill meta header tags
146 include_once('Services/MetaData/classes/class.ilMDUtils.php');
147 ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');
148
149 // Trac access
150 if ($ilCtrl->getNextClass() != "ilcolumngui") {
151 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
153 $ilUser->getId(),
154 $this->object->getId(),
155 $this->object->getRefId(),
156 'crs'
157 );
158 }
159
160 if (!$this->checkAgreement()) {
161 include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
162 $this->tabs_gui->clearTargets();
163 $this->ctrl->setReturn($this, 'view_content');
164 $agreement = new ilMemberAgreementGUI($this->object->getRefId());
165 $this->ctrl->setCmdClass(get_class($agreement));
166 $this->ctrl->forwardCommand($agreement);
167 return true;
168 }
169
170 if (!$this->__checkStartObjects()) {
171 include_once "Services/Container/classes/class.ilContainerStartObjectsContentGUI.php";
172 $stgui = new ilContainerStartObjectsContentGUI($this, $this->object);
173 $stgui->enableDesktop($this->object->getAboStatus(), $this);
174 return $stgui->getHTML();
175 }
176
177 // views handled by general container logic
178 if ($this->object->getViewMode() == ilContainer::VIEW_SIMPLE ||
179 $this->object->getViewMode() == ilContainer::VIEW_BY_TYPE ||
180 $this->object->getViewMode() == ilContainer::VIEW_SESSIONS ||
181 $this->object->getViewMode() == ilContainer::VIEW_TIMING ||
182 $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE
183 ) {
184 $ret = parent::renderObject();
185 return $ret;
186 } else {
187 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
188 $course_content_obj = new ilCourseContentGUI($this);
189
190 $this->ctrl->setCmdClass(get_class($course_content_obj));
191 $this->ctrl->forwardCommand($course_content_obj);
192 }
193
194 return true;
195 }
196
197 public function renderContainer()
198 {
199 return parent::renderObject();
200 }
201
207 public function infoScreenObject()
208 {
209 $this->ctrl->setCmd("showSummary");
210 $this->ctrl->setCmdClass("ilinfoscreengui");
211 $this->infoScreen();
212 }
213
221 public function infoScreen()
222 {
223 global $DIC;
224
225 $ilErr = $DIC['ilErr'];
226 $ilAccess = $DIC['ilAccess'];
227 $ilUser = $DIC['ilUser'];
228 $ilSetting = $DIC['ilSetting'];
229
230 if (!$this->checkPermissionBool('read')) {
231 $this->checkPermission('visible');
232 }
233
234 // Fill meta header tags
235 include_once('Services/MetaData/classes/class.ilMDUtils.php');
236 ilMDUtils::_fillHTMLMetaTags($this->object->getId(), $this->object->getId(), 'crs');
237
238 $this->tabs_gui->setTabActive('info_short');
239
240 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
241 include_once 'Modules/Course/classes/class.ilCourseFile.php';
242
243 $files = ilCourseFile::_readFilesByCourse($this->object->getId());
244
245 $info = new ilInfoScreenGUI($this);
246 $info->enablePrivateNotes();
247 $info->enableFeedback();
248 $info->enableNews();
249 $info->enableBookingInfo(true);
250 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
251 $info->enableNewsEditing();
252 }
253
254 if (
255 strlen($this->object->getImportantInformation()) ||
256 strlen($this->object->getSyllabus()) ||
257 strlen($this->object->getTargetGroup()) ||
258 count($files)) {
259 $info->addSection($this->lng->txt('crs_general_informations'));
260 }
261
262 if (strlen($this->object->getImportantInformation())) {
263 $info->addProperty(
264 $this->lng->txt('crs_important_info'),
265 "<strong>" . nl2br(
266 ilUtil::makeClickable($this->object->getImportantInformation(), true) . "</strong>"
267 )
268 );
269 }
270 if (strlen($this->object->getSyllabus())) {
271 $info->addProperty($this->lng->txt('crs_syllabus'), nl2br(
272 ilUtil::makeClickable($this->object->getSyllabus(), true)
273 ));
274 }
275 if (strlen($this->object->getTargetGroup())) {
276 $info->addProperty(
277 $this->lng->txt('crs_target_group'),
278 nl2br(
279 \ilUtil::makeClickable($this->object->getTargetGroup(), true)
280 )
281 );
282 }
283 // files
284 if (count($files)) {
285 $tpl = new ilTemplate('tpl.event_info_file.html', true, true, 'Modules/Course');
286
287 foreach ($files as $file) {
288 $tpl->setCurrentBlock("files");
289 $this->ctrl->setParameter($this, 'file_id', $file->getFileId());
290 $tpl->setVariable("DOWN_LINK", $this->ctrl->getLinkTarget($this, 'sendfile'));
291 $tpl->setVariable("DOWN_NAME", $file->getFileName());
292 $tpl->setVariable("DOWN_INFO_TXT", $this->lng->txt('crs_file_size_info'));
293 $tpl->setVariable("DOWN_SIZE", $file->getFileSize());
294 $tpl->setVariable("TXT_BYTES", $this->lng->txt('bytes'));
295 $tpl->parseCurrentBlock();
296 }
297 $info->addProperty(
298 $this->lng->txt('crs_file_download'),
299 $tpl->get()
300 );
301 }
302
303 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
304 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'crs', $this->object->getId());
305 $record_gui->setInfoObject($info);
306 $record_gui->parse();
307
308 // meta data
309 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
310
311 // contact
312 if ($this->object->hasContactData()) {
313 $info->addSection($this->lng->txt("crs_contact"));
314 }
315 if (strlen($this->object->getContactName())) {
316 $info->addProperty(
317 $this->lng->txt("crs_contact_name"),
318 $this->object->getContactName()
319 );
320 }
321 if (strlen($this->object->getContactResponsibility())) {
322 $info->addProperty(
323 $this->lng->txt("crs_contact_responsibility"),
324 $this->object->getContactResponsibility()
325 );
326 }
327 if (strlen($this->object->getContactPhone())) {
328 $info->addProperty(
329 $this->lng->txt("crs_contact_phone"),
330 $this->object->getContactPhone()
331 );
332 }
333 if ($this->object->getContactEmail()) {
334 include_once './Modules/Course/classes/class.ilCourseMailTemplateMemberContext.php';
335 require_once 'Services/Mail/classes/class.ilMailFormCall.php';
336
337 $emails = explode(",", $this->object->getContactEmail());
338 foreach ($emails as $email) {
339 $email = trim($email);
340 $etpl = new ilTemplate("tpl.crs_contact_email.html", true, true, 'Modules/Course');
341 $etpl->setVariable(
342 "EMAIL_LINK",
344 $info,
345 'showSummary',
346 array(),
347 array(
348 'type' => 'new',
349 'rcp_to' => $email,
350 'sig' => $this->createMailSignature()
351 ),
352 array(
354 'ref_id' => $this->object->getRefId(),
355 'ts' => time()
356 )
357 )
358 );
359 $etpl->setVariable("CONTACT_EMAIL", $email);
360 $mailString .= $etpl->get() . "<br />";
361 }
362 $info->addProperty($this->lng->txt("crs_contact_email"), $mailString);
363 }
364 if (strlen($this->object->getContactConsultation())) {
365 $info->addProperty(
366 $this->lng->txt("crs_contact_consultation"),
367 nl2br($this->object->getContactConsultation())
368 );
369 }
370
371
372 // support contacts
373 $parts = ilParticipants::getInstanceByObjId($this->object->getId());
374 $conts = $parts->getContacts();
375 if (count($conts) > 0) {
376 $info->addSection($this->lng->txt("crs_mem_contacts"));
377 foreach ($conts as $c) {
378 include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
379 $pgui = new ilPublicUserProfileGUI($c);
380 $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
381 $pgui->setEmbedded(true);
382 $info->addProperty("", $pgui->getHTML());
383 }
384 }
385
386
387
388 //
389 // access
390 //
391
392 // #10360
393 $info->enableAvailability(false);
394 $this->lng->loadLanguageModule("rep");
395 $info->addSection($this->lng->txt("rep_activation_availability"));
396 $info->showLDAPRoleGroupMappingInfo();
397
398 // activation
399 $info->addAccessPeriodProperty();
400
401 switch ($this->object->getSubscriptionLimitationType()) {
403 $txt = $this->lng->txt("crs_info_reg_deactivated");
404 break;
405
406 default:
407 switch ($this->object->getSubscriptionType()) {
409 $txt = $this->lng->txt("crs_info_reg_confirmation");
410 break;
412 $txt = $this->lng->txt("crs_info_reg_direct");
413 break;
415 $txt = $this->lng->txt("crs_info_reg_password");
416 break;
417 }
418 }
419
420 // subscription
421 $info->addProperty($this->lng->txt("crs_info_reg"), $txt);
422
423
424 if ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED) {
425 if ($this->object->getSubscriptionUnlimitedStatus()) {
426 $info->addProperty(
427 $this->lng->txt("crs_reg_until"),
428 $this->lng->txt('crs_unlimited')
429 );
430 } elseif ($this->object->getSubscriptionStart() < time()) {
431 $info->addProperty(
432 $this->lng->txt("crs_reg_until"),
433 $this->lng->txt('crs_to') . ' ' .
434 ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX))
435 );
436 } elseif ($this->object->getSubscriptionStart() > time()) {
437 $info->addProperty(
438 $this->lng->txt("crs_reg_until"),
439 $this->lng->txt('crs_from') . ' ' .
440 ilDatePresentation::formatDate(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX))
441 );
442 }
443 if ($this->object->isSubscriptionMembershipLimited()) {
444 if ($this->object->getSubscriptionMinMembers()) {
445 $info->addProperty(
446 $this->lng->txt("mem_min_users"),
447 $this->object->getSubscriptionMinMembers()
448 );
449 }
450 if ($this->object->getSubscriptionMaxMembers()) {
451 include_once './Modules/Course/classes/class.ilObjCourseAccess.php';
452 $reg_info = ilObjCourseAccess::lookupRegistrationInfo($this->object->getId());
453
454 $info->addProperty(
455 $this->lng->txt('mem_free_places'),
456 $reg_info['reg_info_free_places']
457 );
458 }
459 }
460 }
461
462 if ($this->object->getCancellationEnd()) {
463 $info->addProperty(
464 $this->lng->txt('crs_cancellation_end'),
465 ilDatePresentation::formatDate($this->object->getCancellationEnd())
466 );
467 }
468
469 if (
470 $this->object->getCourseStart() instanceof ilDateTime &&
471 !$this->object->getCourseStart()->isNull()
472 ) {
473 $info->addProperty(
474 $this->lng->txt('crs_period'),
476 $this->object->getCourseStart(),
477 $this->object->getCourseEnd()
478 )
479 );
480 }
481
482 // Confirmation
483 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
485
486 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
487 if ($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_getFields($this->object->getId()) or $privacy->enabledCourseExport()) {
488 include_once('Services/PrivacySecurity/classes/class.ilExportFieldsInfo.php');
489
490 $field_info = ilExportFieldsInfo::_getInstanceByType($this->object->getType());
491
492 $this->lng->loadLanguageModule('ps');
493 $info->addSection($this->lng->txt('crs_user_agreement_info'));
494 $info->addProperty($this->lng->txt('ps_export_data'), $field_info->exportableFieldsToInfoString());
495
496 if ($fields = ilCourseDefinedFieldDefinition::_fieldsToInfoString($this->object->getId())) {
497 $info->addProperty($this->lng->txt('ps_crs_user_fields'), $fields);
498 }
499 }
500
501 $info->enableLearningProgress(true);
502
503 // forward the command
504 $this->ctrl->forwardCommand($info);
505 }
506
510 public function saveNotificationObject()
511 {
512 include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
513 $noti = new ilMembershipNotifications($this->ref_id);
514 if ($noti->canCurrentUserEdit()) {
515 if ((bool) $_REQUEST["crs_ntf"]) {
516 $noti->activateUser();
517 } else {
518 $noti->deactivateUser();
519 }
520 }
521 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
522 $this->ctrl->redirect($this, "");
523 }
524
531 public function editInfoObject(ilPropertyFormGUI $a_form = null)
532 {
533 include_once 'Modules/Course/classes/class.ilCourseFile.php';
534
535 global $DIC;
536
537 $ilErr = $DIC['ilErr'];
538 $ilAccess = $DIC['ilAccess'];
539
540 $this->checkPermission('write');
541 /*
542 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
543 {
544 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
545 }
546 */
547 $this->setSubTabs('properties');
548 $this->tabs_gui->setTabActive('settings');
549 $this->tabs_gui->setSubTabActive('crs_info_settings');
550
551 if (!$a_form) {
552 $a_form = $this->initInfoEditor();
553 }
554 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.edit_info.html', 'Modules/Course');
555 $this->tpl->setVariable('INFO_TABLE', $a_form->getHTML());
556
557 if (!count($files = ilCourseFile::_readFilesByCourse($this->object->getId()))) {
558 return true;
559 }
560 $rows = array();
561 foreach ($files as $file) {
562 $table_data['id'] = $file->getFileId();
563 $table_data['filename'] = $file->getFileName();
564 $table_data['filetype'] = $file->getFileType();
565 $table_data['filesize'] = $file->getFileSize();
566
567 $rows[] = $table_data;
568 }
569
570 include_once("./Modules/Course/classes/class.ilCourseInfoFileTableGUI.php");
571 $table_gui = new ilCourseInfoFileTableGUI($this, 'editInfo');
572 $table_gui->setTitle($this->lng->txt("crs_info_download"));
573 $table_gui->setData($rows);
574 $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
575 $table_gui->addMultiCommand("confirmDeleteInfoFiles", $this->lng->txt("delete"));
576 $table_gui->setSelectAllCheckbox("file_id");
577 $this->tpl->setVariable('INFO_FILE_TABLE', $table_gui->getHTML());
578
579 return true;
580 }
581
590 {
591 if (!count($_POST['file_id'])) {
592 ilUtil::sendFailure($this->lng->txt('select_one'));
593 $this->editInfoObject();
594 return false;
595 }
596
597 $this->setSubTabs('properties');
598 $this->tabs_gui->setTabActive('settings');
599 $this->tabs_gui->setSubTabActive('crs_info_settings');
600
601 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
602 $c_gui = new ilConfirmationGUI();
603
604 // set confirm/cancel commands
605 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteInfoFiles"));
606 $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
607 $c_gui->setCancel($this->lng->txt("cancel"), "editInfo");
608 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteInfoFiles");
609
610 // add items to delete
611 include_once('Modules/Course/classes/class.ilCourseFile.php');
612 foreach ($_POST["file_id"] as $file_id) {
613 $file = new ilCourseFile($file_id);
614 $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
615 }
616
617 $this->tpl->setContent($c_gui->getHTML());
618 }
619
626 public function deleteInfoFilesObject()
627 {
628 if (!count($_POST['file_id'])) {
629 ilUtil::sendFailure($this->lng->txt('select_one'));
630 $this->editInfoObject();
631 return false;
632 }
633 include_once('Modules/Course/classes/class.ilCourseFile.php');
634
635 foreach ($_POST['file_id'] as $file_id) {
636 $file = new ilCourseFile($file_id);
637 if ($this->object->getId() == $file->getCourseId()) {
638 $file->delete();
639 }
640 }
641 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
642 $this->editInfoObject();
643 return true;
644 }
645
653 public function initInfoEditor()
654 {
655 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
656 $form = new ilPropertyFormGUI();
657 $form->setFormAction($this->ctrl->getFormAction($this, 'updateInfo'));
658 $form->setMultipart(true);
659 $form->setTitle($this->lng->txt('crs_general_info'));
660 $form->addCommandButton('updateInfo', $this->lng->txt('save'));
661 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
662
663 $area = new ilTextAreaInputGUI($this->lng->txt('crs_important_info'), 'important');
664 $area->setValue($this->object->getImportantInformation());
665 $area->setRows(6);
666 $area->setCols(80);
667 $form->addItem($area);
668
669 $area = new ilTextAreaInputGUI($this->lng->txt('crs_syllabus'), 'syllabus');
670 $area->setValue($this->object->getSyllabus());
671 $area->setRows(6);
672 $area->setCols(80);
673 $form->addItem($area);
674
675 $tg = new \ilTextAreaInputGUI($this->lng->txt('crs_target_group'), 'target_group');
676 $tg->setValue($this->object->getTargetGroup());
677 $tg->setRows(6);
678 $form->addItem($tg);
679
681 $section->setTitle($this->lng->txt('crs_info_download'));
682 $form->addItem($section);
683
684 $file = new ilFileInputGUI($this->lng->txt('crs_file'), 'file');
685 $file->enableFileNameSelection('file_name');
686 $form->addItem($file);
687
689 $section->setTitle($this->lng->txt('crs_contact'));
690 $form->addItem($section);
691
692 $text = new ilTextInputGUI($this->lng->txt('crs_contact_name'), 'contact_name');
693 $text->setValue($this->object->getContactName());
694 $text->setSize(40);
695 $text->setMaxLength(70);
696 $form->addItem($text);
697
698 $text = new ilTextInputGUI($this->lng->txt('crs_contact_responsibility'), 'contact_responsibility');
699 $text->setValue($this->object->getContactResponsibility());
700 $text->setSize(40);
701 $text->setMaxLength(70);
702 $form->addItem($text);
703
704 $text = new ilTextInputGUI($this->lng->txt('crs_contact_phone'), 'contact_phone');
705 $text->setValue($this->object->getContactPhone());
706 $text->setSize(40);
707 $text->setMaxLength(40);
708 $form->addItem($text);
709
710 $text = new ilTextInputGUI($this->lng->txt('crs_contact_email'), 'contact_email');
711 $text->setValue($this->object->getContactEmail());
712 $text->setInfo($this->lng->txt('crs_contact_email_info'));
713 $text->setSize(40);
714 $text->setMaxLength(255);
715 $form->addItem($text);
716
717 $area = new ilTextAreaInputGUI($this->lng->txt('crs_contact_consultation'), 'contact_consultation');
718 $area->setValue($this->object->getContactConsultation());
719 $area->setRows(6);
720 $area->setCols(80);
721 $form->addItem($area);
722
723 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
724 $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, 'crs', $this->object->getId());
725 $this->record_gui->setPropertyForm($form);
726 $this->record_gui->parse();
727
728 return $form;
729 }
730
736 public function updateInfoObject()
737 {
738 global $DIC;
739
740 $ilErr = $DIC['ilErr'];
741 $ilAccess = $DIC['ilAccess'];
742
743 $this->checkPermission('write');
744
745 include_once 'Modules/Course/classes/class.ilCourseFile.php';
746 $file_obj = new ilCourseFile();
747 $file_obj->setCourseId($this->object->getId());
748 $name = (strlen($_POST['file_name']) ?
749 ilUtil::stripSlashes($_POST['file_name']) :
750 $_FILES['file']['name']);
751 $file_obj->setFileName(ilFileUtils::getValidFilename($name));
752 $file_obj->setFileSize($_FILES['file']['size']);
753 $file_obj->setFileType($_FILES['file']['type']);
754 $file_obj->setTemporaryName($_FILES['file']['tmp_name']);
755 $file_obj->setErrorCode($_FILES['file']['error']);
756
757 $this->object->setImportantInformation(ilUtil::stripSlashes($_POST['important']));
758 $this->object->setSyllabus(ilUtil::stripSlashes($_POST['syllabus']));
759 $this->object->setTargetGroup(\ilUtil::stripSlashes($_POST['target_group']));
760 $this->object->setContactName(ilUtil::stripSlashes($_POST['contact_name']));
761 $this->object->setContactResponsibility(ilUtil::stripSlashes($_POST['contact_responsibility']));
762 $this->object->setContactPhone(ilUtil::stripSlashes($_POST['contact_phone']));
763 $this->object->setContactEmail(ilUtil::stripSlashes($_POST['contact_email']));
764 $this->object->setContactConsultation(ilUtil::stripSlashes($_POST['contact_consultation']));
765
766
767 // validate
768
769 $error = false;
770 $ilErr->setMessage('');
771
772 $file_obj->validate();
773 $this->object->validateInfoSettings();
774 if (strlen($ilErr->getMessage())) {
775 $error = $ilErr->getMessage();
776 }
777
778 // needed for proper advanced MD validation
779 $form = $this->initInfoEditor();
780 $form->checkInput();
781 if (!$this->record_gui->importEditFormPostValues()) {
782 $error = true;
783 }
784
785 if ($error) {
786 if ($error !== true) {
787 ilUtil::sendFailure($ilErr->getMessage());
788 }
789 $this->editInfoObject($form);
790 return false;
791 }
792
793 $this->object->update();
794 $file_obj->create();
795 $this->record_gui->writeEditForm();
796
797
798 // Update ecs content
799 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
800 $ecs = new ilECSCourseSettings($this->object);
801 $ecs->handleContentUpdate();
802
803 ilUtil::sendSuccess($this->lng->txt("crs_settings_saved"));
804 $this->editInfoObject();
805 return true;
806 }
807
808
814 public function updateObject()
815 {
816 $obj_service = $this->getObjectService();
817 $setting = $this->settings;
818
819 $form = $this->initEditForm();
820
821 if (!$form->checkInput()) {
822 $form->setValuesByPost();
823 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input'));
824 return $this->editObject($form);
825 }
826
827 // Additional checks: subsription min/max
828 if (
829 $form->getInput('subscription_max') &&
830 $form->getInput('subscription_min') &&
831 ($form->getInput('subscription_max') < $form->getInput('subscription_min'))
832 ) {
833 $min = $form->getItemByPostVar('subscription_min');
834 $min->setAlert($this->lng->txt('crs_subscription_min_members_err'));
835 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input'));
836 return $this->editObject($form);
837 }
838
839 // Additional checks: both tile and objective view activated (not supported)
840 if (
841 $form->getInput('list_presentation') == "tile" &&
842 $form->getInput('view_mode') == IL_CRS_VIEW_OBJECTIVE) {
843 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('crs_tile_and_objective_view_not_supported'));
844 return $this->editObject($form);
845 }
846
847 // Additional checks: both tile and session limitation activated (not supported)
848 if ($form->getInput('sl') == "1" &&
849 $form->getInput('list_presentation') == "tile") {
850 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('crs_tile_and_session_limit_not_supported'));
851 return $this->editObject($form);
852 }
853
854 // check successful
855
856 // title/desc
857 $this->object->setTitle($form->getInput('title'));
858 $this->object->setDescription($form->getInput('desc'));
859
860 // period
861 $crs_period = $form->getItemByPostVar("period");
862
863
864 $this->object->setCoursePeriod(
865 $crs_period->getStart(),
866 $crs_period->getEnd()
867 );
868
869 // activation/online
870 $this->object->setOfflineStatus((bool) !$form->getInput('activation_online'));
871
872 // activation period
873 $period = $form->getItemByPostVar("access_period");
874 if ($period->getStart() && $period->getEnd()) {
875 $this->object->setActivationStart($period->getStart()->get(IL_CAL_UNIX));
876 $this->object->setActivationEnd($period->getEnd()->get(IL_CAL_UNIX));
877 $this->object->setActivationVisibility((int) $form->getInput('activation_visibility'));
878 } else {
879 $this->object->setActivationStart(null);
880 $this->object->setActivationEnd(null);
881 }
882
883 // subscription settings
884 $this->object->setSubscriptionPassword($form->getInput('subscription_password'));
885 $this->object->setSubscriptionStart(null);
886 $this->object->setSubscriptionEnd(null);
887
888 $sub_type = $form->getInput('subscription_type');
889 $sub_period = $form->getItemByPostVar('subscription_period');
890
891 $this->object->setSubscriptionType($sub_type);
892 if ($sub_type != IL_CRS_SUBSCRIPTION_DEACTIVATED) {
893 if ($sub_period->getStart() && $sub_period->getEnd()) {
894 $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_LIMITED);
895 $this->object->setSubscriptionStart($sub_period->getStart()->get(IL_CAL_UNIX));
896 $this->object->setSubscriptionEnd($sub_period->getEnd()->get(IL_CAL_UNIX));
897 } else {
898 $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_UNLIMITED);
899 }
900 } else {
901 $this->object->setSubscriptionType(IL_CRS_SUBSCRIPTION_DIRECT);
902 $this->object->setSubscriptionLimitationType(IL_CRS_SUBSCRIPTION_DEACTIVATED);
903 }
904
905 // registration code
906 $this->object->enableRegistrationAccessCode((int) $form->getInput('reg_code_enabled'));
907 $this->object->setRegistrationAccessCode($form->getInput('reg_code'));
908
909 // cancellation end
910 $this->object->setCancellationEnd($form->getItemByPostVar("cancel_end")->getDate());
911
912 // waiting list
913 $this->object->enableSubscriptionMembershipLimitation((int) $form->getInput('subscription_membership_limitation'));
914 $this->object->setSubscriptionMaxMembers((int) $form->getInput('subscription_max'));
915 $this->object->setSubscriptionMinMembers((int) $form->getInput('subscription_min'));
916 $old_autofill = $this->object->hasWaitingListAutoFill();
917 switch ((int) $form->getInput('waiting_list')) {
918 case 2:
919 $this->object->enableWaitingList(true);
920 $this->object->setWaitingListAutoFill(true);
921 break;
922
923 case 1:
924 $this->object->enableWaitingList(true);
925 $this->object->setWaitingListAutoFill(false);
926 break;
927
928 default:
929 $this->object->enableWaitingList(false);
930 $this->object->setWaitingListAutoFill(false);
931 break;
932 }
933
934 // title icon visibility
935 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTitleIconVisibility();
936
937 // top actions visibility
938 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTopActionsVisibility();
939
940 ilContainer::_writeContainerSetting($this->object->getId(), "rep_breacrumb", $form->getInput('rep_breacrumb'));
941
942 // custom icon
943 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveIcon();
944
945 // tile image
946 $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
947
948 // list presentation
949 $this->saveListPresentation($form);
950
951
952 // view mode settings
953 $this->object->setViewMode((int) $form->getInput('view_mode'));
954 if ($this->object->getViewMode() == IL_CRS_VIEW_TIMING) {
955 $this->object->setOrderType(ilContainer::SORT_ACTIVATION);
956 $this->object->setTimingMode((int) $form->getInput('timing_mode'));
957 }
958 $this->object->setTimingMode($form->getInput('timing_mode'));
959 $this->object->setOrderType($form->getInput('sorting'));
960 $this->saveSortingSettings($form);
961
962 $this->object->setAboStatus((int) $form->getInput('abo'));
963 $this->object->setShowMembers((int) $form->getInput('show_members'));
964
965 if (\ilPrivacySettings::_getInstance()->participantsListInCoursesEnabled()) {
966 $this->object->setShowMembersExport((int) $form->getInput('show_members_export'));
967 }
968 $this->object->setMailToMembersType((int) $form->getInput('mail_type'));
969
970 $this->object->enableSessionLimit((int) $form->getInput('sl'));
971
972 $session_sp = $form->getInput('sp');
973 $this->object->setNumberOfPreviousSessions(is_numeric($session_sp) ? (int) $session_sp : -1);
974 $session_sn = $form->getInput('sn');
975 $this->object->setNumberOfnextSessions(is_numeric($session_sn) ? (int) $session_sn : -1);
976 $this->object->setAutoNotification($form->getInput('auto_notification') == 1 ? true : false);
977
978 // lp sync
979 $show_lp_sync_confirmation = false;
980
981 // could be hidden in form
982 if (isset($_POST['status_dt'])) {
983 if (
984 $this->object->getStatusDetermination() != ilObjCourse::STATUS_DETERMINATION_LP &&
985 (int) $_POST['status_dt'] == ilObjCourse::STATUS_DETERMINATION_LP
986 ) {
987 $show_lp_sync_confirmation = true;
988 } else {
989 $this->object->setStatusDetermination((int) $form->getInput('status_dt'));
990 }
991 }
992
993 if (!$old_autofill && $this->object->hasWaitingListAutoFill()) {
994 $this->object->handleAutoFill();
995 }
996 $this->object->update();
997
998
1000 $this->object->getId(),
1001 $form,
1002 $this->getSubServices()
1003 );
1004
1005 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1006 global $DIC;
1007
1008 $ilUser = $DIC['ilUser'];
1009 ilChangeEvent::_recordWriteEvent($this->object->getId(), $ilUser->getId(), 'update');
1010 ilChangeEvent::_catchupWriteEvents($this->object->getId(), $ilUser->getId());
1011
1012 // lp sync confirmation required
1013 if ($show_lp_sync_confirmation) {
1014 return $this->confirmLPSync();
1015 }
1016
1017 // Update ecs export settings
1018 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1019 $ecs = new ilECSCourseSettings($this->object);
1020 if (!$ecs->handleSettingsUpdate()) {
1021 $form->setValuesByPost();
1022 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('err_check_input'));
1023 return $this->editObject($form);
1024 }
1025
1026 return $this->afterUpdate();
1027 }
1028
1029 protected function getSubServices() : array
1030 {
1031 $subs = array(
1041 );
1042 if ($this->news->isGloballyActivated()) {
1044 }
1045
1046 return $subs;
1047 }
1048
1049 protected function confirmLPSync()
1050 {
1051 global $DIC;
1052
1053 $tpl = $DIC['tpl'];
1054
1055 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1056 $cgui = new ilConfirmationGUI();
1057 $cgui->setFormAction($this->ctrl->getFormAction($this, "setLPSync"));
1058 $cgui->setHeaderText($this->lng->txt("crs_status_determination_sync"));
1059 $cgui->setCancel($this->lng->txt("cancel"), "edit");
1060 $cgui->setConfirm($this->lng->txt("confirm"), "setLPSync");
1061
1062 $tpl->setContent($cgui->getHTML());
1063 }
1064
1065 protected function setLPSyncObject()
1066 {
1067 $this->object->setStatusDetermination(ilObjCourse::STATUS_DETERMINATION_LP);
1068 $this->object->update();
1069
1070 $this->object->syncMembersStatusWithLP();
1071
1072 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
1073 $this->ctrl->redirect($this, "edit");
1074 }
1075
1082 public function editObject(ilPropertyFormGUI $form = null)
1083 {
1084 $this->setSubTabs('properties');
1085 $this->tabs_gui->setSubTabActive('crs_settings');
1086
1087 if ($form instanceof ilPropertyFormGUI) {
1088 $GLOBALS['DIC']['tpl']->setContent($form->getHTML());
1089 return true;
1090 } else {
1091 parent::editObject();
1092 }
1093 }
1094
1102 protected function initEditForm()
1103 {
1104 $obj_service = $this->getObjectService();
1105 $setting = $this->settings;
1106
1107 include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1108 include_once('./Services/Calendar/classes/class.ilDateTime.php');
1109
1110 $form = new ilPropertyFormGUI();
1111 $form->setTitle($this->lng->txt('crs_edit'));
1112
1113 $form->addCommandButton('update', $this->lng->txt('save'));
1114 $form->addCommandButton('cancel', $this->lng->txt('cancel'));
1115
1116 $form->setFormAction($this->ctrl->getFormAction($this, 'update'));
1117
1118 // title and description
1119 $this->initFormTitleDescription($form);
1120
1121 // Show didactic template type
1122 $this->initDidacticTemplate($form);
1123
1124 // period
1125 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1126 $cdur = new ilDateDurationInputGUI($this->lng->txt('crs_period'), 'period');
1127 $this->lng->loadLanguageModule('mem');
1128 $cdur->enableToggleFullTime(
1129 $this->lng->txt('mem_period_without_time'),
1130 !$this->object->getCourseStartTimeIndication()
1131 );
1132 $cdur->setShowTime(true);
1133 $cdur->setInfo($this->lng->txt('crs_period_info'));
1134 $cdur->setStart($this->object->getCourseStart());
1135 $cdur->setEnd($this->object->getCourseEnd());
1136 $form->addItem($cdur);
1137
1138
1139 // activation/availability
1140
1141 $this->lng->loadLanguageModule('rep');
1142
1144 $section->setTitle($this->lng->txt('rep_activation_availability'));
1145 $form->addItem($section);
1146
1147 $online = new ilCheckboxInputGUI($this->lng->txt('rep_activation_online'), 'activation_online');
1148 $online->setChecked(!$this->object->getOfflineStatus());
1149 $online->setInfo($this->lng->txt('crs_activation_online_info'));
1150 $form->addItem($online);
1151
1152 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1153 $dur = new ilDateDurationInputGUI($this->lng->txt('rep_time_period'), "access_period");
1154 $dur->setShowTime(true);
1155 $dur->setStart(new ilDateTime($this->object->getActivationStart(), IL_CAL_UNIX));
1156 $dur->setEnd(new ilDateTime($this->object->getActivationEnd(), IL_CAL_UNIX));
1157 $form->addItem($dur);
1158
1159 $visible = new ilCheckboxInputGUI($this->lng->txt('rep_activation_limited_visibility'), 'activation_visibility');
1160 $visible->setInfo($this->lng->txt('crs_activation_limited_visibility_info'));
1161 $visible->setChecked($this->object->getActivationVisibility());
1162 $dur->addSubItem($visible);
1163
1164
1166 $section->setTitle($this->lng->txt('crs_reg'));
1167 $form->addItem($section);
1168
1169 $reg_proc = new ilRadioGroupInputGUI($this->lng->txt('crs_registration_type'), 'subscription_type');
1170 $reg_proc->setValue(
1171 ($this->object->getSubscriptionLimitationType() != IL_CRS_SUBSCRIPTION_DEACTIVATED)
1172 ? $this->object->getSubscriptionType()
1174 );
1175 // $reg_proc->setInfo($this->lng->txt('crs_reg_type_info'));
1176
1177 $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_direct'), IL_CRS_SUBSCRIPTION_DIRECT);
1178 $reg_proc->addOption($opt);
1179
1180 $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_password'), IL_CRS_SUBSCRIPTION_PASSWORD);
1181
1182 $pass = new ilTextInputGUI($this->lng->txt("password"), 'subscription_password');
1183 $pass->setRequired(true);
1184 $pass->setInfo($this->lng->txt('crs_reg_password_info'));
1185 $pass->setSubmitFormOnEnter(true);
1186 $pass->setSize(32);
1187 $pass->setMaxLength(32);
1188 $pass->setValue($this->object->getSubscriptionPassword());
1189
1190 $opt->addSubItem($pass);
1191 $reg_proc->addOption($opt);
1192
1193 $opt = new ilRadioOption($this->lng->txt('crs_subscription_options_confirmation'), IL_CRS_SUBSCRIPTION_CONFIRMATION);
1194 $opt->setInfo($this->lng->txt('crs_registration_confirmation_info'));
1195 $reg_proc->addOption($opt);
1196
1197 $opt = new ilRadioOption($this->lng->txt('crs_reg_no_selfreg'), IL_CRS_SUBSCRIPTION_DEACTIVATED);
1198 $opt->setInfo($this->lng->txt('crs_registration_deactivated'));
1199 $reg_proc->addOption($opt);
1200
1201 $form->addItem($reg_proc);
1202
1203
1204 // Registration codes
1205 $reg_code = new ilCheckboxInputGUI($this->lng->txt('crs_reg_code'), 'reg_code_enabled');
1206 $reg_code->setChecked($this->object->isRegistrationAccessCodeEnabled());
1207 $reg_code->setValue(1);
1208 $reg_code->setInfo($this->lng->txt('crs_reg_code_enabled_info'));
1209
1210 /*
1211 $code = new ilNonEditableValueGUI($this->lng->txt('crs_reg_code_value'));
1212 $code->setValue($this->object->getRegistrationAccessCode());
1213 $reg_code->addSubItem($code);
1214 */
1215
1216 #$link = new ilNonEditableValueGUI($this->lng->txt('crs_reg_code_link'));
1217 // Create default access code
1218 if (!$this->object->getRegistrationAccessCode()) {
1219 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
1220 $this->object->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode());
1221 }
1222 $reg_link = new ilHiddenInputGUI('reg_code');
1223 $reg_link->setValue($this->object->getRegistrationAccessCode());
1224 $form->addItem($reg_link);
1225
1226 $link = new ilCustomInputGUI($this->lng->txt('crs_reg_code_link'));
1227 include_once './Services/Link/classes/class.ilLink.php';
1228 $val = ilLink::_getLink($this->object->getRefId(), $this->object->getType(), array(), '_rcode' . $this->object->getRegistrationAccessCode());
1229 $link->setHTML('<span class="small">' . $val . '</span>');
1230 $reg_code->addSubItem($link);
1231
1232 $form->addItem($reg_code);
1233
1234 // time limit
1235 include_once "Services/Form/classes/class.ilDateDurationInputGUI.php";
1236 $sdur = new ilDateDurationInputGUI($this->lng->txt('crs_registration_limited'), "subscription_period");
1237 $sdur->setShowTime(true);
1238 if ($this->object->getSubscriptionStart()) {
1239 $sdur->setStart(new ilDateTime($this->object->getSubscriptionStart(), IL_CAL_UNIX));
1240 }
1241 if ($this->object->getSubscriptionEnd()) {
1242 $sdur->setEnd(new ilDateTime($this->object->getSubscriptionEnd(), IL_CAL_UNIX));
1243 }
1244 $form->addItem($sdur);
1245
1246 // cancellation limit
1247 $cancel = new ilDateTimeInputGUI($this->lng->txt('crs_cancellation_end'), 'cancel_end');
1248 $cancel->setInfo($this->lng->txt('crs_cancellation_end_info'));
1249 $cancel_end = $this->object->getCancellationEnd();
1250 if ($cancel_end) {
1251 $cancel->setDate($cancel_end);
1252 }
1253 $form->addItem($cancel);
1254
1255 // Max members
1256 $lim = new ilCheckboxInputGUI($this->lng->txt('crs_subscription_max_members_short'), 'subscription_membership_limitation');
1257 $lim->setInfo($this->lng->txt('crs_subscription_max_members_short_info'));
1258 $lim->setValue(1);
1259 $lim->setChecked($this->object->isSubscriptionMembershipLimited());
1260
1261 $min = new ilTextInputGUI('', 'subscription_min');
1262 $min->setSubmitFormOnEnter(true);
1263 $min->setSize(4);
1264 $min->setMaxLength(4);
1265 $min->setValue($this->object->getSubscriptionMinMembers() ? $this->object->getSubscriptionMinMembers() : '');
1266 $min->setTitle($this->lng->txt('crs_subscription_min_members'));
1267 $min->setInfo($this->lng->txt('crs_subscription_min_members_info'));
1268 $lim->addSubItem($min);
1269
1270 $max = new ilTextInputGUI('', 'subscription_max');
1271 $max->setSubmitFormOnEnter(true);
1272 $max->setSize(4);
1273 $max->setMaxLength(4);
1274 $max->setValue($this->object->getSubscriptionMaxMembers() ? $this->object->getSubscriptionMaxMembers() : '');
1275 $max->setTitle($this->lng->txt('crs_subscription_max_members'));
1276 $max->setInfo($this->lng->txt('crs_reg_max_info'));
1277
1278 $lim->addSubItem($max);
1279
1280 /*
1281 $wait = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list'),'waiting_list');
1282 $wait->setChecked($this->object->enabledWaitingList());
1283 $wait->setInfo($this->lng->txt('crs_wait_info'));
1284 $lim->addSubItem($wait);
1285
1286 $wait = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list'),'waiting_list');
1287 $wait->setChecked($this->object->enabledWaitingList());
1288 $wait->setInfo($this->lng->txt('crs_wait_info'));
1289 $lim->addSubItem($wait);
1290
1291 $auto = new ilCheckboxInputGUI($this->lng->txt('crs_waiting_list_autofill'), 'auto_wait');
1292 $auto->setChecked($this->object->hasWaitingListAutoFill());
1293 $auto->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1294 $wait->addSubItem($auto);
1295 */
1296
1297 $wait = new ilRadioGroupInputGUI($this->lng->txt('crs_waiting_list'), 'waiting_list');
1298
1299 $option = new ilRadioOption($this->lng->txt('none'), 0);
1300 $wait->addOption($option);
1301
1302 $option = new ilRadioOption($this->lng->txt('crs_waiting_list_no_autofill'), 1);
1303 $option->setInfo($this->lng->txt('crs_wait_info'));
1304 $wait->addOption($option);
1305
1306 $option = new ilRadioOption($this->lng->txt('crs_waiting_list_autofill'), 2);
1307 $option->setInfo($this->lng->txt('crs_waiting_list_autofill_info'));
1308 $wait->addOption($option);
1309
1310 if ($this->object->hasWaitingListAutoFill()) {
1311 $wait->setValue(2);
1312 } elseif ($this->object->enabledWaitingList()) {
1313 $wait->setValue(1);
1314 }
1315
1316 $lim->addSubItem($wait);
1317
1318 $form->addItem($lim);
1319
1320
1321 $pres = new ilFormSectionHeaderGUI();
1322 $pres->setTitle($this->lng->txt('crs_view_mode'));
1323
1324 $form->addItem($pres);
1325
1326 // title and icon visibility
1327 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTitleIconVisibility();
1328
1329 // top actions visibility
1330 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTopActionsVisibility();
1331
1332 // breadcrumbs
1333 if ($setting->get("rep_breadcr_crs_overwrite")) {
1334 $add = $setting->get("rep_breadcr_crs_default")
1335 ? " (" . $this->lng->txt("crs_breadcrumb_crs_only") . ")"
1336 : " (" . $this->lng->txt("crs_breadcrumb_full_path") . ")";
1337 $options = array(
1338 self::BREADCRUMB_DEFAULT => $this->lng->txt("crs_sys_default") . $add,
1339 self::BREADCRUMB_CRS_ONLY => $this->lng->txt("crs_breadcrumb_crs_only"),
1340 self::BREADCRUMB_FULL_PATH => $this->lng->txt("crs_breadcrumb_full_path")
1341 );
1342 $si = new ilSelectInputGUI($this->lng->txt("crs_shorten_breadcrumb"), "rep_breacrumb");
1343 $si->setValue((int) ilContainer::_lookupContainerSetting($this->object->getId(), "rep_breacrumb"));
1344 $si->setOptions($options);
1345 $form->addItem($si);
1346 }
1347
1348
1349 // custom icon
1350 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addIcon();
1351
1352 // tile image
1353 $form = $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
1354
1355 // list presentation
1356 $form = $this->initListPresentationForm($form);
1357
1358 // presentation type
1359 $view_type = new ilRadioGroupInputGUI($this->lng->txt('crs_presentation_type'), 'view_mode');
1360 $view_type->setValue($this->object->getViewMode());
1361
1362 $opts = new ilRadioOption($this->lng->txt('cntr_view_sessions'), IL_CRS_VIEW_SESSIONS);
1363 $opts->setInfo($this->lng->txt('cntr_view_info_sessions'));
1364 $view_type->addOption($opts);
1365
1366 // Limited sessions
1367 $sess = new ilCheckboxInputGUI($this->lng->txt('sess_limit'), 'sl');
1368 $sess->setValue(1);
1369 $sess->setChecked($this->object->isSessionLimitEnabled());
1370 $sess->setInfo($this->lng->txt('sess_limit_info'));
1371
1372 $prev = new ilNumberInputGUI($this->lng->txt('sess_num_prev'), 'sp');
1373 #$prev->setSubmitFormOnEnter(true);
1374 $prev->setMinValue(0);
1375 $prev->setValue(
1376 $this->object->getNumberOfPreviousSessions() == -1 ?
1377 '' :
1378 $this->object->getNumberOfPreviousSessions()
1379 );
1380 $prev->setSize(2);
1381 $prev->setMaxLength(3);
1382 $sess->addSubItem($prev);
1383
1384 $next = new ilNumberInputGUI($this->lng->txt('sess_num_next'), 'sn');
1385 #$next->setSubmitFormOnEnter(true);
1386 $next->setMinValue(0);
1387 $next->setValue(
1388 $this->object->getNumberOfNextSessions() == -1 ?
1389 '' :
1390 $this->object->getNumberOfnextSessions()
1391 );
1392 $next->setSize(2);
1393 $next->setMaxLength(3);
1394 $sess->addSubItem($next);
1395
1396 $opts->addSubItem($sess);
1397
1398
1399
1400
1401 $optsi = new ilRadioOption($this->lng->txt('cntr_view_simple'), IL_CRS_VIEW_SIMPLE);
1402 $optsi->setInfo($this->lng->txt('cntr_view_info_simple'));
1403 $view_type->addOption($optsi);
1404
1405 $optbt = new ilRadioOption($this->lng->txt('cntr_view_by_type'), IL_CRS_VIEW_BY_TYPE);
1406 $optbt->setInfo($this->lng->txt('cntr_view_info_by_type'));
1407 $view_type->addOption($optbt);
1408
1409 $opto = new ilRadioOption($this->lng->txt('crs_view_objective'), IL_CRS_VIEW_OBJECTIVE);
1410 $opto->setInfo($this->lng->txt('crs_view_info_objective'));
1411 $view_type->addOption($opto);
1412
1413 $optt = new ilRadioOption($this->lng->txt('crs_view_timing'), IL_CRS_VIEW_TIMING);
1414 $optt->setInfo($this->lng->txt('crs_view_info_timing'));
1415
1416 // cognos-blu-patch: begin
1417 $timing = new ilRadioGroupInputGUI($this->lng->txt('crs_view_timings'), "timing_mode");
1418 $timing->setValue($this->object->getTimingMode());
1419
1420 $absolute = new ilRadioOption($this->lng->txt('crs_view_timing_absolute'), IL_CRS_VIEW_TIMING_ABSOLUTE);
1421 $absolute->setInfo($this->lng->txt('crs_view_info_timing_absolute'));
1422 $timing->addOption($absolute);
1423
1424 $relative = new ilRadioOption($this->lng->txt('crs_view_timing_relative'), IL_CRS_VIEW_TIMING_RELATIVE);
1425 $relative->setInfo($this->lng->txt('crs_view_info_timing_relative'));
1426 $timing->addOption($relative);
1427
1428 $optt->addSubItem($timing);
1429 // cognos-blu-patch: end
1430
1431 $view_type->addOption($optt);
1432
1433 $form->addItem($view_type);
1434
1435 $this->initSortingForm(
1436 $form,
1437 array(
1442 )
1443 );
1444
1445
1446
1447 // lp vs. course status
1448 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1450 include_once './Services/Object/classes/class.ilObjectLP.php';
1451 $olp = ilObjectLP::getInstance($this->object->getId());
1452 if ($olp->getCurrentMode()) {
1453 $lp_status = new ilFormSectionHeaderGUI();
1454 $lp_status->setTitle($this->lng->txt('crs_course_status_of_users'));
1455 $form->addItem($lp_status);
1456
1457 $lp_status_options = new ilRadioGroupInputGUI($this->lng->txt('crs_status_determination'), "status_dt");
1458 // $lp_status_options->setRequired(true);
1459 $lp_status_options->setValue($this->object->getStatusDetermination());
1460
1461 $lp_option = new ilRadioOption(
1462 $this->lng->txt('crs_status_determination_lp'),
1464 $this->lng->txt('crs_status_determination_lp_info')
1465 );
1466 $lp_status_options->addOption($lp_option);
1467 $lp_status_options->addOption(new ilRadioOption(
1468 $this->lng->txt('crs_status_determination_manual'),
1470 ));
1471
1472 $form->addItem($lp_status_options);
1473 }
1474 }
1475
1476 // additional features
1477 $feat = new ilFormSectionHeaderGUI();
1478 $feat->setTitle($this->lng->txt('obj_features'));
1479 $form->addItem($feat);
1480
1481 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
1483 $this->object->getId(),
1484 $form,
1485 $this->getSubServices()
1486 );
1487
1488 $mem = new ilCheckboxInputGUI($this->lng->txt('crs_show_members'), 'show_members');
1489 $mem->setChecked($this->object->getShowMembers());
1490 $mem->setInfo($this->lng->txt('crs_show_members_info'));
1491 $form->addItem($mem);
1492
1493 // check privacy
1494 if (\ilPrivacySettings::_getInstance()->participantsListInCoursesEnabled()) {
1495 $part_list = new ilCheckboxInputGUI($this->lng->txt('crs_show_member_export'), 'show_members_export');
1496 $part_list->setChecked($this->object->getShowMembersExport());
1497 $part_list->setInfo($this->lng->txt('crs_show_member_export_info'));
1498 $mem->addSubItem($part_list);
1499 }
1500
1501 // Show members type
1502 $mail_type = new ilRadioGroupInputGUI($this->lng->txt('crs_mail_type'), 'mail_type');
1503 $mail_type->setValue($this->object->getMailToMembersType());
1504
1505 $mail_tutors = new ilRadioOption(
1506 $this->lng->txt('crs_mail_tutors_only'),
1508 $this->lng->txt('crs_mail_tutors_only_info')
1509 );
1510 $mail_type->addOption($mail_tutors);
1511
1512 $mail_all = new ilRadioOption(
1513 $this->lng->txt('crs_mail_all'),
1515 $this->lng->txt('crs_mail_all_info')
1516 );
1517 $mail_type->addOption($mail_all);
1518 $form->addItem($mail_type);
1519
1520 // Notification Settings
1521 /*$notification = new ilFormSectionHeaderGUI();
1522 $notification->setTitle($this->lng->txt('crs_notification'));
1523 $form->addItem($notification);*/
1524
1525 // Self notification
1526 $not = new ilCheckboxInputGUI($this->lng->txt('crs_auto_notification'), 'auto_notification');
1527 $not->setValue(1);
1528 $not->setInfo($this->lng->txt('crs_auto_notification_info'));
1529 $not->setChecked($this->object->getAutoNotification());
1530 $form->addItem($not);
1531
1532
1533 // Further information
1534 //$further = new ilFormSectionHeaderGUI();
1535 //$further->setTitle($this->lng->txt('crs_further_settings'));
1536 //$form->addItem($further);
1537
1538 $desk = new ilCheckboxInputGUI($this->lng->txt('crs_add_remove_from_desktop'), 'abo');
1539 $desk->setChecked($this->object->getAboStatus());
1540 $desk->setInfo($this->lng->txt('crs_add_remove_from_desktop_info'));
1541 $form->addItem($desk);
1542
1543
1544 // Edit ecs export settings
1545 include_once 'Modules/Course/classes/class.ilECSCourseSettings.php';
1546 $ecs = new ilECSCourseSettings($this->object);
1547 $ecs->addSettingsToForm($form, 'crs');
1548
1549 return $form;
1550 }
1551
1552 protected function getEditFormValues()
1553 {
1554 // values are done in initEditForm()
1555 }
1556
1557 public function sendFileObject()
1558 {
1559 include_once 'Modules/Course/classes/class.ilCourseFile.php';
1560 $file = new ilCourseFile((int) $_GET['file_id']);
1561 ilUtil::deliverFile($file->getAbsolutePath(), $file->getFileName(), $file->getFileType());
1562 return true;
1563 }
1564
1568 public function setSubTabs($a_tab)
1569 {
1570 global $DIC;
1571
1572 $rbacsystem = $DIC['rbacsystem'];
1573 $ilUser = $DIC['ilUser'];
1574 $ilAccess = $DIC['ilAccess'];
1575 $tree = $DIC['tree'];
1576
1577 switch ($a_tab) {
1578 case "properties":
1579 $this->tabs_gui->addSubTabTarget(
1580 "crs_settings",
1581 $this->ctrl->getLinkTarget($this, 'edit'),
1582 "edit",
1583 get_class($this)
1584 );
1585
1586 $this->tabs_gui->addSubTabTarget(
1587 "crs_info_settings",
1588 $this->ctrl->getLinkTarget($this, 'editInfo'),
1589 "editInfo",
1590 get_class($this)
1591 );
1592
1593 $this->tabs_gui->addSubTabTarget(
1594 "preconditions",
1595 $this->ctrl->getLinkTargetByClass('ilConditionHandlerGUI', 'listConditions'),
1596 "",
1597 "ilConditionHandlerGUI"
1598 );
1599
1600 $this->tabs_gui->addSubTabTarget(
1601 "crs_start_objects",
1602 $this->ctrl->getLinkTargetByClass('ilContainerStartObjectsGUI', 'listStructure'),
1603 "listStructure",
1604 get_class($this)
1605 );
1606
1607 $this->tabs_gui->addSubTabTarget(
1608 'groupings',
1609 $this->ctrl->getLinkTargetByClass('ilobjcoursegroupinggui', 'listGroupings'),
1610 'listGroupings',
1611 get_class($this)
1612 );
1613 $lti_settings = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
1614 if ($lti_settings->hasSettingsAccess()) {
1615 $this->tabs_gui->addSubTabTarget(
1616 'lti_provider',
1617 $this->ctrl->getLinkTargetByClass(ilLTIProviderObjectSettingGUI::class)
1618 );
1619 }
1620
1621 // map settings
1622 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1623 if (ilMapUtil::isActivated()) {
1624 $this->tabs_gui->addSubTabTarget(
1625 "crs_map_settings",
1626 $this->ctrl->getLinkTarget($this, 'editMapSettings'),
1627 "editMapSettings",
1628 get_class($this)
1629 );
1630 }
1631
1632
1633 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1634 include_once('Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
1635 // only show if export permission is granted
1636 if (ilPrivacySettings::_getInstance()->checkExportAccess($this->object->getRefId()) or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId())) {
1637 $this->tabs_gui->addSubTabTarget(
1638 'crs_custom_user_fields',
1639 $this->ctrl->getLinkTargetByClass('ilobjectcustomuserfieldsgui'),
1640 '',
1641 'ilobjectcustomuserfieldsgui'
1642 );
1643 }
1644
1645 // certificates
1646 $validator = new ilCertificateActiveValidator();
1647 if (true === $validator->validate()) {
1648 $this->tabs_gui->addSubTabTarget(
1649 "certificate",
1650 $this->ctrl->getLinkTargetByClass("ilcertificategui", "certificateeditor"),
1651 "",
1652 "ilcertificategui"
1653 );
1654 }
1655 // news settings
1656 if ($this->object->getUseNews()) {
1657 $this->tabs_gui->addSubTab(
1658 'obj_news_settings',
1659 $this->lng->txt("cont_news_settings"),
1660 $this->ctrl->getLinkTargetByClass('ilcontainernewssettingsgui')
1661 );
1662 }
1663
1664 if ($this->object->getShowMembersExport()) {
1665 $this->tabs_gui->addSubTab(
1666 'export_members',
1667 $this->lng->txt('crs_show_member_export_settings'),
1668 $this->ctrl->getLinkTargetByClass('ilmemberexportsettingsgui', '')
1669 );
1670 }
1671
1672 $this->tabs_gui->addSubTabTarget(
1673 "obj_multilinguality",
1674 $this->ctrl->getLinkTargetByClass("ilobjecttranslationgui", ""),
1675 "",
1676 "ilobjecttranslationgui"
1677 );
1678
1679 break;
1680
1681 }
1682 }
1683
1687 public function showPossibleSubObjects()
1688 {
1689 if (
1690 $this->object->getViewMode() == ilContainer::VIEW_OBJECTIVE &&
1691 !$this->isActiveAdministrationPanel()) {
1692 return;
1693 }
1694 $gui = new ilObjectAddNewItemGUI($this->object->getRefId());
1695 $gui->render();
1696 }
1697
1698
1703 protected function afterSave(ilObject $a_new_object)
1704 {
1705 global $DIC;
1706
1707 $rbacadmin = $DIC['rbacadmin'];
1708 $ilUser = $DIC['ilUser'];
1709 $ilSetting = $DIC['ilSetting'];
1710
1711 $a_new_object->getMemberObject()->add($ilUser->getId(), IL_CRS_ADMIN);
1712 $a_new_object->getMemberObject()->updateNotification($ilUser->getId(), $ilSetting->get('mail_crs_admin_notification', true));
1713 // cognos-blu-patch: begin
1714 $a_new_object->getMemberObject()->updateContact($ilUser->getId(), 1);
1715 // cognos-blu-patch: end
1716 $a_new_object->update();
1717
1718 // BEGIN ChangeEvent: Record write event.
1719 require_once('Services/Tracking/classes/class.ilChangeEvent.php');
1720 global $DIC;
1721
1722 $ilUser = $DIC['ilUser'];
1723 ilChangeEvent::_recordWriteEvent($a_new_object->getId(), $ilUser->getId(), 'create');
1724 // END ChangeEvent: Record write event.
1725
1726 // always send a message
1727 ilUtil::sendSuccess($this->lng->txt("crs_added"), true);
1728
1729 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
1731 "save",
1732 $this->ctrl->getLinkTarget($this, "edit", "", false, false)
1733 ));
1734 }
1735
1742 public function setShowHidePrefs()
1743 {
1744 global $DIC;
1745
1746 $ilUser = $DIC['ilUser'];
1747
1748 if (isset($_GET['admin_hide'])) {
1749 $ilUser->writePref('crs_admin_hide', (int) $_GET['admin_hide']);
1750 }
1751 if (isset($_GET['tutor_hide'])) {
1752 $ilUser->writePref('crs_tutor_hide', (int) $_GET['tutor_hide']);
1753 }
1754 if (isset($_GET['member_hide'])) {
1755 $ilUser->writePref('crs_member_hide', (int) $_GET['member_hide']);
1756 }
1757 if (isset($_GET['subscriber_hide'])) {
1758 $ilUser->writePref('crs_subscriber_hide', (int) $_GET['subscriber_hide']);
1759 }
1760 if (isset($_GET['wait_hide'])) {
1761 $ilUser->writePref('crs_wait_hide', (int) $_GET['wait_hide']);
1762 }
1763 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1764 foreach (ilCourseParticipants::getMemberRoles($this->object->getRefId()) as $role_id) {
1765 if (isset($_GET['role_hide_' . $role_id])) {
1766 $ilUser->writePref('crs_role_hide_' . $role_id, (int) $_GET['role_hide_' . $role_id]);
1767 }
1768 }
1769 }
1770
1771 public function readMemberData($ids, $selected_columns = null, bool $skip_names = false)
1772 {
1773 include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
1774 $this->show_tracking =
1775 (
1778 );
1779 if ($this->show_tracking) {
1780 include_once('./Services/Object/classes/class.ilObjectLP.php');
1781 $olp = ilObjectLP::getInstance($this->object->getId());
1782 $this->show_tracking = $olp->isActive();
1783 }
1784
1785 if ($this->show_tracking) {
1786 include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
1787 $completed = ilLPStatusWrapper::_lookupCompletedForObject($this->object->getId());
1788 $in_progress = ilLPStatusWrapper::_lookupInProgressForObject($this->object->getId());
1789 $failed = ilLPStatusWrapper::_lookupFailedForObject($this->object->getId());
1790 }
1791 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
1793
1794 if ($privacy->enabledCourseAccessTimes()) {
1795 include_once('./Services/Tracking/classes/class.ilLearningProgress.php');
1796 $progress = ilLearningProgress::_lookupProgressByObjId($this->object->getId());
1797 }
1798
1799 $do_prtf = (is_array($selected_columns) &&
1800 in_array('prtf', $selected_columns) &&
1801 is_array($ids));
1802 if ($do_prtf) {
1803 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1805 $ids,
1806 $this->ctrl->getLinkTarget($this, "members")
1807 );
1808 }
1809
1810 foreach ((array) $ids as $usr_id) {
1818 if (!$skip_names) {
1819 $name = ilObjUser::_lookupName($usr_id);
1820 $tmp_data['firstname'] = $name['firstname'];
1821 $tmp_data['lastname'] = $name['lastname'];
1822 $tmp_data['login'] = $name['login'];
1823 }
1824 $tmp_data['passed'] = $this->object->getMembersObject()->hasPassed($usr_id) ? 1 : 0;
1825 if ($this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
1826 $tmp_data['passed_info'] = $this->object->getMembersObject()->getPassedInfo($usr_id);
1827 }
1828 $tmp_data['notification'] = $this->object->getMembersObject()->isNotificationEnabled($usr_id) ? 1 : 0;
1829 $tmp_data['blocked'] = $this->object->getMembersObject()->isBlocked($usr_id) ? 1 : 0;
1830 // cognos-blu-patch: begin
1831 $tmp_data['contact'] = $this->object->getMembersObject()->isContact($usr_id) ? 1 : 0;
1832 // cognos-blu-patch: end
1833
1834 $tmp_data['usr_id'] = $usr_id;
1835
1836 if ($this->show_tracking) {
1837 if (in_array($usr_id, $completed)) {
1838 $tmp_data['progress'] = ilLPStatus::LP_STATUS_COMPLETED;
1839 } elseif (in_array($usr_id, $in_progress)) {
1840 $tmp_data['progress'] = ilLPStatus::LP_STATUS_IN_PROGRESS;
1841 } elseif (in_array($usr_id, $failed)) {
1842 $tmp_data['progress'] = ilLPStatus::LP_STATUS_FAILED;
1843 } else {
1844 $tmp_data['progress'] = ilLPStatus::LP_STATUS_NOT_ATTEMPTED;
1845 }
1846 }
1847
1848 if ($privacy->enabledCourseAccessTimes()) {
1849 if (isset($progress[$usr_id]['ts']) and $progress[$usr_id]['ts']) {
1850 $tmp_data['access_ut'] = $progress[$usr_id]['ts'];
1851 $tmp_data['access_time'] = ilDatePresentation::formatDate(new ilDateTime($progress[$usr_id]['ts'], IL_CAL_UNIX));
1852 } else {
1853 $tmp_data['access_ut'] = 0;
1854 $tmp_data['access_time'] = $this->lng->txt('no_date');
1855 }
1856 }
1857
1858 if ($do_prtf) {
1859 $tmp_data['prtf'] = $all_prtf[$usr_id];
1860 }
1861
1862 $members[$usr_id] = $tmp_data;
1863 }
1864 return $members ? $members : array();
1865 }
1866
1873 public function updateLPFromStatus($a_member_id, $a_has_passed)
1874 {
1875 global $DIC;
1876
1877 $ilUser = $DIC['ilUser'];
1878
1879 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
1881 $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
1882 include_once './Services/Object/classes/class.ilObjectLP.php';
1883 $olp = ilObjectLP::getInstance($this->object->getId());
1884 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL_BY_TUTOR) {
1885 include_once 'Services/Tracking/classes/class.ilLPMarks.php';
1886 $marks = new ilLPMarks($this->object->getId(), $a_member_id);
1887
1888 // only if status has changed
1889 if ($marks->getCompleted() != $a_has_passed) {
1890 $marks->setCompleted($a_has_passed);
1891 $marks->update();
1892
1893 // as course is origin of LP status change, block syncing
1894 include_once("./Modules/Course/classes/class.ilCourseAppEventListener.php");
1896
1897 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
1898 ilLPStatusWrapper::_updateStatus($this->object->getId(), $a_member_id);
1899 }
1900 }
1901 }
1902 }
1903
1904
1905
1906 public function autoFillObject()
1907 {
1908 global $DIC;
1909
1910 $rbacsystem = $DIC['rbacsystem'];
1911
1912 $this->checkPermission('write');
1913
1914 if ($this->object->isSubscriptionMembershipLimited() and $this->object->getSubscriptionMaxMembers() and
1915 $this->object->getSubscriptionMaxMembers() <= $this->object->getMembersObject()->getCountMembers()) {
1916 ilUtil::sendFailure($this->lng->txt("crs_max_members_reached"));
1917 $this->membersObject();
1918
1919 return false;
1920 }
1921 if ($number = $this->object->getMembersObject()->autoFillSubscribers()) {
1922 ilUtil::sendSuccess($this->lng->txt("crs_number_users_added") . " " . $number);
1923 } else {
1924 ilUtil::sendFailure($this->lng->txt("crs_no_users_added"));
1925 }
1926 $this->membersObject();
1927
1928 return true;
1929 }
1930
1931 public function leaveObject()
1932 {
1933 global $DIC;
1934
1935 $ilUser = $DIC['ilUser'];
1936
1937 $this->checkPermission('leave');
1938
1939 if ($this->object->getMembersObject()->isLastAdmin($ilUser->getId())) {
1940 ilUtil::sendFailure($this->lng->txt('crs_min_one_admin'));
1941 $this->viewObject();
1942 return false;
1943 }
1944
1945 $this->tabs_gui->setTabActive('crs_unsubscribe');
1946 include_once "Services/Utilities/classes/class.ilConfirmationGUI.php";
1947 $cgui = new ilConfirmationGUI();
1948 $cgui->setHeaderText($this->lng->txt('crs_unsubscribe_sure'));
1949 $cgui->setFormAction($this->ctrl->getFormAction($this));
1950 $cgui->setCancel($this->lng->txt("cancel"), "cancel");
1951 $cgui->setConfirm($this->lng->txt("crs_unsubscribe"), "performUnsubscribe");
1952 $this->tpl->setContent($cgui->getHTML());
1953 }
1954
1958 public function unsubscribeObject()
1959 {
1960 $this->leaveObject();
1961 }
1962
1964 {
1965 global $DIC;
1966
1967 $ilUser = $DIC['ilUser'];
1968 $ilCtrl = $DIC['ilCtrl'];
1969
1970 // CHECK ACCESS
1971 $this->checkPermission('leave');
1972 $this->object->getMembersObject()->delete($this->ilias->account->getId());
1973 $this->object->getMembersObject()->sendUnsubscribeNotificationToAdmins($this->ilias->account->getId());
1974 $this->object->getMembersObject()->sendNotification($this->object->getMembersObject()->NOTIFY_UNSUBSCRIBE, $ilUser->getId());
1975
1976 ilUtil::sendSuccess($this->lng->txt('crs_unsubscribed_from_crs'), true);
1977
1978 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->tree->getParentId($this->ref_id));
1979 $ilCtrl->redirectByClass("ilrepositorygui", "");
1980 }
1981
1985 protected function getAgreementTabs()
1986 {
1987 if ($GLOBALS['DIC']['ilAccess']->checkAccess('visible', '', $this->ref_id)) {
1988 $GLOBALS['DIC']['ilTabs']->addTarget(
1989 "info_short",
1990 $this->ctrl->getLinkTargetByClass(
1991 array("ilobjcoursegui", "ilinfoscreengui"),
1992 "showSummary"
1993 ),
1994 "infoScreen"
1995 );
1996 }
1997 if ($GLOBALS['DIC']['ilAccess']->checkAccess('leave', '', $this->object->getRefId()) and $this->object->getMemberObject()->isMember()) {
1998 $GLOBALS['DIC']['ilTabs']->addTarget(
1999 "crs_unsubscribe",
2000 $this->ctrl->getLinkTarget($this, "unsubscribe"),
2001 'leave',
2002 ""
2003 );
2004 }
2005 }
2006
2013 public function addContentTab()
2014 {
2015 $this->tabs_gui->addTab(
2016 "view_content",
2017 $this->lng->txt("content"),
2018 $this->ctrl->getLinkTarget($this, "view")
2019 );
2020 }
2021
2025 public function getTabs()
2026 {
2027 global $DIC;
2028
2029 $ilUser = $DIC['ilUser'];
2030 $lng = $DIC['lng'];
2031 $ilHelp = $DIC['ilHelp'];
2032
2033 $ilAccess = $GLOBALS['DIC']->access();
2034
2035 $ilHelp->setScreenIdComponent("crs");
2036
2037 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
2038
2039 if ($ilAccess->checkAccess('read', '', $this->ref_id)) {
2040 // default activation
2041 $this->tabs_gui->activateTab('view_content');
2042 if ($this->object->isNewsTimelineEffective()) {
2043 if (!$this->object->isNewsTimelineLandingPageEffective()) {
2044 $this->addContentTab();
2045 }
2046 $this->tabs_gui->addTab(
2047 "news_timeline",
2048 $lng->txt("cont_news_timeline_tab"),
2049 $this->ctrl->getLinkTargetByClass("ilnewstimelinegui", "show")
2050 );
2051 if ($this->object->isNewsTimelineLandingPageEffective()) {
2052 $this->addContentTab();
2053 }
2054 } else {
2055 $this->addContentTab();
2056 }
2057 }
2058
2059 if ($this->object->getViewMode() == IL_CRS_VIEW_TIMING and
2060 $ilAccess->checkAccess('write', '', $this->ref_id)
2061 ) {
2062 $this->tabs->addTab(
2063 'timings_timings',
2064 $lng->txt('timings_timings'),
2065 $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'manageTimings')
2066 );
2067 } elseif (
2068 $this->object->getViewMode() == IL_CRS_VIEW_TIMING and
2069 $this->object->getMemberObject()->isParticipant() and
2070 $ilAccess->checkAccess('read', '', $this->ref_id)) {
2071 $this->tabs->addTab(
2072 'timings_timings',
2073 $lng->txt('timings_timings'),
2074 $this->ctrl->getLinkTargetByClass('ilcoursecontentgui', 'managePersonalTimings')
2075 );
2076 }
2077
2078
2079
2080 // learning objectives
2081 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
2082 include_once('./Modules/Course/classes/class.ilCourseObjective.php');
2083 if ($this->object->getViewMode() == IL_CRS_VIEW_OBJECTIVE or ilCourseObjective::_getCountObjectives($this->object->getId())) {
2084 $this->tabs_gui->addTarget(
2085 'crs_objectives',
2086 $this->ctrl->getLinkTargetByClass('illoeditorgui', ''),
2087 'illoeditorgui'
2088 );
2089 }
2090 }
2091
2092 if (
2093 $ilAccess->checkAccess('visible', '', $this->ref_id) ||
2094 $ilAccess->checkAccess('join', '', $this->ref_id) ||
2095 $ilAccess->checkAccess('read', '', $this->ref_id)
2096 ) {
2097 //$next_class = $this->ctrl->getNextClass($this);
2098
2099 // this is not nice. tabs should be displayed in ilcoursegui
2100 // not via ilrepositorygui, then next_class == ilinfoscreengui
2101 // could be checked
2102 $force_active = (strtolower($_GET["cmdClass"]) == "ilinfoscreengui"
2103 || strtolower($_GET["cmdClass"]) == "ilnotegui")
2104 ? true
2105 : false;
2106 $this->tabs_gui->addTarget(
2107 "info_short",
2108 $this->ctrl->getLinkTargetByClass(
2109 array("ilobjcoursegui", "ilinfoscreengui"),
2110 "showSummary"
2111 ),
2112 "infoScreen",
2113 "",
2114 "",
2115 $force_active
2116 );
2117 }
2118 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
2119 $force_active = (strtolower($_GET["cmdClass"]) == "ilconditionhandlergui"
2120 && $_GET["item_id"] == "")
2121 ? true
2122 : false;
2123 $this->tabs_gui->addTarget(
2124 "settings",
2125 $this->ctrl->getLinkTarget($this, "edit"),
2126 array("edit", "editMapSettings", "editCourseIcons", "listStructure"),
2127 "",
2128 "",
2129 $force_active
2130 );
2131 }
2132
2133
2134 $is_participant = ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId());
2135 include_once './Services/Mail/classes/class.ilMail.php';
2136 $mail = new ilMail($GLOBALS['DIC']['ilUser']->getId());
2137
2138 include_once './Modules/Course/classes/class.ilCourseMembershipGUI.php';
2139 $membership_gui = new ilCourseMembershipGUI($this, $this->object);
2140 $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
2141
2142 // badges
2143 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
2144 include_once 'Services/Badge/classes/class.ilBadgeHandler.php';
2145 if (ilBadgeHandler::getInstance()->isObjectActive($this->object->getId())) {
2146 $this->tabs_gui->addTarget(
2147 "obj_tool_setting_badges",
2148 $this->ctrl->getLinkTargetByClass("ilbadgemanagementgui", ""),
2149 "",
2150 "ilbadgemanagementgui"
2151 );
2152 }
2153 }
2154
2155 // skills
2156 if (ilContSkillPresentationGUI::isAccessible($this->ref_id)) {
2157 $this->tabs_gui->addTarget(
2158 "obj_tool_setting_skills",
2159 $this->ctrl->getLinkTargetByClass(array("ilcontainerskillgui", "ilcontskillpresentationgui"), ""),
2160 "",
2161 array("ilcontainerskillgui", "ilcontskillpresentationgui", "ilcontskilladmingui")
2162 );
2163 }
2164
2165 // booking
2166 if ($ilAccess->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
2167 $this->object->getId(),
2169 false
2170 )) {
2171 $this->tabs_gui->addTarget(
2172 "obj_tool_setting_booking",
2173 $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
2174 );
2175 }
2176
2177 // learning progress
2178 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2179 if (ilLearningProgressAccess::checkAccess($this->object->getRefId(), $is_participant)) {
2180 $this->tabs_gui->addTarget(
2181 'learning_progress',
2182 $this->ctrl->getLinkTargetByClass(array('ilobjcoursegui','illearningprogressgui'), ''),
2183 '',
2184 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
2185 );
2186 }
2187
2188 // meta data
2189 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
2190 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
2191 $mdgui = new ilObjectMetaDataGUI($this->object);
2192 $mdtab = $mdgui->getTab();
2193 if ($mdtab) {
2194 $this->tabs_gui->addTarget(
2195 "meta_data",
2196 $mdtab,
2197 "",
2198 "ilobjectmetadatagui"
2199 );
2200 }
2201 }
2202
2203 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2204 $this->tabs_gui->addTarget(
2205 'export',
2206 $this->ctrl->getLinkTargetByClass('ilexportgui', ''),
2207 'export',
2208 'ilexportgui'
2209 );
2210 }
2211
2212 if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)) {
2213 $this->tabs_gui->addTarget(
2214 "perm_settings",
2215 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"),
2216 array("perm","info","owner"),
2217 'ilpermissiongui'
2218 );
2219 }
2220
2221 // Join/Leave
2222 if ($ilAccess->checkAccess('join', '', $this->ref_id)
2223 and !$this->object->getMemberObject()->isAssigned()) {
2224 include_once './Modules/Course/classes/class.ilCourseWaitingList.php';
2225 if (ilCourseWaitingList::_isOnList($ilUser->getId(), $this->object->getId())) {
2226 $this->tabs_gui->addTab(
2227 'leave',
2228 $this->lng->txt('membership_leave'),
2229 $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', 'show', '')
2230 );
2231 } else {
2232 $this->tabs_gui->addTarget(
2233 "join",
2234 $this->ctrl->getLinkTargetByClass('ilcourseregistrationgui', "show"),
2235 'show',
2236 ""
2237 );
2238 }
2239 }
2240 if ($ilAccess->checkAccess('leave', '', $this->object->getRefId())
2241 and $this->object->getMemberObject()->isMember()) {
2242 $this->tabs_gui->addTarget(
2243 "crs_unsubscribe",
2244 $this->ctrl->getLinkTarget($this, "unsubscribe"),
2245 'leave',
2246 ""
2247 );
2248 }
2249 }
2250
2251
2252 public function executeCommand()
2253 {
2254 global $DIC;
2255 $rbacsystem = $DIC['rbacsystem'];
2256 $ilUser = $DIC['ilUser'];
2257 $ilAccess = $DIC['ilAccess'];
2258 $ilErr = $DIC['ilErr'];
2259 $ilTabs = $DIC['ilTabs'];
2260 $ilNavigationHistory = $DIC['ilNavigationHistory'];
2261 $ilCtrl = $DIC['ilCtrl'];
2262 $ilToolbar = $DIC['ilToolbar'];
2263
2264 $next_class = $this->ctrl->getNextClass($this);
2265 $cmd = $this->ctrl->getCmd();
2266
2267 $this->prepareOutput();
2268
2269 // add entry to navigation history
2270 if (!$this->getCreationMode() &&
2271 $ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
2272 include_once("./Services/Link/classes/class.ilLink.php");
2273 $ilNavigationHistory->addItem(
2274 $_GET["ref_id"],
2275 ilLink::_getLink($_GET["ref_id"], "crs"),
2276 "crs"
2277 );
2278 }
2279 $header_action = true;
2280 switch ($next_class) {
2281 case 'ilreputilgui':
2282 $ru = new \ilRepUtilGUI($this);
2283 $this->ctrl->setReturn($this, 'trash');
2284 $this->ctrl->forwardCommand($ru);
2285 break;
2286
2287 case 'illtiproviderobjectsettinggui':
2288
2289 $this->setSubTabs('properties');
2290 $this->tabs_gui->activateTab('settings');
2291 $this->tabs_gui->activateSubTab('lti_provider');
2292 $lti_gui = new ilLTIProviderObjectSettingGUI($this->object->getRefId());
2293 $lti_gui->setCustomRolesForSelection($GLOBALS['DIC']->rbac()->review()->getLocalRoles($this->object->getRefId()));
2294 $lti_gui->offerLTIRolesForSelection(false);
2295 $this->ctrl->forwardCommand($lti_gui);
2296 break;
2297
2298 case 'ilcoursemembershipgui':
2299
2300 $this->tabs_gui->activateTab('members');
2301
2302 include_once './Modules/Course/classes/class.ilCourseMembershipGUI.php';
2303 $mem_gui = new ilCourseMembershipGUI($this, $this->object);
2304 $this->ctrl->forwardCommand($mem_gui);
2305 break;
2306
2307 case "ilinfoscreengui":
2308 $this->infoScreen(); // forwards command
2309 break;
2310
2311 case 'ilobjectmetadatagui':
2312 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2313 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
2314 }
2315 $this->tabs_gui->setTabActive('meta_data');
2316 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
2317 $md_gui = new ilObjectMetaDataGUI($this->object);
2318 $this->ctrl->forwardCommand($md_gui);
2319 break;
2320
2321 case 'ilcourseregistrationgui':
2322 $this->ctrl->setReturn($this, '');
2323 $this->tabs_gui->setTabActive('join');
2324 include_once('./Modules/Course/classes/class.ilCourseRegistrationGUI.php');
2325 $registration = new ilCourseRegistrationGUI($this->object, $this);
2326 $this->ctrl->forwardCommand($registration);
2327 break;
2328
2329 case 'ilobjectcustomuserfieldsgui':
2330 include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
2331 $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
2332 $this->setSubTabs('properties');
2333 $this->tabs_gui->activateTab('settings');
2334 $this->tabs_gui->activateSubTab('crs_custom_user_fields');
2335 $this->ctrl->forwardCommand($cdf_gui);
2336 break;
2337
2338 case "ilcourseobjectivesgui":
2339 include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
2340
2341 $this->ctrl->setReturn($this, "");
2342 $reg_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2343 $ret = &$this->ctrl->forwardCommand($reg_gui);
2344 break;
2345
2346 case 'ilobjcoursegroupinggui':
2347 include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
2348
2349 $this->ctrl->setReturn($this, 'edit');
2350 $this->setSubTabs('properties');
2351 $this->tabs_gui->activateTab('settings');
2352 $this->tabs_gui->activateSubTab('groupings');
2353 $crs_grp_gui = new ilObjCourseGroupingGUI($this->object, (int) $_GET['obj_id']);
2354 $this->ctrl->forwardCommand($crs_grp_gui);
2355 break;
2356
2357
2358 case "ilpropertyformgui":
2359 // only case is currently adv metadata internal link in info settings, see #24497
2360 $form = $this->initInfoEditor();
2361 $this->ctrl->forwardCommand($form);
2362 break;
2363
2364 case "ilcolumngui":
2365 $this->tabs_gui->setTabActive('none');
2366 $this->checkPermission("read");
2367 //$this->prepareOutput();
2368 //include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
2369 //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
2370 // ilObjStyleSheet::getContentStylePath(0));
2371 //$this->renderObject();
2372 $this->viewObject();
2373 break;
2374
2375 case "ilconditionhandlergui":
2376 include_once './Services/Conditions/classes/class.ilConditionHandlerGUI.php';
2377 // preconditions for whole course
2378 $this->setSubTabs("properties");
2379 $this->tabs_gui->activateTab('settings');
2380 $this->tabs_gui->activateSubTab('preconditions');
2381 $new_gui = new ilConditionHandlerGUI($this);
2382 $this->ctrl->forwardCommand($new_gui);
2383 break;
2384
2385 case "illearningprogressgui":
2386 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
2387
2388 $new_gui = new ilLearningProgressGUI(
2390 $this->object->getRefId(),
2391 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
2392 );
2393 $this->ctrl->forwardCommand($new_gui);
2394 $this->tabs_gui->setTabActive('learning_progress');
2395 break;
2396
2397 case 'ilpermissiongui':
2398 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
2399 $this->tabs_gui->setTabActive('perm_settings');
2400 $perm_gui = new ilPermissionGUI($this);
2401 $ret = &$this->ctrl->forwardCommand($perm_gui);
2402 break;
2403
2404 case 'ilcalendarpresentationgui':
2405 include_once('./Services/Calendar/classes/class.ilCalendarPresentationGUI.php');
2406 $cal = new ilCalendarPresentationGUI($this->object->getRefId());
2407 $ret = $this->ctrl->forwardCommand($cal);
2408 $header_action = false;
2409 break;
2410
2411 case 'ilcoursecontentinterface':
2412
2413 $this->initCourseContentInterface();
2414 $this->cci_obj->cci_setContainer($this);
2415
2416 $this->ctrl->forwardCommand($this->cci_obj);
2417 $this->setSubTabs('content');
2418 $this->tabs_gui->setTabActive('content');
2419 break;
2420
2421 case 'ilcoursecontentgui':
2422 $this->ctrl->setReturn($this, 'members');
2423 include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
2424 $course_content_obj = new ilCourseContentGUI($this);
2425 $this->ctrl->forwardCommand($course_content_obj);
2426 break;
2427
2428 case 'ilpublicuserprofilegui':
2429 $this->tpl->enableDragDropFileUpload(null);
2430 require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
2431 $this->setSubTabs('members');
2432 $this->tabs_gui->setTabActive('members');
2433 $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
2434 $profile_gui->setBackUrl($this->ctrl->getLinkTargetByClass(["ilCourseMembershipGUI", "ilUsersGalleryGUI"], 'view'));
2435 $this->tabs_gui->setSubTabActive('crs_members_gallery');
2436 $html = $this->ctrl->forwardCommand($profile_gui);
2437 $this->tpl->setVariable("ADM_CONTENT", $html);
2438 break;
2439
2440
2441 case 'ilmemberagreementgui':
2442 include_once('Services/Membership/classes/class.ilMemberAgreementGUI.php');
2443 $this->tabs_gui->clearTargets();
2444
2445 $this->ctrl->setReturn($this, '');
2446 $agreement = new ilMemberAgreementGUI($this->object->getRefId());
2447 $this->ctrl->forwardCommand($agreement);
2448 break;
2449
2450
2451 // container page editing
2452 case "ilcontainerpagegui":
2453 $ret = $this->forwardToPageObject();
2454 if ($ret != "") {
2455 $this->tpl->setContent($ret);
2456 }
2457 $header_action = false;
2458 break;
2459
2460 case "ilcontainerstartobjectspagegui":
2461 // file downloads, etc. (currently not active)
2462 include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
2463 $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
2464 $ret = $this->ctrl->forwardCommand($pgui);
2465 if ($ret) {
2466 $this->tpl->setContent($ret);
2467 }
2468 break;
2469
2470 case 'ilobjectcopygui':
2471 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
2472 $cp = new ilObjectCopyGUI($this);
2473 $cp->setType('crs');
2474 $this->ctrl->forwardCommand($cp);
2475 break;
2476
2477 case "ilobjstylesheetgui":
2478 $this->forwardToStyleSheet();
2479 break;
2480
2481
2482 case 'ilexportgui':
2483 $this->tabs_gui->setTabActive('export');
2484 include_once './Services/Export/classes/class.ilExportGUI.php';
2485 $exp = new ilExportGUI($this);
2486 $exp->addFormat('xml');
2487 $this->ctrl->forwardCommand($exp);
2488 break;
2489
2490 case "ilcommonactiondispatchergui":
2491 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
2493 $this->ctrl->forwardCommand($gui);
2494 break;
2495
2496 case 'ildidactictemplategui':
2497 $this->ctrl->setReturn($this, 'edit');
2498 include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
2499 $did = new ilDidacticTemplateGUI($this);
2500 $this->ctrl->forwardCommand($did);
2501 break;
2502
2503 case "ilcertificategui":
2504 $this->tabs_gui->activateTab("settings");
2505 $this->setSubTabs("properties");
2506 $this->tabs_gui->activateSubTab('certificate');
2507
2508 $guiFactory = new ilCertificateGUIFactory();
2509 $output_gui = $guiFactory->create($this->object);
2510 $this->ctrl->forwardCommand($output_gui);
2511 break;
2512
2513 case 'ilobjectservicesettingsgui':
2514 $this->ctrl->setReturn($this, 'edit');
2515 $this->setSubTabs("properties");
2516 $this->tabs_gui->activateTab('settings');
2517 $this->tabs_gui->acltivateSubTab('tool_settings');
2518
2519 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
2521 $this,
2522 $this->object->getId(),
2523 array(
2525 )
2526 );
2527 $this->ctrl->forwardCommand($service);
2528 break;
2529
2530 case 'illoeditorgui':
2531 #$this->tabs_gui->clearTargets();
2532 #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
2533 $this->tabs_gui->activateTab('crs_objectives');
2534
2535 include_once './Modules/Course/classes/Objectives/class.ilLOEditorGUI.php';
2536 $editor = new ilLOEditorGUI($this->object);
2537 $this->ctrl->forwardCommand($editor);
2538 if (strtolower($this->ctrl->getCmdClass()) === "illopagegui") {
2539 $header_action = false;
2540 }
2541 break;
2542
2543 case 'ilcontainerstartobjectsgui':
2544 $this->ctrl->setReturn($this, 'edit');
2545 $this->tabs_gui->clearTargets();
2546 $this->tabs_gui->setBackTarget(
2547 $this->lng->txt("back_to_crs_content"),
2548 $this->ctrl->getLinkTarget($this, "edit")
2549 );
2550 $this->tabs_gui->addTab(
2551 "start",
2552 $this->lng->txt("crs_start_objects"),
2553 $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure")
2554 );
2555 if (strtolower($this->ctrl->getCmdClass()) ==
2556 "ilcontainerstartobjectspagegui") {
2557 $header_action = false;
2558 }
2559 global $DIC;
2560
2561 $ilHelp = $DIC['ilHelp'];
2562 $ilHelp->setScreenIdComponent("crs");
2563
2564 include_once './Services/Container/classes/class.ilContainerStartObjectsGUI.php';
2565 $stgui = new ilContainerStartObjectsGUI($this->object);
2566 $this->ctrl->forwardCommand($stgui);
2567 break;
2568
2569 case 'illomembertestresultgui':
2570 include_once './Modules/Course/classes/Objectives/class.ilLOMemberTestResultGUI.php';
2571 $GLOBALS['DIC']['ilCtrl']->setReturn($this, 'members');
2572 $GLOBALS['DIC']['ilTabs']->clearTargets();
2573 $GLOBALS['DIC']['ilTabs']->setBackTarget(
2574 $GLOBALS['DIC']['lng']->txt('back'),
2575 $GLOBALS['DIC']['ilCtrl']->getLinkTarget($this, 'members')
2576 );
2577
2578 $result_view = new ilLOMemberTestResultGUI($this, $this->object, (int) $_REQUEST['uid']);
2579 $this->ctrl->forwardCommand($result_view);
2580 break;
2581
2582 case 'ilmailmembersearchgui':
2583 include_once 'Services/Mail/classes/class.ilMail.php';
2584 $mail = new ilMail($ilUser->getId());
2585
2586 if (
2587 !($this->object->getMailToMembersType() == ilCourseConstants::MAIL_ALLOWED_ALL ||
2588 $ilAccess->checkAccess('manage_members', "", $this->object->getRefId())) &&
2589 $rbacsystem->checkAccess('internal_mail', $mail->getMailObjectReferenceId())) {
2590 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"), $ilErr->MESSAGE);
2591 }
2592
2593 $this->tabs_gui->setTabActive('members');
2594
2595 include_once './Services/Contact/classes/class.ilMailMemberSearchGUI.php';
2596 include_once './Services/Contact/classes/class.ilMailMemberCourseRoles.php';
2597
2598 $mail_search = new ilMailMemberSearchGUI($this, $this->object->getRefId(), new ilMailMemberCourseRoles());
2599 $mail_search->setObjParticipants(
2600 ilCourseParticipants::_getInstanceByObjId($this->object->getId())
2601 );
2602 $this->ctrl->forwardCommand($mail_search);
2603 break;
2604
2605 case 'ilbadgemanagementgui':
2606 $this->tabs_gui->setTabActive('obj_tool_setting_badges');
2607 include_once 'Services/Badge/classes/class.ilBadgeManagementGUI.php';
2608 $bgui = new ilBadgeManagementGUI($this->object->getRefId(), $this->object->getId(), 'crs');
2609 $this->ctrl->forwardCommand($bgui);
2610 break;
2611
2612 case "ilcontainernewssettingsgui":
2613 $this->setSubTabs("properties");
2614 $this->tabs_gui->activateTab('settings');
2615 $this->tabs_gui->activateSubTab('obj_news_settings');
2616 $news_set_gui = new ilContainerNewsSettingsGUI($this);
2617 $news_set_gui->setTimeline(true);
2618 $news_set_gui->setCronNotifications(true);
2619 $news_set_gui->setHideByDate(true);
2620 $this->ctrl->forwardCommand($news_set_gui);
2621 break;
2622
2623 case "ilnewstimelinegui":
2624 $this->tabs_gui->setTabActive('news_timeline');
2625 include_once("./Services/News/classes/class.ilNewsTimelineGUI.php");
2626 $t = ilNewsTimelineGUI::getInstance($this->object->getRefId(), $this->object->getNewsTimelineAutoENtries());
2627 $t->setUserEditAll($ilAccess->checkAccess('write', '', $this->object->getRefId(), 'grp'));
2628 $this->showPermanentLink($tpl);
2629 $this->ctrl->forwardCommand($t);
2630 include_once 'Services/Tracking/classes/class.ilLearningProgress.php';
2632 $ilUser->getId(),
2633 $this->object->getId(),
2634 $this->object->getRefId(),
2635 'crs'
2636 );
2637 break;
2638
2639 case 'ilmemberexportsettingsgui':
2640 $this->setSubTabs('properties');
2641 $this->tabs_gui->activateTab('properties');
2642 $this->tabs_gui->activateSubTab('export_members');
2643 include_once './Services/Membership/classes/Export/class.ilMemberExportSettingsGUI.php';
2644 $settings_gui = new ilMemberExportSettingsGUI($this->object->getType(), $this->object->getId());
2645 $this->ctrl->forwardCommand($settings_gui);
2646 break;
2647
2648
2649 case "ilcontainerskillgui":
2650 $this->tabs_gui->activateTab('obj_tool_setting_skills');
2651 include_once("./Services/Container/Skills/classes/class.ilContainerSkillGUI.php");
2652 $gui = new ilContainerSkillGUI($this);
2653 $this->ctrl->forwardCommand($gui);
2654 break;
2655
2656
2657 case 'ilobjecttranslationgui':
2658 $this->checkPermissionBool("write");
2659 $this->setSubTabs("properties");
2660 $this->tabs_gui->activateTab("settings");
2661 $this->tabs_gui->activateSubTab("obj_multilinguality");
2662 include_once("./Services/Object/classes/class.ilObjectTranslationGUI.php");
2663 $transgui = new ilObjectTranslationGUI($this);
2664 $this->ctrl->forwardCommand($transgui);
2665 break;
2666
2667 case "ilbookinggatewaygui":
2668 $this->tabs_gui->activateTab('obj_tool_setting_booking');
2669 $gui = new ilBookingGatewayGUI($this);
2670 $this->ctrl->forwardCommand($gui);
2671 break;
2672
2673 default:
2674/* if(!$this->creation_mode)
2675 {
2676 $this->checkPermission('visible');
2677 }*/
2678 /*
2679 if(!$this->creation_mode and !$ilAccess->checkAccess('visible','',$this->object->getRefId(),'crs'))
2680 {
2681 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
2682 }
2683 */
2684
2685 // #9401 - see also ilStartupGUI::_checkGoto()
2686 if ($cmd == 'infoScreenGoto') {
2687 if (ilObjCourse::_isActivated($this->object->getId()) &&
2688 ilObjCourse::_registrationEnabled($this->object->getId())) {
2689 $cmd = 'join';
2690 } else {
2691 $cmd = 'infoScreen';
2692 }
2693 }
2694
2695 if (!$this->creation_mode) {
2696 if ($cmd == "infoScreen") {
2697 $this->checkPermission("visible");
2698 } else {
2699 // $this->checkPermission("read");
2700 }
2701 }
2702
2703
2704 if (!$this->creation_mode
2705 && $cmd != 'infoScreen'
2706 && $cmd != 'sendfile'
2707 && $cmd != 'unsubscribe'
2708 && $cmd != 'deliverCertificate'
2709 && $cmd != 'performUnsubscribe'
2710 && $cmd != 'removeFromDesk'
2711 && $cmd !== 'leave'
2712 && !$ilAccess->checkAccess("read", '', $this->object->getRefId())
2713 || $cmd == 'join'
2714 || $cmd == 'subscribe') {
2715 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
2716 if ($rbacsystem->checkAccess('join', $this->object->getRefId()) &&
2717 !ilCourseParticipants::_isParticipant($this->object->getRefId(), $ilUser->getId())) {
2718 include_once('./Modules/Course/classes/class.ilCourseRegistrationGUI.php');
2719 $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
2720 } else {
2721 $this->infoScreenObject();
2722 break;
2723 }
2724 }
2725
2726 if ($cmd == 'listObjectives') {
2727 include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
2728
2729 $this->ctrl->setReturn($this, "");
2730 $obj_gui = new ilCourseObjectivesGUI($this->object->getRefId());
2731 $ret = &$this->ctrl->forwardCommand($obj_gui);
2732 break;
2733 }
2734
2735 // cognos-blu-patch: begin
2736 // cognos-blu-patch: end
2737
2738 // if news timeline is landing page, redirect if necessary
2739 if ($cmd == "" && $this->object->isNewsTimelineLandingPageEffective()) {
2740 $this->ctrl->redirectbyclass("ilnewstimelinegui");
2741 }
2742
2743 if (!$cmd) {
2744 $cmd = 'view';
2745 }
2746 $cmd .= 'Object';
2747 $this->$cmd();
2748
2749 break;
2750 }
2751
2752 if ($header_action) {
2753 $this->addHeaderAction();
2754 }
2755
2756 return true;
2757 }
2758
2765 private function checkAgreement()
2766 {
2767 global $DIC;
2768
2769 $ilUser = $DIC['ilUser'];
2770 $ilAccess = $DIC['ilAccess'];
2771
2772 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2773 return true;
2774 }
2775
2776 // Disable aggrement if is not member of course
2777 if (!$this->object->getMemberObject()->isAssigned()) {
2778 return true;
2779 }
2780
2781 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
2782 if (ilMemberViewSettings::getInstance()->isActive()) {
2783 return true;
2784 }
2785
2786 include_once('Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
2787 include_once('Services/Membership/classes/class.ilMemberAgreement.php');
2789
2790 // Check agreement
2791 if (($privacy->courseConfirmationRequired() or ilCourseDefinedFieldDefinition::_hasFields($this->object->getId()))
2792 and !ilMemberAgreement::_hasAccepted($ilUser->getId(), $this->object->getId())) {
2793 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Missing course confirmation.');
2794 return false;
2795 }
2796 // Check required fields
2797 include_once('Modules/Course/classes/Export/class.ilCourseUserData.php');
2798 if (!ilCourseUserData::_checkRequired($ilUser->getId(), $this->object->getId())) {
2799 $GLOBALS['DIC']['ilLog']->write(__METHOD__ . ': Missing required fields');
2800 return false;
2801 }
2802 return true;
2803 }
2804
2805 // STATIC
2806 public static function _forwards()
2807 {
2808 return array("ilCourseRegisterGUI",'ilConditionHandlerGUI');
2809 }
2810
2811 public function addLocatorItems()
2812 {
2813 global $DIC;
2814
2815 $ilLocator = $DIC['ilLocator'];
2816 switch ($this->ctrl->getCmd()) {
2817 default:
2818 #$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""));
2819 break;
2820 }
2821 }
2822
2826 protected function membersObject()
2827 {
2828 $GLOBALS['DIC']['ilCtrl']->redirectByClass('ilcoursemembershipgui');
2829 }
2830
2834 public static function _goto($a_target, $a_add = "")
2835 {
2836 global $DIC;
2837
2838 $ilAccess = $DIC['ilAccess'];
2839 $ilErr = $DIC['ilErr'];
2840 $lng = $DIC['lng'];
2841 $ilUser = $DIC['ilUser'];
2842
2843 include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php';
2844 if (substr($a_add, 0, 5) == 'rcode') {
2845 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
2846 // Redirect to login for anonymous
2848 "login.php?target=" . $_GET["target"] . "&cmd=force_login&lang=" .
2849 $ilUser->getCurrentLanguage()
2850 );
2851 }
2852
2853 // Redirects to target location after assigning user to course
2855 $a_target,
2857 substr($a_add, 5)
2858 );
2859 }
2860
2861 if ($a_add == "mem" && $ilAccess->checkAccess("manage_members", "", $a_target)) {
2862 ilObjectGUI::_gotoRepositoryNode($a_target, "members");
2863 }
2864
2865 if ($a_add == "comp" && ilContSkillPresentationGUI::isAccessible($a_target)) {
2866 ilObjectGUI::_gotoRepositoryNode($a_target, "competences");
2867 }
2868
2869 if ($ilAccess->checkAccess("read", "", $a_target)) {
2871 } else {
2872 // to do: force flat view
2873 if ($ilAccess->checkAccess("visible", "", $a_target)) {
2874 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreenGoto");
2875 } else {
2876 if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
2877 ilUtil::sendFailure(sprintf(
2878 $lng->txt("msg_no_perm_read_item"),
2880 ), true);
2882 }
2883 }
2884 }
2885 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
2886 }
2887
2888
2892 public function editMapSettingsObject()
2893 {
2894 global $DIC;
2895
2896 $ilUser = $DIC['ilUser'];
2897 $ilCtrl = $DIC['ilCtrl'];
2898 $ilUser = $DIC['ilUser'];
2899 $ilAccess = $DIC['ilAccess'];
2900
2901 $this->setSubTabs("properties");
2902 $this->tabs_gui->activateTab('settings');
2903 $this->tabs_gui->activateSubTab('crs_map_settings');
2904
2905 if (!ilMapUtil::isActivated() ||
2906 !$ilAccess->checkAccess("write", "", $this->object->getRefId())) {
2907 return;
2908 }
2909
2910 $latitude = $this->object->getLatitude();
2911 $longitude = $this->object->getLongitude();
2912 $zoom = $this->object->getLocationZoom();
2913
2914 // Get Default settings, when nothing is set
2915 if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
2917 $latitude = $def["latitude"];
2918 $longitude = $def["longitude"];
2919 $zoom = $def["zoom"];
2920 }
2921
2922 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
2923 $form = new ilPropertyFormGUI();
2924 $form->setFormAction($ilCtrl->getFormAction($this));
2925
2926 $form->setTitle($this->lng->txt("crs_map_settings"));
2927
2928 // enable map
2929 $public = new ilCheckboxInputGUI(
2930 $this->lng->txt("crs_enable_map"),
2931 "enable_map"
2932 );
2933 $public->setValue("1");
2934 $public->setChecked($this->object->getEnableCourseMap());
2935 $form->addItem($public);
2936
2937 // map location
2938 $loc_prop = new ilLocationInputGUI(
2939 $this->lng->txt("crs_map_location"),
2940 "location"
2941 );
2942 $loc_prop->setLatitude($latitude);
2943 $loc_prop->setLongitude($longitude);
2944 $loc_prop->setZoom($zoom);
2945 $form->addItem($loc_prop);
2946
2947 $form->addCommandButton("saveMapSettings", $this->lng->txt("save"));
2948
2949 $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
2950 //$this->tpl->show();
2951 }
2952
2953 public function saveMapSettingsObject()
2954 {
2955 global $DIC;
2956
2957 $ilCtrl = $DIC['ilCtrl'];
2958 $ilUser = $DIC['ilUser'];
2959
2960 $this->object->setLatitude(ilUtil::stripSlashes($_POST["location"]["latitude"]));
2961 $this->object->setLongitude(ilUtil::stripSlashes($_POST["location"]["longitude"]));
2962 $this->object->setLocationZoom(ilUtil::stripSlashes($_POST["location"]["zoom"]));
2963 $this->object->setEnableCourseMap(ilUtil::stripSlashes($_POST["enable_map"]));
2964 $this->object->update();
2965
2966 $ilCtrl->redirect($this, "editMapSettings");
2967 }
2968
2969
2977 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
2978 {
2980 $a_item_list_gui,
2981 'ilcoursecontentgui',
2982 $a_item_data,
2983 $a_show_path,
2984 $this->object->getAboStatus(),
2985 $this->object->getRefId(),
2986 $this->object->getId()
2987 );
2988 }
2989
2993 public static function _modifyItemGUI(
2994 $a_item_list_gui,
2995 $a_cmd_class,
2996 $a_item_data,
2997 $a_show_path,
2998 $a_abo_status,
2999 $a_course_ref_id,
3000 $a_course_obj_id,
3001 $a_parent_ref_id = 0
3002 ) {
3003 global $DIC;
3004
3005 $lng = $DIC['lng'];
3006 $ilAccess = $DIC['ilAccess'];
3007
3008 // this is set for folders within the course
3009 if ($a_parent_ref_id == 0) {
3010 $a_parent_ref_id = $a_course_ref_id;
3011 }
3012
3013 // Special handling for tests in courses with learning objectives
3014 if ($a_item_data['type'] == 'tst' and
3016 $a_item_list_gui->addCommandLinkParameter(array('crs_show_result' => $a_course_ref_id));
3017 }
3018
3019 $a_item_list_gui->enableSubscribe($a_abo_status);
3020
3021 $is_tutor = ($ilAccess->checkAccess(
3022 'write',
3023 '',
3024 $a_course_ref_id,
3025 'crs',
3026 $a_course_obj_id
3027 ));
3028
3029 if ($a_show_path and $is_tutor) {
3030 $a_item_list_gui->addCustomProperty(
3031 $lng->txt('path'),
3032 ilContainer::_buildPath($a_item_data['ref_id'], $a_course_ref_id),
3033 false,
3034 true
3035 );
3036 }
3037 }
3038
3042 public function setContentSubTabs()
3043 {
3044 global $DIC;
3045
3046 $ilAccess = $DIC['ilAccess'];
3047 $lng = $DIC['lng'];
3048 $ilCtrl = $DIC['ilCtrl'];
3049
3050 if ($this->object->getType() != 'crs') {
3051 return true;
3052 }
3053 if (!$ilAccess->checkAccess(
3054 'write',
3055 '',
3056 $this->object->getRefId(),
3057 'crs',
3058 $this->object->getId()
3059 )) {
3060 $is_tutor = false;
3061 // No further tabs if objective view or archives
3062 if ($this->object->enabledObjectiveView()) {
3063 return false;
3064 }
3065 } else {
3066 $is_tutor = true;
3067 }
3068
3069 // These subtabs should also work, if the command is called directly in
3070 // ilObjCourseGUI, so please use ...ByClass methods.
3071 // (see ilObjCourseGUI->executeCommand: case "ilcolumngui")
3072
3073 if (!$_SESSION['crs_timings_panel'][$this->object->getId()] or 1) {
3074 if (!$this->isActiveAdministrationPanel()) {
3075 $this->tabs_gui->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass("ilobjcoursegui", "view"));
3076 } else {
3077 $this->tabs_gui->addSubTab("view_content", $lng->txt("view"), $ilCtrl->getLinkTargetByClass("ilobjcoursegui", "disableAdministrationPanel"));
3078 }
3079 }
3080 // cognos-blu-patch: begin
3081 // cognos-blu-patch: begin
3082
3083 $this->addStandardContainerSubTabs(false);
3084
3085
3086 return true;
3087 }
3088
3096 protected function loadDate($a_field)
3097 {
3098 global $DIC;
3099
3100 $ilUser = $DIC['ilUser'];
3101
3102 include_once('./Services/Calendar/classes/class.ilDateTime.php');
3103
3104 // #10206 / #10217
3105 if (is_array($_POST[$a_field]['date'])) {
3106 $dt['year'] = (int) $_POST[$a_field]['date']['y'];
3107 $dt['mon'] = (int) $_POST[$a_field]['date']['m'];
3108 $dt['mday'] = (int) $_POST[$a_field]['date']['d'];
3109 $dt['hours'] = (int) $_POST[$a_field]['time']['h'];
3110 $dt['minutes'] = (int) $_POST[$a_field]['time']['m'];
3111 $dt['seconds'] = (int) $_POST[$a_field]['time']['s'];
3112 } else {
3113 $date = date_parse($_POST[$a_field]['date'] . " " . $_POST[$a_field]['time']);
3114 $dt['year'] = (int) $date['year'];
3115 $dt['mon'] = (int) $date['month'];
3116 $dt['mday'] = (int) $date['day'];
3117 $dt['hours'] = (int) $date['hour'];
3118 $dt['minutes'] = (int) $date['minute'];
3119 $dt['seconds'] = (int) $date['second'];
3120 }
3121
3122 $date = new ilDateTime($dt, IL_CAL_FKT_GETDATE, $ilUser->getTimeZone());
3123 return $date;
3124 }
3125
3133 public function askResetObject()
3134 {
3135 ilUtil::sendQuestion($this->lng->txt('crs_objectives_reset_sure'));
3136
3137 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
3138 $confirm = new ilConfirmationGUI();
3139 $confirm->setFormAction($this->ctrl->getFormAction($this));
3140 $confirm->setConfirm($this->lng->txt('reset'), 'reset');
3141 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
3142
3143 $GLOBALS['DIC']['tpl']->setContent($confirm->getHTML());
3144 return true;
3145 }
3146
3147 public function resetObject()
3148 {
3149 global $DIC;
3150
3151 $ilUser = $DIC['ilUser'];
3152
3153 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
3154 $usr_results = new ilLOUserResults($this->object->getId(), $GLOBALS['DIC']['ilUser']->getId());
3155 $usr_results->delete();
3156
3157
3158 include_once './Modules/Course/classes/Objectives/class.ilLOTestRun.php';
3159 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
3161 $this->object->getId(),
3162 $GLOBALS['DIC']['ilUser']->getId()
3163 );
3164
3165 include_once './Modules/Course/classes/class.ilCourseObjectiveResult.php';
3166
3167 $tmp_obj_res = new ilCourseObjectiveResult($ilUser->getId());
3168 $tmp_obj_res->reset($this->object->getId());
3169
3170 $ilUser->deletePref('crs_objectives_force_details_' . $this->object->getId());
3171
3172 ilUtil::sendSuccess($this->lng->txt('crs_objectives_reseted'));
3173 $this->viewObject();
3174 }
3175
3176 public function __checkStartObjects()
3177 {
3178 global $DIC;
3179
3180 $ilAccess = $DIC['ilAccess'];
3181 $ilUser = $DIC['ilUser'];
3182
3183 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
3184 return true;
3185 }
3186
3187 include_once './Services/Container/classes/class.ilContainerStartObjects.php';
3188 $this->start_obj = new ilContainerStartObjects(
3189 $this->object->getRefId(),
3190 $this->object->getId()
3191 );
3192 if (count($this->start_obj->getStartObjects()) &&
3193 !$this->start_obj->allFullfilled($ilUser->getId())) {
3194 return false;
3195 }
3196
3197 return true;
3198 }
3199
3204 public function prepareOutput($a_show_subobjects = true)
3205 {
3206 global $DIC;
3207
3208 $rbacsystem = $DIC['rbacsystem'];
3209 if (!$this->getCreationMode()) {
3210 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
3212 if ($settings->isActive() and $settings->getContainer() != $this->object->getRefId()) {
3213 $settings->setContainer($this->object->getRefId());
3214 $rbacsystem->initMemberView();
3215 }
3216 }
3217 parent::prepareOutput($a_show_subobjects);
3218 }
3219
3224 public function createMailSignature()
3225 {
3226 $link = chr(13) . chr(10) . chr(13) . chr(10);
3227 $link .= $this->lng->txt('crs_mail_permanent_link');
3228 $link .= chr(13) . chr(10) . chr(13) . chr(10);
3229 include_once './Services/Link/classes/class.ilLink.php';
3230 $link .= ilLink::_getLink($this->object->getRefId());
3231 return rawurlencode(base64_encode($link));
3232 }
3233
3234 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
3235 {
3236 global $DIC;
3237
3238 $ilUser = $DIC->user();
3239
3240 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
3241
3242 if ($lg && $this->ref_id && ilCourseParticipants::_isParticipant($this->ref_id, $ilUser->getId())) {
3243 // certificate
3244
3245 $validator = new ilCertificateDownloadValidator();
3246 if (true === $validator->isCertificateDownloadable($ilUser->getId(), $this->object->getId())) {
3247 $cert_url = $this->ctrl->getLinkTarget($this, "deliverCertificate");
3248
3249 $this->lng->loadLanguageModule("certificate");
3250 $lg->addCustomCommand($cert_url, "download_certificate");
3251
3252 $lg->addHeaderIcon(
3253 "cert_icon",
3254 ilUtil::getImagePath("icon_cert.svg"),
3255 $this->lng->txt("download_certificate"),
3256 null,
3257 null,
3258 $cert_url
3259 );
3260 }
3261
3262 // notification
3263 include_once "Services/Membership/classes/class.ilMembershipNotifications.php";
3265 $noti = new ilMembershipNotifications($this->ref_id);
3266 if (!$noti->isCurrentUserActive()) {
3267 $lg->addHeaderIcon(
3268 "not_icon",
3269 ilUtil::getImagePath("notification_off.svg"),
3270 $this->lng->txt("crs_notification_deactivated")
3271 );
3272
3273 $this->ctrl->setParameter($this, "crs_ntf", 1);
3274 $caption = "crs_activate_notification";
3275 } else {
3276 $lg->addHeaderIcon(
3277 "not_icon",
3278 ilUtil::getImagePath("notification_on.svg"),
3279 $this->lng->txt("crs_notification_activated")
3280 );
3281
3282 $this->ctrl->setParameter($this, "crs_ntf", 0);
3283 $caption = "crs_deactivate_notification";
3284 }
3285
3286 if ($noti->canCurrentUserEdit()) {
3287 $lg->addCustomCommand(
3288 $this->ctrl->getLinkTarget($this, "saveNotification"),
3289 $caption
3290 );
3291 }
3292
3293 $this->ctrl->setParameter($this, "crs_ntf", "");
3294 }
3295 }
3296
3297 return $lg;
3298 }
3299
3301 {
3302 global $DIC;
3303
3304 $ilUser = $DIC['ilUser'];
3305 $ilAccess = $DIC['ilAccess'];
3306
3307 $user_id = null;
3308 if ($ilAccess->checkAccess('manage_members', '', $this->ref_id)) {
3309 $user_id = $_REQUEST["member_id"];
3310 }
3311 if (!$user_id) {
3312 $user_id = $ilUser->getId();
3313 }
3314
3315 $objId = (int) $this->object->getId();
3316
3317 $validator = new ilCertificateDownloadValidator();
3318
3319 if (false === $validator->isCertificateDownloadable($user_id, $objId)) {
3320 ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
3321 $this->ctrl->redirect($this);
3322 }
3323
3324 $repository = new ilUserCertificateRepository();
3325
3326 $certLogger = $DIC->logger()->cert();
3327 $pdfGenerator = new ilPdfGenerator($repository, $certLogger);
3328
3329 $pdfAction = new ilCertificatePdfAction(
3330 $certLogger,
3331 $pdfGenerator,
3333 $this->lng->txt('error_creating_certificate_pdf')
3334 );
3335
3336 $pdfAction->downloadPdf((int) $user_id, $objId);
3337 }
3338
3339
3340 protected function afterSaveCallback()
3341 {
3342 $this->ctrl->redirectByClass(array('ilrepositorygui','ilobjcoursegui','illoeditorgui'), 'materials');
3343 }
3344
3345 public function saveSortingObject()
3346 {
3347 if (isset($_POST['position']["lobj"])) {
3348 $lobj = $_POST['position']["lobj"];
3349 unset($_POST['position']["lobj"]);
3350
3351 $objective_order = array();
3352 foreach ($lobj as $objective_id => $materials) {
3353 $objective_order[$objective_id] = $materials[0];
3354 unset($lobj[$objective_id][0]);
3355 }
3356
3357 // objective order
3358 include_once "Modules/Course/classes/class.ilCourseObjective.php";
3359 asort($objective_order);
3360 $pos = 0;
3361 foreach (array_keys($objective_order) as $objective_id) {
3362 $obj = new ilCourseObjective($this->object, $objective_id);
3363 $obj->writePosition(++$pos);
3364 }
3365
3366 // material order
3367 include_once "Modules/Course/classes/class.ilCourseObjectiveMaterials.php";
3368 foreach ($lobj as $objective_id => $materials) {
3369 $objmat = new ilCourseObjectiveMaterials($objective_id);
3370
3371 asort($materials);
3372 $pos = 0;
3373 foreach (array_keys($materials) as $ass_id) {
3374 $objmat->writePosition($ass_id, ++$pos);
3375 }
3376 }
3377 }
3378
3379 return parent::saveSortingObject();
3380 }
3381
3387 {
3388 include_once './Services/Link/classes/class.ilLink.php';
3389 ilUtil::redirect(ilLink::_getLink((int) $_REQUEST['tid']));
3390 return true;
3391 }
3392
3396 protected function redirectLocToTestObject($a_force_new_run = null)
3397 {
3398 $objective_id = (int) $_REQUEST['objective_id'];
3399 $test_id = (int) $_REQUEST['tid'];
3400
3401 include_once './Modules/Course/classes/Objectives/class.ilLOUserResults.php';
3402 include_once './Modules/Course/classes/Objectives/class.ilLOSettings.php';
3403 include_once './Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
3404
3405
3406 $res = new ilLOUserResults(
3407 $this->object->getId(),
3408 $GLOBALS['DIC']['ilUser']->getId()
3409 );
3410 $passed = $res->getCompletedObjectiveIds();
3411
3412 $has_completed = false;
3413 if ($objective_id) {
3414 $objective_ids = array($objective_id);
3415 if (in_array($objective_id, $passed)) {
3416 $has_completed = true;
3417 $passed = array();
3418 }
3419 } else {
3420 include_once './Modules/Course/classes/class.ilCourseObjective.php';
3421 $objective_ids = ilCourseObjective::_getObjectiveIds($this->object->getId(), true);
3422
3423 // do not disable objective question if all are passed
3424 if (count($objective_ids) == count($passed)) {
3425 $has_completed = true;
3426 $passed = array();
3427 }
3428 }
3429
3430 if ($has_completed) {
3431 // show confirmation
3432 $this->redirectLocToTestConfirmation($objective_id, $test_id);
3433 return true;
3434 }
3435
3436 include_once './Services/Link/classes/class.ilLink.php';
3438 return true;
3439 }
3440
3446 protected function redirectLocToTestConfirmation($a_objective_id, $a_test_id)
3447 {
3448 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
3449 $confirm = new ilConfirmationGUI();
3450 $confirm->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
3451
3452 if ($a_objective_id) {
3453 $question = $this->lng->txt('crs_loc_objective_passed_confirmation');
3454 } else {
3455 $question = $this->lng->txt('crs_loc_objectives_passed_confirmation');
3456 }
3457
3458 $confirm->addHiddenItem('objective_id', $a_objective_id);
3459 $confirm->addHiddenItem('tid', $a_test_id);
3460 $confirm->setConfirm($this->lng->txt('crs_loc_tst_start'), 'redirectLocToTestConfirmed');
3461 $confirm->setCancel($this->lng->txt('cancel'), 'view');
3462
3463 ilUtil::sendQuestion($question);
3464
3465 $GLOBALS['DIC']['tpl']->setContent($confirm->getHTML());
3466 return true;
3467 }
3468 // end-patch lok
3469
3476 public function getLocalRoles($a_exclude = array())
3477 {
3478 $crs_admin = $this->object->getDefaultAdminRole();
3479 $crs_member = $this->object->getDefaultMemberRole();
3480 $local_roles = $this->object->getLocalCourseRoles(false);
3481 $crs_roles = array();
3482
3483 //put the course member role to the top of the crs_roles array
3484 if (in_array($crs_member, $local_roles)) {
3485 #$crs_roles[$crs_member] = ilObjRole::_getTranslation(array_search ($crs_member, $local_roles));
3486 #unset($local_roles[$crs_roles[$crs_member]]);
3487 }
3488
3489 foreach ($local_roles as $title => $role_id) {
3490 if ($role_id == $crs_admin && !$this->hasAdminPermission()) {
3491 continue;
3492 }
3493
3494 $crs_roles[$role_id] = ilObjRole::_getTranslation($title);
3495 }
3496
3497 if (count($a_exclude) > 0) {
3498 foreach ($a_exclude as $excluded_role) {
3499 if (isset($crs_roles[$excluded_role])) {
3500 unset($crs_roles[$excluded_role]);
3501 }
3502 }
3503 }
3504 return $crs_roles;
3505 }
3506
3511 protected function hasAdminPermission()
3512 {
3513 global $DIC;
3514
3515 $ilUser = $DIC['ilUser'];
3516 return ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $ilUser->getId())->isAdmin()
3517 or $this->checkPermissionBool('edit_permission');
3518 }
3519
3520
3524 protected function jump2UsersGalleryObject()
3525 {
3526 $this->ctrl->redirectByClass('ilUsersGalleryGUI');
3527 }
3528
3532 public function setSideColumnReturn()
3533 {
3534 $this->ctrl->setReturn($this, "view");
3535 }
3536} // END class.ilObjCourseGUI
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$failed
Definition: Utf8Test.php:85
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CRS_SUBSCRIPTION_LIMITED
const IL_CRS_VIEW_SESSIONS
const IL_CRS_VIEW_TIMING_ABSOLUTE
const IL_CRS_VIEW_SIMPLE
const IL_CRS_VIEW_OBJECTIVE
const IL_CRS_VIEW_BY_TYPE
const IL_CRS_SUBSCRIPTION_PASSWORD
const IL_CRS_SUBSCRIPTION_CONFIRMATION
const IL_CRS_VIEW_TIMING
const IL_CRS_SUBSCRIPTION_UNLIMITED
const IL_CRS_SUBSCRIPTION_DEACTIVATED
const IL_CRS_SUBSCRIPTION_DIRECT
const IL_CRS_VIEW_TIMING_RELATIVE
const IL_CAL_FKT_GETDATE
const IL_CAL_UNIX
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
const IL_CRS_ADMIN
Base class for course and group participants.
static getInstance()
Constructor.
Class ilBadgeManagementGUI.
This class is used for inegration of the booking manager as a service into other repository objects,...
Validates if an active certificate is stored in the database and can be downloaded by the user.
Just a wrapper class to create Unit Test for other classes.
static _catchupWriteEvents($obj_id, $usr_id, $timestamp=null)
Catches up with all write events which occured before the specified timestamp.
static _recordWriteEvent($obj_id, $usr_id, $action, $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
Confirmation screen class.
static isAccessible($ref_id)
Is container skill presentation accessible.
Class ilContainerGUI.
afterUpdate()
Post (successful) object update hook.
& forwardToPageObject()
forward command to page object
initSortingForm(ilPropertyFormGUI $form, array $a_sorting_settings)
Append sorting settings to property form.
addStandardContainerSubTabs($a_include_view=true)
Add standar container subtabs for view, manage, oderdering and text/media editor link.
showPermanentLink()
show permanent link
saveListPresentation(ilPropertyFormGUI $form)
Save list presentation setting.
forwardToStyleSheet()
Forward to style object.
initListPresentationForm(ilPropertyFormGUI $form)
Add list presentation settings to form.
saveSortingSettings(ilPropertyFormGUI $form)
Save sorting settings.
Skills for container (course/group) (top gui class)
Class ilContainerStartObjectsGUI.
Container start objects page GUI class.
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _writeContainerSetting($a_id, $a_keyword, $a_value)
static setBlockedForLP($a_status)
Toggle LP blocking property status.
Class ilCourseContentGUI.
static _getFields($a_container_id, $a_sort=IL_CDF_SORT_NAME)
Get all fields of a container.
static _hasFields($a_container_id)
Check if there are any define fields.
static _fieldsToInfoString($a_obj_id)
Fields to info string.
static _readFilesByCourse($a_course_id)
class ilCourseObjectiveMaterials
class ilcourseobjective
static _getCountObjectives($a_obj_id, $a_activated_only=false)
get count objectives
static _getObjectiveIds($course_id, $a_activated_only=false)
class ilobjcourseobjectivesgui
static _getInstanceByObjId($a_obj_id, $a_usr_id)
Get singleton instance.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static getMemberRoles($a_ref_id)
Get member roles.
GUI class for course registrations.
static _checkRequired($a_usr_id, $a_obj_id)
Check required fields.
This class represents a custom property in a property form.
input GUI for a time span (start and end date)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
This class represents a date/time property in a property form.
@classDescription Date and time handling
isNull()
Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...)
GUI class for didactic template settings inside repository objects.
Class ilECSCourseSettings.
static _getInstanceByType($a_type)
Get Singleton Instance.
Export User Interface Class.
This class represents a file property in a property form.
static getValidFilename($a_filename)
Get valid filename.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
Class ilInfoScreenGUI.
Class ilLOEditorGUI.
static deleteRuns($a_container_id, $a_user_id)
Delete runs @global type $ilDB.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupCompletedForObject($a_obj_id, $a_user_ids=null)
Get completed users for object.
static _lookupFailedForObject($a_obj_id, $a_user_ids=null)
Get failed users for object.
static _lookupInProgressForObject($a_obj_id, $a_user_ids=null)
Get in progress users for object.
const LP_STATUS_COMPLETED
const LP_STATUS_FAILED
const LP_STATUS_NOT_ATTEMPTED
const LP_STATUS_IN_PROGRESS
GUI class for LTI provider object settings.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
static _lookupProgressByObjId($a_obj_id)
lookup progress for a specific object
This class represents a location property in a property form.
static _fillHTMLMetaTags($a_rbac_id, $a_obj_id, $a_type)
Fill html meta tags.
static getLinkTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], $context_params=[])
const CONTEXT_KEY
Session parameter for the context.
Class ilMailMemberCourseRoles.
Class ilMailMemberSearchGUI.
static isActivated()
Checks whether Map feature is activated.
static getDefaultSettings()
Get default longitude, latitude and zoom.
static _hasAccepted($a_usr_id, $a_obj_id)
Check if user has accepted agreement.
Membership notification settings.
static handleCode($a_ref_id, $a_type, $a_code)
Handle target parameter.
static generateCode()
Generate new registration key.
static getInstance($a_ref_id, $a_include_auto_entries)
Get instance.
This class represents a number property in a property form.
static lookupRegistrationInfo($a_obj_id)
Lookup registration info @global ilDB $ilDB @global ilObjUser $ilUser @global ilLanguage $lng.
Class ilObjCourseGUI.
checkAgreement()
Check agreement and redirect if it is not accepted.
setContentSubTabs()
Set content sub tabs.
afterSave(ilObject $a_new_object)
save object @access public
membersObject()
Called from goto?
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add file manager link.
hasAdminPermission()
user has admin permission or "edit permission" permission on this course
executeCommand()
execute command note: this method is overwritten in all container objects
updateLPFromStatus($a_member_id, $a_has_passed)
sync course status and lp status
saveNotificationObject()
:TEMP: Save notification setting (from infoscreen)
afterImport(ilObject $a_new_object)
add course admin after import file
initInfoEditor()
init info editor
editMapSettingsObject()
Edit Map Settings.
static _goto($a_target, $a_add="")
goto target course
setSubTabs($a_tab)
set sub tabs
editInfoObject(ilPropertyFormGUI $a_form=null)
Edit info page informations.
readMemberData($ids, $selected_columns=null, bool $skip_names=false)
addContentTab()
Add content tab.
getLocalRoles($a_exclude=array())
createMailSignature()
Create a course mail signature.
static _modifyItemGUI( $a_item_list_gui, $a_cmd_class, $a_item_data, $a_show_path, $a_abo_status, $a_course_ref_id, $a_course_obj_id, $a_parent_ref_id=0)
We need a static version of this, e.g.
saveSortingObject()
Save Sorting.
__construct()
Constructor @access public.
setSideColumnReturn()
Set return point for side column actions.
redirectLocToTestObject($a_force_new_run=null)
Test redirection will be moved lo adapter.
loadDate($a_field)
load date
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
updateObject()
Update course settings @global type $ilUser.
askResetObject()
ask reset test results
getAgreementTabs()
Get tabs for member agreement.
infoScreen()
Show info screen.
setShowHidePrefs()
set preferences (show/hide tabel content)
unsubscribeObject()
DEPRECATED?
confirmDeleteInfoFilesObject()
show info file donfimation table
editObject(ilPropertyFormGUI $form=null)
edit object
viewObject()
viewObject container presentation for "administration -> repository, trash, permissions"
deleteInfoFilesObject()
Delete info files.
redirectLocToTestConfirmation($a_objective_id, $a_test_id)
Show confirmation whether user wants to start a new run or resume a previous run.
showPossibleSubObjects()
show possible sub objects selection list
renderObject()
render the object
prepareOutput($a_show_subobjects=true)
Handle member view.
getEditFormValues()
Get values for edit form.
Class ilObjCourseGroupingGUI.
static _lookupViewMode($a_id)
lookup view mode of container
const STATUS_DETERMINATION_MANUAL
static _registrationEnabled($a_obj_id)
Registration enabled? Method is in Access class, since it is needed by Access/ListGUI.
const STATUS_DETERMINATION_LP
static _isActivated($a_obj_id)
Is activated.
static getAvailablePortfolioLinksForUserIds(array $a_owner_ids, $a_back_url=null)
static _getTranslation($a_role_title)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static _lookupName($a_user_id)
lookup user name
Render add new item selector.
GUI class for the workflow of copying objects.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
getFormAction($a_cmd, $a_formaction="")
get form action for command (command is method name without "Object", e.g.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
getReturnLocation($a_cmd, $a_location="")
get return location for command (command is method name without "Object", e.g.
editObject()
edit object
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getCreationMode()
get creation mode
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
addHeaderAction()
Add header action menu.
getObjectService()
Get object service.
static getInstance($a_obj_id)
Class ilObjectMetaDataGUI.
GUI class for service settings (calendar, notes, comments)
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
GUI class for object translation handling.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
update()
update object in db
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static _isParticipant($a_ref_id, $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.
static _getInstance()
Get instance of ilPrivacySettings.
This class represents a property form user interface.
GUI class for public user profile presentation.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
This class represents a text property in a property form.
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
$c
Definition: cli.php:37
const ANONYMOUS_USER_ID
Definition: constants.php:25
const ROOT_FOLDER_ID
Definition: constants.php:30
$txt
Definition: error.php:13
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
language()
Definition: language.php:2
if($format !==null) $name
Definition: metadata.php:230
if( $orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:285
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Class ilPdfGeneratorConstantsTest.
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
global $ilSetting
Definition: privfeed.php:17
$service
Definition: result.php:17
foreach($_POST as $key=> $value) $res
$objId
Definition: xapitoken.php:39
$rows
Definition: xhr_table.php:10