ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjSessionGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once('./Services/Object/classes/class.ilObjectGUI.php');
5 include_once('./Modules/Session/classes/class.ilObjSession.php');
6 include_once('./Modules/Session/classes/class.ilSessionFile.php');
7 include_once './Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php';
8 
21 {
22 
23 
24  public $lng;
25  public $ctrl;
26  public $tpl;
27 
28  protected $container_ref_id = 0;
29  protected $container_obj_id = 0;
30 
31  protected $files = array();
32 
40  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
41  {
42  global $ilCtrl, $lng, $tpl;
43 
44  $this->type = "sess";
45  parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
46 
47  $this->lng = $lng;
48  $this->lng->loadLanguageModule("event");
49  $this->lng->loadLanguageModule('crs');
50  $this->lng->loadLanguageModule('trac');
51  $this->lng->loadLanguageModule('sess');
52 
53 
54  $this->tpl = $tpl;
55  $this->ctrl = $ilCtrl;
56  }
57 
58 
65  public function executeCommand()
66  {
67  global $ilUser,$ilCtrl;
68 
69  $next_class = $this->ctrl->getNextClass($this);
70  $cmd = $this->ctrl->getCmd();
71 
72 
73  $this->prepareOutput();
74  switch($next_class)
75  {
76  case "ilinfoscreengui":
77  $this->checkPermission("visible");
78  $this->infoScreen(); // forwards command
79  break;
80 
81  case 'ilpermissiongui':
82  $this->tabs_gui->setTabActive('perm_settings');
83  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
84  $perm_gui = new ilPermissionGUI($this);
85  $ret = $this->ctrl->forwardCommand($perm_gui);
86  break;
87 
88  case 'ilobjectcopygui':
89  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
90  $cp = new ilObjectCopyGUI($this);
91  $cp->setType('sess');
92  $this->ctrl->forwardCommand($cp);
93  break;
94 
95  case "ilexportgui":
96 // $this->prepareOutput();
97  $this->tabs_gui->setTabActive("export");
98  include_once("./Services/Export/classes/class.ilExportGUI.php");
99  $exp_gui = new ilExportGUI($this);
100  $exp_gui->addFormat("xml");
101  $ret = $this->ctrl->forwardCommand($exp_gui);
102 // $this->tpl->show();
103  break;
104 
105  case "ilcommonactiondispatchergui":
106  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
108  $this->ctrl->forwardCommand($gui);
109  break;
110 
111  case 'ilmembershipgui':
112  $this->ctrl->setReturn($this,'members');
113  include_once './Services/Membership/classes/class.ilMembershipGUI.php';
114  $mem = new ilMembershipGUI($this);
115  $this->ctrl->forwardCommand($mem);
116  break;
117 
118  case "illearningprogressgui":
119  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
121  $this->object->getRefId(),
122  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
123  $this->ctrl->forwardCommand($new_gui);
124  $this->tabs_gui->setTabActive('learning_progress');
125  break;
126 
127  default:
128  if(!$cmd)
129  {
130  $cmd = "infoScreen";
131  }
132  $cmd .= "Object";
133  if ($cmd != "infoScreenObject")
134  {
135  $this->checkPermission("read");
136  }
137  else
138  {
139  $this->checkPermission("visible");
140  }
141  $this->$cmd();
142 
143  break;
144  }
145 
146  $this->addHeaderAction();
147 
148  return true;
149  }
150 
155  public function getCurrentObject()
156  {
157  return $this->object;
158  }
159 
163  protected function prepareOutput()
164  {
166 
167  if(!$this->getCreationMode())
168  {
169  $title = strlen($this->object->getTitle()) ? (': '.$this->object->getTitle()) : '';
170 
171  include_once './Modules/Session/classes/class.ilSessionAppointment.php';
172  $this->tpl->setTitle(
173  $this->object->getFirstAppointment()->appointmentToString().$title);
174  }
175  }
176 
184  public function registerObject()
185  {
186  global $ilUser;
187 
188  $this->checkPermission('read');
189 
190  include_once './Services/Membership/classes/class.ilParticipants.php';
191  $part = ilParticipants::getInstanceByObjId($this->getCurrentObject()->getId());
192 
193  include_once './Modules/Session/classes/class.ilEventParticipants.php';
194  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
195  if(
196  $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
197  $this->getCurrentObject()->getRegistrationMaxUsers() and
198  (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
199  )
200  {
201  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
202  $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
203  $wait->addToList($ilUser->getId());
204  ilUtil::sendInfo($this->lng->txt('sess_reg_added_to_wl'),TRUE);
205  $this->ctrl->redirect($this,'infoScreen');
206  return TRUE;
207  }
208 
209 
210  switch($this->getCurrentObject()->getRegistrationType())
211  {
213  $this->ctrl->redirect($this,'info');
214  break;
215 
217  $part->add($ilUser->getId());
218  ilUtil::sendSuccess($this->lng->txt('event_registered'),true);
219  $this->ctrl->redirect($this,'infoScreen');
220  break;
221 
223  ilUtil::sendSuccess($this->lng->txt('sess_registered_confirm'),true);
224  $part->addSubscriber($ilUser->getId());
225  $this->ctrl->redirect($this,'infoScreen');
226  break;
227  }
228  }
229 
234  public function joinObject()
235  {
236  global $ilUser;
237 
238  $this->checkPermission('read');
239 
240  if($ilUser->isAnonymous())
241  {
242  $this->ctrl->redirect($this,'infoScreen');
243  }
244 
245  include_once './Modules/Session/classes/class.ilEventParticipants.php';
246 
247  if(ilEventParticipants::_isRegistered($ilUser->getId(),$this->object->getId()))
248  {
249  $_SESSION['sess_hide_info'] = true;
250  ilEventParticipants::_unregister($ilUser->getId(),$this->object->getId());
251  ilUtil::sendSuccess($this->lng->txt('event_unregistered'),true);
252  }
253  else
254  {
255  ilEventParticipants::_register($ilUser->getId(),$this->object->getId());
256  ilUtil::sendSuccess($this->lng->txt('event_registered'),true);
257  }
258 
259  $this->ctrl->redirect($this,'infoScreen');
260  }
261 
268  public function unregisterObject()
269  {
270  global $ilUser;
271 
272  include_once './Modules/Session/classes/class.ilEventParticipants.php';
273  ilEventParticipants::_unregister($ilUser->getId(),$this->object->getId());
274 
275  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
276  ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
277 
278  ilUtil::sendSuccess($this->lng->txt('event_unregistered'),true);
279  $this->ctrl->returnToParent($this);
280  }
281 
290  public static function _goto($a_target)
291  {
292  global $ilAccess,$ilErr,$lng;
293 
294  if($ilAccess->checkAccess('visible', "", $a_target))
295  {
296  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
297  }
298  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
299  }
300 
304  public function addToDeskObject()
305  {
306  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
308  $this->infoScreenObject();
309  }
310 
314  public function removeFromDeskObject()
315  {
316  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
318  $this->infoScreenObject();
319  }
320 
321 
327  public function infoScreenObject()
328  {
329  $this->ctrl->setCmd("showSummary");
330  $this->ctrl->setCmdClass("ilinfoscreengui");
331  $this->infoScreen();
332  }
333 
337  function modifyItemGUI($a_item_list_gui,$a_item_data, $a_show_path)
338  {
339  global $tree;
340 
341  // if folder is in a course, modify item list gui according to course requirements
342  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs'))
343  {
344  // #10611
345  include_once "Services/Object/classes/class.ilObjectActivation.php";
346  ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
347 
348  include_once("./Modules/Course/classes/class.ilObjCourse.php");
349  include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
350  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
352  $a_item_list_gui,
353  get_class($this),
354  $a_item_data,
355  $a_show_path,
356  ilObjCourse::_lookupAboStatus($course_obj_id),
357  $course_ref_id,
358  $course_obj_id,
359  $this->object->getRefId());
360  }
361  }
362 
366  protected function showJoinRequestButton()
367  {
368  global $ilToolbar, $ilUser;
369 
370  if(!$this->getCurrentObject()->enabledRegistration() || $ilUser->isAnonymous())
371  {
372  return FALSE;
373  }
374 
375  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
376 
377  include_once './Services/Membership/classes/class.ilParticipants.php';
378  $part = ilParticipants::getInstanceByObjId($this->getCurrentObject()->getId());
379 
380  include_once './Modules/Session/classes/class.ilEventParticipants.php';
381  if(ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId()))
382  {
383  $ilToolbar->addFormButton($this->lng->txt('event_unregister'),'unregister');
384  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
385  return TRUE;
386  }
387  elseif($part->isSubscriber($ilUser->getId()))
388  {
389  $ilToolbar->addFormButton($this->lng->txt('event_unregister'),'unregister');
390  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
391  return TRUE;
392  }
393  elseif(ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId()))
394  {
395  $ilToolbar->addFormButton($this->lng->txt('leave_waiting_list'),'unregister');
396  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
397  return TRUE;
398  }
399 
400  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
401 
402  if(
403  $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
404  $this->getCurrentObject()->getRegistrationMaxUsers() and
405  (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
406  )
407  {
408  if($this->getCurrentObject()->isRegistrationWaitingListEnabled())
409  {
410  ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded_wl'));
411  $ilToolbar->addFormButton($this->lng->txt('mem_add_to_wl'),'register');
412  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
413  return TRUE;
414  }
415  else
416  {
417  ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded'));
418  return TRUE;
419  }
420  }
421  else
422  {
423  if(!isset($_SESSION['sess_hide_info']))
424  {
425  ilUtil::sendInfo($this->lng->txt('sess_join_info'));
426  $ilToolbar->addFormButton($this->lng->txt('join_session'),'register', '', true);
427  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
428  return TRUE;
429  }
430  }
431  }
432 
433 
434 
442  public function infoScreen()
443  {
444  global $ilAccess, $ilUser,$ilCtrl,$tree,$ilToolbar;
445 
446  $this->checkPermission('visible');
447  $this->tabs_gui->setTabActive('info_short');
448 
449  $appointment_obj = $this->object->getFirstAppointment();
450 
451  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
452  $info = new ilInfoScreenGUI($this);
453 
454  $this->showJoinRequestButton();
455 
456  // Session information
457  if(strlen($this->object->getLocation()) or strlen($this->object->getDetails()))
458  {
459  $info->addSection($this->lng->txt('event_section_information'));
460  }
461  if(strlen($location = $this->object->getLocation()))
462  {
463  $info->addProperty($this->lng->txt('event_location'),
464  nl2br($this->object->getLocation()));
465  }
466  if(strlen($this->object->getDetails()))
467  {
468  $info->addProperty($this->lng->txt('event_details_workflow'),
469  nl2br($this->object->getDetails()));
470  }
471 
472  // Tutor information
473  if($this->object->hasTutorSettings())
474  {
475  $info->addSection($this->lng->txt('event_tutor_data'));
476  if(strlen($fullname = $this->object->getName()))
477  {
478  $info->addProperty($this->lng->txt('event_lecturer'),
479  $fullname);
480  }
481  if(strlen($email = $this->object->getEmail()))
482  {
483  $info->addProperty($this->lng->txt('tutor_email'),
484  $email);
485  }
486  if(strlen($phone = $this->object->getPhone()))
487  {
488  $info->addProperty($this->lng->txt('tutor_phone'),
489  $phone);
490  }
491  }
492 
493 
494  $html = '';
495 
496  include_once './Services/Object/classes/class.ilObjectActivation.php';
497  include_once './Services/Container/classes/class.ilContainerSorting.php';
498  include_once './Modules/Session/classes/class.ilSessionObjectListGUIFactory.php';
499 
500  $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
501  $parent_id = $tree->getParentId($this->object->getRefId());
502  $parent_id = ilObject::_lookupObjId($parent_id);
503  $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems(
504  'sess',
505  $this->object->getId(),
506  $eventItems
507  );
508 
509  foreach($eventItems as $item)
510  {
511  $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
512  $list_gui->setContainerObject($this);
513 
514  $this->modifyItemGUI($list_gui, $item, false);
515 
516  $html .= $list_gui->getListItemHTML(
517  $item['ref_id'],
518  $item['obj_id'],
519  $item['title'],
520  $item['description']
521  );
522  }
523 
524  if(strlen($html))
525  {
526  $info->addSection($this->lng->txt('event_materials'));
527  $info->addProperty(
528  '&nbsp;',
529  $html);
530  }
531 
532  // forward the command
533  $this->ctrl->forwardCommand($info);
534 
535  // store read event
536  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
537  ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
538  $this->object->getId(), $ilUser->getId());
539  }
540 
546  public function sendFileObject()
547  {
548  $file = new ilSessionFile((int) $_GET['file_id']);
549 
550  ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
551  return true;
552  }
553 
554  protected function initCreateForm($a_new_type)
555  {
556  if(!is_object($this->object))
557  {
558  $this->object = new ilObjSession();
559  }
560  $this->initForm('create');
561  return $this->form;
562  }
563 
570  {
571  global $ilLog;
572 
573  $this->saveObject(false);
574 
575  /*
576  $this->ctrl->setParameter($this,'ref_id',$this->object->getRefId());
577  $target = $this->ctrl->getLinkTarget($this,'materials');
578  $target = str_replace('new_type=','nt=',$target);
579  */
580  $this->ctrl->setParameter($this,'ref_id',$this->object->getRefId());
581  $this->ctrl->redirect($this,'materials');
582  }
583 
591  public function saveObject($a_redirect_on_success = true)
592  {
593  global $ilErr,$ilUser;
594 
595  $this->object = new ilObjSession();
596 
597  $this->load();
598  $this->loadRecurrenceSettings();
599  $this->initForm('create');
600 
601  $ilErr->setMessage('');
602  if(!$this->form->checkInput()) {
603  $ilErr->setMessage($this->lng->txt('err_check_input'));
604  }
605 
606  $this->object->validate();
607  $this->object->getFirstAppointment()->validate();
608 
609  if(strlen($ilErr->getMessage()))
610  {
611  ilUtil::sendFailure($ilErr->getMessage().$_GET['ref_id']);
612  $this->createObject();
613  return false;
614  }
615  // Create session
616  $this->object->create();
617  $this->object->createReference();
618  $this->object->putInTree($_GET["ref_id"]);
619  $this->object->setPermissions($_GET["ref_id"]);
620 
621  // #14547 - active is default
622  if(!$this->form->getInput("lp_preset"))
623  {
624  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
625  $lp_obj_settings = new ilLPObjSettings($this->object->getId());
626  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
627  $lp_obj_settings->update(false);
628  }
629 
630  // create appointment
631  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
632  $this->object->getFirstAppointment()->create();
633 
634  $this->handleFileUpload();
635 
636  $this->createRecurringSessions($this->form->getInput("lp_preset"));
637 
638  if($a_redirect_on_success)
639  {
640  ilUtil::sendInfo($this->lng->txt('event_add_new_event'),true);
641  $this->ctrl->returnToParent($this);
642  }
643 
644  return true;
645 
646  }
647 
648  public function handleFileUpload()
649  {
650  global $tree;
651 
652  include_once './Modules/Session/classes/class.ilEventItems.php';
653  $ev = new ilEventItems($this->object->getId());
654  $items = $ev->getItems();
655 
656  $counter = 0;
657  while(true)
658  {
659  if(!isset($_FILES['files']['name'][$counter]))
660  {
661  break;
662  }
663  if(!strlen($_FILES['files']['name'][$counter]))
664  {
665  $counter++;
666  continue;
667  }
668 
669  include_once './Modules/File/classes/class.ilObjFile.php';
670  $file = new ilObjFile();
671  $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
672  $file->setDescription('');
673  $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
674  $file->setFileType($_FILES['files']['type'][$counter]);
675  $file->setFileSize($_FILES['files']['size'][$counter]);
676  $file->create();
677  $new_ref_id = $file->createReference();
678  $file->putInTree($tree->getParentId($this->object->getRefId()));
679  $file->setPermissions($tree->getParentId($this->object->getRefId()));
680  $file->createDirectory();
681  $file->getUploadFile(
682  $_FILES['files']['tmp_name'][$counter],
683  $_FILES['files']['name'][$counter]
684  );
685 
686  $items[] = $new_ref_id;
687  $counter++;
688 
689  }
690 
691  $ev->setItems($items);
692  $ev->update();
693  }
694 
695 
696 
704  protected function createRecurringSessions($a_activate_lp = true)
705  {
706  global $tree;
707 
708  if(!$this->rec->getFrequenceType())
709  {
710  return true;
711  }
712  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
713  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(),$this->rec);
714 
715  $period_start = clone $this->object->getFirstAppointment()->getStart();
716 
717 
718  $period_end = clone $this->object->getFirstAppointment()->getStart();
719  $period_end->increment(IL_CAL_YEAR,5);
720  $date_list = $calc->calculateDateList($period_start,$period_end);
721 
722  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
723  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
724  $parent_id = $tree->getParentId($this->object->getRefId());
725 
726  include_once './Modules/Session/classes/class.ilEventItems.php';
727  $evi = new ilEventItems($this->object->getId());
728  $eitems = $evi->getItems();
729 
730  $counter = 0;
731  foreach($date_list->get() as $date)
732  {
733  if(!$counter++)
734  {
735  continue;
736  }
737 
738  $new_obj = $this->object->cloneObject($parent_id);
739  $new_obj->read();
740  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
741  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
742  $new_obj->getFirstAppointment()->update();
743  $new_obj->update();
744 
745  // #14547 - active is default
746  if(!$a_activate_lp)
747  {
748  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
749  $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
750  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
751  $lp_obj_settings->update(false);
752  }
753 
754  $new_evi = new ilEventItems($new_obj->getId());
755  $new_evi->setItems($eitems);
756  $new_evi->update();
757  }
758  }
759 
760 
768  public function editObject()
769  {
770  $this->tabs_gui->setTabActive('settings');
771 
772  $this->initForm('edit');
773  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_edit.html','Modules/Session');
774  $this->tpl->setVariable('EVENT_EDIT_TABLE',$this->form->getHTML());
775 
776  if(!count($this->object->getFiles()))
777  {
778  return true;
779  }
780  $rows = array();
781  foreach($this->object->getFiles() as $file)
782  {
783  $table_data['id'] = $file->getFileId();
784  $table_data['filename'] = $file->getFileName();
785  $table_data['filetype'] = $file->getFileType();
786  $table_data['filesize'] = $file->getFileSize();
787 
788  $rows[] = $table_data;
789  }
790 
791  include_once("./Modules/Session/classes/class.ilSessionFileTableGUI.php");
792  $table_gui = new ilSessionFileTableGUI($this, "edit");
793  $table_gui->setTitle($this->lng->txt("event_files"));
794  $table_gui->setData($rows);
795  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
796  $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
797  $table_gui->setSelectAllCheckbox("file_id");
798  $this->tpl->setVariable('EVENT_FILE_TABLE',$table_gui->getHTML());
799 
800  return true;
801  }
802 
810  public function updateObject()
811  {
812  global $ilErr;
813 
814  $this->load();
815  $this->initForm('edit');
816 
817  $ilErr->setMessage('');
818  if(!$this->form->checkInput())
819  {
820  $ilErr->setMessage($this->lng->txt('err_check_input'));
821  }
822  $this->object->validate();
823  $this->object->getFirstAppointment()->validate();
824 
825  if(strlen($ilErr->getMessage()))
826  {
827  ilUtil::sendFailure($ilErr->getMessage());
828  $this->editObject();
829  return false;
830  }
831  // Update event
832  $this->object->update();
833  $this->object->getFirstAppointment()->update();
834 
835  $this->handleFileUpload();
836 
837  ilUtil::sendSuccess($this->lng->txt('event_updated'),true);
838  $this->ctrl->redirect($this,'edit');
839  #$this->object->initFiles();
840  #$this->editObject();
841  return true;
842  }
843 
851  public function confirmDeleteFilesObject()
852  {
853  $this->tabs_gui->setTabActive('settings');
854 
855  if(!count($_POST['file_id']))
856  {
857  ilUtil::sendFailure($this->lng->txt('select_one'));
858  $this->editObject();
859  return false;
860  }
861 
862  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
863  $c_gui = new ilConfirmationGUI();
864 
865  // set confirm/cancel commands
866  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
867  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
868  $c_gui->setCancel($this->lng->txt("cancel"), "edit");
869  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
870 
871  // add items to delete
872  foreach($_POST["file_id"] as $file_id)
873  {
874  $file = new ilSessionFile($file_id);
875  if($file->getSessionId() != $this->object->getEventId())
876  {
877  ilUtil::sendFailure($this->lng->txt('select_one'));
878  $this->edit();
879  return false;
880  }
881  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
882  }
883 
884  $this->tpl->setContent($c_gui->getHTML());
885  return true;
886  }
887 
895  public function deleteFilesObject()
896  {
897  if(!count($_POST['file_id']))
898  {
899  ilUtil::sendFailure($this->lng->txt('select_one'));
900  $this->editObject();
901  return false;
902  }
903  foreach($_POST['file_id'] as $id)
904  {
905  $file = new ilSessionFile($id);
906  $file->delete();
907  }
908  $this->object->initFiles();
909  $this->editObject();
910  return true;
911  }
912 
913  protected function initContainer($a_init_participants = false)
914  {
915  global $tree;
916 
917  $is_course = $is_group = false;
918 
919  // #13178
920  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'grp');
921  if($this->container_ref_id)
922  {
923  $is_group = true;
924  }
925  if(!$this->container_ref_id)
926  {
927  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
928  if($this->container_ref_id)
929  {
930  $is_course = true;
931  }
932  }
933  if(!$this->container_ref_id)
934  {
935  ilUtil::sendFailure('No container object found. Aborting');
936  return true;
937  }
938  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
939 
940  if($a_init_participants && $this->container_obj_id)
941  {
942  if($is_course)
943  {
944  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
945  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
946  }
947  else if($is_group)
948  {
949  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
950  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
951  }
952  }
953 
954  }
955 
963  public function materialsObject()
964  {
965  global $tree, $objDefinition;
966 
967  $this->tabs_gui->setTabActive('crs_materials');
968 
969  // #11337 - support ANY parent container (crs, grp, fld)
970  $parent_ref_id = $tree->getParentId($this->object->getRefId());
971 
972  include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
973  $gui = new ilObjectAddNewItemGUI($parent_ref_id);
974  $gui->setDisabledObjectTypes(array("itgr", "sess"));
975  $gui->setAfterCreationCallback($this->ref_id);
976  $gui->render();
977 
978  include_once 'Modules/Session/classes/class.ilEventItems.php';
979  $this->event_items = new ilEventItems($this->object->getId());
980 
981  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
982  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
983  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
984  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
985 
986  $tbl->setMaterialItems($this->event_items->getItems());
987  $tbl->setContainerRefId($this->getContainerRefId());
988  $tbl->getDataFromDb();
989 
990  $this->tpl->setContent($tbl->getHTML());
991  }
992 
1000  public function saveMaterialsObject()
1001  {
1002  include_once './Modules/Session/classes/class.ilEventItems.php';
1003 
1004  $this->event_items = new ilEventItems($this->object->getId());
1005 
1006  $list_items = is_array($_POST['all_items']) ? $_POST['all_items'] : array();
1007  $list_items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1008 
1009  $checked = $this->event_items->getItems();
1010  $checked = array_diff($checked, $list_items);//remove all visible items in list
1011  $checked = array_merge($checked, $list_items_checked);//add checked items in list
1012 
1013  $this->event_items->setItems($checked);
1014  $this->event_items->update();
1015 
1016  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1017  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1018  $tbl->setOffset(0);
1019  $tbl->storeNavParameter();//remove offset and go to page 1
1020 
1021  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1022  $this->ctrl->redirect($this,'materials');
1023  }
1024 
1029  protected function membersObject()
1030  {
1031  global $tree,$ilUser;
1032 
1033  $this->checkPermission('write');
1034  $this->tabs_gui->setTabActive('event_edit_members');
1035 
1036  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_members.html', 'Modules/Session');
1037 
1038  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1039  $toolbar = new ilToolbarGUI();
1040  $toolbar->addButton($this->lng->txt('sess_gen_attendance_list'),
1041  $this->ctrl->getLinkTarget($this,'attendanceList'));
1042 
1043  $this->tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
1044 
1045  $members_obj = $this->initContainer(true);
1046 
1047  include_once './Modules/Session/classes/class.ilEventParticipants.php';
1048 
1049  // Save hide/show table settings
1050  $this->setShowHidePrefs();
1051 
1052  // Waiting list table
1053  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
1054  $waiting_list = new ilSessionWaitingList($this->object->getId());
1055  if(count($wait = $waiting_list->getAllUsers()))
1056  {
1057  include_once('./Services/Membership/classes/class.ilWaitingListTableGUI.php');
1058  if($ilUser->getPref('sess_wait_hide'))
1059  {
1060  $table_gui = new ilWaitingListTableGUI($this,$waiting_list,false);
1061  $this->ctrl->setParameter($this,'wait_hide',0);
1062  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1063  $this->lng->txt('show'));
1064  $this->ctrl->clearParameters($this);
1065  }
1066  else
1067  {
1068  $table_gui = new ilWaitingListTableGUI($this,$waiting_list,true);
1069  $this->ctrl->setParameter($this,'wait_hide',1);
1070  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1071  $this->lng->txt('hide'));
1072  $this->ctrl->clearParameters($this);
1073  }
1074  $table_gui->setUsers($wait);
1075  $table_gui->setTitle($this->lng->txt('grp_header_waiting_list'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
1076  $this->tpl->setVariable('TABLE_WAIT',$table_gui->getHTML());
1077  }
1078 
1079  // subscribers
1080  // Subscriber table
1081  include_once './Services/Membership/classes/class.ilParticipants.php';
1082  $part = ilParticipants::getInstanceByObjId($this->object->getId());
1083  if($part->getSubscribers())
1084  {
1085  include_once('./Services/Membership/classes/class.ilSubscriberTableGUI.php');
1086  if($ilUser->getPref('grp_subscriber_hide'))
1087  {
1088  $table_gui = new ilSubscriberTableGUI($this,false, false);
1089  $this->ctrl->setParameter($this,'subscriber_hide',0);
1090  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1091  $this->lng->txt('show'));
1092  $this->ctrl->clearParameters($this);
1093  }
1094  else
1095  {
1096  $table_gui = new ilSubscriberTableGUI($this,true, false);
1097  $this->ctrl->setParameter($this,'subscriber_hide',1);
1098  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1099  $this->lng->txt('hide'));
1100  $this->ctrl->clearParameters($this);
1101  }
1102  $table_gui->readSubscriberData();
1103  $table_gui->setTitle($this->lng->txt('group_new_registrations'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
1104  $this->tpl->setVariable('TABLE_SUB',$table_gui->getHTML());
1105  }
1106 
1107 
1108  // Admins
1109  if(count($admins = $members_obj->getAdmins()))
1110  {
1111  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1112  if($ilUser->getPref('sess_admin_hide'))
1113  {
1115  $this->ctrl->setParameter($this,'admin_hide',0);
1116  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1117  $this->lng->txt('show'));
1118  $this->ctrl->clearParameters($this);
1119  }
1120  else
1121  {
1123  $this->ctrl->setParameter($this,'admin_hide',1);
1124  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1125  $this->lng->txt('hide'));
1126  $this->ctrl->clearParameters($this);
1127  }
1128 
1129  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1130  $table->setTitle($this->lng->txt('event_tbl_admins'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1131  $table->enableRegistration($this->object->enabledRegistration());
1132  $table->setParticipants($admins);
1133  $table->parse();
1134  $this->tpl->setVariable('ADMINS',$table->getHTML());
1135  }
1136 
1137  // Tutors
1138  if(count($tutors = $members_obj->getTutors()))
1139  {
1140  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1141  if($ilUser->getPref('sess_tutor_hide'))
1142  {
1144  $this->ctrl->setParameter($this,'tutor_hide',0);
1145  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1146  $this->lng->txt('show'));
1147  $this->ctrl->clearParameters($this);
1148  }
1149  else
1150  {
1152  $this->ctrl->setParameter($this,'tutor_hide',1);
1153  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1154  $this->lng->txt('hide'));
1155  $this->ctrl->clearParameters($this);
1156  }
1157  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1158  $table->setTitle($this->lng->txt('event_tbl_tutors'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1159  $table->enableRegistration($this->object->enabledRegistration());
1160  $table->setParticipants($tutors);
1161  $table->parse();
1162  $this->tpl->setVariable('TUTORS',$table->getHTML());
1163  }
1164 
1165  // Members
1166  if(count($members = $members_obj->getMembers()))
1167  {
1168  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1169  if($ilUser->getPref('sess_member_hide'))
1170  {
1172  $this->ctrl->setParameter($this,'member_hide',0);
1173  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1174  $this->lng->txt('show'));
1175  $this->ctrl->clearParameters($this);
1176  }
1177  else
1178  {
1180  $this->ctrl->setParameter($this,'member_hide',1);
1181  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1182  $this->lng->txt('hide'));
1183  $this->ctrl->clearParameters($this);
1184  }
1185  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1186  $table->setTitle($this->lng->txt('event_tbl_members'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1187  $table->enableRegistration($this->object->enabledRegistration());
1188  $table->setParticipants($members);
1189  $table->parse();
1190  $this->tpl->setVariable('MEMBERS',$table->getHTML());
1191  }
1192 
1193 
1194  $GLOBALS['lng']->loadLanguageModule('mmbr');
1195  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
1196  $this->tpl->setVariable('TXT_SELECTED_USER',$this->lng->txt('mmbr_selected_users'));
1197  $this->tpl->setVariable('BTN_FOOTER_MAIL',$this->lng->txt('mmbr_btn_mail_selected_users'));
1198  $this->tpl->setVariable('ARROW_DOWN',ilUtil::getImagePath('arrow_downright.svg'));
1199  }
1200 
1207  public function setShowHidePrefs()
1208  {
1209  global $ilUser;
1210 
1211  if(isset($_GET['admin_hide']))
1212  {
1213  $ilUser->writePref('sess_admin_hide',(int) $_GET['admin_hide']);
1214  }
1215  if(isset($_GET['tutor_hide']))
1216  {
1217  $ilUser->writePref('sess_tutor_hide',(int) $_GET['tutor_hide']);
1218  }
1219  if(isset($_GET['member_hide']))
1220  {
1221  $ilUser->writePref('sess_member_hide',(int) $_GET['member_hide']);
1222  }
1223  }
1224 
1232  public function updateMembersObject()
1233  {
1234  global $tree;
1235 
1236  $this->checkPermission('write');
1237 
1238 
1239 
1240  $this->initContainer();
1241 
1242  $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
1243  $_POST['registered'] = is_array($_POST['registered']) ? $_POST['registered'] : array();
1244 
1245  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1246 
1247  $visible = $_POST['visible_participants'] ? $_POST['visible_participants'] : array();
1248  foreach($visible as $user)
1249  {
1250  $part = new ilEventParticipants($this->object->getId());
1251  $part->setUserId($user);
1252  $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
1253  $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
1254  $part->setParticipated(isset($_POST['participants'][$user]) ? true : false);
1255  $part->setRegistered(isset($_POST['registered'][$user]) ? true : false);
1256  $part->updateUser();
1257  }
1258  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1259  $this->membersObject();
1260  }
1261 
1268  public function attendanceListObject()
1269  {
1270  global $tpl,$ilTabs;
1271 
1272  $this->checkPermission('write');
1273  $ilTabs->setTabActive('event_edit_members');
1274 
1275  $list = $this->initAttendanceList();
1276  $form = $list->initForm('printAttendanceList');
1277  $tpl->setContent($form->getHTML());
1278  }
1279 
1285  protected function initAttendanceList()
1286  {
1287  $members_obj = $this->initContainer(true);
1288 
1289  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1290  $list = new ilAttendanceList($this, $members_obj);
1291  $list->setId('sessattlst');
1292 
1293  $event_app = $this->object->getFirstAppointment();
1295  $desc = ilDatePresentation::formatPeriod($event_app->getStart(),$event_app->getEnd());
1297  $desc .= " ".$this->object->getTitle();
1298  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1299 
1300  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1301  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1302  if($this->object->enabledRegistration())
1303  {
1304  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1305  }
1306  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1307  $list->addBlank($this->lng->txt('sess_signature'));
1308 
1309  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1310 
1311  return $list;
1312  }
1313 
1319  protected function printAttendanceListObject()
1320  {
1321  $this->checkPermission('write');
1322 
1323  $list = $this->initAttendanceList();
1324  $list->initFromForm();
1325  $list->setCallback(array($this, 'getAttendanceListUserData'));
1326 
1327  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1328  $this->event_part = new ilEventParticipants($this->object->getId());
1329 
1330  echo $list->getFullscreenHTML();
1331  exit();
1332  }
1333 
1343  public function getAttendanceListUserData($a_user_id, $a_filters)
1344  {
1345  $data = $this->event_part->getUser($a_user_id);
1346 
1347  if($a_filters && $a_filters["registered"] && !$data["registered"])
1348  {
1349  return;
1350  }
1351 
1352  $data['registered'] = $data['registered'] ?
1353  $this->lng->txt('yes') :
1354  $this->lng->txt('no');
1355  $data['participated'] = $data['participated'] ?
1356  $this->lng->txt('yes') :
1357  $this->lng->txt('no');
1358 
1359  return $data;
1360  }
1361 
1369  public function eventsListObject()
1370  {
1371  global $ilErr,$ilAccess, $ilUser,$tree;
1372 
1373  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
1374  {
1375  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
1376  }
1377 
1378  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_list.html','Modules/Session');
1379  $this->__showButton($this->ctrl->getLinkTarget($this,'exportCSV'),$this->lng->txt('event_csv_export'));
1380 
1381  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1382 
1383  $this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
1384  $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.sess_list_row.html','Modules/Session');
1385 
1386  $members_obj = $this->initContainer(true);
1387  $members = $members_obj->getParticipants();
1388  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
1389 
1390  // Table
1391  $tbl = new ilTableGUI();
1392  $tbl->setTitle($this->lng->txt("event_overview"),
1393  'icon_usr.svg',
1394  $this->lng->txt('obj_usr'));
1395  $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
1396 
1397  $course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
1398  $events = array();
1399  foreach($tree->getSubtree($tree->getNodeData($course_ref_id),false,'sess') as $event_id)
1400  {
1401  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
1402  if(!is_object($tmp_event) or $tmp_event->getType() != 'sess')
1403  {
1404  continue;
1405  }
1406  $events[] = $tmp_event;
1407  }
1408 
1409  $headerNames = array();
1410  $headerVars = array();
1411  $colWidth = array();
1412 
1413  $headerNames[] = $this->lng->txt('name');
1414  $headerVars[] = "name";
1415  $colWidth[] = '20%';
1416 
1417  for ($i = 1; $i <= count($events); $i++)
1418  {
1419  $headerNames[] = $i;
1420  $headerVars[] = "event_".$i;
1421  $colWidth[] = 80/count($events)."%";
1422  }
1423 
1424  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1425  $tbl->setHeaderNames($headerNames);
1426  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'eventsList'));
1427  $tbl->setColumnWidth($colWidth);
1428 
1429  $tbl->setOrderColumn($_GET["sort_by"]);
1430  $tbl->setOrderDirection($_GET["sort_order"]);
1431  $tbl->setOffset($_GET["offset"]);
1432  $tbl->setLimit($ilUser->getPref("hits_per_page"));
1433  $tbl->setMaxCount(count($members));
1434  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1435 
1436  $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
1437  $tbl->disable('sort');
1438  $tbl->render();
1439 
1440  $counter = 0;
1441  foreach($sliced_users as $user_id)
1442  {
1443  foreach($events as $event_obj)
1444  {
1445  $this->tpl->setCurrentBlock("eventcols");
1446 
1447  $event_part = new ilEventParticipants($this->object->getId());
1448 
1449  {
1450  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1451  ilUtil::getImagePath('icon_ok.svg') :
1452  ilUtil::getImagePath('icon_not_ok.svg'));
1453 
1454  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1455  $this->lng->txt('event_participated') :
1456  $this->lng->txt('event_not_participated'));
1457  }
1458 
1459  $this->tpl->parseCurrentBlock();
1460  }
1461 
1462  $this->tpl->setCurrentBlock("tbl_content");
1463  $name = ilObjUser::_lookupName($user_id);
1464  $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1465  $this->tpl->setVariable("LASTNAME",$name['lastname']);
1466  $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
1467  $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
1468  $this->tpl->parseCurrentBlock();
1469  }
1470 
1471  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1472  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1473  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1474  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1475  $this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
1476  $i = 1;
1477  foreach($events as $event_obj)
1478  {
1479  $this->tpl->setCurrentBlock("legend_loop");
1480  $this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1481  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1482  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1483  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1484  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1485  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1486  $this->tpl->parseCurrentBlock();
1487  }
1488 
1489  }
1490 
1496  protected function initForm($a_mode)
1497  {
1498  global $ilUser;
1499 
1500  if(is_object($this->form))
1501  {
1502  return true;
1503  }
1504 
1505  $this->lng->loadLanguageModule('dateplaner');
1506 
1507  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1508 
1509  include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1511 
1512  $this->form = new ilPropertyFormGUI();
1513  $this->form->setMultipart(true);
1514  $this->form->setTableWidth('600px');
1515  $this->form->setFormAction($this->ctrl->getFormAction($this));
1516  $this->form->setMultipart(true);
1517 
1518  /*
1519  $full = new ilCheckboxInputGUI('','fulltime');
1520  $full->setChecked($this->object->getFirstAppointment()->enabledFulltime() ? true : false);
1521  $full->setOptionTitle($this->lng->txt('event_fulltime_info'));
1522  $full->setAdditionalAttributes('onchange="ilToggleSessionTime(this);"');
1523  #$this->form->addItem($full);
1524  */
1525 
1526  $this->lng->loadLanguageModule('dateplaner');
1527  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1528  #$this->tpl->addJavaScript('./Modules/Session/js/toggle_session_time.js');
1529  $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
1530  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'),'event');
1531  $dur->setStartText($this->lng->txt('event_start_date'));
1532  $dur->setEndText($this->lng->txt('event_end_date'));
1533  $dur->enableToggleFullTime(
1534  $this->lng->txt('event_fulltime_info'),
1535  $this->object->getFirstAppointment()->enabledFulltime() ? true : false
1536  );
1537  $dur->setShowTime(true);
1538  $dur->setStart($this->object->getFirstAppointment()->getStart());
1539  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1540 
1541  $this->form->addItem($dur);
1542 
1543  /*
1544  // start
1545  $start = new ilDateTimeInputGUI($this->lng->txt('event_start_date'),'start');
1546  $start->setMinuteStepSize(5);
1547  $start->setDate($this->object->getFirstAppointment()->getStart());
1548  $start->setShowTime(true);
1549  #$this->form->addItem($start);
1550 
1551  // end
1552  $end = new ilDateTimeInputGUI($this->lng->txt('event_end_date'),'end');
1553  $end->setMinuteStepSize(5);
1554  $end->setDate($this->object->getFirstAppointment()->getEnd());
1555  $end->setShowTime(true);
1556  #$this->form->addItem($end);
1557  */
1558 
1559  // Recurrence
1560  if($a_mode == 'create')
1561  {
1562  if(!is_object($this->rec))
1563  {
1564  include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1565  $this->rec = new ilEventRecurrence();
1566  }
1567  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1568  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
1569  $rec->allowUnlimitedRecurrences(false);
1570  $rec->setRecurrence($this->rec);
1571  $this->form->addItem($rec);
1572 
1573  // #14547
1574  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1575  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1576  $lp->setChecked(true);
1577  $this->form->addItem($lp);
1578  }
1579 
1581  $section->setTitle($this->lng->txt('event_section_information'));
1582  $this->form->addItem($section);
1583 
1584  // title
1585  $title = new ilTextInputGUI($this->lng->txt('event_title'),'title');
1586  $title->setValue($this->object->getTitle());
1587  $title->setSize(50);
1588  $title->setMaxLength(70);
1589  $this->form->addItem($title);
1590 
1591  // desc
1592  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'),'desc');
1593  $desc->setValue($this->object->getLongDescription());
1594  $desc->setRows(4);
1595  $desc->setCols(50);
1596  $this->form->addItem($desc);
1597 
1598  // location
1599  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'),'location');
1600  $desc->setValue($this->object->getLocation());
1601  $desc->setRows(4);
1602  $desc->setCols(50);
1603  $this->form->addItem($desc);
1604 
1605  // workflow
1606  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'),'details');
1607  $details->setValue($this->object->getDetails());
1608  $details->setCols(50);
1609  $details->setRows(4);
1610  $this->form->addItem($details);
1611 
1612  // section
1614  $section->setTitle($this->lng->txt('event_tutor_data'));
1615  $this->form->addItem($section);
1616 
1617  // name
1618  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'),'tutor_name');
1619  $tutor_name->setValue($this->object->getName());
1620  $tutor_name->setSize(20);
1621  $tutor_name->setMaxLength(70);
1622  $this->form->addItem($tutor_name);
1623 
1624  // email
1625  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'),'tutor_email');
1626  $tutor_email->setValue($this->object->getEmail());
1627  $tutor_email->setSize(20);
1628  $tutor_email->setMaxLength(70);
1629  $this->form->addItem($tutor_email);
1630 
1631  // phone
1632  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'),'tutor_phone');
1633  $tutor_phone->setValue($this->object->getPhone());
1634  $tutor_phone->setSize(20);
1635  $tutor_phone->setMaxLength(70);
1636  $this->form->addItem($tutor_phone);
1637 
1639  $section->setTitle($this->lng->txt('sess_section_reg'));
1640  $this->form->addItem($section);
1641 
1642  include_once './Modules/Session/classes/class.ilSessionMembershipRegistrationSettingsGUI.php';
1643  include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
1644  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1645  $this,
1646  $this->object,
1647  array(
1652  )
1653  );
1654  $reg_settings->addMembershipFormElements($this->form, '');
1655 
1656 
1658  $section->setTitle($this->lng->txt('event_assign_files'));
1659  $this->form->addItem($section);
1660 
1661  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'),'files');
1662  $files->setFilenames(array(0 => ''));
1663  $this->form->addItem($files);
1664 
1665  switch($a_mode)
1666  {
1667  case 'create':
1668  $this->form->setTitle($this->lng->txt('event_table_create'));
1669 
1670  $this->form->addCommandButton('save',$this->lng->txt('event_btn_add'));
1671  $this->form->addCommandButton('saveAndAssignMaterials',$this->lng->txt('event_btn_add_edit'));
1672  $this->form->addCommandButton('cancelEdit',$this->lng->txt('cancel'));
1673 
1674  return true;
1675 
1676  case 'edit':
1677  $this->form->setTitle($this->lng->txt('event_table_update'));
1678 
1679  $this->form->addCommandButton('update',$this->lng->txt('save'));
1680  $this->form->addCommandButton('cancelEdit',$this->lng->txt('cancel'));
1681 
1682  return true;
1683  }
1684  return true;
1685  }
1686 
1694  protected function load()
1695  {
1696  global $ilUser;
1697 
1698  $this->object->getFirstAppointment()->setStartingTime($this->__toUnix($_POST['event']['start']['date'],$_POST['event']['start']['time']));
1699  $this->object->getFirstAppointment()->setEndingTime($this->__toUnix($_POST['event']['end']['date'],$_POST['event']['end']['time']));
1700  $this->object->getFirstAppointment()->toggleFullTime((bool) $_POST['event']['fulltime']);
1701 
1702  include_once('./Services/Calendar/classes/class.ilDate.php');
1703  if($this->object->getFirstAppointment()->isFullday())
1704  {
1705  $start = new ilDate($_POST['event']['start']['date']['y'].'-'.$_POST['event']['start']['date']['m'].'-'.$_POST['event']['start']['date']['d'],
1706  IL_CAL_DATE);
1707  $this->object->getFirstAppointment()->setStart($start);
1708 
1709  $end = new ilDate($_POST['event']['end']['date']['y'].'-'.$_POST['event']['end']['date']['m'].'-'.$_POST['event']['end']['date']['d'],
1710  IL_CAL_DATE);
1711  $this->object->getFirstAppointment()->setEnd($end);
1712  }
1713  else
1714  {
1715  $start_dt['year'] = (int) $_POST['event']['start']['date']['y'];
1716  $start_dt['mon'] = (int) $_POST['event']['start']['date']['m'];
1717  $start_dt['mday'] = (int) $_POST['event']['start']['date']['d'];
1718  $start_dt['hours'] = (int) $_POST['event']['start']['time']['h'];
1719  $start_dt['minutes'] = (int) $_POST['event']['start']['time']['m'];
1720 
1721  $start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1722  $this->object->getFirstAppointment()->setStart($start);
1723 
1724  $end_dt['year'] = (int) $_POST['event']['end']['date']['y'];
1725  $end_dt['mon'] = (int) $_POST['event']['end']['date']['m'];
1726  $end_dt['mday'] = (int) $_POST['event']['end']['date']['d'];
1727  $end_dt['hours'] = (int) $_POST['event']['end']['time']['h'];
1728  $end_dt['minutes'] = (int) $_POST['event']['end']['time']['m'];
1729  $end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1730  $this->object->getFirstAppointment()->setEnd($end);
1731  }
1732 
1733  $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1734  $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1735  $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1736  $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1737  $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1738  $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1739  $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1740 
1741  $this->object->setRegistrationType((int) $_POST['registration_type']);
1742  $this->object->setRegistrationMaxUsers((int) $_POST['registration_max_members']);
1743  $this->object->enableRegistrationUserLimit((int) $_POST['registration_membership_limited']);
1744  $this->object->enableRegistrationWaitingList((int) $_POST['waiting_list']);
1745  }
1746 
1753  protected function loadRecurrenceSettings()
1754  {
1755  include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1756  $this->rec = new ilSessionRecurrence();
1757 
1758  switch($_POST['frequence'])
1759  {
1760  case IL_CAL_FREQ_DAILY:
1761  $this->rec->setFrequenceType($_POST['frequence']);
1762  $this->rec->setInterval((int) $_POST['count_DAILY']);
1763  break;
1764 
1765  case IL_CAL_FREQ_WEEKLY:
1766  $this->rec->setFrequenceType($_POST['frequence']);
1767  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1768  if(is_array($_POST['byday_WEEKLY']))
1769  {
1770  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1771  }
1772  break;
1773 
1774  case IL_CAL_FREQ_MONTHLY:
1775  $this->rec->setFrequenceType($_POST['frequence']);
1776  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1777  switch((int) $_POST['subtype_MONTHLY'])
1778  {
1779  case 0:
1780  // nothing to do;
1781  break;
1782 
1783  case 1:
1784  switch((int) $_POST['monthly_byday_day'])
1785  {
1786  case 8:
1787  // Weekday
1788  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1789  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1790  break;
1791 
1792  case 9:
1793  // Day of month
1794  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1795  break;
1796 
1797  default:
1798  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1799  break;
1800  }
1801  break;
1802 
1803  case 2:
1804  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1805  break;
1806  }
1807  break;
1808 
1809  case IL_CAL_FREQ_YEARLY:
1810  $this->rec->setFrequenceType($_POST['frequence']);
1811  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1812  switch((int) $_POST['subtype_YEARLY'])
1813  {
1814  case 0:
1815  // nothing to do;
1816  break;
1817 
1818  case 1:
1819  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1820  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1821  break;
1822 
1823  case 2:
1824  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1825  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1826  break;
1827  }
1828  break;
1829  }
1830 
1831  // UNTIL
1832  switch((int) $_POST['until_type'])
1833  {
1834  case 1:
1835  $this->rec->setFrequenceUntilDate(null);
1836  // nothing to do
1837  break;
1838 
1839  case 2:
1840  $this->rec->setFrequenceUntilDate(null);
1841  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1842  break;
1843 
1844  case 3:
1845  $end_dt['year'] = (int) $_POST['until_end']['date']['y'];
1846  $end_dt['mon'] = (int) $_POST['until_end']['date']['m'];
1847  $end_dt['mday'] = (int) $_POST['until_end']['date']['d'];
1848 
1849  $this->rec->setFrequenceUntilCount(0);
1850  $this->rec->setFrequenceUntilDate(new ilDate($end_dt,IL_CAL_FKT_GETDATE,$this->timezone));
1851  break;
1852  }
1853  }
1854 
1855 
1863  protected function __toUnix($date,$time)
1864  {
1865  return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
1866  }
1867 
1874  public function addLocatorItems()
1875  {
1876  global $ilLocator;
1877 
1878  if (is_object($this->object))
1879  {
1880  // see prepareOutput()
1881  include_once './Modules/Session/classes/class.ilSessionAppointment.php';
1882  $title = strlen($this->object->getTitle()) ? (': '.$this->object->getTitle()) : '';
1883  $title = $this->object->getFirstAppointment()->appointmentToString().$title;
1884 
1885  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
1886  }
1887  }
1888 
1895  public function getTabs($tabs_gui)
1896  {
1897  global $ilAccess, $ilTabs, $tree, $ilCtrl, $ilHelp;
1898 
1899  $ilHelp->setScreenIdComponent("sess");
1900 
1901  $parent_id = $tree->getParentId($this->object->getRefId());
1902 
1903  // #11650
1904  $parent_type = ilObject::_lookupType($parent_id, true);
1905 
1906  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
1907  $tabs_gui->setBackTarget($this->lng->txt('back_to_'.$parent_type.'_content'),
1908  $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
1909  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1910 
1911  $tabs_gui->addTarget('info_short',
1912  $this->ctrl->getLinkTarget($this,'infoScreen'));
1913 
1914  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1915  {
1916  $tabs_gui->addTarget('settings',
1917  $this->ctrl->getLinkTarget($this,'edit'));
1918  $tabs_gui->addTarget('crs_materials',
1919  $this->ctrl->getLinkTarget($this,'materials'));
1920  $tabs_gui->addTarget('event_edit_members',
1921  $this->ctrl->getLinkTarget($this,'members'));
1922  }
1923 
1924  // learning progress
1925  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1926  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
1927  {
1928  $tabs_gui->addTarget('learning_progress',
1929  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'),''),
1930  '',
1931  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1932  }
1933 
1934  // export
1935  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1936  {
1937  $ilTabs->addTarget("export",
1938  $this->ctrl->getLinkTargetByClass("ilexportgui", ""), "", "ilexportgui");
1939  }
1940 
1941 
1942  // edit permissions
1943  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1944  {
1945  $tabs_gui->addTarget("perm_settings",
1946  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), array("perm","info","owner"), 'ilpermissiongui');
1947  }
1948 
1949  }
1950 
1956  public function afterSaveCallback(ilObject $a_obj)
1957  {
1958  // add new object to materials
1959  include_once './Modules/Session/classes/class.ilEventItems.php';
1960  $event_items = new ilEventItems($this->object->getId());
1961  $event_items->addItem($a_obj->getRefId());
1962  $event_items->update();
1963 
1964  /*
1965  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
1966  $this->ctrl->redirect($this, "materials");
1967  */
1968  }
1969 
1973  protected function sendMailToSelectedUsersObject()
1974  {
1975  $GLOBALS['ilCtrl']->setReturn($this,'members');
1976  $GLOBALS['ilCtrl']->setCmdClass('ilmembershipgui');
1977  include_once './Services/Membership/classes/class.ilMembershipGUI.php';
1978  $mem = new ilMembershipGUI($this);
1979  $GLOBALS['ilCtrl']->forwardCommand($mem);
1980  }
1981 
1985  public function readMemberData($a_usr_ids)
1986  {
1987  $tmp_data = array();
1988  foreach ($a_usr_ids as $usr_id)
1989  {
1990  $tmp_data[$usr_id] = array();
1991  }
1992  return $tmp_data;
1993  }
1994 
2003  {
2004  $this->checkPermission('write');
2005 
2006  if(!count($_POST["waiting"]))
2007  {
2008  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2009  $this->membersObject();
2010  return false;
2011  }
2012 
2013  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2014  $waiting_list = new ilSessionWaitingList($this->object->getId());
2015 
2016  include_once './Modules/Session/classes/class.ilEventParticipants.php';
2017  $part = new ilEventParticipants($this->object->getId());
2018 
2019  $added_users = 0;
2020  foreach($_POST["waiting"] as $user_id)
2021  {
2022  $part->register($user_id);
2023  $waiting_list->removeFromList($user_id);
2024 
2025  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2027  $noti->setRefId($this->object->getRefId());
2028  $noti->setRecipients(array($user_id));
2030  $noti->send();
2031 
2032  ++$added_users;
2033  }
2034  if($added_users)
2035  {
2036  ilUtil::sendSuccess($this->lng->txt("sess_users_added"));
2037  $this->membersObject();
2038 
2039  return true;
2040  }
2041  else
2042  {
2043  ilUtil::sendFailure($this->lng->txt("sess_users_already_assigned"));
2044  $this->searchObject();
2045  return false;
2046  }
2047  }
2048 
2055  public function refuseFromListObject()
2056  {
2057  $this->checkPermission('write');
2058 
2059  if(!count($_POST['waiting']))
2060  {
2061  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2062  $this->membersObject();
2063  return false;
2064  }
2065 
2066  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2067  $waiting_list = new ilSessionWaitingList($this->object->getId());
2068 
2069  foreach($_POST["waiting"] as $user_id)
2070  {
2071  $waiting_list->removeFromList($user_id);
2072 
2073  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2075  $noti->setRefId($this->object->getRefId());
2076  $noti->setRecipients(array($user_id));
2078  $noti->send();
2079 
2080  }
2081 
2082  ilUtil::sendSuccess($this->lng->txt('sess_users_removed_from_list'));
2083  $this->membersObject();
2084  return true;
2085  }
2086 
2093  public function assignSubscribersObject()
2094  {
2095  global $lng,$ilUser;
2096 
2097  $this->checkPermission('write');
2098 
2099  if(!count($_POST['subscribers']))
2100  {
2101  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2102  $this->membersObject();
2103  return false;
2104  }
2105 
2106  include_once './Services/Membership/classes/class.ilParticipants.php';
2107  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2108 
2109  foreach($_POST['subscribers'] as $usr_id)
2110  {
2111  $part->add($usr_id);
2112  $part->deleteSubscriber($usr_id);
2113 
2114  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2116  $noti->setRefId($this->object->getRefId());
2117  $noti->setRecipients(array($usr_id));
2119  $noti->send();
2120  }
2121  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_assigned"),true);
2122  $this->ctrl->redirect($this,'members');
2123  return true;
2124  }
2125 
2132  public function refuseSubscribersObject()
2133  {
2134  global $lng;
2135 
2136  $this->checkPermission('write');
2137 
2138  if(!count($_POST['subscribers']))
2139  {
2140  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2141  $this->membersObject();
2142  return false;
2143  }
2144 
2145  include_once './Services/Membership/classes/class.ilParticipants.php';
2146  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2147  foreach($_POST['subscribers'] as $usr_id)
2148  {
2149  $part->deleteSubscriber($usr_id);
2150 
2151  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2153  $noti->setRefId($this->object->getRefId());
2154  $noti->setRecipients(array($usr_id));
2156  $noti->send();
2157  }
2158  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_removed"));
2159  $this->membersObject();
2160  return true;
2161 
2162  }
2167  public function getContainerRefId()
2168  {
2169  if(!$this->container_ref_id)
2170  {
2171  $this->initContainer();
2172  }
2173  return $this->container_ref_id;
2174  }
2175 
2177  {
2178  if(!is_array($_POST["subscribers"]))
2179  {
2180  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2181  $this->membersObject();
2182 
2183  return false;
2184  }
2185 
2186  $this->lng->loadLanguageModule('mmbr');
2187 
2188  $this->checkPermission('write');
2189  $this->tabs_gui->setTabActive('event_edit_members');
2190 
2191  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2192  $c_gui = new ilConfirmationGUI();
2193 
2194  // set confirm/cancel commands
2195  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
2196  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2197  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2198  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
2199 
2200  foreach($_POST["subscribers"] as $subscribers)
2201  {
2202  $name = ilObjUser::_lookupName($subscribers);
2203 
2204  $c_gui->addItem('subscribers[]',
2205  $name['user_id'],
2206  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2207  ilUtil::getImagePath('icon_usr.svg'));
2208  }
2209 
2210  $this->tpl->setContent($c_gui->getHTML());
2211  return true;
2212  }
2213 
2215  {
2216  if(!is_array($_POST["subscribers"]))
2217  {
2218  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2219  $this->membersObject();
2220 
2221  return false;
2222  }
2223  $this->checkPermission('write');
2224  $this->tabs_gui->setTabActive('event_edit_members');
2225 
2226  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2227  $c_gui = new ilConfirmationGUI();
2228 
2229  // set confirm/cancel commands
2230  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
2231  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2232  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2233  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
2234 
2235  foreach($_POST["subscribers"] as $subscribers)
2236  {
2237  $name = ilObjUser::_lookupName($subscribers);
2238 
2239  $c_gui->addItem('subscribers[]',
2240  $name['user_id'],
2241  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2242  ilUtil::getImagePath('icon_usr.svg'));
2243  }
2244 
2245  $this->tpl->setContent($c_gui->getHTML());
2246  return true;
2247  }
2248 
2250  {
2251  if(!is_array($_POST["waiting"]))
2252  {
2253  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2254  $this->membersObject();
2255 
2256  return false;
2257  }
2258 
2259  $this->lng->loadLanguageModule('mmbr');
2260 
2261  $this->checkPermission('write');
2262  $this->tabs_gui->setTabActive('event_edit_members');
2263 
2264  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2265  $c_gui = new ilConfirmationGUI();
2266 
2267  // set confirm/cancel commands
2268  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
2269  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2270  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2271  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
2272 
2273  foreach($_POST["waiting"] as $waiting)
2274  {
2275  $name = ilObjUser::_lookupName($waiting);
2276 
2277  $c_gui->addItem('waiting[]',
2278  $name['user_id'],
2279  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2280  ilUtil::getImagePath('icon_usr.svg'));
2281  }
2282 
2283  $this->tpl->setContent($c_gui->getHTML());
2284  return true;
2285  }
2286 
2288  {
2289  if(!is_array($_POST["waiting"]))
2290  {
2291  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2292  $this->membersObject();
2293 
2294  return false;
2295  }
2296  $this->checkPermission('write');
2297  $this->tabs_gui->setTabActive('event_edit_members');
2298 
2299  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2300  $c_gui = new ilConfirmationGUI();
2301 
2302  // set confirm/cancel commands
2303  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
2304  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2305  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2306  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
2307 
2308  foreach($_POST["waiting"] as $waiting)
2309  {
2310  $name = ilObjUser::_lookupName($waiting);
2311 
2312  $c_gui->addItem('waiting[]',
2313  $name['user_id'],
2314  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2315  ilUtil::getImagePath('icon_usr.svg'));
2316  }
2317 
2318  $this->tpl->setContent($c_gui->getHTML());
2319  return true;
2320  }
2321 
2322  function cancelEditObject()
2323  {
2324  global $ilCtrl, $tree;
2325  $parent_id = $tree->getParentId($this->object->getRefId());
2326  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2327  $ilCtrl->redirectByClass("ilrepositorygui", "");
2328  }
2329 }
2330 ?>