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