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