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