ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjSessionGUI.php
Go to the documentation of this file.
1<?php
2
20
21include_once('./Services/Object/classes/class.ilObjectGUI.php');
22include_once('./Modules/Session/classes/class.ilObjSession.php');
23include_once('./Modules/Session/classes/class.ilSessionFile.php');
24
38{
42 protected $logger = null;
46 protected $http;
47
48 public $lng;
49 public $ctrl;
50 public $tpl;
51
52 protected $container_ref_id = 0;
53 protected $container_obj_id = 0;
54
55 protected $files = array();
56
64 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
65 {
66 global $DIC;
67
68 $ilCtrl = $DIC['ilCtrl'];
69 $lng = $DIC['lng'];
70 $tpl = $DIC['tpl'];
71
72 $this->type = "sess";
73 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
74
75 $this->lng = $lng;
76 $this->lng->loadLanguageModule("event");
77 $this->lng->loadLanguageModule('crs');
78 $this->lng->loadLanguageModule('trac');
79 $this->lng->loadLanguageModule('sess');
80
81 $this->tpl = $tpl;
82 $this->ctrl = $ilCtrl;
83
84 $this->http = $DIC->http();
85 $this->logger = $DIC->logger()->sess();
86 $this->ui = $DIC->ui();
87 }
88
89
96 public function executeCommand()
97 {
98 global $DIC;
99
100 $ilUser = $DIC['ilUser'];
101 $ilCtrl = $DIC['ilCtrl'];
102
103 $next_class = $this->ctrl->getNextClass($this);
104 $cmd = $this->ctrl->getCmd();
105
106 if (
107 !$this->getCreationMode() &&
108 $GLOBALS['DIC']->access()->checkAccess('read', '', $_GET['ref_id'])
109 ) {
110 $GLOBALS['DIC']['ilNavigationHistory']->addItem(
111 (int) $_GET['ref_id'],
112 ilLink::_getLink((int) $_GET['ref_id'], 'sess'),
113 'sess'
114 );
115 }
116
117 $this->prepareOutput();
118 switch ($next_class) {
119 case 'ilsessionmembershipgui':
120 $this->tabs_gui->activateTab('members');
121 include_once './Modules/Session/classes/class.ilSessionMembershipGUI.php';
122 $mem_gui = new ilSessionMembershipGUI($this, $this->object);
123 $this->ctrl->forwardCommand($mem_gui);
124 break;
125
126 case "ilinfoscreengui":
127 $this->checkPermission("visible");
128 $this->infoScreen(); // forwards command
129 break;
130
131 case 'ilobjectmetadatagui':
132 $this->checkPermission('edit_metadata');
133 $this->tabs_gui->activateTab('metadata');
134 $md_gui = new ilObjectMetaDataGUI($this->object);
135 $this->ctrl->forwardCommand($md_gui);
136 break;
137
138
139 case 'ilpermissiongui':
140 $this->tabs_gui->setTabActive('perm_settings');
141 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
142 $perm_gui = new ilPermissionGUI($this);
143 $ret = $this->ctrl->forwardCommand($perm_gui);
144 break;
145
146 case 'ilobjectcopygui':
147 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
148 $cp = new ilObjectCopyGUI($this);
149 $cp->setType('sess');
150 $this->ctrl->forwardCommand($cp);
151 break;
152
153 case "ilexportgui":
154// $this->prepareOutput();
155 $this->tabs_gui->setTabActive("export");
156 include_once("./Services/Export/classes/class.ilExportGUI.php");
157 $exp_gui = new ilExportGUI($this);
158 $exp_gui->addFormat("xml");
159 $ret = $this->ctrl->forwardCommand($exp_gui);
160// $this->tpl->show();
161 break;
162
163 case "ilcommonactiondispatchergui":
164 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
166 $this->ctrl->forwardCommand($gui);
167 break;
168
169 case 'ilmembershipgui':
170 $this->ctrl->setReturn($this, 'members');
171 include_once './Services/Membership/classes/class.ilMembershipMailGUI.php';
172 $mem = new ilMembershipMailGUI($this);
173 $this->ctrl->forwardCommand($mem);
174 break;
175
176 case "illearningprogressgui":
177 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
178 $new_gui = new ilLearningProgressGUI(
180 $this->object->getRefId(),
181 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
182 );
183 $this->ctrl->forwardCommand($new_gui);
184 $this->tabs_gui->setTabActive('learning_progress');
185 break;
186
187 case "ilpropertyformgui":
188 // only case is currently adv metadata internal link in info settings, see #24497
189 if (!is_object($this->object)) {
190 $form = $this->initCreateForm("sess");
191 } else {
192 $form = $this->initForm("edit");
193 }
194 $ilCtrl->forwardCommand($form);
195 break;
196
197 case "ilbookinggatewaygui":
198 $tree = $DIC['tree'];
199 $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
200
201 $this->tabs_gui->activateTab('obj_tool_setting_booking');
202 $gui = new ilBookingGatewayGUI($this, $parent_id);
203 $this->ctrl->forwardCommand($gui);
204 break;
205
206 default:
207 if ($cmd == "applyFilter") {
208 $cmd == "applyFilter";
209 $this->$cmd();
210 } elseif ($cmd == "resetFilter") {
211 $cmd == "resetFilter";
212 $this->$cmd();
213 }
214 if (!$cmd) {
215 $cmd = "infoScreen";
216 }
217 $cmd .= "Object";
218 $this->$cmd();
219
220 break;
221 }
222
223 $this->addHeaderAction();
224
225 return true;
226 }
227
228
232 protected function membersObject()
233 {
234 $this->ctrl->redirectByClass('ilSessionMembershipGUI', 'participants');
235 }
236
241 public function getCurrentObject()
242 {
243 return $this->object;
244 }
245
249 public function prepareOutput($a_show_subobjects = true)
250 {
251 parent::prepareOutput($a_show_subobjects);
252
253 if (!$this->getCreationMode()) {
254 $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
255
256 include_once './Modules/Session/classes/class.ilSessionAppointment.php';
257 $this->tpl->setTitle(
258 $this->object->getFirstAppointment()->appointmentToString() . $title
259 );
260 }
261 }
262
270 public function registerObject()
271 {
272 global $DIC;
273
274 $ilUser = $DIC->user();
275 $ilAppEventHandler = $DIC['ilAppEventHandler'];
276
277 $this->checkPermission('visible');
278
279 include_once './Services/Membership/classes/class.ilParticipants.php';
280 $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
281
282 include_once './Modules/Session/classes/class.ilEventParticipants.php';
283 $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
284 $event_part->updateExcusedForUser($ilUser->getId(), false);
285
286 if (
287 $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
288 $this->getCurrentObject()->getRegistrationMaxUsers() and
289 (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
290 ) {
291 if (!$this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
292 ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded'), true);
293 $this->ctrl->redirect($this, 'infoScreen');
294 }
295 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
296 $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
297 $wait->addToList($ilUser->getId());
298 ilUtil::sendInfo($this->lng->txt('sess_reg_added_to_wl'), true);
299 $this->ctrl->redirect($this, 'infoScreen');
300 return true;
301 }
302
303
304 switch ($this->getCurrentObject()->getRegistrationType()) {
306 $this->ctrl->redirect($this, 'info');
307 break;
308
310 $part->register($ilUser->getId());
311 ilUtil::sendSuccess($this->lng->txt('event_registered'), true);
312
313 $ilAppEventHandler->raise(
314 "Modules/Session",
315 'enter',
316 array(
317 'obj_id' => $this->getCurrentObject()->getId(),
318 'ref_id' => $this->getCurrentObject()->getRefId(),
319 'usr_id' => $ilUser->getId()
320 )
321 );
322
323 $this->ctrl->redirect($this, 'infoScreen');
324 break;
325
327 ilUtil::sendSuccess($this->lng->txt('sess_registered_confirm'), true);
328 $part->addSubscriber($ilUser->getId());
329
330 $ilAppEventHandler->raise(
331 "Modules/Session",
332 'register',
333 array(
334 'obj_id' => $this->getCurrentObject()->getId(),
335 'ref_id' => $this->getCurrentObject()->getRefId(),
336 'usr_id' => $ilUser->getId()
337 )
338 );
339
340 $this->ctrl->redirect($this, 'infoScreen');
341 break;
342 }
343 }
344
349 public function joinObject()
350 {
351 global $DIC;
352
353 $ilUser = $DIC['ilUser'];
354
355 $this->checkPermission('read');
356
357 if ($ilUser->isAnonymous()) {
358 $this->ctrl->redirect($this, 'infoScreen');
359 }
360
361 include_once './Modules/Session/classes/class.ilEventParticipants.php';
362
363 if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) {
364 $_SESSION['sess_hide_info'] = true;
365 ilEventParticipants::_unregister($ilUser->getId(), $this->object->getId());
366 ilUtil::sendSuccess($this->lng->txt('event_unregistered'), true);
367 } else {
368 ilEventParticipants::_register($ilUser->getId(), $this->object->getId());
369 ilUtil::sendSuccess($this->lng->txt('event_registered'), true);
370 }
371
372 $this->ctrl->redirect($this, 'infoScreen');
373 }
374
382 public function unregisterObject($a_refuse_participation = false)
383 {
384 global $DIC;
385
386 $ilUser = $DIC->user();
387 $ilAppEventHandler = $DIC['ilAppEventHandler'];
388
389 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
390 $part = ilSessionParticipants::getInstance($this->object->getRefId());
391 if ($part->isSubscriber($ilUser->getId())) {
392 $part->deleteSubscriber($ilUser->getId());
393 }
394
395 $part->unregister($ilUser->getId());
396
397 if ($a_refuse_participation) {
398 $event_part = new \ilEventParticipants($this->object->getId());
399 $event_part->updateExcusedForUser($ilUser->getId(), true);
400 }
401
402
403 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
404 ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
405
406 // check for visible permission of user
408 $GLOBALS['DIC']->access()->clear();
409 $has_access = $GLOBALS['DIC']->access()->checkAccessOfUser(
410 $GLOBALS['DIC']->user()->getId(),
411 'visible',
412 '',
413 $this->object->getRefId()
414 );
415 if (!$has_access) {
416 $parent = $GLOBALS['DIC']->repositoryTree()->getParentId($this->object->getRefId());
417 $this->redirectToRefId($parent);
418 return;
419 }
420
421 $ilAppEventHandler->raise(
422 "Modules/Session",
423 'unregister',
424 array(
425 'obj_id' => $this->getCurrentObject()->getId(),
426 'ref_id' => $this->getCurrentObject()->getRefId(),
427 'usr_id' => $ilUser->getId()
428 )
429 );
430 if ($a_refuse_participation) {
431 \ilUtil::sendInfo($this->lng->txt('sess_participation_refused_info'), true);
432 } else {
433 ilUtil::sendSuccess($this->lng->txt('event_unregistered'), true);
434 }
435 $this->ctrl->returnToParent($this);
436 }
437
446 public static function _goto($a_target)
447 {
448 global $DIC;
449
450 $ilAccess = $DIC->access();
451 $ilErr = $DIC["ilErr"];
452 $lng = $DIC->language();
453
454 $ilCtrl = $DIC->ctrl();
455 $parts = explode('_', $a_target);
456 $a_target = $parts[0];
457
458 if ($ilAccess->checkAccess('write', '', $a_target)) {
459 if (isset($parts[1]) && 'part' === $parts[1]) {
460 $ilCtrl->initBaseClass('ilRepositoryGUI');
461 $ilCtrl->setParameterByClass('ilSessionMembershipGUI', 'ref_id', (int) $a_target);
462 $ilCtrl->setTargetScript('ilias.php');
463 $ilCtrl->redirectByClass(array('ilRepositoryGUI', __CLASS__, 'ilSessionMembershipGUI'));
464 }
465 }
466
467 if ($ilAccess->checkAccess('visible', "", $a_target)) {
468 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
469 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
471 sprintf(
472 $lng->txt("msg_no_perm_read_item"),
474 ),
475 true
476 );
478 }
479 }
480
481
482
488 public function infoScreenObject()
489 {
490 $this->ctrl->setCmd("showSummary");
491 $this->ctrl->setCmdClass("ilinfoscreengui");
492 $this->infoScreen();
493 }
494
502 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
503 {
504 global $DIC;
505
506 $tree = $DIC['tree'];
507
508 // if folder is in a course, modify item list gui according to course requirements
509 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
510 // #10611
511 include_once "Services/Object/classes/class.ilObjectActivation.php";
512 ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
513
514 include_once("./Modules/Course/classes/class.ilObjCourse.php");
515 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
516 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
518 $a_item_list_gui,
519 get_class($this),
520 $a_item_data,
521 $a_show_path,
522 ilObjCourse::_lookupAboStatus($course_obj_id),
523 $course_ref_id,
524 $course_obj_id,
525 $this->object->getRefId()
526 );
527 }
528 }
529
535 public function showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar)
536 {
537 $this->showJoinRequestButton($a_ilToolbar);
538 }
539
540
544 protected function refuseParticipationObject()
545 {
546 return $this->unregisterObject(true);
547 }
548
553 protected function showJoinRequestButton(ilToolbarGUI $ilToolbar = null)
554 {
555 global $DIC;
556
557 $ilUser = $DIC['ilUser'];
558
559 if (!$ilToolbar) {
560 global $DIC;
561
562 $ilToolbar = $DIC['ilToolbar'];
563 }
564
565 if (!$this->getCurrentObject()->enabledRegistrationForUsers() || $ilUser->isAnonymous()) {
566 return false;
567 }
568
569 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
570
571 include_once './Services/Membership/classes/class.ilParticipants.php';
572 $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
573
574 include_once './Modules/Session/classes/class.ilEventParticipants.php';
575
576 $this->ctrl->setParameter($this, "ref_id", $this->getCurrentObject()->getRefId());
577
578 $btn_excused = null;
579 if ($this->object->isCannotParticipateOptionEnabled()) {
580 $btn_excused = $this->ui->factory()->button()->standard(
581 $this->lng->txt('sess_bt_refuse'),
582 $this->ctrl->getLinkTarget($this, 'refuseParticipation')
583 );
584 }
585
586
587 if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId())) {
588 if (!is_null($btn_excused)) {
589 $ilToolbar->addComponent($btn_excused);
590 }
591 return true;
592 } elseif ($part->isSubscriber($ilUser->getId())) {
593 if (!is_null($btn_excused)) {
594 $ilToolbar->addComponent($btn_excused);
595 }
596 return true;
597 } elseif (ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId())) {
598 if (!is_null($btn_excused)) {
599 $ilToolbar->addComponent($btn_excused);
600 }
601 return true;
602 }
603
604 $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
605
606 if (
607 $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
608 $this->getCurrentObject()->getRegistrationMaxUsers() and
609 (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
610 ) {
611 if ($this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
612 ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded_wl'));
613 $btn_attend = $this->ui->factory()->button()->primary(
614 $this->lng->txt("mem_add_to_wl"),
615 $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
616 );
617 $ilToolbar->addComponent($btn_attend);
618 if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
619 $ilToolbar->addComponent($btn_excused);
620 }
621 return true;
622 } else {
623 ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded'));
624 return true;
625 }
626 } else {
627 if (!isset($_SESSION['sess_hide_info'])) {
628 ilUtil::sendInfo($this->lng->txt('sess_join_info'));
629 $btn_attend = $this->ui->factory()->button()->primary(
630 $this->lng->txt("join_session"),
631 $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register")
632 );
633 $ilToolbar->addComponent($btn_attend);
634 if (!$event_part->isExcused($ilUser->getId()) && !is_null($btn_excused)) {
635 $ilToolbar->addComponent($btn_excused);
636 }
637 return true;
638 }
639 }
640 }
641
642
643
651 public function infoScreen()
652 {
653 global $DIC;
654
655 $ilAccess = $DIC['ilAccess'];
656 $ilUser = $DIC['ilUser'];
657 $ilCtrl = $DIC['ilCtrl'];
658 $tree = $DIC['tree'];
659 $ilToolbar = $DIC['ilToolbar'];
660 $lng = $DIC['lng'];
661
662 $this->checkPermission('visible');
663 $this->tabs_gui->setTabActive('info_short');
664
665 $this->showJoinRequestButton();
666
667 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
668 $info = new ilInfoScreenGUI($this);
669 $info->enableBookingInfo(true);
670
671 $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
672 $parent_id = $tree->getParentId($this->object->getRefId());
673 $parent_id = ilObject::_lookupObjId($parent_id);
674 $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems(
675 'sess',
676 $this->object->getId(),
677 $eventItems
678 );
679
680 $lng->loadLanguageModule("cntr");// #14158
681
682 $html = '';
683 foreach ($eventItems as $item) {
684 $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
685 $list_gui->setContainerObject($this);
686
687 $this->modifyItemGUI($list_gui, $item, false);
688
689 $html .= $list_gui->getListItemHTML(
690 $item['ref_id'],
691 $item['obj_id'],
692 $item['title'],
693 $item['description']
694 );
695 }
696
697 if (strlen($html)) {
698 $info->addSection($this->lng->txt('event_materials'));
699 $info->addProperty(
700 '&nbsp;',
701 $html
702 );
703 }
704
705
706
707 // Session information
708 if (strlen($this->object->getLocation()) or strlen($this->object->getDetails())) {
709 $info->addSection($this->lng->txt('event_section_information'));
710 }
711 if (strlen($location = $this->object->getLocation())) {
712 $info->addProperty(
713 $this->lng->txt('event_location'),
714 ilUtil::makeClickable(nl2br($this->object->getLocation()), true)
715 );
716 }
717 if (strlen($this->object->getDetails())) {
718 $info->addProperty(
719 $this->lng->txt('event_details_workflow'),
720 ilUtil::makeClickable(nl2br($this->object->getDetails()), true)
721 );
722 }
723
724 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'sess', $this->object->getId());
725 $record_gui->setInfoObject($info);
726 $record_gui->parse();
727
728 // meta data
729 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
730
731
732 // Tutor information
733 if ($this->object->hasTutorSettings()) {
734 $info->addSection($this->lng->txt('event_tutor_data'));
735 if (strlen($fullname = $this->object->getName())) {
736 $info->addProperty(
737 $this->lng->txt('event_lecturer'),
738 $fullname
739 );
740 }
741 if (strlen($email = $this->object->getEmail())) {
742 $info->addProperty(
743 $this->lng->txt('tutor_email'),
744 $email
745 );
746 }
747 if (strlen($phone = $this->object->getPhone())) {
748 $info->addProperty(
749 $this->lng->txt('tutor_phone'),
750 $phone
751 );
752 }
753 }
754
755 // support contacts
756 $parts = ilParticipants::getInstance($this->object->getRefId());
757 $contacts = $parts->getContacts();
758 if (count($contacts) > 0) {
759 $info->addSection($this->lng->txt("crs_mem_contacts"));
760 foreach ($contacts as $contact) {
761 $pgui = new ilPublicUserProfileGUI($contact);
762 $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
763 $pgui->setEmbedded(true);
764 $info->addProperty("", $pgui->getHTML());
765 }
766 }
767
768 // forward the command
769 $this->ctrl->forwardCommand($info);
770
771 // store read event
772 require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
774 $this->object->getType(),
775 $this->object->getRefId(),
776 $this->object->getId(),
777 $ilUser->getId()
778 );
779 }
780
786 public function sendFileObject()
787 {
788 $file = new ilSessionFile((int) $_GET['file_id']);
789
790 ilUtil::deliverFile($file->getAbsolutePath(), $file->getFileName(), $file->getFileType());
791 return true;
792 }
793
794 protected function initCreateForm($a_new_type)
795 {
796 if (!is_object($this->object)) {
797 $this->object = new ilObjSession();
798 }
799 return $this->initForm('create');
800 }
801
808 {
809 $this->saveObject(false);
810
811 $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId());
812 $this->ctrl->setParameter($this, 'new_type', '');
813 $this->ctrl->redirect($this, 'materials');
814 }
815
823 public function saveObject($a_redirect_on_success = true)
824 {
825 global $DIC;
826
827 $ilErr = $DIC['ilErr'];
828 $ilUser = $DIC['ilUser'];
829
830 $this->object = new ilObjSession();
831
832 $this->ctrl->saveParameter($this, "new_type");
833
834 $form = $this->initForm('create');
835 $ilErr->setMessage('');
836 if (!$form->checkInput()) {
837 $form->setValuesByPost();
838 $ilErr->setMessage($this->lng->txt('err_check_input'));
839 $this->createObject($form);
840 return false;
841 }
842
843 if (
844 $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
845 !$this->record_gui->importEditFormPostValues()
846 ) {
847 $ilErr->setMessage($this->lng->txt('err_check_input'));
848 }
849
850 $this->load();
851 $this->loadRecurrenceSettings();
852
853 $this->object->validate();
854 $this->object->getFirstAppointment()->validate();
855
856 if (strlen($ilErr->getMessage())) {
857 ilUtil::sendFailure($ilErr->getMessage());
858 $this->form->setValuesByPost();
859 $this->createObject();
860 return false;
861 }
862 // Create session
863 $this->object->create();
864 $this->object->createReference();
865 $this->object->putInTree($_GET["ref_id"]);
866 $this->object->setPermissions($_GET["ref_id"]);
867
869 $this->object->getId(),
870 $this->form,
871 array(
873 )
874 );
875 if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
876 $this->record_gui->writeEditForm($this->object->getId());
877 }
878
879
880 // apply didactic template?
881 $dtpl = $this->getDidacticTemplateVar("dtpl");
882 if ($dtpl) {
883 $this->object->applyDidacticTemplate($dtpl);
884 }
885
886 // #14547 - active is default
887 if (!$this->form->getInput("lp_preset")) {
888 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
889 $lp_obj_settings = new ilLPObjSettings($this->object->getId());
890 $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
891 $lp_obj_settings->update(false);
892 }
893
894 // create appointment
895 $this->object->getFirstAppointment()->setSessionId($this->object->getId());
896 $this->object->getFirstAppointment()->create();
897
898 $this->handleFileUpload();
899
900 $DIC->object()->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
901
902 $this->createRecurringSessions($this->form->getInput("lp_preset"));
903
904 if ($a_redirect_on_success) {
905 ilUtil::sendInfo($this->lng->txt('event_add_new_event'), true);
906 $this->ctrl->returnToParent($this);
907 }
908
909 return true;
910 }
911
912 public function handleFileUpload()
913 {
914 global $DIC;
915
916 $tree = $DIC['tree'];
917
918 include_once './Modules/Session/classes/class.ilEventItems.php';
919 $ev = new ilEventItems($this->object->getId());
920 $items = $ev->getItems();
921
922 $counter = 0;
923 while (true) {
924 if (!isset($_FILES['files']['name'][$counter])) {
925 break;
926 }
927 if (!strlen($_FILES['files']['name'][$counter])) {
928 $counter++;
929 continue;
930 }
931
932 include_once './Modules/File/classes/class.ilObjFile.php';
933 $file = new ilObjFile();
934 $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
935 $file->setDescription('');
936 $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
937 $file->setFileType($_FILES['files']['type'][$counter]);
938 $file->setFileSize($_FILES['files']['size'][$counter]);
939 $file->create();
940 $new_ref_id = $file->createReference();
941 $file->putInTree($tree->getParentId($this->object->getRefId()));
942 $file->setPermissions($tree->getParentId($this->object->getRefId()));
943 $file->createDirectory();
944
945 $upload = $DIC->upload();
946 if (!$upload->hasBeenProcessed()) {
947 $upload->process();
948 }
949 $file->getUploadFile(
950 $_FILES['files']['tmp_name'][$counter],
951 $_FILES['files']['name'][$counter]
952 );
953
954 $items[] = $new_ref_id;
955 $counter++;
956 }
957
958 $ev->setItems($items);
959 $ev->update();
960 }
961
962
963
971 protected function createRecurringSessions($a_activate_lp = true)
972 {
973 global $DIC;
974
975 $tree = $DIC['tree'];
976
977 if (!$this->rec->getFrequenceType()) {
978 return true;
979 }
980 include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
981 $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(), $this->rec);
982
983 $period_start = clone $this->object->getFirstAppointment()->getStart();
984
985
986 $period_end = clone $this->object->getFirstAppointment()->getStart();
987 $period_end->increment(IL_CAL_YEAR, 5);
988 $date_list = $calc->calculateDateList($period_start, $period_end);
989
990 $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
991 $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
992 $parent_id = $tree->getParentId($this->object->getRefId());
993
994 include_once './Modules/Session/classes/class.ilEventItems.php';
995 $evi = new ilEventItems($this->object->getId());
996 $eitems = $evi->getItems();
997
998 $counter = 0;
999 foreach ($date_list->get() as $date) {
1000 if (!$counter++) {
1001 continue;
1002 }
1003
1004 $new_obj = $this->object->cloneObject($parent_id);
1005
1006 // apply didactic template?
1007 $dtpl = $this->getDidacticTemplateVar("dtpl");
1008 if ($dtpl) {
1009 $new_obj->applyDidacticTemplate($dtpl);
1010 }
1011
1012 $new_obj->read();
1013 $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
1014 $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
1015 $new_obj->getFirstAppointment()->update();
1016 $new_obj->update(true);
1017
1018 // #14547 - active is default
1019 if (!$a_activate_lp) {
1020 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
1021 $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
1022 $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
1023 $lp_obj_settings->update(false);
1024 }
1025
1026 $new_evi = new ilEventItems($new_obj->getId());
1027 $new_evi->setItems($eitems);
1028 $new_evi->update();
1029 }
1030 }
1031
1032
1040 public function editObject()
1041 {
1042 $this->tabs_gui->setTabActive('settings');
1043
1044 $this->initForm('edit');
1045 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit.html', 'Modules/Session');
1046 $this->tpl->setVariable('EVENT_EDIT_TABLE', $this->form->getHTML());
1047
1048 if (!count($this->object->getFiles())) {
1049 return true;
1050 }
1051 $rows = array();
1052 foreach ($this->object->getFiles() as $file) {
1053 $table_data['id'] = $file->getFileId();
1054 $table_data['filename'] = $file->getFileName();
1055 $table_data['filetype'] = $file->getFileType();
1056 $table_data['filesize'] = $file->getFileSize();
1057
1058 $rows[] = $table_data;
1059 }
1060
1061 include_once("./Modules/Session/classes/class.ilSessionFileTableGUI.php");
1062 $table_gui = new ilSessionFileTableGUI($this, "edit");
1063 $table_gui->setTitle($this->lng->txt("event_files"));
1064 $table_gui->setData($rows);
1065 $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
1066 $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
1067 $table_gui->setSelectAllCheckbox("file_id");
1068 $this->tpl->setVariable('EVENT_FILE_TABLE', $table_gui->getHTML());
1069
1070 return true;
1071 }
1072
1076 public function updateObject() : bool
1077 {
1078 global $DIC;
1079
1080 $ilErr = $DIC['ilErr'];
1081
1082 $old_autofill = $this->object->hasWaitingListAutoFill();
1083
1084 $form = $this->initForm('edit');
1085 $ilErr->setMessage('');
1086 if (!$this->form->checkInput()) {
1087 $ilErr->setMessage($this->lng->txt('err_check_input'));
1088 $form->setValuesByPost();
1089 $this->editObject();
1090 return false;
1091 }
1092
1093 //Mantis 21972: Choose didactic template on settings screen
1094 $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
1095
1096 $modified = false;
1097 $new_type_info = $form->getInput('didactic_type');
1098 if ($new_type_info) {
1099 $new_type = explode('_', $form->getInput('didactic_type'));
1100 $new_type = $new_type[1];
1101
1102 $modified = ($new_type != $old_type);
1103 $this->logger->info('Switched group type from ' . $old_type . ' to ' . $new_type);
1104 }
1105
1106 if (
1107 $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
1108 !$this->record_gui->importEditFormPostValues()
1109 ) {
1110 $ilErr->setMessage($this->lng->txt('err_check_input'));
1111 }
1112
1113 $this->load();
1114
1115 $this->object->validate();
1116 $this->object->getFirstAppointment()->validate();
1117
1118 if (strlen($ilErr->getMessage())) {
1119 ilUtil::sendFailure($ilErr->getMessage());
1120 $this->editObject();
1121 return false;
1122 }
1123 // Update event
1124 $this->object->update();
1125 $this->object->getFirstAppointment()->update();
1126
1128 $this->object->getId(),
1129 $this->form,
1130 array(
1132 )
1133 );
1134 if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
1135 $this->record_gui->writeEditForm();
1136 }
1137 $this->handleFileUpload();
1138
1139 $DIC->object()->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
1140
1141 // if autofill has been activated trigger process
1142 if (!$old_autofill &&
1143 $this->object->hasWaitingListAutoFill()) {
1144 $this->object->handleAutoFill();
1145 }
1146
1147 //Mantis 21972: Choose didactic template on settings screen
1148 if ($modified) {
1149 if ($new_type == 0) {
1150 $new_type_txt = $this->lng->txt('il_sess_status_open');
1151 } else {
1152 $dtpl = new ilDidacticTemplateSetting($new_type);
1153 $new_type_txt = $dtpl->getPresentationTitle($this->lng->getLangKey());
1154 }
1155 $this->tabs_gui->activateTab('settings');
1156
1157 ilUtil::sendQuestion($this->lng->txt('sess_warn_sess_type_changed'));
1158 $confirm = new ilConfirmationGUI();
1159 $confirm->setFormAction($this->ctrl->getFormAction($this));
1160 $confirm->addItem(
1161 'sess_type',
1162 $new_type,
1163 $this->lng->txt('sess_info_new_sess_type') . ': ' . $new_type_txt
1164 );
1165 $confirm->addButton($this->lng->txt('sess_change_type'), 'updateSessionType');
1166 $confirm->setCancel($this->lng->txt('cancel'), 'edit');
1167
1168 $this->tpl->setContent($confirm->getHTML());
1169 return true;
1170 } else {
1171 ilUtil::sendSuccess($this->lng->txt('event_updated'), true);
1172 $this->ctrl->redirect($this, 'edit');
1173 #$this->object->initFiles();
1174 #$this->editObject();
1175 return true;
1176 }
1177 }
1178
1182 public function updateSessionTypeObject() : void
1183 {
1185 $this->object->getRefId(),
1186 $this->http->request()->getParsedBody()['sess_type']
1187 );
1188
1189 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1190 $this->ctrl->redirect($this, 'edit');
1191 }
1192
1201 {
1202 $this->tabs_gui->setTabActive('settings');
1203
1204 if (!count($_POST['file_id'])) {
1205 ilUtil::sendFailure($this->lng->txt('select_one'));
1206 $this->editObject();
1207 return false;
1208 }
1209
1210 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1211 $c_gui = new ilConfirmationGUI();
1212
1213 // set confirm/cancel commands
1214 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
1215 $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
1216 $c_gui->setCancel($this->lng->txt("cancel"), "edit");
1217 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
1218
1219 // add items to delete
1220 foreach ($_POST["file_id"] as $file_id) {
1221 $file = new ilSessionFile($file_id);
1222 if ($file->getSessionId() != $this->object->getEventId()) {
1223 ilUtil::sendFailure($this->lng->txt('select_one'));
1224 $this->edit();
1225 return false;
1226 }
1227 $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
1228 }
1229
1230 $this->tpl->setContent($c_gui->getHTML());
1231 return true;
1232 }
1233
1241 public function deleteFilesObject()
1242 {
1243 if (!count($_POST['file_id'])) {
1244 ilUtil::sendFailure($this->lng->txt('select_one'));
1245 $this->editObject();
1246 return false;
1247 }
1248 foreach ($_POST['file_id'] as $id) {
1249 $file = new ilSessionFile($id);
1250 $file->delete();
1251 }
1252 $this->object->initFiles();
1253 $this->editObject();
1254 return true;
1255 }
1256
1257 protected function initContainer($a_init_participants = false)
1258 {
1259 global $DIC;
1260
1261 $tree = $DIC['tree'];
1262
1263 $is_course = $is_group = false;
1264
1265 // #13178
1266 $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
1267 if ($this->container_ref_id) {
1268 $is_group = true;
1269 }
1270 if (!$this->container_ref_id) {
1271 $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1272 if ($this->container_ref_id) {
1273 $is_course = true;
1274 }
1275 }
1276 if (!$this->container_ref_id) {
1277 ilUtil::sendFailure('No container object found. Aborting');
1278 return true;
1279 }
1280 $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
1281
1282 if ($a_init_participants && $this->container_obj_id) {
1283 if ($is_course) {
1284 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1285 return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
1286 } elseif ($is_group) {
1287 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
1288 return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
1289 }
1290 }
1291 }
1292
1296 public function materialsObject()
1297 {
1298 global $DIC;
1299
1300 $tree = $DIC['tree'];
1301 $objDefinition = $DIC['objDefinition'];
1302
1303 $this->tabs_gui->activateTab('materials');
1304
1305 // #11337 - support ANY parent container (crs, grp, fld)
1306 $parent_ref_id = $tree->getParentId($this->object->getRefId());
1307
1308 include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
1309 $gui = new ilObjectAddNewItemGUI($parent_ref_id);
1310 $gui->setDisabledObjectTypes(
1311 array_merge(
1312 [
1313 'itgr', 'sess'
1314 ],
1315 $objDefinition->getSideBlockTypes()
1316 )
1317 );
1318 $gui->setAfterCreationCallback($this->ref_id);
1319 $gui->render();
1320
1321 include_once 'Modules/Session/classes/class.ilEventItems.php';
1322 $this->event_items = new ilEventItems($this->object->getId());
1323
1324 include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1325 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1326
1327 $tbl->setDisableFilterHiding(true);
1328
1329 $tbl->addMultiCommand('saveMaterials', $this->lng->txt('sess_assign'));
1330 $tbl->addMultiCommand("removeMaterials", $this->lng->txt("remove"));
1331
1332 $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
1333 $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
1334
1335 $tbl->setMaterialItems($this->event_items->getItems());
1336 $tbl->setContainerRefId($this->getContainerRefId());
1337 $data = $tbl->getDataFromDb();
1338 $tbl->setMaterials($data);
1339
1340 $this->tpl->setContent($tbl->getHTML());
1341 }
1342
1346 public function applyFilter()
1347 {
1348 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1349 $tbl->writeFilterToSession(); // writes filter to session
1350 $tbl->resetOffset(); // sets record offest to 0 (first page)
1351 $this->ctrl->redirect($this, "materials");
1352 }
1353
1357 public function resetFilter()
1358 {
1359 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1360 $tbl->resetOffset(); // sets record offest to 0 (first page)
1361 $tbl->resetFilter(); // clears filter
1362 $this->ctrl->redirect($this, "materials");
1363 }
1364
1368 public function removeMaterialsObject()
1369 {
1370 $items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1371
1372 $this->event_items = new ilEventItems($this->object->getId());
1373 $this->event_items->removeItems($items_checked);
1374
1375 $this->postUpdateMaterials();
1376 }
1377
1378
1384 public function saveMaterialsObject()
1385 {
1386 include_once './Modules/Session/classes/class.ilEventItems.php';
1387
1388 $this->event_items = new ilEventItems($this->object->getId());
1389 $db_items = $this->event_items->getItems();
1390
1391 $list_items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1392 $list_items_checked = array_map('intval', $list_items_checked);
1393
1394 $items_to_save = array_merge($db_items, $list_items_checked);
1395 $items_to_save = array_unique($items_to_save);
1396
1397 $this->event_items->setItems($items_to_save);
1398 $this->event_items->update();
1399 $this->postUpdateMaterials();
1400 }
1401
1405 public function postUpdateMaterials()
1406 {
1407 include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1408 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1409 $tbl->setOffset(0);
1410 $tbl->storeNavParameter();//remove offset and go to page 1
1411
1412 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1413 $this->ctrl->redirect($this, 'materials');
1414 }
1415
1416
1423 public function attendanceListObject()
1424 {
1425 global $DIC;
1426
1427 $tpl = $DIC['tpl'];
1428 $ilTabs = $DIC['ilTabs'];
1429
1430 $this->checkPermission('manage_members');
1431 $ilTabs->setTabActive('event_edit_members');
1432
1433 $list = $this->initAttendanceList();
1434 $form = $list->initForm('printAttendanceList');
1435 $tpl->setContent($form->getHTML());
1436 }
1437
1443 protected function initAttendanceList()
1444 {
1445 $members_obj = $this->initContainer(true);
1446
1447 include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1448 $list = new ilAttendanceList(
1449 $this,
1450 $this->object,
1451 $members_obj
1452 );
1453 $list->setId('sessattlst');
1454
1455 $event_app = $this->object->getFirstAppointment();
1457 $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd());
1459 $desc .= " " . $this->object->getTitle();
1460 $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1461
1462 $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1463 $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1464 if ($this->object->enabledRegistration()) {
1465 $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1466 }
1467 $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1468 $list->addBlank($this->lng->txt('sess_signature'));
1469
1470 $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1471
1472 return $list;
1473 }
1474
1480 protected function printAttendanceListObject()
1481 {
1482 $this->checkPermission('manage_members');
1483
1484 $list = $this->initAttendanceList();
1485 $list->initFromForm();
1486 $list->setCallback(array($this, 'getAttendanceListUserData'));
1487
1488 include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1489 $this->event_part = new ilEventParticipants($this->object->getId());
1490
1491 echo $list->getFullscreenHTML();
1492 exit();
1493 }
1494
1504 public function getAttendanceListUserData($a_user_id, $a_filters)
1505 {
1506 $data = $this->event_part->getUser($a_user_id);
1507
1508 if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
1509 return;
1510 }
1511
1512 $data['registered'] = $data['registered'] ?
1513 $this->lng->txt('yes') :
1514 $this->lng->txt('no');
1515 $data['participated'] = $data['participated'] ?
1516 $this->lng->txt('yes') :
1517 $this->lng->txt('no');
1518
1519 return $data;
1520 }
1521
1529 public function eventsListObject()
1530 {
1531 global $DIC;
1532
1533 $ilErr = $DIC['ilErr'];
1534 $ilAccess = $DIC['ilAccess'];
1535 $ilUser = $DIC['ilUser'];
1536 $tree = $DIC['tree'];
1537
1538 if (!$ilAccess->checkAccess('manage_members', '', $this->object->getRefId())) {
1539 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
1540 }
1541
1542 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session');
1543 $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export'));
1544
1545 include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1546
1547 $this->tpl->addBlockfile("EVENTS_TABLE", "events_table", "tpl.table.html");
1548 $this->tpl->addBlockfile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session');
1549
1550 $members_obj = $this->initContainer(true);
1551 $members = $members_obj->getParticipants();
1552 $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
1553
1554 // Table
1555 $tbl = new ilTableGUI();
1556 $tbl->setTitle(
1557 $this->lng->txt("event_overview"),
1558 'icon_usr.svg',
1559 $this->lng->txt('obj_usr')
1560 );
1561 $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
1562
1563 $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1564 $events = array();
1565 foreach ($tree->getSubtree($tree->getNodeData($course_ref_id), false, 'sess') as $event_id) {
1566 $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
1567 if (!is_object($tmp_event) or $tmp_event->getType() != 'sess') {
1568 continue;
1569 }
1570 $events[] = $tmp_event;
1571 }
1572
1573 $headerNames = array();
1574 $headerVars = array();
1575 $colWidth = array();
1576
1577 $headerNames[] = $this->lng->txt('name');
1578 $headerVars[] = "name";
1579 $colWidth[] = '20%';
1580
1581 for ($i = 1; $i <= count($events); $i++) {
1582 $headerNames[] = $i;
1583 $headerVars[] = "event_" . $i;
1584 $colWidth[] = 80 / count($events) . "%";
1585 }
1586
1587 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1588 $tbl->setHeaderNames($headerNames);
1589 $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this, 'eventsList'));
1590 $tbl->setColumnWidth($colWidth);
1591
1592 $tbl->setOrderColumn($_GET["sort_by"]);
1593 $tbl->setOrderDirection($_GET["sort_order"]);
1594 $tbl->setOffset($_GET["offset"]);
1595 $tbl->setLimit($ilUser->getPref("hits_per_page"));
1596 $tbl->setMaxCount(count($members));
1597 $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1598
1599 $sliced_users = array_slice($members, $_GET['offset'], $_SESSION['tbl_limit']);
1600 $tbl->disable('sort');
1601 $tbl->render();
1602
1603 $counter = 0;
1604 foreach ($sliced_users as $user_id) {
1605 foreach ($events as $event_obj) {
1606 $this->tpl->setCurrentBlock("eventcols");
1607
1608 $event_part = new ilEventParticipants($this->object->getId());
1609
1610 {
1611 $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1612 ilUtil::getImagePath('icon_ok.svg') :
1613 ilUtil::getImagePath('icon_not_ok.svg'));
1614
1615 $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1616 $this->lng->txt('event_participated') :
1617 $this->lng->txt('event_not_participated'));
1618 }
1619
1620 $this->tpl->parseCurrentBlock();
1621 }
1622
1623 $this->tpl->setCurrentBlock("tbl_content");
1624 $name = ilObjUser::_lookupName($user_id);
1625 $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
1626 $this->tpl->setVariable("LASTNAME", $name['lastname']);
1627 $this->tpl->setVariable("FIRSTNAME", $name['firstname']);
1628 $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id));
1629 $this->tpl->parseCurrentBlock();
1630 }
1631
1632 $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1633 $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1634 $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1635 $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1636 $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time"));
1637 $i = 1;
1638 foreach ($events as $event_obj) {
1639 $this->tpl->setCurrentBlock("legend_loop");
1640 $this->tpl->setVariable("LEGEND_CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
1641 $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1642 $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1643 $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1644 $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1645 $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1646 $this->tpl->parseCurrentBlock();
1647 }
1648 }
1649
1653 protected function initForm(string $a_mode) : ilPropertyFormGUI
1654 {
1655 global $DIC;
1656
1657 $ilUser = $DIC['ilUser'];
1658
1659 if (is_object($this->form)) {
1660 return $this->form;
1661 }
1662
1663 $this->lng->loadLanguageModule('dateplaner');
1664
1665 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1666
1667 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1669
1670 $this->form = new ilPropertyFormGUI();
1671 $this->form->setMultipart(true);
1672 $this->form->setTableWidth('600px');
1673 $this->form->setFormAction($this->ctrl->getFormAction($this));
1674 $this->form->setMultipart(true);
1675
1676 $this->form = $this->initDidacticTemplate($this->form);
1677
1678 $this->lng->loadLanguageModule('dateplaner');
1679 include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1680 $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
1681 $dur->setRequired(true);
1682 $dur->enableToggleFullTime(
1683 $this->lng->txt('event_fulltime_info'),
1684 $this->object->getFirstAppointment()->enabledFulltime() ? true : false
1685 );
1686 $dur->setShowTime(true);
1687 $dur->setStart($this->object->getFirstAppointment()->getStart());
1688 $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1689
1690 $this->form->addItem($dur);
1691
1692
1693 // Recurrence
1694 if ($a_mode == 'create') {
1695 if (!is_object($this->rec)) {
1696 include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1697 $this->rec = new ilEventRecurrence();
1698 }
1699 include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1700 $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
1701 $rec->allowUnlimitedRecurrences(false);
1702 $rec->setRecurrence($this->rec);
1703 $this->form->addItem($rec);
1704
1705 // #14547
1706 $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1707 $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1708 $lp->setChecked(true);
1709 $this->form->addItem($lp);
1710 }
1711
1713 $section->setTitle($this->lng->txt('event_section_information'));
1714 $this->form->addItem($section);
1715
1716 // title
1717 $title = new ilTextInputGUI($this->lng->txt('event_title'), 'title');
1718 $title->setRequired(true);
1719 $title->setValue($this->object->getTitle());
1720 $title->setSize(50);
1721 $title->setMaxLength(70);
1722 $this->form->addItem($title);
1723
1724 // desc
1725 $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'), 'desc');
1726 $desc->setValue($this->object->getLongDescription());
1727 $desc->setRows(4);
1728 $desc->setCols(50);
1729 $this->form->addItem($desc);
1730
1731 // location
1732 $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'), 'location');
1733 $desc->setValue($this->object->getLocation());
1734 $desc->setRows(4);
1735 $desc->setCols(50);
1736 $this->form->addItem($desc);
1737
1738 // workflow
1739 $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'), 'details');
1740 $details->setValue($this->object->getDetails());
1741 $details->setCols(50);
1742 $details->setRows(4);
1743 $this->form->addItem($details);
1744
1745 if ($a_mode == 'create') {
1746 $this->record_gui = new ilAdvancedMDRecordGUI(
1748 'sess'
1749 );
1750 $this->record_gui->setRefId((int) $_GET['ref_id']);
1751 $this->record_gui->setPropertyForm($this->form);
1752 $this->record_gui->parse();
1753 } elseif ($this->checkPermissionBool('edit_metadata')) {
1754 $this->record_gui = new ilAdvancedMDRecordGUI(
1756 'sess',
1757 $this->object->getId()
1758 );
1759 $this->record_gui->setPropertyForm($this->form);
1760 $this->record_gui->parse();
1761 }
1762
1763
1764 // section
1766 $section->setTitle($this->lng->txt('event_tutor_data'));
1767 $this->form->addItem($section);
1768
1769 // name
1770 $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'), 'tutor_name');
1771 $tutor_name->setValue($this->object->getName());
1772 $tutor_name->setSize(20);
1773 $tutor_name->setMaxLength(70);
1774 $this->form->addItem($tutor_name);
1775
1776 // email
1777 $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'), 'tutor_email');
1778 $tutor_email->setValue($this->object->getEmail());
1779 $tutor_email->setSize(20);
1780 $tutor_email->setMaxLength(70);
1781 $this->form->addItem($tutor_email);
1782
1783 // phone
1784 $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'), 'tutor_phone');
1785 $tutor_phone->setValue($this->object->getPhone());
1786 $tutor_phone->setSize(20);
1787 $tutor_phone->setMaxLength(70);
1788 $this->form->addItem($tutor_phone);
1789
1791 $section->setTitle($this->lng->txt('sess_section_reg'));
1792 $this->form->addItem($section);
1793
1794 include_once './Modules/Session/classes/class.ilSessionMembershipRegistrationSettingsGUI.php';
1795 include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
1797 $this,
1798 $this->object,
1799 array(
1805 )
1806 );
1807 $reg_settings->addMembershipFormElements($this->form, '');
1808
1809
1811 $section->setTitle($this->lng->txt('event_assign_files'));
1812 $this->form->addItem($section);
1813
1814 $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
1815 $files->setFilenames(array(0 => ''));
1816 $this->form->addItem($files);
1817
1819 $section->setTitle($this->lng->txt('sess_setting_header_presentation'));
1820 $this->form->addItem($section);
1821
1822 $DIC->object()->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
1823
1824 $features = new ilFormSectionHeaderGUI();
1825 $features->setTitle($this->lng->txt('obj_features'));
1826 $this->form->addItem($features);
1828 $this->object->getId(),
1829 $this->form,
1830 array(
1832 )
1833 );
1834
1835 $gallery = new ilCheckboxInputGUI($this->lng->txt('sess_show_members'), 'show_members');
1836 $gallery->setChecked($this->object->getShowMembers());
1837 $gallery->setInfo($this->lng->txt('sess_show_participants_info'));
1838 $this->form->addItem($gallery);
1839
1840
1841 // Show mail to members type
1842 $mail_type = new ilRadioGroupInputGUI($this->lng->txt('sess_mail_type'), 'mail_type');
1843 $mail_type->setValue($this->object->getMailToMembersType());
1844
1845 $mail_tutors = new ilRadioOption(
1846 $this->lng->txt('sess_mail_admins_only'),
1848 $this->lng->txt('sess_mail_admins_only_info')
1849 );
1850 $mail_type->addOption($mail_tutors);
1851
1852 $mail_all = new ilRadioOption(
1853 $this->lng->txt('sess_mail_all'),
1855 $this->lng->txt('sess_mail_all_info')
1856 );
1857 $mail_type->addOption($mail_all);
1858 $this->form->addItem($mail_type);
1859
1860
1861
1862 switch ($a_mode) {
1863 case 'create':
1864 $this->form->setTitle($this->lng->txt('event_table_create'));
1865 $this->form->addCommandButton('save', $this->lng->txt('event_btn_add'));
1866 $this->form->addCommandButton('saveAndAssignMaterials', $this->lng->txt('event_btn_add_edit'));
1867 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1868 return $this->form;
1869
1870 case 'edit':
1871 $this->form->setTitle($this->lng->txt('event_table_update'));
1872 $this->form->addCommandButton('update', $this->lng->txt('save'));
1873 $this->form->addCommandButton('cancelEdit', $this->lng->txt('cancel'));
1874 return $this->form;
1875 }
1876 return $this->form;
1877 }
1878
1886 protected function load()
1887 {
1888 $event = $this->form->getItemByPostVar('event');
1889 if ($event->getStart() && $event->getEnd()) {
1890 $this->object->getFirstAppointment()->setStartingTime($event->getStart()->get(IL_CAL_UNIX));
1891 $this->object->getFirstAppointment()->setEndingTime($event->getStart()->get(IL_CAL_UNIX));
1892 $this->object->getFirstAppointment()->setStart($event->getStart());
1893 $this->object->getFirstAppointment()->setEnd($event->getEnd());
1894 $this->object->getFirstAppointment()->toggleFulltime($event->getStart() instanceof ilDate);
1895 }
1896
1897 $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1898 $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1899 $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1900 $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1901 $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1902 $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1903 $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1904
1905 $this->object->setRegistrationNotificationEnabled(ilUtil::stripSlashes($_POST['registration_notification']));
1906 $this->object->setRegistrationNotificationOption(ilUtil::stripSlashes($_POST['notification_option']));
1907
1908 $this->object->setRegistrationType((int) $_POST['registration_type']);
1909
1910 switch ($this->object->getRegistrationType()) {
1912 $this->object->enableCannotParticipateOption((bool) $_POST['show_cannot_participate_direct']);
1913 break;
1915 $this->object->enableCannotParticipateOption((bool) $_POST['show_cannot_participate_request']);
1916 break;
1917 default:
1918 $this->object->enableCannotParticipateOption(false);
1919 break;
1920 }
1921
1922
1923 // $this->object->setRegistrationMinUsers((int) $_POST['registration_min_members']);
1924 $this->object->setRegistrationMaxUsers((int) $_POST['registration_max_members']);
1925 $this->object->enableRegistrationUserLimit((int) $_POST['registration_membership_limited']);
1926 $this->object->setShowMembers((int) $_POST['show_members']);
1927 $this->object->setMailToMembersType((int) $_POST['mail_type']);
1928
1929 switch ((int) $_POST['waiting_list']) {
1930 case 2:
1931 $this->object->enableRegistrationWaitingList(true);
1932 $this->object->setWaitingListAutoFill(true);
1933 break;
1934
1935 case 1:
1936 $this->object->enableRegistrationWaitingList(true);
1937 $this->object->setWaitingListAutoFill(false);
1938 break;
1939
1940 default:
1941 $this->object->enableRegistrationWaitingList(false);
1942 $this->object->setWaitingListAutoFill(false);
1943 break;
1944 }
1945 }
1946
1953 protected function loadRecurrenceSettings()
1954 {
1955 include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1956 $this->rec = new ilSessionRecurrence();
1957
1958 switch ($_POST['frequence']) {
1959 case IL_CAL_FREQ_DAILY:
1960 $this->rec->setFrequenceType($_POST['frequence']);
1961 $this->rec->setInterval((int) $_POST['count_DAILY']);
1962 break;
1963
1964 case IL_CAL_FREQ_WEEKLY:
1965 $this->rec->setFrequenceType($_POST['frequence']);
1966 $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1967 if (is_array($_POST['byday_WEEKLY'])) {
1968 $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $_POST['byday_WEEKLY'])));
1969 }
1970 break;
1971
1973 $this->rec->setFrequenceType($_POST['frequence']);
1974 $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1975 switch ((int) $_POST['subtype_MONTHLY']) {
1976 case 0:
1977 // nothing to do;
1978 break;
1979
1980 case 1:
1981 switch ((int) $_POST['monthly_byday_day']) {
1982 case 8:
1983 // Weekday
1984 $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1985 $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1986 break;
1987
1988 case 9:
1989 // Day of month
1990 $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1991 break;
1992
1993 default:
1994 $this->rec->setBYDAY((int) $_POST['monthly_byday_num'] . $_POST['monthly_byday_day']);
1995 break;
1996 }
1997 break;
1998
1999 case 2:
2000 $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
2001 break;
2002 }
2003 break;
2004
2005 case IL_CAL_FREQ_YEARLY:
2006 $this->rec->setFrequenceType($_POST['frequence']);
2007 $this->rec->setInterval((int) $_POST['count_YEARLY']);
2008 switch ((int) $_POST['subtype_YEARLY']) {
2009 case 0:
2010 // nothing to do;
2011 break;
2012
2013 case 1:
2014 $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
2015 $this->rec->setBYDAY((int) $_POST['yearly_byday_num'] . $_POST['yearly_byday']);
2016 break;
2017
2018 case 2:
2019 $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
2020 $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
2021 break;
2022 }
2023 break;
2024 }
2025
2026 // UNTIL
2027 switch ((int) $_POST['until_type']) {
2028 case 1:
2029 $this->rec->setFrequenceUntilDate(null);
2030 // nothing to do
2031 break;
2032
2033 case 2:
2034 $this->rec->setFrequenceUntilDate(null);
2035 $this->rec->setFrequenceUntilCount((int) $_POST['count']);
2036 break;
2037
2038 case 3:
2039 $frequence = $this->form->getItemByPostVar('frequence');
2040 $end = $frequence->getRecurrence()->getFrequenceUntilDate();
2041 $this->rec->setFrequenceUntilCount(0);
2042 $this->rec->setFrequenceUntilDate($end);
2043 break;
2044 }
2045 }
2046
2047
2055 protected function __toUnix($date, $time)
2056 {
2057 return mktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
2058 }
2059
2066 public function addLocatorItems()
2067 {
2068 global $DIC;
2069
2070 $ilLocator = $DIC['ilLocator'];
2071
2072 if (!$this->getCreationMode()) {
2073 // see prepareOutput()
2074 include_once './Modules/Session/classes/class.ilSessionAppointment.php';
2075 $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
2076 $title = $this->object->getFirstAppointment()->appointmentToString() . $title;
2077
2078 $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2079 }
2080 }
2081
2082
2087 {
2088 global $DIC;
2089
2090 $objDefinition = $DIC['objDefinition'];
2091
2092 $tree = $DIC->repositoryTree();
2093 $ctrl = $DIC->ctrl();
2094
2095 $parent_id = $tree->getParentId($this->object->getRefId());
2096
2097 // #11650
2098 $parent_type = ilObject::_lookupType($parent_id, true);
2099
2100 $parent_class = $objDefinition->getClassName($parent_type);
2101 $parent_class = 'ilObj' . $parent_class . 'GUI';
2102
2103 $ctrl->setParameterByClass($parent_class, "ref_id", $parent_id);
2104 $ctrl->redirectByClass($parent_class, "view");
2105 }
2106
2107
2114 public function getTabs()
2115 {
2116 global $DIC;
2117
2118 $ilAccess = $DIC['ilAccess'];
2119 $ilTabs = $DIC['ilTabs'];
2120 $tree = $DIC['tree'];
2121 $ilCtrl = $DIC['ilCtrl'];
2122 $ilHelp = $DIC['ilHelp'];
2123 $ilUser = $DIC->user();
2124
2125 $ilHelp->setScreenIdComponent("sess");
2126
2127 $parent_id = $tree->getParentId($this->object->getRefId());
2128
2129 // #11650
2130 $parent_type = ilObject::_lookupType($parent_id, true);
2131
2132 $this->tabs_gui->setBackTarget(
2133 $this->lng->txt('back_to_' . $parent_type . '_content'),
2134 $ilCtrl->getLinkTarget($this, "redirectToParentContentPage")
2135 );
2136
2137 $this->tabs_gui->addTarget(
2138 'info_short',
2139 $this->ctrl->getLinkTarget($this, 'infoScreen')
2140 );
2141
2142 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2143 $this->tabs_gui->addTarget(
2144 'settings',
2145 $this->ctrl->getLinkTarget($this, 'edit')
2146 );
2147 }
2148 if ($ilAccess->checkAccess('manage_materials', '', $this->object->getRefId())) {
2149 $this->tabs_gui->addTab(
2150 'materials',
2151 $this->lng->txt('crs_materials'),
2152 $this->ctrl->getLinkTarget($this, 'materials')
2153 );
2154 }
2155
2156 // booking
2157 $tree = $DIC['tree'];
2158 $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
2159
2160 if ($ilAccess->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
2161 ilObject::_lookupObjId($parent_id),
2163 false
2164 )) {
2165 $this->tabs_gui->addTarget(
2166 "obj_tool_setting_booking",
2167 $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
2168 );
2169 }
2170
2171 // member tab
2172 $is_participant = $this->object->getMembersObject()->isAssigned($ilUser->getId());
2173 $membership_gui = new ilSessionMembershipGUI($this, $this->object);
2174 $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
2175
2176
2177 // learning progress
2178 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2179 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
2180 $this->tabs_gui->addTarget(
2181 'learning_progress',
2182 $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'), ''),
2183 '',
2184 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
2185 );
2186 }
2187
2188 // meta data
2189 if ($ilAccess->checkAccess('edit_metadata', '', $this->ref_id)) {
2190 $mdgui = new ilObjectMetaDataGUI($this->object);
2191 $mdtab = $mdgui->getTab();
2192 if ($mdtab) {
2193 $this->tabs_gui->addTab(
2194 "metadata",
2195 $this->lng->txt('meta_data'),
2196 $mdtab
2197 );
2198 }
2199 }
2200
2201 // export
2202 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
2203 $this->tabs_gui->addTarget(
2204 "export",
2205 $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
2206 "",
2207 "ilexportgui"
2208 );
2209 }
2210
2211
2212 // edit permissions
2213 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
2214 $this->tabs_gui->addTarget(
2215 "perm_settings",
2216 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
2217 array("perm","info","owner"),
2218 'ilpermissiongui'
2219 );
2220 }
2221 }
2222
2228 public function afterSaveCallback(ilObject $a_obj)
2229 {
2230 // add new object to materials
2231 include_once './Modules/Session/classes/class.ilEventItems.php';
2232 $event_items = new ilEventItems($this->object->getId());
2233 $event_items->addItem($a_obj->getRefId());
2234 $event_items->update();
2235
2236 /*
2237 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
2238 $this->ctrl->redirect($this, "materials");
2239 */
2240 }
2241
2242
2246 public function readMemberData($a_usr_ids)
2247 {
2248 $tmp_data = array();
2249 foreach ($a_usr_ids as $usr_id) {
2250 $tmp_data[$usr_id] = array();
2251 }
2252 return $tmp_data;
2253 }
2254
2255
2256
2261 public function getContainerRefId()
2262 {
2263 if (!$this->container_ref_id) {
2264 $this->initContainer();
2265 }
2267 }
2268
2269
2275 protected function cancelEditObject()
2276 {
2277 global $DIC;
2278
2279 $ilCtrl = $DIC['ilCtrl'];
2280 $tree = $DIC['tree'];
2281
2282 $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
2283
2284 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2285
2286 $ilCtrl->redirectByClass("ilrepositorygui", "");
2287 }
2288
2289
2294 public function getDefaultMemberRole()
2295 {
2296 $local_roles = $GLOBALS['DIC']->rbac()->review()->getRolesOfRoleFolder($this->object->getRefId(), false);
2297
2298 foreach ($local_roles as $role_id) {
2299 $title = ilObject::_lookupTitle($role_id);
2300 if (substr($title, 0, 19) == 'il_sess_participant') {
2301 return $role_id;
2302 }
2303 }
2304 return 0;
2305 }
2306
2307
2312 public function getLocalRoles()
2313 {
2314 return $GLOBALS['DIC']->rbac()->review()->getRolesOfRoleFolder($this->object->getRefId(), false);
2315 }
2316
2317
2322 public function createMailSignature()
2323 {
2324 $link = chr(13) . chr(10) . chr(13) . chr(10);
2325 $link .= $this->lng->txt('sess_mail_permanent_link');
2326 $link .= chr(13) . chr(10) . chr(13) . chr(10);
2327 include_once './Services/Link/classes/class.ilLink.php';
2328 $link .= ilLink::_getLink($this->object->getRefId());
2329 return rawurlencode(base64_encode($link));
2330 }
2331
2335 protected function importFileObject($parent_id = null, $a_catch_errors = true)
2336 {
2337 return parent::importFileObject($parent_id, $a_catch_errors);
2338 }
2339}
user()
Definition: user.php:4
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$section
Definition: Utf8Test.php:83
$location
Definition: buildRTE.php:44
$_GET["client_id"]
$_POST["username"]
$_SESSION["AccountId"]
An exception for terminatinating execution or to throw for unit testing.
Provides an interface to the ILIAS HTTP services.
const IL_CAL_FREQ_YEARLY
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_WEEKLY
const IL_CAL_UNIX
const IL_CAL_YEAR
importEditFormPostValues()
Load edit form values from post.
Base class for attendance lists.
This class is used for inegration of the booking manager as a service into other repository objects,...
Calculates an ilDateList for a given calendar entry and recurrence rule.
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static _getInstance($a_obj_id)
get instance by obj_id
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
input GUI for a time span (start and end date)
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
Class for single dates.
static lookupTemplateId($a_ref_id)
Lookup template id @global ilDB $ilDB.
static switchTemplate($a_ref_id, $a_new_tpl_id)
class ilEvent
static _isRegistered($a_usr_id, $a_event_id)
static _register($a_usr_id, $a_event_id)
static _unregister($a_usr_id, $a_event_id)
Export User Interface Class.
This class represents a file wizard property in a property form.
This class represents a section header in a property form.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilInfoScreenGUI.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
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.
static _lookupAboStatus($a_id)
Class ilObjFile.
materialsObject()
show material assignment
refuseParticipationObject()
refuse participation
addLocatorItems()
Add session locator.
cancelEditObject()
Cancel editigin @global type $ilCtrl @global type $tree.
executeCommand()
execute command
importFileObject($parent_id=null, $a_catch_errors=true)
Import.
prepareOutput($a_show_subobjects=true)
initContainer($a_init_participants=false)
applyFilter()
Apply filter.
showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar)
saveMaterialsObject()
save material assignment
readMemberData($a_usr_ids)
Used for waiting list.
loadRecurrenceSettings()
load recurrence settings
unregisterObject($a_refuse_participation=false)
unregister from session
redirectToParentContentPageObject()
Redirect to parent content page.
getAttendanceListUserData($a_user_id, $a_filters)
Get user data for attendance list.
confirmDeleteFilesObject()
confirm delete files
attendanceListObject()
show attendance list selection
updateObject()
update object
static _goto($a_target)
goto
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
initForm(string $a_mode)
Init Form.
updateSessionTypeObject()
change session type
resetFilter()
Reset filter.
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container @global type $tree.
removeMaterialsObject()
Remove materials from the current object.
saveAndAssignMaterialsObject()
Save and assign sessoin materials.
saveObject($a_redirect_on_success=true)
save object
membersObject()
Redirect to member adminsitration.
getCurrentObject()
Get session object.
printAttendanceListObject()
print attendance list
__toUnix($date, $time)
@access protected
getLocalRoles()
get all local roles
afterSaveCallback(ilObject $a_obj)
Custom callback after object is created (in parent containert.
getDefaultMemberRole()
Get default member role.
initCreateForm($a_new_type)
Init object creation form.
joinObject()
Called from info screen.
createRecurringSessions($a_activate_lp=true)
create recurring sessions
deleteFilesObject()
delete files
initAttendanceList()
Init attendance list object.
showJoinRequestButton(ilToolbarGUI $ilToolbar=null)
createMailSignature()
Create a course mail signature.
registerObject()
register to session
eventsListObject()
list sessions of all user
postUpdateMaterials()
redirect to list of materials without offset/page.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
getContainerRefId()
container ref id
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
static getItemsByEvent($a_event_id)
Get session material / event items.
Render add new item selector.
GUI class for the workflow of copying objects.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObjectGUI Basic methods of all Output classes.
__showButton($a_cmd, $a_text, $a_target='')
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
getDidacticTemplateVar($a_type)
Get didactic template setting from creation screen.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
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.
saveObject()
save object
initDidacticTemplate(ilPropertyFormGUI $form)
Show didactic template types.
addHeaderAction()
Add header action menu.
createObject()
create new object form
redirectToRefId($a_ref_id, $a_cmd="")
redirects to (repository) view per ref id usually to a container and usually used at the end of a sav...
Class ilObjectMetaDataGUI.
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)
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstance($a_ref_id)
Get instance by ref_id.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
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.
static resetCaches()
Reset internal caches.
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...
GUI class for membership features.
static factory($a_type)
Get list gui by type This method caches all the returned list guis.
static getInstance($a_ref_id)
Get instance.
Class ilTableGUI.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static _sortIds($a_ids, $a_table, $a_field, $a_id_name)
Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,...
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
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 switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows)
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 deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
const ROOT_FOLDER_ID
Definition: constants.php:30
global $DIC
Definition: goto.php:24
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
$ilUser
Definition: imgupload.php:18
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
exit
Definition: login.php:29
if($format !==null) $name
Definition: metadata.php:230
$i
Definition: metadata.php:24
if( $orgName !==null) if($spconfig->hasValue('contacts')) $email
Definition: metadata.php:285
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6
ui()
Definition: ui.php:5
$rows
Definition: xhr_table.php:10