ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 }
87
88
95 public function executeCommand()
96 {
97 global $DIC;
98
99 $ilUser = $DIC['ilUser'];
100 $ilCtrl = $DIC['ilCtrl'];
101
102 $next_class = $this->ctrl->getNextClass($this);
103 $cmd = $this->ctrl->getCmd();
104
105 if (
106 !$this->getCreationMode() &&
107 $GLOBALS['DIC']->access()->checkAccess('read', '', $_GET['ref_id'])
108 ) {
109 $GLOBALS['DIC']['ilNavigationHistory']->addItem(
110 (int) $_GET['ref_id'],
111 ilLink::_getLink((int) $_GET['ref_id'], 'sess'),
112 'sess'
113 );
114 }
115
116 $this->prepareOutput();
117 switch ($next_class) {
118 case 'ilsessionmembershipgui':
119 $this->tabs_gui->activateTab('members');
120 include_once './Modules/Session/classes/class.ilSessionMembershipGUI.php';
121 $mem_gui = new ilSessionMembershipGUI($this, $this->object);
122 $this->ctrl->forwardCommand($mem_gui);
123 break;
124
125 case "ilinfoscreengui":
126 $this->checkPermission("visible");
127 $this->infoScreen(); // forwards command
128 break;
129
130 case 'ilobjectmetadatagui':
131 $this->checkPermission('edit_metadata');
132 $this->tabs_gui->activateTab('metadata');
133 $md_gui = new ilObjectMetaDataGUI($this->object);
134 $this->ctrl->forwardCommand($md_gui);
135 break;
136
137
138 case 'ilpermissiongui':
139 $this->tabs_gui->setTabActive('perm_settings');
140 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
141 $perm_gui = new ilPermissionGUI($this);
142 $ret = $this->ctrl->forwardCommand($perm_gui);
143 break;
144
145 case 'ilobjectcopygui':
146 include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
147 $cp = new ilObjectCopyGUI($this);
148 $cp->setType('sess');
149 $this->ctrl->forwardCommand($cp);
150 break;
151
152 case "ilexportgui":
153// $this->prepareOutput();
154 $this->tabs_gui->setTabActive("export");
155 include_once("./Services/Export/classes/class.ilExportGUI.php");
156 $exp_gui = new ilExportGUI($this);
157 $exp_gui->addFormat("xml");
158 $ret = $this->ctrl->forwardCommand($exp_gui);
159// $this->tpl->show();
160 break;
161
162 case "ilcommonactiondispatchergui":
163 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
165 $this->ctrl->forwardCommand($gui);
166 break;
167
168 case 'ilmembershipgui':
169 $this->ctrl->setReturn($this, 'members');
170 include_once './Services/Membership/classes/class.ilMembershipMailGUI.php';
171 $mem = new ilMembershipMailGUI($this);
172 $this->ctrl->forwardCommand($mem);
173 break;
174
175 case "illearningprogressgui":
176 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
177 $new_gui = new ilLearningProgressGUI(
179 $this->object->getRefId(),
180 $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
181 );
182 $this->ctrl->forwardCommand($new_gui);
183 $this->tabs_gui->setTabActive('learning_progress');
184 break;
185
186 case "ilpropertyformgui":
187 // only case is currently adv metadata internal link in info settings, see #24497
188 if (!is_object($this->object)) {
189 $form = $this->initCreateForm("sess");
190 } else {
191 $form = $this->initForm("edit");
192 }
193 $ilCtrl->forwardCommand($form);
194 break;
195
196 case "ilbookinggatewaygui":
197 $tree = $DIC['tree'];
198 $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
199
200 $this->tabs_gui->activateTab('obj_tool_setting_booking');
201 $gui = new ilBookingGatewayGUI($this, $parent_id);
202 $this->ctrl->forwardCommand($gui);
203 break;
204
205 default:
206 if ($cmd == "applyFilter") {
207 $cmd == "applyFilter";
208 $this->$cmd();
209 } elseif ($cmd == "resetFilter") {
210 $cmd == "resetFilter";
211 $this->$cmd();
212 }
213 if (!$cmd) {
214 $cmd = "infoScreen";
215 }
216 $cmd .= "Object";
217 $this->$cmd();
218
219 break;
220 }
221
222 $this->addHeaderAction();
223
224 return true;
225 }
226
227
231 protected function membersObject()
232 {
233 $this->ctrl->redirectByClass('ilSessionMembershipGUI', 'participants');
234 }
235
240 public function getCurrentObject()
241 {
242 return $this->object;
243 }
244
248 public function prepareOutput($a_show_subobjects = true)
249 {
250 parent::prepareOutput($a_show_subobjects);
251
252 if (!$this->getCreationMode()) {
253 $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
254
255 include_once './Modules/Session/classes/class.ilSessionAppointment.php';
256 $this->tpl->setTitle(
257 $this->object->getFirstAppointment()->appointmentToString() . $title
258 );
259 }
260 }
261
269 public function registerObject()
270 {
271 global $DIC;
272
273 $ilUser = $DIC->user();
274 $ilAppEventHandler = $DIC['ilAppEventHandler'];
275
276 $this->checkPermission('visible');
277
278 include_once './Services/Membership/classes/class.ilParticipants.php';
279 $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
280
281 include_once './Modules/Session/classes/class.ilEventParticipants.php';
282 $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
283 $event_part->updateExcusedForUser($ilUser->getId(), false);
284
285 if (
286 $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
287 $this->getCurrentObject()->getRegistrationMaxUsers() and
288 (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
289 ) {
290 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
291 $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
292 $wait->addToList($ilUser->getId());
293 ilUtil::sendInfo($this->lng->txt('sess_reg_added_to_wl'), true);
294 $this->ctrl->redirect($this, 'infoScreen');
295 return true;
296 }
297
298
299 switch ($this->getCurrentObject()->getRegistrationType()) {
301 $this->ctrl->redirect($this, 'info');
302 break;
303
305 $part->register($ilUser->getId());
306 ilUtil::sendSuccess($this->lng->txt('event_registered'), true);
307
308 $ilAppEventHandler->raise(
309 "Modules/Session",
310 'enter',
311 array(
312 'obj_id' => $this->getCurrentObject()->getId(),
313 'ref_id' => $this->getCurrentObject()->getRefId(),
314 'usr_id' => $ilUser->getId()
315 )
316 );
317
318 $this->ctrl->redirect($this, 'infoScreen');
319 break;
320
322 ilUtil::sendSuccess($this->lng->txt('sess_registered_confirm'), true);
323 $part->addSubscriber($ilUser->getId());
324
325 $ilAppEventHandler->raise(
326 "Modules/Session",
327 'register',
328 array(
329 'obj_id' => $this->getCurrentObject()->getId(),
330 'ref_id' => $this->getCurrentObject()->getRefId(),
331 'usr_id' => $ilUser->getId()
332 )
333 );
334
335 $this->ctrl->redirect($this, 'infoScreen');
336 break;
337 }
338 }
339
344 public function joinObject()
345 {
346 global $DIC;
347
348 $ilUser = $DIC['ilUser'];
349
350 $this->checkPermission('read');
351
352 if ($ilUser->isAnonymous()) {
353 $this->ctrl->redirect($this, 'infoScreen');
354 }
355
356 include_once './Modules/Session/classes/class.ilEventParticipants.php';
357
358 if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) {
359 $_SESSION['sess_hide_info'] = true;
360 ilEventParticipants::_unregister($ilUser->getId(), $this->object->getId());
361 ilUtil::sendSuccess($this->lng->txt('event_unregistered'), true);
362 } else {
363 ilEventParticipants::_register($ilUser->getId(), $this->object->getId());
364 ilUtil::sendSuccess($this->lng->txt('event_registered'), true);
365 }
366
367 $this->ctrl->redirect($this, 'infoScreen');
368 }
369
377 public function unregisterObject($a_refuse_participation = false)
378 {
379 global $DIC;
380
381 $ilUser = $DIC->user();
382 $ilAppEventHandler = $DIC['ilAppEventHandler'];
383
384 include_once './Modules/Session/classes/class.ilSessionParticipants.php';
385 $part = ilSessionParticipants::getInstance($this->object->getRefId());
386 if ($part->isSubscriber($ilUser->getId())) {
387 $part->deleteSubscriber($ilUser->getId());
388 }
389
390 $part->unregister($ilUser->getId());
391
392 if ($a_refuse_participation) {
393 $event_part = new \ilEventParticipants($this->object->getId());
394 $event_part->updateExcusedForUser($ilUser->getId(), true);
395 }
396
397
398 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
399 ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
400
401 // check for visible permission of user
403 $GLOBALS['DIC']->access()->clear();
404 $has_access = $GLOBALS['DIC']->access()->checkAccessOfUser(
405 $GLOBALS['DIC']->user()->getId(),
406 'visible',
407 '',
408 $this->object->getRefId()
409 );
410 if (!$has_access) {
411 $parent = $GLOBALS['DIC']->repositoryTree()->getParentId($this->object->getRefId());
412 $this->redirectToRefId($parent);
413 return;
414 }
415
416 $ilAppEventHandler->raise(
417 "Modules/Session",
418 'unregister',
419 array(
420 'obj_id' => $this->getCurrentObject()->getId(),
421 'ref_id' => $this->getCurrentObject()->getRefId(),
422 'usr_id' => $ilUser->getId()
423 )
424 );
425 if ($a_refuse_participation) {
426 \ilUtil::sendInfo($this->lng->txt('sess_participation_refused_info'), true);
427 } else {
428 ilUtil::sendSuccess($this->lng->txt('event_unregistered'), true);
429 }
430 $this->ctrl->returnToParent($this);
431 }
432
441 public static function _goto($a_target)
442 {
443 global $DIC;
444
445 $ilAccess = $DIC->access();
446 $ilErr = $DIC["ilErr"];
447 $lng = $DIC->language();
448
449 $ilCtrl = $DIC->ctrl();
450 $parts = explode('_', $a_target);
451 $a_target = $parts[0];
452
453 if ($ilAccess->checkAccess('write', '', $a_target)) {
454 if (isset($parts[1]) && 'part' === $parts[1]) {
455 $ilCtrl->initBaseClass('ilRepositoryGUI');
456 $ilCtrl->setParameterByClass('ilSessionMembershipGUI', 'ref_id', (int) $a_target);
457 $ilCtrl->setTargetScript('ilias.php');
458 $ilCtrl->redirectByClass(array('ilRepositoryGUI', __CLASS__, 'ilSessionMembershipGUI'));
459 }
460 }
461
462 if ($ilAccess->checkAccess('visible', "", $a_target)) {
463 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
464 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
466 sprintf(
467 $lng->txt("msg_no_perm_read_item"),
469 ),
470 true
471 );
473 }
474 }
475
476
477
483 public function infoScreenObject()
484 {
485 $this->ctrl->setCmd("showSummary");
486 $this->ctrl->setCmdClass("ilinfoscreengui");
487 $this->infoScreen();
488 }
489
497 public function modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
498 {
499 global $DIC;
500
501 $tree = $DIC['tree'];
502
503 // if folder is in a course, modify item list gui according to course requirements
504 if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs')) {
505 // #10611
506 include_once "Services/Object/classes/class.ilObjectActivation.php";
507 ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
508
509 include_once("./Modules/Course/classes/class.ilObjCourse.php");
510 include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
511 $course_obj_id = ilObject::_lookupObjId($course_ref_id);
513 $a_item_list_gui,
514 get_class($this),
515 $a_item_data,
516 $a_show_path,
517 ilObjCourse::_lookupAboStatus($course_obj_id),
518 $course_ref_id,
519 $course_obj_id,
520 $this->object->getRefId()
521 );
522 }
523 }
524
530 public function showJoinRequestButtonInCalendar(ilToolbarGUI $a_ilToolbar)
531 {
532 $this->showJoinRequestButton($a_ilToolbar);
533 }
534
535
539 protected function refuseParticipationObject()
540 {
541 return $this->unregisterObject(true);
542 }
543
548 protected function showJoinRequestButton(ilToolbarGUI $ilToolbar = null)
549 {
550 global $DIC;
551
552 $ilUser = $DIC['ilUser'];
553
554 if (!$ilToolbar) {
555 global $DIC;
556
557 $ilToolbar = $DIC['ilToolbar'];
558 }
559
560 if (!$this->getCurrentObject()->enabledRegistration() || $ilUser->isAnonymous()) {
561 return false;
562 }
563
564 include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
565
566 include_once './Services/Membership/classes/class.ilParticipants.php';
567 $part = ilParticipants::getInstance($this->getCurrentObject()->getRefId());
568
569 include_once './Modules/Session/classes/class.ilEventParticipants.php';
570
571 $btn_attend = ilLinkButton::getInstance();
572 $btn_attend->addCSSClass("btn-primary");
573 $this->ctrl->setParameter($this, "ref_id", $this->getCurrentObject()->getRefId());
574
575 $btn_excused = \ilLinkButton::getInstance();
576 $btn_excused->setCaption($this->lng->txt('sess_bt_refuse'), false);
577 $btn_excused->setUrl($this->ctrl->getLinkTarget($this, 'refuseParticipation'));
578
579
580 if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId())) {
581 $ilToolbar->addButtonInstance($btn_excused);
582 return true;
583 } elseif ($part->isSubscriber($ilUser->getId())) {
584 $ilToolbar->addButtonInstance($btn_excused);
585 return true;
586 } elseif (ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId())) {
587 $ilToolbar->addButtonInstance($btn_excused);
588 return true;
589 }
590
591 $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
592
593 if (
594 $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
595 $this->getCurrentObject()->getRegistrationMaxUsers() and
596 (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
597 ) {
598 if ($this->getCurrentObject()->isRegistrationWaitingListEnabled()) {
599 ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded_wl'));
600 $btn_attend->setCaption($this->lng->txt("mem_add_to_wl"), false);
601 $btn_attend->setUrl($this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register"));
602 $ilToolbar->addButtonInstance($btn_attend);
603 if (!$event_part->isExcused($ilUser->getId())) {
604 $ilToolbar->addButtonInstance($btn_excused);
605 }
606 return true;
607 } else {
608 ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded'));
609 return true;
610 }
611 } else {
612 if (!isset($_SESSION['sess_hide_info'])) {
613 ilUtil::sendInfo($this->lng->txt('sess_join_info'));
614 $btn_attend->setCaption($this->lng->txt("join_session"), false);
615 $btn_attend->setUrl($this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI", "ilObjSessionGUI"), "register"));
616 $ilToolbar->addButtonInstance($btn_attend);
617 if (!$event_part->isExcused($ilUser->getId())) {
618 $ilToolbar->addButtonInstance($btn_excused);
619 }
620
621 return true;
622 }
623 }
624 }
625
626
627
635 public function infoScreen()
636 {
637 global $DIC;
638
639 $ilAccess = $DIC['ilAccess'];
640 $ilUser = $DIC['ilUser'];
641 $ilCtrl = $DIC['ilCtrl'];
642 $tree = $DIC['tree'];
643 $ilToolbar = $DIC['ilToolbar'];
644 $lng = $DIC['lng'];
645
646 $this->checkPermission('visible');
647 $this->tabs_gui->setTabActive('info_short');
648
649 $this->showJoinRequestButton();
650
651 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
652 $info = new ilInfoScreenGUI($this);
653 $info->enableBookingInfo(true);
654
655 $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
656 $parent_id = $tree->getParentId($this->object->getRefId());
657 $parent_id = ilObject::_lookupObjId($parent_id);
658 $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems(
659 'sess',
660 $this->object->getId(),
661 $eventItems
662 );
663
664 $lng->loadLanguageModule("cntr");// #14158
665
666 $html = '';
667 foreach ($eventItems as $item) {
668 $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
669 $list_gui->setContainerObject($this);
670
671 $this->modifyItemGUI($list_gui, $item, false);
672
673 $html .= $list_gui->getListItemHTML(
674 $item['ref_id'],
675 $item['obj_id'],
676 $item['title'],
677 $item['description']
678 );
679 }
680
681 if (strlen($html)) {
682 $info->addSection($this->lng->txt('event_materials'));
683 $info->addProperty(
684 '&nbsp;',
685 $html
686 );
687 }
688
689
690
691 // Session information
692 if (strlen($this->object->getLocation()) or strlen($this->object->getDetails())) {
693 $info->addSection($this->lng->txt('event_section_information'));
694 }
695 if (strlen($location = $this->object->getLocation())) {
696 $info->addProperty(
697 $this->lng->txt('event_location'),
698 ilUtil::makeClickable(nl2br($this->object->getLocation()), true)
699 );
700 }
701 if (strlen($this->object->getDetails())) {
702 $info->addProperty(
703 $this->lng->txt('event_details_workflow'),
704 ilUtil::makeClickable(nl2br($this->object->getDetails()), true)
705 );
706 }
707
708 $record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_INFO, 'sess', $this->object->getId());
709 $record_gui->setInfoObject($info);
710 $record_gui->parse();
711
712 // meta data
713 $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
714
715
716 // Tutor information
717 if ($this->object->hasTutorSettings()) {
718 $info->addSection($this->lng->txt('event_tutor_data'));
719 if (strlen($fullname = $this->object->getName())) {
720 $info->addProperty(
721 $this->lng->txt('event_lecturer'),
722 $fullname
723 );
724 }
725 if (strlen($email = $this->object->getEmail())) {
726 $info->addProperty(
727 $this->lng->txt('tutor_email'),
728 $email
729 );
730 }
731 if (strlen($phone = $this->object->getPhone())) {
732 $info->addProperty(
733 $this->lng->txt('tutor_phone'),
734 $phone
735 );
736 }
737 }
738
739 // support contacts
740 $parts = ilParticipants::getInstance($this->object->getRefId());
741 $contacts = $parts->getContacts();
742 if (count($contacts) > 0) {
743 $info->addSection($this->lng->txt("crs_mem_contacts"));
744 foreach ($contacts as $contact) {
745 $pgui = new ilPublicUserProfileGUI($contact);
746 $pgui->setBackUrl($this->ctrl->getLinkTargetByClass("ilinfoscreengui"));
747 $pgui->setEmbedded(true);
748 $info->addProperty("", $pgui->getHTML());
749 }
750 }
751
752 // forward the command
753 $this->ctrl->forwardCommand($info);
754
755 // store read event
756 require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
758 $this->object->getType(),
759 $this->object->getRefId(),
760 $this->object->getId(),
761 $ilUser->getId()
762 );
763 }
764
770 public function sendFileObject()
771 {
772 $file = new ilSessionFile((int) $_GET['file_id']);
773
774 ilUtil::deliverFile($file->getAbsolutePath(), $file->getFileName(), $file->getFileType());
775 return true;
776 }
777
778 protected function initCreateForm($a_new_type)
779 {
780 if (!is_object($this->object)) {
781 $this->object = new ilObjSession();
782 }
783 return $this->initForm('create');
784 }
785
792 {
793 $this->saveObject(false);
794
795 $this->ctrl->setParameter($this, 'ref_id', $this->object->getRefId());
796 $this->ctrl->setParameter($this, 'new_type', '');
797 $this->ctrl->redirect($this, 'materials');
798 }
799
807 public function saveObject($a_redirect_on_success = true)
808 {
809 global $DIC;
810
811 $ilErr = $DIC['ilErr'];
812 $ilUser = $DIC['ilUser'];
813
814 $this->object = new ilObjSession();
815
816 $this->ctrl->saveParameter($this, "new_type");
817
818 $form = $this->initForm('create');
819 $ilErr->setMessage('');
820 if (!$form->checkInput()) {
821 $form->setValuesByPost();
822 $ilErr->setMessage($this->lng->txt('err_check_input'));
823 $this->createObject($form);
824 return false;
825 }
826
827 if (
828 $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
829 !$this->record_gui->importEditFormPostValues()
830 ) {
831 $ilErr->setMessage($this->lng->txt('err_check_input'));
832 }
833
834 $this->load();
835 $this->loadRecurrenceSettings();
836
837 $this->object->validate();
838 $this->object->getFirstAppointment()->validate();
839
840 if (strlen($ilErr->getMessage())) {
841 ilUtil::sendFailure($ilErr->getMessage());
842 $this->form->setValuesByPost();
843 $this->createObject();
844 return false;
845 }
846 // Create session
847 $this->object->create();
848 $this->object->createReference();
849 $this->object->putInTree($_GET["ref_id"]);
850 $this->object->setPermissions($_GET["ref_id"]);
851
853 $this->object->getId(),
854 $this->form,
855 array(
857 )
858 );
859 if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
860 $this->record_gui->writeEditForm($this->object->getId());
861 }
862
863
864 // apply didactic template?
865 $dtpl = $this->getDidacticTemplateVar("dtpl");
866 if ($dtpl) {
867 $this->object->applyDidacticTemplate($dtpl);
868 }
869
870 // #14547 - active is default
871 if (!$this->form->getInput("lp_preset")) {
872 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
873 $lp_obj_settings = new ilLPObjSettings($this->object->getId());
874 $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
875 $lp_obj_settings->update(false);
876 }
877
878 // create appointment
879 $this->object->getFirstAppointment()->setSessionId($this->object->getId());
880 $this->object->getFirstAppointment()->create();
881
882 $this->handleFileUpload();
883
884 $DIC->object()->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
885
886 $this->createRecurringSessions($this->form->getInput("lp_preset"));
887
888 if ($a_redirect_on_success) {
889 ilUtil::sendInfo($this->lng->txt('event_add_new_event'), true);
890 $this->ctrl->returnToParent($this);
891 }
892
893 return true;
894 }
895
896 public function handleFileUpload()
897 {
898 global $DIC;
899
900 $tree = $DIC['tree'];
901
902 include_once './Modules/Session/classes/class.ilEventItems.php';
903 $ev = new ilEventItems($this->object->getId());
904 $items = $ev->getItems();
905
906 $counter = 0;
907 while (true) {
908 if (!isset($_FILES['files']['name'][$counter])) {
909 break;
910 }
911 if (!strlen($_FILES['files']['name'][$counter])) {
912 $counter++;
913 continue;
914 }
915
916 include_once './Modules/File/classes/class.ilObjFile.php';
917 $file = new ilObjFile();
918 $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
919 $file->setDescription('');
920 $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
921 $file->setFileType($_FILES['files']['type'][$counter]);
922 $file->setFileSize($_FILES['files']['size'][$counter]);
923 $file->create();
924 $new_ref_id = $file->createReference();
925 $file->putInTree($tree->getParentId($this->object->getRefId()));
926 $file->setPermissions($tree->getParentId($this->object->getRefId()));
927 $file->createDirectory();
928
929 $upload = $DIC->upload();
930 if (!$upload->hasBeenProcessed()) {
931 $upload->process();
932 }
933 $file->getUploadFile(
934 $_FILES['files']['tmp_name'][$counter],
935 $_FILES['files']['name'][$counter]
936 );
937
938 $items[] = $new_ref_id;
939 $counter++;
940 }
941
942 $ev->setItems($items);
943 $ev->update();
944 }
945
946
947
955 protected function createRecurringSessions($a_activate_lp = true)
956 {
957 global $DIC;
958
959 $tree = $DIC['tree'];
960
961 if (!$this->rec->getFrequenceType()) {
962 return true;
963 }
964 include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
965 $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(), $this->rec);
966
967 $period_start = clone $this->object->getFirstAppointment()->getStart();
968
969
970 $period_end = clone $this->object->getFirstAppointment()->getStart();
971 $period_end->increment(IL_CAL_YEAR, 5);
972 $date_list = $calc->calculateDateList($period_start, $period_end);
973
974 $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
975 $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
976 $parent_id = $tree->getParentId($this->object->getRefId());
977
978 include_once './Modules/Session/classes/class.ilEventItems.php';
979 $evi = new ilEventItems($this->object->getId());
980 $eitems = $evi->getItems();
981
982 $counter = 0;
983 foreach ($date_list->get() as $date) {
984 if (!$counter++) {
985 continue;
986 }
987
988 $new_obj = $this->object->cloneObject($parent_id);
989
990 // apply didactic template?
991 $dtpl = $this->getDidacticTemplateVar("dtpl");
992 if ($dtpl) {
993 $new_obj->applyDidacticTemplate($dtpl);
994 }
995
996 $new_obj->read();
997 $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
998 $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
999 $new_obj->getFirstAppointment()->update();
1000 $new_obj->update(true);
1001
1002 // #14547 - active is default
1003 if (!$a_activate_lp) {
1004 include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
1005 $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
1006 $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
1007 $lp_obj_settings->update(false);
1008 }
1009
1010 $new_evi = new ilEventItems($new_obj->getId());
1011 $new_evi->setItems($eitems);
1012 $new_evi->update();
1013 }
1014 }
1015
1016
1024 public function editObject()
1025 {
1026 $this->tabs_gui->setTabActive('settings');
1027
1028 $this->initForm('edit');
1029 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_edit.html', 'Modules/Session');
1030 $this->tpl->setVariable('EVENT_EDIT_TABLE', $this->form->getHTML());
1031
1032 if (!count($this->object->getFiles())) {
1033 return true;
1034 }
1035 $rows = array();
1036 foreach ($this->object->getFiles() as $file) {
1037 $table_data['id'] = $file->getFileId();
1038 $table_data['filename'] = $file->getFileName();
1039 $table_data['filetype'] = $file->getFileType();
1040 $table_data['filesize'] = $file->getFileSize();
1041
1042 $rows[] = $table_data;
1043 }
1044
1045 include_once("./Modules/Session/classes/class.ilSessionFileTableGUI.php");
1046 $table_gui = new ilSessionFileTableGUI($this, "edit");
1047 $table_gui->setTitle($this->lng->txt("event_files"));
1048 $table_gui->setData($rows);
1049 $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
1050 $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
1051 $table_gui->setSelectAllCheckbox("file_id");
1052 $this->tpl->setVariable('EVENT_FILE_TABLE', $table_gui->getHTML());
1053
1054 return true;
1055 }
1056
1060 public function updateObject() : bool
1061 {
1062 global $DIC;
1063
1064 $ilErr = $DIC['ilErr'];
1065
1066 $old_autofill = $this->object->hasWaitingListAutoFill();
1067
1068 $form = $this->initForm('edit');
1069 $ilErr->setMessage('');
1070 if (!$this->form->checkInput()) {
1071 $ilErr->setMessage($this->lng->txt('err_check_input'));
1072 $form->setValuesByPost();
1073 $this->editObject();
1074 return false;
1075 }
1076
1077 //Mantis 21972: Choose didactic template on settings screen
1078 $old_type = ilDidacticTemplateObjSettings::lookupTemplateId($this->object->getRefId());
1079
1080 $modified = false;
1081 $new_type_info = $form->getInput('didactic_type');
1082 if ($new_type_info) {
1083 $new_type = explode('_', $form->getInput('didactic_type'));
1084 $new_type = $new_type[1];
1085
1086 $modified = ($new_type != $old_type);
1087 $this->logger->info('Switched group type from ' . $old_type . ' to ' . $new_type);
1088 }
1089
1090 if (
1091 $this->record_gui instanceof \ilAdvancedMDRecordGUI &&
1092 !$this->record_gui->importEditFormPostValues()
1093 ) {
1094 $ilErr->setMessage($this->lng->txt('err_check_input'));
1095 }
1096
1097 $this->load();
1098
1099 $this->object->validate();
1100 $this->object->getFirstAppointment()->validate();
1101
1102 if (strlen($ilErr->getMessage())) {
1103 ilUtil::sendFailure($ilErr->getMessage());
1104 $this->editObject();
1105 return false;
1106 }
1107 // Update event
1108 $this->object->update();
1109 $this->object->getFirstAppointment()->update();
1110
1112 $this->object->getId(),
1113 $this->form,
1114 array(
1116 )
1117 );
1118 if ($this->record_gui instanceof \ilAdvancedMDRecordGUI) {
1119 $this->record_gui->writeEditForm();
1120 }
1121 $this->handleFileUpload();
1122
1123 $DIC->object()->commonSettings()->legacyForm($this->form, $this->object)->saveTileImage();
1124
1125 // if autofill has been activated trigger process
1126 if (!$old_autofill &&
1127 $this->object->hasWaitingListAutoFill()) {
1128 $this->object->handleAutoFill();
1129 }
1130
1131 //Mantis 21972: Choose didactic template on settings screen
1132 if ($modified) {
1133 if ($new_type == 0) {
1134 $new_type_txt = $this->lng->txt('il_sess_status_open');
1135 } else {
1136 $dtpl = new ilDidacticTemplateSetting($new_type);
1137 $new_type_txt = $dtpl->getPresentationTitle($this->lng->getLangKey());
1138 }
1139 $this->tabs_gui->activateTab('settings');
1140
1141 ilUtil::sendQuestion($this->lng->txt('sess_warn_sess_type_changed'));
1142 $confirm = new ilConfirmationGUI();
1143 $confirm->setFormAction($this->ctrl->getFormAction($this));
1144 $confirm->addItem(
1145 'sess_type',
1146 $new_type,
1147 $this->lng->txt('sess_info_new_sess_type') . ': ' . $new_type_txt
1148 );
1149 $confirm->addButton($this->lng->txt('sess_change_type'), 'updateSessionType');
1150 $confirm->setCancel($this->lng->txt('cancel'), 'edit');
1151
1152 $this->tpl->setContent($confirm->getHTML());
1153 return true;
1154 } else {
1155 ilUtil::sendSuccess($this->lng->txt('event_updated'), true);
1156 $this->ctrl->redirect($this, 'edit');
1157 #$this->object->initFiles();
1158 #$this->editObject();
1159 return true;
1160 }
1161 }
1162
1166 public function updateSessionTypeObject() : void
1167 {
1169 $this->object->getRefId(),
1170 $this->http->request()->getParsedBody()['sess_type']
1171 );
1172
1173 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1174 $this->ctrl->redirect($this, 'edit');
1175 }
1176
1185 {
1186 $this->tabs_gui->setTabActive('settings');
1187
1188 if (!count($_POST['file_id'])) {
1189 ilUtil::sendFailure($this->lng->txt('select_one'));
1190 $this->editObject();
1191 return false;
1192 }
1193
1194 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
1195 $c_gui = new ilConfirmationGUI();
1196
1197 // set confirm/cancel commands
1198 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
1199 $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
1200 $c_gui->setCancel($this->lng->txt("cancel"), "edit");
1201 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
1202
1203 // add items to delete
1204 foreach ($_POST["file_id"] as $file_id) {
1205 $file = new ilSessionFile($file_id);
1206 if ($file->getSessionId() != $this->object->getEventId()) {
1207 ilUtil::sendFailure($this->lng->txt('select_one'));
1208 $this->edit();
1209 return false;
1210 }
1211 $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
1212 }
1213
1214 $this->tpl->setContent($c_gui->getHTML());
1215 return true;
1216 }
1217
1225 public function deleteFilesObject()
1226 {
1227 if (!count($_POST['file_id'])) {
1228 ilUtil::sendFailure($this->lng->txt('select_one'));
1229 $this->editObject();
1230 return false;
1231 }
1232 foreach ($_POST['file_id'] as $id) {
1233 $file = new ilSessionFile($id);
1234 $file->delete();
1235 }
1236 $this->object->initFiles();
1237 $this->editObject();
1238 return true;
1239 }
1240
1241 protected function initContainer($a_init_participants = false)
1242 {
1243 global $DIC;
1244
1245 $tree = $DIC['tree'];
1246
1247 $is_course = $is_group = false;
1248
1249 // #13178
1250 $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'grp');
1251 if ($this->container_ref_id) {
1252 $is_group = true;
1253 }
1254 if (!$this->container_ref_id) {
1255 $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1256 if ($this->container_ref_id) {
1257 $is_course = true;
1258 }
1259 }
1260 if (!$this->container_ref_id) {
1261 ilUtil::sendFailure('No container object found. Aborting');
1262 return true;
1263 }
1264 $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
1265
1266 if ($a_init_participants && $this->container_obj_id) {
1267 if ($is_course) {
1268 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
1269 return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
1270 } elseif ($is_group) {
1271 include_once './Modules/Group/classes/class.ilGroupParticipants.php';
1272 return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
1273 }
1274 }
1275 }
1276
1280 public function materialsObject()
1281 {
1282 global $DIC;
1283
1284 $tree = $DIC['tree'];
1285 $objDefinition = $DIC['objDefinition'];
1286
1287 $this->tabs_gui->activateTab('materials');
1288
1289 // #11337 - support ANY parent container (crs, grp, fld)
1290 $parent_ref_id = $tree->getParentId($this->object->getRefId());
1291
1292 include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
1293 $gui = new ilObjectAddNewItemGUI($parent_ref_id);
1294 $gui->setDisabledObjectTypes(
1295 array_merge(
1296 [
1297 'itgr', 'sess'
1298 ],
1299 $objDefinition->getSideBlockTypes()
1300 )
1301 );
1302 $gui->setAfterCreationCallback($this->ref_id);
1303 $gui->render();
1304
1305 include_once 'Modules/Session/classes/class.ilEventItems.php';
1306 $this->event_items = new ilEventItems($this->object->getId());
1307
1308 include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1309 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1310
1311 $tbl->setDisableFilterHiding(true);
1312
1313 $tbl->addMultiCommand('saveMaterials', $this->lng->txt('sess_assign'));
1314 $tbl->addMultiCommand("removeMaterials", $this->lng->txt("remove"));
1315
1316 $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
1317 $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
1318
1319 $tbl->setMaterialItems($this->event_items->getItems());
1320 $tbl->setContainerRefId($this->getContainerRefId());
1321 $data = $tbl->getDataFromDb();
1322 $tbl->setMaterials($data);
1323
1324 $this->tpl->setContent($tbl->getHTML());
1325 }
1326
1330 public function applyFilter()
1331 {
1332 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1333 $tbl->writeFilterToSession(); // writes filter to session
1334 $tbl->resetOffset(); // sets record offest to 0 (first page)
1335 $this->ctrl->redirect($this, "materials");
1336 }
1337
1341 public function resetFilter()
1342 {
1343 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1344 $tbl->resetOffset(); // sets record offest to 0 (first page)
1345 $tbl->resetFilter(); // clears filter
1346 $this->ctrl->redirect($this, "materials");
1347 }
1348
1352 public function removeMaterialsObject()
1353 {
1354 $items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1355
1356 $this->event_items = new ilEventItems($this->object->getId());
1357 $this->event_items->removeItems($items_checked);
1358
1359 $this->postUpdateMaterials();
1360 }
1361
1362
1368 public function saveMaterialsObject()
1369 {
1370 include_once './Modules/Session/classes/class.ilEventItems.php';
1371
1372 $this->event_items = new ilEventItems($this->object->getId());
1373 $db_items = $this->event_items->getItems();
1374
1375 $list_items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1376 $list_items_checked = array_map('intval', $list_items_checked);
1377
1378 $items_to_save = array_merge($db_items, $list_items_checked);
1379 $items_to_save = array_unique($items_to_save);
1380
1381 $this->event_items->setItems($items_to_save);
1382 $this->event_items->update();
1383 $this->postUpdateMaterials();
1384 }
1385
1389 public function postUpdateMaterials()
1390 {
1391 include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1392 $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1393 $tbl->setOffset(0);
1394 $tbl->storeNavParameter();//remove offset and go to page 1
1395
1396 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1397 $this->ctrl->redirect($this, 'materials');
1398 }
1399
1400
1407 public function attendanceListObject()
1408 {
1409 global $DIC;
1410
1411 $tpl = $DIC['tpl'];
1412 $ilTabs = $DIC['ilTabs'];
1413
1414 $this->checkPermission('manage_members');
1415 $ilTabs->setTabActive('event_edit_members');
1416
1417 $list = $this->initAttendanceList();
1418 $form = $list->initForm('printAttendanceList');
1419 $tpl->setContent($form->getHTML());
1420 }
1421
1427 protected function initAttendanceList()
1428 {
1429 $members_obj = $this->initContainer(true);
1430
1431 include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1432 $list = new ilAttendanceList(
1433 $this,
1434 $this->object,
1435 $members_obj
1436 );
1437 $list->setId('sessattlst');
1438
1439 $event_app = $this->object->getFirstAppointment();
1441 $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd());
1443 $desc .= " " . $this->object->getTitle();
1444 $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1445
1446 $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1447 $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1448 if ($this->object->enabledRegistration()) {
1449 $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1450 }
1451 $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1452 $list->addBlank($this->lng->txt('sess_signature'));
1453
1454 $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1455
1456 return $list;
1457 }
1458
1464 protected function printAttendanceListObject()
1465 {
1466 $this->checkPermission('manage_members');
1467
1468 $list = $this->initAttendanceList();
1469 $list->initFromForm();
1470 $list->setCallback(array($this, 'getAttendanceListUserData'));
1471
1472 include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1473 $this->event_part = new ilEventParticipants($this->object->getId());
1474
1475 echo $list->getFullscreenHTML();
1476 exit();
1477 }
1478
1488 public function getAttendanceListUserData($a_user_id, $a_filters)
1489 {
1490 $data = $this->event_part->getUser($a_user_id);
1491
1492 if ($a_filters && $a_filters["registered"] && !$data["registered"]) {
1493 return;
1494 }
1495
1496 $data['registered'] = $data['registered'] ?
1497 $this->lng->txt('yes') :
1498 $this->lng->txt('no');
1499 $data['participated'] = $data['participated'] ?
1500 $this->lng->txt('yes') :
1501 $this->lng->txt('no');
1502
1503 return $data;
1504 }
1505
1513 public function eventsListObject()
1514 {
1515 global $DIC;
1516
1517 $ilErr = $DIC['ilErr'];
1518 $ilAccess = $DIC['ilAccess'];
1519 $ilUser = $DIC['ilUser'];
1520 $tree = $DIC['tree'];
1521
1522 if (!$ilAccess->checkAccess('manage_members', '', $this->object->getRefId())) {
1523 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
1524 }
1525
1526 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session');
1527 $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export'));
1528
1529 include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1530
1531 $this->tpl->addBlockfile("EVENTS_TABLE", "events_table", "tpl.table.html");
1532 $this->tpl->addBlockfile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session');
1533
1534 $members_obj = $this->initContainer(true);
1535 $members = $members_obj->getParticipants();
1536 $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id');
1537
1538 // Table
1539 $tbl = new ilTableGUI();
1540 $tbl->setTitle(
1541 $this->lng->txt("event_overview"),
1542 'icon_usr.svg',
1543 $this->lng->txt('obj_usr')
1544 );
1545 $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']);
1546
1547 $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs');
1548 $events = array();
1549 foreach ($tree->getSubtree($tree->getNodeData($course_ref_id), false, 'sess') as $event_id) {
1550 $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false);
1551 if (!is_object($tmp_event) or $tmp_event->getType() != 'sess') {
1552 continue;
1553 }
1554 $events[] = $tmp_event;
1555 }
1556
1557 $headerNames = array();
1558 $headerVars = array();
1559 $colWidth = array();
1560
1561 $headerNames[] = $this->lng->txt('name');
1562 $headerVars[] = "name";
1563 $colWidth[] = '20%';
1564
1565 for ($i = 1; $i <= count($events); $i++) {
1566 $headerNames[] = $i;
1567 $headerVars[] = "event_" . $i;
1568 $colWidth[] = 80 / count($events) . "%";
1569 }
1570
1571 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
1572 $tbl->setHeaderNames($headerNames);
1573 $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this, 'eventsList'));
1574 $tbl->setColumnWidth($colWidth);
1575
1576 $tbl->setOrderColumn($_GET["sort_by"]);
1577 $tbl->setOrderDirection($_GET["sort_order"]);
1578 $tbl->setOffset($_GET["offset"]);
1579 $tbl->setLimit($ilUser->getPref("hits_per_page"));
1580 $tbl->setMaxCount(count($members));
1581 $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
1582
1583 $sliced_users = array_slice($members, $_GET['offset'], $_SESSION['tbl_limit']);
1584 $tbl->disable('sort');
1585 $tbl->render();
1586
1587 $counter = 0;
1588 foreach ($sliced_users as $user_id) {
1589 foreach ($events as $event_obj) {
1590 $this->tpl->setCurrentBlock("eventcols");
1591
1592 $event_part = new ilEventParticipants($this->object->getId());
1593
1594 {
1595 $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1596 ilUtil::getImagePath('icon_ok.svg') :
1597 ilUtil::getImagePath('icon_not_ok.svg'));
1598
1599 $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1600 $this->lng->txt('event_participated') :
1601 $this->lng->txt('event_not_participated'));
1602 }
1603
1604 $this->tpl->parseCurrentBlock();
1605 }
1606
1607 $this->tpl->setCurrentBlock("tbl_content");
1608 $name = ilObjUser::_lookupName($user_id);
1609 $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
1610 $this->tpl->setVariable("LASTNAME", $name['lastname']);
1611 $this->tpl->setVariable("FIRSTNAME", $name['firstname']);
1612 $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id));
1613 $this->tpl->parseCurrentBlock();
1614 }
1615
1616 $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1617 $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1618 $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1619 $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1620 $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time"));
1621 $i = 1;
1622 foreach ($events as $event_obj) {
1623 $this->tpl->setCurrentBlock("legend_loop");
1624 $this->tpl->setVariable("LEGEND_CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2'));
1625 $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1626 $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1627 $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1628 $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1629 $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1630 $this->tpl->parseCurrentBlock();
1631 }
1632 }
1633
1637 protected function initForm(string $a_mode) : ilPropertyFormGUI
1638 {
1639 global $DIC;
1640
1641 $ilUser = $DIC['ilUser'];
1642
1643 if (is_object($this->form)) {
1644 return $this->form;
1645 }
1646
1647 $this->lng->loadLanguageModule('dateplaner');
1648
1649 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1650
1651 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1653
1654 $this->form = new ilPropertyFormGUI();
1655 $this->form->setMultipart(true);
1656 $this->form->setTableWidth('600px');
1657 $this->form->setFormAction($this->ctrl->getFormAction($this));
1658 $this->form->setMultipart(true);
1659
1660 $this->form = $this->initDidacticTemplate($this->form);
1661
1662 $this->lng->loadLanguageModule('dateplaner');
1663 include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1664 $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event');
1665 $dur->setRequired(true);
1666 $dur->enableToggleFullTime(
1667 $this->lng->txt('event_fulltime_info'),
1668 $this->object->getFirstAppointment()->enabledFulltime() ? true : false
1669 );
1670 $dur->setShowTime(true);
1671 $dur->setStart($this->object->getFirstAppointment()->getStart());
1672 $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1673
1674 $this->form->addItem($dur);
1675
1676
1677 // Recurrence
1678 if ($a_mode == 'create') {
1679 if (!is_object($this->rec)) {
1680 include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1681 $this->rec = new ilEventRecurrence();
1682 }
1683 include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1684 $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
1685 $rec->allowUnlimitedRecurrences(false);
1686 $rec->setRecurrence($this->rec);
1687 $this->form->addItem($rec);
1688
1689 // #14547
1690 $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1691 $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1692 $lp->setChecked(true);
1693 $this->form->addItem($lp);
1694 }
1695
1697 $section->setTitle($this->lng->txt('event_section_information'));
1698 $this->form->addItem($section);
1699
1700 // title
1701 $title = new ilTextInputGUI($this->lng->txt('event_title'), 'title');
1702 $title->setRequired(true);
1703 $title->setValue($this->object->getTitle());
1704 $title->setSize(50);
1705 $title->setMaxLength(70);
1706 $this->form->addItem($title);
1707
1708 // desc
1709 $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'), 'desc');
1710 $desc->setValue($this->object->getLongDescription());
1711 $desc->setRows(4);
1712 $desc->setCols(50);
1713 $this->form->addItem($desc);
1714
1715 // location
1716 $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'), 'location');
1717 $desc->setValue($this->object->getLocation());
1718 $desc->setRows(4);
1719 $desc->setCols(50);
1720 $this->form->addItem($desc);
1721
1722 // workflow
1723 $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'), 'details');
1724 $details->setValue($this->object->getDetails());
1725 $details->setCols(50);
1726 $details->setRows(4);
1727 $this->form->addItem($details);
1728
1729 if ($a_mode == 'create') {
1730 $this->record_gui = new ilAdvancedMDRecordGUI(
1732 'sess'
1733 );
1734 $this->record_gui->setRefId((int) $_GET['ref_id']);
1735 $this->record_gui->setPropertyForm($this->form);
1736 $this->record_gui->parse();
1737 } elseif ($this->checkPermissionBool('edit_metadata')) {
1738 $this->record_gui = new ilAdvancedMDRecordGUI(
1740 'sess',
1741 $this->object->getId()
1742 );
1743 $this->record_gui->setPropertyForm($this->form);
1744 $this->record_gui->parse();
1745 }
1746
1747
1748 // section
1750 $section->setTitle($this->lng->txt('event_tutor_data'));
1751 $this->form->addItem($section);
1752
1753 // name
1754 $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'), 'tutor_name');
1755 $tutor_name->setValue($this->object->getName());
1756 $tutor_name->setSize(20);
1757 $tutor_name->setMaxLength(70);
1758 $this->form->addItem($tutor_name);
1759
1760 // email
1761 $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'), 'tutor_email');
1762 $tutor_email->setValue($this->object->getEmail());
1763 $tutor_email->setSize(20);
1764 $tutor_email->setMaxLength(70);
1765 $this->form->addItem($tutor_email);
1766
1767 // phone
1768 $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'), 'tutor_phone');
1769 $tutor_phone->setValue($this->object->getPhone());
1770 $tutor_phone->setSize(20);
1771 $tutor_phone->setMaxLength(70);
1772 $this->form->addItem($tutor_phone);
1773
1775 $section->setTitle($this->lng->txt('sess_section_reg'));
1776 $this->form->addItem($section);
1777
1778 include_once './Modules/Session/classes/class.ilSessionMembershipRegistrationSettingsGUI.php';
1779 include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
1781 $this,
1782 $this->object,
1783 array(
1788 )
1789 );
1790 $reg_settings->addMembershipFormElements($this->form, '');
1791
1792
1794 $section->setTitle($this->lng->txt('event_assign_files'));
1795 $this->form->addItem($section);
1796
1797 $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'), 'files');
1798 $files->setFilenames(array(0 => ''));
1799 $this->form->addItem($files);
1800
1802 $section->setTitle($this->lng->txt('sess_setting_header_presentation'));
1803 $this->form->addItem($section);
1804
1805 $DIC->object()->commonSettings()->legacyForm($this->form, $this->object)->addTileImage();
1806
1807 $features = new ilFormSectionHeaderGUI();
1808 $features->setTitle($this->lng->txt('obj_features'));
1809 $this->form->addItem($features);
1811 $this->object->getId(),
1812 $this->form,
1813 array(
1815 )
1816 );
1817
1818 $gallery = new ilCheckboxInputGUI($this->lng->txt('sess_show_members'), 'show_members');
1819 $gallery->setChecked($this->object->getShowMembers());
1820 $gallery->setInfo($this->lng->txt('sess_show_participants_info'));
1821 $this->form->addItem($gallery);
1822
1823
1824 // Show mail to members type
1825 $mail_type = new ilRadioGroupInputGUI($this->lng->txt('sess_mail_type'), 'mail_type');
1826 $mail_type->setValue($this->object->getMailToMembersType());
1827
1828 $mail_tutors = new ilRadioOption(
1829 $this->lng->txt('sess_mail_admins_only'),
1831 $this->lng->txt('sess_mail_admins_only_info')
1832 );
1833 $mail_type->addOption($mail_tutors);
1834
1835 $mail_all = new ilRadioOption(
1836 $this->lng->txt('sess_mail_all'),
1838 $this->lng->txt('sess_mail_all_info')
1839 );
1840 $mail_type->addOption($mail_all);
1841 $this->form->addItem($mail_type);
1842
1843
1844
1845 switch ($a_mode) {
1846 case 'create':
1847 $this->form->setTitle($this->lng->txt('event_table_create'));
1848 $this->form->addCommandButton('save', $this->lng->txt('event_btn_add'));
1849 $this->form->addCommandButton('saveAndAssignMaterials', $this->lng->txt('event_btn_add_edit'));
1850 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1851 return $this->form;
1852
1853 case 'edit':
1854 $this->form->setTitle($this->lng->txt('event_table_update'));
1855 $this->form->addCommandButton('update', $this->lng->txt('save'));
1856 $this->form->addCommandButton('cancelEdit', $this->lng->txt('cancel'));
1857 return $this->form;
1858 }
1859 return $this->form;
1860 }
1861
1869 protected function load()
1870 {
1871 $event = $this->form->getItemByPostVar('event');
1872 if ($event->getStart() && $event->getEnd()) {
1873 $this->object->getFirstAppointment()->setStartingTime($event->getStart()->get(IL_CAL_UNIX));
1874 $this->object->getFirstAppointment()->setEndingTime($event->getStart()->get(IL_CAL_UNIX));
1875 $this->object->getFirstAppointment()->setStart($event->getStart());
1876 $this->object->getFirstAppointment()->setEnd($event->getEnd());
1877 $this->object->getFirstAppointment()->toggleFulltime($event->getStart() instanceof ilDate);
1878 }
1879
1880 $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1881 $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1882 $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1883 $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1884 $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1885 $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1886 $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1887
1888 $this->object->setRegistrationNotificationEnabled(ilUtil::stripSlashes($_POST['registration_notification']));
1889 $this->object->setRegistrationNotificationOption(ilUtil::stripSlashes($_POST['notification_option']));
1890
1891 $this->object->setRegistrationType((int) $_POST['registration_type']);
1892 // $this->object->setRegistrationMinUsers((int) $_POST['registration_min_members']);
1893 $this->object->setRegistrationMaxUsers((int) $_POST['registration_max_members']);
1894 $this->object->enableRegistrationUserLimit((int) $_POST['registration_membership_limited']);
1895 $this->object->setShowMembers((int) $_POST['show_members']);
1896 $this->object->setMailToMembersType((int) $_POST['mail_type']);
1897
1898 switch ((int) $_POST['waiting_list']) {
1899 case 2:
1900 $this->object->enableRegistrationWaitingList(true);
1901 $this->object->setWaitingListAutoFill(true);
1902 break;
1903
1904 case 1:
1905 $this->object->enableRegistrationWaitingList(true);
1906 $this->object->setWaitingListAutoFill(false);
1907 break;
1908
1909 default:
1910 $this->object->enableRegistrationWaitingList(false);
1911 $this->object->setWaitingListAutoFill(false);
1912 break;
1913 }
1914 }
1915
1922 protected function loadRecurrenceSettings()
1923 {
1924 include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1925 $this->rec = new ilSessionRecurrence();
1926
1927 switch ($_POST['frequence']) {
1928 case IL_CAL_FREQ_DAILY:
1929 $this->rec->setFrequenceType($_POST['frequence']);
1930 $this->rec->setInterval((int) $_POST['count_DAILY']);
1931 break;
1932
1933 case IL_CAL_FREQ_WEEKLY:
1934 $this->rec->setFrequenceType($_POST['frequence']);
1935 $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1936 if (is_array($_POST['byday_WEEKLY'])) {
1937 $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',', $_POST['byday_WEEKLY'])));
1938 }
1939 break;
1940
1942 $this->rec->setFrequenceType($_POST['frequence']);
1943 $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1944 switch ((int) $_POST['subtype_MONTHLY']) {
1945 case 0:
1946 // nothing to do;
1947 break;
1948
1949 case 1:
1950 switch ((int) $_POST['monthly_byday_day']) {
1951 case 8:
1952 // Weekday
1953 $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1954 $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1955 break;
1956
1957 case 9:
1958 // Day of month
1959 $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1960 break;
1961
1962 default:
1963 $this->rec->setBYDAY((int) $_POST['monthly_byday_num'] . $_POST['monthly_byday_day']);
1964 break;
1965 }
1966 break;
1967
1968 case 2:
1969 $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1970 break;
1971 }
1972 break;
1973
1974 case IL_CAL_FREQ_YEARLY:
1975 $this->rec->setFrequenceType($_POST['frequence']);
1976 $this->rec->setInterval((int) $_POST['count_YEARLY']);
1977 switch ((int) $_POST['subtype_YEARLY']) {
1978 case 0:
1979 // nothing to do;
1980 break;
1981
1982 case 1:
1983 $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1984 $this->rec->setBYDAY((int) $_POST['yearly_byday_num'] . $_POST['yearly_byday']);
1985 break;
1986
1987 case 2:
1988 $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1989 $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1990 break;
1991 }
1992 break;
1993 }
1994
1995 // UNTIL
1996 switch ((int) $_POST['until_type']) {
1997 case 1:
1998 $this->rec->setFrequenceUntilDate(null);
1999 // nothing to do
2000 break;
2001
2002 case 2:
2003 $this->rec->setFrequenceUntilDate(null);
2004 $this->rec->setFrequenceUntilCount((int) $_POST['count']);
2005 break;
2006
2007 case 3:
2008 $frequence = $this->form->getItemByPostVar('frequence');
2009 $end = $frequence->getRecurrence()->getFrequenceUntilDate();
2010 $this->rec->setFrequenceUntilCount(0);
2011 $this->rec->setFrequenceUntilDate($end);
2012 break;
2013 }
2014 }
2015
2016
2024 protected function __toUnix($date, $time)
2025 {
2026 return mktime($time['h'], $time['m'], 0, $date['m'], $date['d'], $date['y']);
2027 }
2028
2035 public function addLocatorItems()
2036 {
2037 global $DIC;
2038
2039 $ilLocator = $DIC['ilLocator'];
2040
2041 if (!$this->getCreationMode()) {
2042 // see prepareOutput()
2043 include_once './Modules/Session/classes/class.ilSessionAppointment.php';
2044 $title = strlen($this->object->getTitle()) ? (': ' . $this->object->getTitle()) : '';
2045 $title = $this->object->getFirstAppointment()->appointmentToString() . $title;
2046
2047 $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
2048 }
2049 }
2050
2051
2056 {
2057 global $DIC;
2058
2059 $objDefinition = $DIC['objDefinition'];
2060
2061 $tree = $DIC->repositoryTree();
2062 $ctrl = $DIC->ctrl();
2063
2064 $parent_id = $tree->getParentId($this->object->getRefId());
2065
2066 // #11650
2067 $parent_type = ilObject::_lookupType($parent_id, true);
2068
2069 $parent_class = $objDefinition->getClassName($parent_type);
2070 $parent_class = 'ilObj' . $parent_class . 'GUI';
2071
2072 $ctrl->setParameterByClass($parent_class, "ref_id", $parent_id);
2073 $ctrl->redirectByClass($parent_class, "view");
2074 }
2075
2076
2083 public function getTabs()
2084 {
2085 global $DIC;
2086
2087 $ilAccess = $DIC['ilAccess'];
2088 $ilTabs = $DIC['ilTabs'];
2089 $tree = $DIC['tree'];
2090 $ilCtrl = $DIC['ilCtrl'];
2091 $ilHelp = $DIC['ilHelp'];
2092 $ilUser = $DIC->user();
2093
2094 $ilHelp->setScreenIdComponent("sess");
2095
2096 $parent_id = $tree->getParentId($this->object->getRefId());
2097
2098 // #11650
2099 $parent_type = ilObject::_lookupType($parent_id, true);
2100
2101 $this->tabs_gui->setBackTarget(
2102 $this->lng->txt('back_to_' . $parent_type . '_content'),
2103 $ilCtrl->getLinkTarget($this, "redirectToParentContentPage")
2104 );
2105
2106 $this->tabs_gui->addTarget(
2107 'info_short',
2108 $this->ctrl->getLinkTarget($this, 'infoScreen')
2109 );
2110
2111 if ($ilAccess->checkAccess('write', '', $this->object->getRefId())) {
2112 $this->tabs_gui->addTarget(
2113 'settings',
2114 $this->ctrl->getLinkTarget($this, 'edit')
2115 );
2116 }
2117 if ($ilAccess->checkAccess('manage_materials', '', $this->object->getRefId())) {
2118 $this->tabs_gui->addTab(
2119 'materials',
2120 $this->lng->txt('crs_materials'),
2121 $this->ctrl->getLinkTarget($this, 'materials')
2122 );
2123 }
2124
2125 // booking
2126 $tree = $DIC['tree'];
2127 $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
2128
2129 if ($ilAccess->checkAccess('write', '', $this->ref_id) && ilContainer::_lookupContainerSetting(
2130 ilObject::_lookupObjId($parent_id),
2132 false
2133 )) {
2134 $this->tabs_gui->addTarget(
2135 "obj_tool_setting_booking",
2136 $this->ctrl->getLinkTargetByClass(array("ilbookinggatewaygui"), "")
2137 );
2138 }
2139
2140 // member tab
2141 $is_participant = $this->object->getMembersObject()->isAssigned($ilUser->getId());
2142 $membership_gui = new ilSessionMembershipGUI($this, $this->object);
2143 $membership_gui->addMemberTab($this->tabs_gui, $is_participant);
2144
2145
2146 // learning progress
2147 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
2148 if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
2149 $this->tabs_gui->addTarget(
2150 'learning_progress',
2151 $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'), ''),
2152 '',
2153 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui')
2154 );
2155 }
2156
2157 // meta data
2158 if ($ilAccess->checkAccess('edit_metadata', '', $this->ref_id)) {
2159 $mdgui = new ilObjectMetaDataGUI($this->object);
2160 $mdtab = $mdgui->getTab();
2161 if ($mdtab) {
2162 $this->tabs_gui->addTab(
2163 "metadata",
2164 $this->lng->txt('meta_data'),
2165 $mdtab
2166 );
2167 }
2168 }
2169
2170 // export
2171 if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
2172 $this->tabs_gui->addTarget(
2173 "export",
2174 $this->ctrl->getLinkTargetByClass("ilexportgui", ""),
2175 "",
2176 "ilexportgui"
2177 );
2178 }
2179
2180
2181 // edit permissions
2182 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
2183 $this->tabs_gui->addTarget(
2184 "perm_settings",
2185 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"),
2186 array("perm","info","owner"),
2187 'ilpermissiongui'
2188 );
2189 }
2190 }
2191
2197 public function afterSaveCallback(ilObject $a_obj)
2198 {
2199 // add new object to materials
2200 include_once './Modules/Session/classes/class.ilEventItems.php';
2201 $event_items = new ilEventItems($this->object->getId());
2202 $event_items->addItem($a_obj->getRefId());
2203 $event_items->update();
2204
2205 /*
2206 ilUtil::sendSuccess($this->lng->txt("object_added"), true);
2207 $this->ctrl->redirect($this, "materials");
2208 */
2209 }
2210
2211
2215 public function readMemberData($a_usr_ids)
2216 {
2217 $tmp_data = array();
2218 foreach ($a_usr_ids as $usr_id) {
2219 $tmp_data[$usr_id] = array();
2220 }
2221 return $tmp_data;
2222 }
2223
2224
2225
2230 public function getContainerRefId()
2231 {
2232 if (!$this->container_ref_id) {
2233 $this->initContainer();
2234 }
2236 }
2237
2238
2244 protected function cancelEditObject()
2245 {
2246 global $DIC;
2247
2248 $ilCtrl = $DIC['ilCtrl'];
2249 $tree = $DIC['tree'];
2250
2251 $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
2252
2253 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2254
2255 $ilCtrl->redirectByClass("ilrepositorygui", "");
2256 }
2257
2258
2263 public function getDefaultMemberRole()
2264 {
2265 $local_roles = $GLOBALS['DIC']->rbac()->review()->getRolesOfRoleFolder($this->object->getRefId(), false);
2266
2267 foreach ($local_roles as $role_id) {
2268 $title = ilObject::_lookupTitle($role_id);
2269 if (substr($title, 0, 19) == 'il_sess_participant') {
2270 return $role_id;
2271 }
2272 }
2273 return 0;
2274 }
2275
2276
2281 public function getLocalRoles()
2282 {
2283 return $GLOBALS['DIC']->rbac()->review()->getRolesOfRoleFolder($this->object->getRefId(), false);
2284 }
2285
2286
2291 public function createMailSignature()
2292 {
2293 $link = chr(13) . chr(10) . chr(13) . chr(10);
2294 $link .= $this->lng->txt('sess_mail_permanent_link');
2295 $link .= chr(13) . chr(10) . chr(13) . chr(10);
2296 include_once './Services/Link/classes/class.ilLink.php';
2297 $link .= ilLink::_getLink($this->object->getRefId());
2298 return rawurlencode(base64_encode($link));
2299 }
2300
2304 protected function importFileObject($parent_id = null, $a_catch_errors = true)
2305 {
2307 $tpl = $this->tpl;
2309
2310 if (!$parent_id) {
2311 $parent_id = $_GET["ref_id"];
2312 }
2313 $new_type = $_REQUEST["new_type"];
2314
2315 // create permission is already checked in createObject. This check here is done to prevent hacking attempts
2316 if (!$this->checkPermissionBool("create", "", $new_type)) {
2317 $ilErr->raiseError($this->lng->txt("no_create_permission"));
2318 }
2319
2320 $this->lng->loadLanguageModule($new_type);
2321 $this->ctrl->setParameter($this, "new_type", $new_type);
2322
2323 $form = $this->initImportForm($new_type);
2324 if ($form->checkInput()) {
2325 // :todo: make some check on manifest file
2326 include_once("./Services/Export/classes/class.ilImport.php");
2327 $imp = new ilImport((int) $parent_id);
2328 try {
2329 $new_id = $imp->importObject(
2330 null,
2331 $_FILES["importfile"]["tmp_name"],
2332 $_FILES["importfile"]["name"],
2333 $new_type
2334 );
2335 } catch (ilException $e) {
2336 $this->tmp_import_dir = $imp->getTemporaryImportDir();
2337 if (!$a_catch_errors) {
2338 throw $e;
2339 }
2340 // display message and form again
2341 ilUtil::sendFailure($this->lng->txt("obj_import_file_error") . " <br />" . $e->getMessage());
2342 $form->setValuesByPost();
2343 $tpl->setContent($form->getHtml());
2344 return;
2345 }
2346
2347 if ($new_id > 0) {
2348 $this->ctrl->setParameter($this, "new_type", "");
2349 $newObj = ilObjectFactory::getInstanceByObjId($new_id);
2350 $this->afterImport($newObj);
2351 }
2352 // import failed
2353 else {
2354 if ($objDefinition->isContainer($new_type)) {
2355 ilUtil::sendFailure($this->lng->txt("container_import_zip_file_invalid"));
2356 } else {
2357 // not enough information here...
2358 return;
2359 }
2360 }
2361 }
2362
2363 // display form to correct errors
2364 $form->setValuesByPost();
2365 $tpl->setContent($form->getHtml());
2366 }
2367}
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)
Base class for ILIAS Exception handling.
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.
Import class.
Class ilInfoScreenGUI.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
Class ilObjUserTrackingGUI.
static getInstance()
Factory.
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 getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
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.
initImportForm($a_new_type)
Init object import form.
afterImport(ilObject $a_new_object)
Post (successful) object import hook.
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 IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
global $ilCtrl
Definition: ilias.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
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46
$rows
Definition: xhr_table.php:10