ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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  {
165  parent::prepareOutput();
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,$lng;
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  $lng->loadLanguageModule("cntr");// #14158
510 
511  foreach($eventItems as $item)
512  {
513  $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
514  $list_gui->setContainerObject($this);
515 
516  $this->modifyItemGUI($list_gui, $item, false);
517 
518  $html .= $list_gui->getListItemHTML(
519  $item['ref_id'],
520  $item['obj_id'],
521  $item['title'],
522  $item['description']
523  );
524  }
525 
526  if(strlen($html))
527  {
528  $info->addSection($this->lng->txt('event_materials'));
529  $info->addProperty(
530  '&nbsp;',
531  $html);
532  }
533 
534  // forward the command
535  $this->ctrl->forwardCommand($info);
536 
537  // store read event
538  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
539  ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
540  $this->object->getId(), $ilUser->getId());
541  }
542 
548  public function sendFileObject()
549  {
550  $file = new ilSessionFile((int) $_GET['file_id']);
551 
552  ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
553  return true;
554  }
555 
556  protected function initCreateForm($a_new_type)
557  {
558  if(!is_object($this->object))
559  {
560  $this->object = new ilObjSession();
561  }
562  $this->initForm('create');
563  return $this->form;
564  }
565 
572  {
573  global $ilLog;
574 
575  $this->saveObject(false);
576 
577  /*
578  $this->ctrl->setParameter($this,'ref_id',$this->object->getRefId());
579  $target = $this->ctrl->getLinkTarget($this,'materials');
580  $target = str_replace('new_type=','nt=',$target);
581  */
582  $this->ctrl->setParameter($this,'ref_id',$this->object->getRefId());
583  $this->ctrl->redirect($this,'materials');
584  }
585 
593  public function saveObject($a_redirect_on_success = true)
594  {
595  global $ilErr,$ilUser;
596 
597  $this->object = new ilObjSession();
598 
599  $this->load();
600  $this->loadRecurrenceSettings();
601  $this->initForm('create');
602 
603  $ilErr->setMessage('');
604  if(!$this->form->checkInput()) {
605  $ilErr->setMessage($this->lng->txt('err_check_input'));
606  }
607 
608  $this->object->validate();
609  $this->object->getFirstAppointment()->validate();
610 
611  if(strlen($ilErr->getMessage()))
612  {
613  ilUtil::sendFailure($ilErr->getMessage().$_GET['ref_id']);
614  $this->createObject();
615  return false;
616  }
617  // Create session
618  $this->object->create();
619  $this->object->createReference();
620  $this->object->putInTree($_GET["ref_id"]);
621  $this->object->setPermissions($_GET["ref_id"]);
622 
623  // #14547 - active is default
624  if(!$this->form->getInput("lp_preset"))
625  {
626  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
627  $lp_obj_settings = new ilLPObjSettings($this->object->getId());
628  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
629  $lp_obj_settings->update(false);
630  }
631 
632  // create appointment
633  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
634  $this->object->getFirstAppointment()->create();
635 
636  $this->handleFileUpload();
637 
638  $this->createRecurringSessions($this->form->getInput("lp_preset"));
639 
640  if($a_redirect_on_success)
641  {
642  ilUtil::sendInfo($this->lng->txt('event_add_new_event'),true);
643  $this->ctrl->returnToParent($this);
644  }
645 
646  return true;
647 
648  }
649 
650  public function handleFileUpload()
651  {
652  global $tree;
653 
654  include_once './Modules/Session/classes/class.ilEventItems.php';
655  $ev = new ilEventItems($this->object->getId());
656  $items = $ev->getItems();
657 
658  $counter = 0;
659  while(true)
660  {
661  if(!isset($_FILES['files']['name'][$counter]))
662  {
663  break;
664  }
665  if(!strlen($_FILES['files']['name'][$counter]))
666  {
667  $counter++;
668  continue;
669  }
670 
671  include_once './Modules/File/classes/class.ilObjFile.php';
672  $file = new ilObjFile();
673  $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
674  $file->setDescription('');
675  $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
676  $file->setFileType($_FILES['files']['type'][$counter]);
677  $file->setFileSize($_FILES['files']['size'][$counter]);
678  $file->create();
679  $new_ref_id = $file->createReference();
680  $file->putInTree($tree->getParentId($this->object->getRefId()));
681  $file->setPermissions($tree->getParentId($this->object->getRefId()));
682  $file->createDirectory();
683  $file->getUploadFile(
684  $_FILES['files']['tmp_name'][$counter],
685  $_FILES['files']['name'][$counter]
686  );
687 
688  $items[] = $new_ref_id;
689  $counter++;
690 
691  }
692 
693  $ev->setItems($items);
694  $ev->update();
695  }
696 
697 
698 
706  protected function createRecurringSessions($a_activate_lp = true)
707  {
708  global $tree;
709 
710  if(!$this->rec->getFrequenceType())
711  {
712  return true;
713  }
714  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
715  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(),$this->rec);
716 
717  $period_start = clone $this->object->getFirstAppointment()->getStart();
718 
719 
720  $period_end = clone $this->object->getFirstAppointment()->getStart();
721  $period_end->increment(IL_CAL_YEAR,5);
722  $date_list = $calc->calculateDateList($period_start,$period_end);
723 
724  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
725  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
726  $parent_id = $tree->getParentId($this->object->getRefId());
727 
728  include_once './Modules/Session/classes/class.ilEventItems.php';
729  $evi = new ilEventItems($this->object->getId());
730  $eitems = $evi->getItems();
731 
732  $counter = 0;
733  foreach($date_list->get() as $date)
734  {
735  if(!$counter++)
736  {
737  continue;
738  }
739 
740  $new_obj = $this->object->cloneObject($parent_id);
741  $new_obj->read();
742  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
743  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
744  $new_obj->getFirstAppointment()->update();
745  $new_obj->update();
746 
747  // #14547 - active is default
748  if(!$a_activate_lp)
749  {
750  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
751  $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
752  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
753  $lp_obj_settings->update(false);
754  }
755 
756  $new_evi = new ilEventItems($new_obj->getId());
757  $new_evi->setItems($eitems);
758  $new_evi->update();
759  }
760  }
761 
762 
770  public function editObject()
771  {
772  $this->tabs_gui->setTabActive('settings');
773 
774  $this->initForm('edit');
775  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_edit.html','Modules/Session');
776  $this->tpl->setVariable('EVENT_EDIT_TABLE',$this->form->getHTML());
777 
778  if(!count($this->object->getFiles()))
779  {
780  return true;
781  }
782  $rows = array();
783  foreach($this->object->getFiles() as $file)
784  {
785  $table_data['id'] = $file->getFileId();
786  $table_data['filename'] = $file->getFileName();
787  $table_data['filetype'] = $file->getFileType();
788  $table_data['filesize'] = $file->getFileSize();
789 
790  $rows[] = $table_data;
791  }
792 
793  include_once("./Modules/Session/classes/class.ilSessionFileTableGUI.php");
794  $table_gui = new ilSessionFileTableGUI($this, "edit");
795  $table_gui->setTitle($this->lng->txt("event_files"));
796  $table_gui->setData($rows);
797  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
798  $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
799  $table_gui->setSelectAllCheckbox("file_id");
800  $this->tpl->setVariable('EVENT_FILE_TABLE',$table_gui->getHTML());
801 
802  return true;
803  }
804 
812  public function updateObject()
813  {
814  global $ilErr;
815 
816  $old_autofill = $this->object->hasWaitingListAutoFill();
817 
818  $this->load();
819  $this->initForm('edit');
820 
821  $ilErr->setMessage('');
822  if(!$this->form->checkInput())
823  {
824  $ilErr->setMessage($this->lng->txt('err_check_input'));
825  }
826  $this->object->validate();
827  $this->object->getFirstAppointment()->validate();
828 
829  if(strlen($ilErr->getMessage()))
830  {
831  ilUtil::sendFailure($ilErr->getMessage());
832  $this->editObject();
833  return false;
834  }
835  // Update event
836  $this->object->update();
837  $this->object->getFirstAppointment()->update();
838 
839  $this->handleFileUpload();
840 
841  // if autofill has been activated trigger process
842  if(!$old_autofill &&
843  $this->object->hasWaitingListAutoFill())
844  {
845  $this->object->handleAutoFill();
846  }
847 
848  ilUtil::sendSuccess($this->lng->txt('event_updated'),true);
849  $this->ctrl->redirect($this,'edit');
850  #$this->object->initFiles();
851  #$this->editObject();
852  return true;
853  }
854 
862  public function confirmDeleteFilesObject()
863  {
864  $this->tabs_gui->setTabActive('settings');
865 
866  if(!count($_POST['file_id']))
867  {
868  ilUtil::sendFailure($this->lng->txt('select_one'));
869  $this->editObject();
870  return false;
871  }
872 
873  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
874  $c_gui = new ilConfirmationGUI();
875 
876  // set confirm/cancel commands
877  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
878  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
879  $c_gui->setCancel($this->lng->txt("cancel"), "edit");
880  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
881 
882  // add items to delete
883  foreach($_POST["file_id"] as $file_id)
884  {
885  $file = new ilSessionFile($file_id);
886  if($file->getSessionId() != $this->object->getEventId())
887  {
888  ilUtil::sendFailure($this->lng->txt('select_one'));
889  $this->edit();
890  return false;
891  }
892  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
893  }
894 
895  $this->tpl->setContent($c_gui->getHTML());
896  return true;
897  }
898 
906  public function deleteFilesObject()
907  {
908  if(!count($_POST['file_id']))
909  {
910  ilUtil::sendFailure($this->lng->txt('select_one'));
911  $this->editObject();
912  return false;
913  }
914  foreach($_POST['file_id'] as $id)
915  {
916  $file = new ilSessionFile($id);
917  $file->delete();
918  }
919  $this->object->initFiles();
920  $this->editObject();
921  return true;
922  }
923 
924  protected function initContainer($a_init_participants = false)
925  {
926  global $tree;
927 
928  $is_course = $is_group = false;
929 
930  // #13178
931  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'grp');
932  if($this->container_ref_id)
933  {
934  $is_group = true;
935  }
936  if(!$this->container_ref_id)
937  {
938  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
939  if($this->container_ref_id)
940  {
941  $is_course = true;
942  }
943  }
944  if(!$this->container_ref_id)
945  {
946  ilUtil::sendFailure('No container object found. Aborting');
947  return true;
948  }
949  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
950 
951  if($a_init_participants && $this->container_obj_id)
952  {
953  if($is_course)
954  {
955  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
956  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
957  }
958  else if($is_group)
959  {
960  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
961  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
962  }
963  }
964 
965  }
966 
974  public function materialsObject()
975  {
976  global $tree, $objDefinition;
977 
978  $this->tabs_gui->setTabActive('crs_materials');
979 
980  // #11337 - support ANY parent container (crs, grp, fld)
981  $parent_ref_id = $tree->getParentId($this->object->getRefId());
982 
983  include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
984  $gui = new ilObjectAddNewItemGUI($parent_ref_id);
985  $gui->setDisabledObjectTypes(array("itgr", "sess"));
986  $gui->setAfterCreationCallback($this->ref_id);
987  $gui->render();
988 
989  include_once 'Modules/Session/classes/class.ilEventItems.php';
990  $this->event_items = new ilEventItems($this->object->getId());
991 
992  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
993  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
994  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
995  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
996 
997  $tbl->setMaterialItems($this->event_items->getItems());
998  $tbl->setContainerRefId($this->getContainerRefId());
999  $tbl->getDataFromDb();
1000 
1001  $this->tpl->setContent($tbl->getHTML());
1002  }
1003 
1011  public function saveMaterialsObject()
1012  {
1013  include_once './Modules/Session/classes/class.ilEventItems.php';
1014 
1015  $this->event_items = new ilEventItems($this->object->getId());
1016 
1017  $list_items = is_array($_POST['all_items']) ? $_POST['all_items'] : array();
1018  $list_items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1019 
1020  $checked = $this->event_items->getItems();
1021  $checked = array_diff($checked, $list_items);//remove all visible items in list
1022  $checked = array_merge($checked, $list_items_checked);//add checked items in list
1023 
1024  $this->event_items->setItems($checked);
1025  $this->event_items->update();
1026 
1027  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1028  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1029  $tbl->setOffset(0);
1030  $tbl->storeNavParameter();//remove offset and go to page 1
1031 
1032  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1033  $this->ctrl->redirect($this,'materials');
1034  }
1035 
1040  protected function membersObject()
1041  {
1042  global $tree,$ilUser;
1043 
1044  $this->checkPermission('write');
1045  $this->tabs_gui->setTabActive('event_edit_members');
1046 
1047  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_members.html', 'Modules/Session');
1048 
1049  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1050  $toolbar = new ilToolbarGUI();
1051  $toolbar->addButton($this->lng->txt('crs_print_list'),
1052  $this->ctrl->getLinkTarget($this,'attendanceList'));
1053 
1054  $this->tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
1055 
1056  $members_obj = $this->initContainer(true);
1057 
1058  include_once './Modules/Session/classes/class.ilEventParticipants.php';
1059 
1060  // Save hide/show table settings
1061  $this->setShowHidePrefs();
1062 
1063  // Waiting list table
1064  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
1065  $waiting_list = new ilSessionWaitingList($this->object->getId());
1066  if(count($wait = $waiting_list->getAllUsers()))
1067  {
1068  include_once('./Services/Membership/classes/class.ilWaitingListTableGUI.php');
1069  if($ilUser->getPref('sess_wait_hide'))
1070  {
1071  $table_gui = new ilWaitingListTableGUI($this,$waiting_list,false);
1072  $this->ctrl->setParameter($this,'wait_hide',0);
1073  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1074  $this->lng->txt('show'));
1075  $this->ctrl->clearParameters($this);
1076  }
1077  else
1078  {
1079  $table_gui = new ilWaitingListTableGUI($this,$waiting_list,true);
1080  $this->ctrl->setParameter($this,'wait_hide',1);
1081  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1082  $this->lng->txt('hide'));
1083  $this->ctrl->clearParameters($this);
1084  }
1085  $table_gui->setUsers($wait);
1086  $table_gui->setTitle($this->lng->txt('grp_header_waiting_list'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
1087  $this->tpl->setVariable('TABLE_WAIT',$table_gui->getHTML());
1088  }
1089 
1090  // subscribers
1091  // Subscriber table
1092  include_once './Services/Membership/classes/class.ilParticipants.php';
1093  $part = ilParticipants::getInstanceByObjId($this->object->getId());
1094  if($part->getSubscribers())
1095  {
1096  include_once('./Services/Membership/classes/class.ilSubscriberTableGUI.php');
1097  if($ilUser->getPref('grp_subscriber_hide'))
1098  {
1099  $table_gui = new ilSubscriberTableGUI($this,false, false);
1100  $this->ctrl->setParameter($this,'subscriber_hide',0);
1101  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1102  $this->lng->txt('show'));
1103  $this->ctrl->clearParameters($this);
1104  }
1105  else
1106  {
1107  $table_gui = new ilSubscriberTableGUI($this,true, false);
1108  $this->ctrl->setParameter($this,'subscriber_hide',1);
1109  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1110  $this->lng->txt('hide'));
1111  $this->ctrl->clearParameters($this);
1112  }
1113  $table_gui->readSubscriberData();
1114  $table_gui->setTitle($this->lng->txt('sess_new_registrations'),'icon_usr.svg',$this->lng->txt('sess_new_registrations'));
1115  $this->tpl->setVariable('TABLE_SUB',$table_gui->getHTML());
1116  }
1117 
1118 
1119  // Admins
1120  if(count($admins = $members_obj->getAdmins()))
1121  {
1122  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1123  if($ilUser->getPref('sess_admin_hide'))
1124  {
1126  $this->ctrl->setParameter($this,'admin_hide',0);
1127  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1128  $this->lng->txt('show'));
1129  $this->ctrl->clearParameters($this);
1130  }
1131  else
1132  {
1134  $this->ctrl->setParameter($this,'admin_hide',1);
1135  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1136  $this->lng->txt('hide'));
1137  $this->ctrl->clearParameters($this);
1138  }
1139 
1140  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1141  $table->setTitle($this->lng->txt('event_tbl_admins'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1142  $table->enableRegistration($this->object->enabledRegistration());
1143  $table->setParticipants($admins);
1144  $table->parse();
1145  $this->tpl->setVariable('ADMINS',$table->getHTML());
1146  }
1147 
1148  // Tutors
1149  if(count($tutors = $members_obj->getTutors()))
1150  {
1151  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1152  if($ilUser->getPref('sess_tutor_hide'))
1153  {
1155  $this->ctrl->setParameter($this,'tutor_hide',0);
1156  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1157  $this->lng->txt('show'));
1158  $this->ctrl->clearParameters($this);
1159  }
1160  else
1161  {
1163  $this->ctrl->setParameter($this,'tutor_hide',1);
1164  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1165  $this->lng->txt('hide'));
1166  $this->ctrl->clearParameters($this);
1167  }
1168  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1169  $table->setTitle($this->lng->txt('event_tbl_tutors'),'icon_usr.svg',$this->lng->txt('event_tbl_tutors'));
1170  $table->enableRegistration($this->object->enabledRegistration());
1171  $table->setParticipants($tutors);
1172  $table->parse();
1173  $this->tpl->setVariable('TUTORS',$table->getHTML());
1174  }
1175 
1176  // Members
1177  if(count($members = $members_obj->getMembers()))
1178  {
1179  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1180  if($ilUser->getPref('sess_member_hide'))
1181  {
1183  $this->ctrl->setParameter($this,'member_hide',0);
1184  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1185  $this->lng->txt('show'));
1186  $this->ctrl->clearParameters($this);
1187  }
1188  else
1189  {
1191  $this->ctrl->setParameter($this,'member_hide',1);
1192  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1193  $this->lng->txt('hide'));
1194  $this->ctrl->clearParameters($this);
1195  }
1196  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1197  $table->setTitle($this->lng->txt('event_tbl_members'),'icon_usr.svg',$this->lng->txt('event_tbl_members'));
1198  $table->enableRegistration($this->object->enabledRegistration());
1199  $table->setParticipants($members);
1200  $table->parse();
1201  $this->tpl->setVariable('MEMBERS',$table->getHTML());
1202  }
1203 
1204 
1205  $GLOBALS['lng']->loadLanguageModule('mmbr');
1206  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
1207  $this->tpl->setVariable('TXT_SELECTED_USER',$this->lng->txt('mmbr_selected_users'));
1208  $this->tpl->setVariable('BTN_FOOTER_MAIL',$this->lng->txt('mmbr_btn_mail_selected_users'));
1209  $this->tpl->setVariable('ARROW_DOWN',ilUtil::getImagePath('arrow_downright.svg'));
1210  }
1211 
1218  public function setShowHidePrefs()
1219  {
1220  global $ilUser;
1221 
1222  if(isset($_GET['admin_hide']))
1223  {
1224  $ilUser->writePref('sess_admin_hide',(int) $_GET['admin_hide']);
1225  }
1226  if(isset($_GET['tutor_hide']))
1227  {
1228  $ilUser->writePref('sess_tutor_hide',(int) $_GET['tutor_hide']);
1229  }
1230  if(isset($_GET['member_hide']))
1231  {
1232  $ilUser->writePref('sess_member_hide',(int) $_GET['member_hide']);
1233  }
1234  }
1235 
1243  public function updateMembersObject()
1244  {
1245  global $tree;
1246 
1247  $this->checkPermission('write');
1248 
1249 
1250 
1251  $this->initContainer();
1252 
1253  $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
1254  $_POST['registered'] = is_array($_POST['registered']) ? $_POST['registered'] : array();
1255 
1256  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1257 
1258  $visible = $_POST['visible_participants'] ? $_POST['visible_participants'] : array();
1259  foreach($visible as $user)
1260  {
1261  $part = new ilEventParticipants($this->object->getId());
1262  $part->setUserId($user);
1263  $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
1264  $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
1265  $part->setParticipated(isset($_POST['participants'][$user]) ? true : false);
1266  $part->setRegistered(isset($_POST['registered'][$user]) ? true : false);
1267  $part->updateUser();
1268  }
1269  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1270  $this->membersObject();
1271  }
1272 
1279  public function attendanceListObject()
1280  {
1281  global $tpl,$ilTabs;
1282 
1283  $this->checkPermission('write');
1284  $ilTabs->setTabActive('event_edit_members');
1285 
1286  $list = $this->initAttendanceList();
1287  $form = $list->initForm('printAttendanceList');
1288  $tpl->setContent($form->getHTML());
1289  }
1290 
1296  protected function initAttendanceList()
1297  {
1298  $members_obj = $this->initContainer(true);
1299 
1300  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1301  $list = new ilAttendanceList($this, $members_obj);
1302  $list->setId('sessattlst');
1303 
1304  $event_app = $this->object->getFirstAppointment();
1306  $desc = ilDatePresentation::formatPeriod($event_app->getStart(),$event_app->getEnd());
1308  $desc .= " ".$this->object->getTitle();
1309  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1310 
1311  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1312  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1313  if($this->object->enabledRegistration())
1314  {
1315  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1316  }
1317  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1318  $list->addBlank($this->lng->txt('sess_signature'));
1319 
1320  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1321 
1322  return $list;
1323  }
1324 
1330  protected function printAttendanceListObject()
1331  {
1332  $this->checkPermission('write');
1333 
1334  $list = $this->initAttendanceList();
1335  $list->initFromForm();
1336  $list->setCallback(array($this, 'getAttendanceListUserData'));
1337 
1338  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1339  $this->event_part = new ilEventParticipants($this->object->getId());
1340 
1341  echo $list->getFullscreenHTML();
1342  exit();
1343  }
1344 
1354  public function getAttendanceListUserData($a_user_id, $a_filters)
1355  {
1356  $data = $this->event_part->getUser($a_user_id);
1357 
1358  if($a_filters && $a_filters["registered"] && !$data["registered"])
1359  {
1360  return;
1361  }
1362 
1363  $data['registered'] = $data['registered'] ?
1364  $this->lng->txt('yes') :
1365  $this->lng->txt('no');
1366  $data['participated'] = $data['participated'] ?
1367  $this->lng->txt('yes') :
1368  $this->lng->txt('no');
1369 
1370  return $data;
1371  }
1372 
1380  public function eventsListObject()
1381  {
1382  global $ilErr,$ilAccess, $ilUser,$tree;
1383 
1384  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
1385  {
1386  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
1387  }
1388 
1389  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_list.html','Modules/Session');
1390  $this->__showButton($this->ctrl->getLinkTarget($this,'exportCSV'),$this->lng->txt('event_csv_export'));
1391 
1392  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1393 
1394  $this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
1395  $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.sess_list_row.html','Modules/Session');
1396 
1397  $members_obj = $this->initContainer(true);
1398  $members = $members_obj->getParticipants();
1399  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
1400 
1401  // Table
1402  $tbl = new ilTableGUI();
1403  $tbl->setTitle($this->lng->txt("event_overview"),
1404  'icon_usr.svg',
1405  $this->lng->txt('obj_usr'));
1406  $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
1407 
1408  $course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
1409  $events = array();
1410  foreach($tree->getSubtree($tree->getNodeData($course_ref_id),false,'sess') as $event_id)
1411  {
1412  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
1413  if(!is_object($tmp_event) or $tmp_event->getType() != 'sess')
1414  {
1415  continue;
1416  }
1417  $events[] = $tmp_event;
1418  }
1419 
1420  $headerNames = array();
1421  $headerVars = array();
1422  $colWidth = array();
1423 
1424  $headerNames[] = $this->lng->txt('name');
1425  $headerVars[] = "name";
1426  $colWidth[] = '20%';
1427 
1428  for ($i = 1; $i <= count($events); $i++)
1429  {
1430  $headerNames[] = $i;
1431  $headerVars[] = "event_".$i;
1432  $colWidth[] = 80/count($events)."%";
1433  }
1434 
1435  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1436  $tbl->setHeaderNames($headerNames);
1437  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'eventsList'));
1438  $tbl->setColumnWidth($colWidth);
1439 
1440  $tbl->setOrderColumn($_GET["sort_by"]);
1441  $tbl->setOrderDirection($_GET["sort_order"]);
1442  $tbl->setOffset($_GET["offset"]);
1443  $tbl->setLimit($ilUser->getPref("hits_per_page"));
1444  $tbl->setMaxCount(count($members));
1445  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1446 
1447  $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
1448  $tbl->disable('sort');
1449  $tbl->render();
1450 
1451  $counter = 0;
1452  foreach($sliced_users as $user_id)
1453  {
1454  foreach($events as $event_obj)
1455  {
1456  $this->tpl->setCurrentBlock("eventcols");
1457 
1458  $event_part = new ilEventParticipants($this->object->getId());
1459 
1460  {
1461  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1462  ilUtil::getImagePath('icon_ok.svg') :
1463  ilUtil::getImagePath('icon_not_ok.svg'));
1464 
1465  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1466  $this->lng->txt('event_participated') :
1467  $this->lng->txt('event_not_participated'));
1468  }
1469 
1470  $this->tpl->parseCurrentBlock();
1471  }
1472 
1473  $this->tpl->setCurrentBlock("tbl_content");
1474  $name = ilObjUser::_lookupName($user_id);
1475  $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1476  $this->tpl->setVariable("LASTNAME",$name['lastname']);
1477  $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
1478  $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
1479  $this->tpl->parseCurrentBlock();
1480  }
1481 
1482  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1483  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1484  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1485  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1486  $this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
1487  $i = 1;
1488  foreach($events as $event_obj)
1489  {
1490  $this->tpl->setCurrentBlock("legend_loop");
1491  $this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1492  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1493  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1494  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1495  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1496  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1497  $this->tpl->parseCurrentBlock();
1498  }
1499 
1500  }
1501 
1507  protected function initForm($a_mode)
1508  {
1509  global $ilUser;
1510 
1511  if(is_object($this->form))
1512  {
1513  return true;
1514  }
1515 
1516  $this->lng->loadLanguageModule('dateplaner');
1517 
1518  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1519 
1520  include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1522 
1523  $this->form = new ilPropertyFormGUI();
1524  $this->form->setMultipart(true);
1525  $this->form->setTableWidth('600px');
1526  $this->form->setFormAction($this->ctrl->getFormAction($this));
1527  $this->form->setMultipart(true);
1528 
1529  /*
1530  $full = new ilCheckboxInputGUI('','fulltime');
1531  $full->setChecked($this->object->getFirstAppointment()->enabledFulltime() ? true : false);
1532  $full->setOptionTitle($this->lng->txt('event_fulltime_info'));
1533  $full->setAdditionalAttributes('onchange="ilToggleSessionTime(this);"');
1534  #$this->form->addItem($full);
1535  */
1536 
1537  $this->lng->loadLanguageModule('dateplaner');
1538  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1539  #$this->tpl->addJavaScript('./Modules/Session/js/toggle_session_time.js');
1540  $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
1541  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'),'event');
1542  $dur->setStartText($this->lng->txt('event_start_date'));
1543  $dur->setEndText($this->lng->txt('event_end_date'));
1544  $dur->enableToggleFullTime(
1545  $this->lng->txt('event_fulltime_info'),
1546  $this->object->getFirstAppointment()->enabledFulltime() ? true : false
1547  );
1548  $dur->setShowTime(true);
1549  $dur->setStart($this->object->getFirstAppointment()->getStart());
1550  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1551 
1552  $this->form->addItem($dur);
1553 
1554  /*
1555  // start
1556  $start = new ilDateTimeInputGUI($this->lng->txt('event_start_date'),'start');
1557  $start->setMinuteStepSize(5);
1558  $start->setDate($this->object->getFirstAppointment()->getStart());
1559  $start->setShowTime(true);
1560  #$this->form->addItem($start);
1561 
1562  // end
1563  $end = new ilDateTimeInputGUI($this->lng->txt('event_end_date'),'end');
1564  $end->setMinuteStepSize(5);
1565  $end->setDate($this->object->getFirstAppointment()->getEnd());
1566  $end->setShowTime(true);
1567  #$this->form->addItem($end);
1568  */
1569 
1570  // Recurrence
1571  if($a_mode == 'create')
1572  {
1573  if(!is_object($this->rec))
1574  {
1575  include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1576  $this->rec = new ilEventRecurrence();
1577  }
1578  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1579  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
1580  $rec->allowUnlimitedRecurrences(false);
1581  $rec->setRecurrence($this->rec);
1582  $this->form->addItem($rec);
1583 
1584  // #14547
1585  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1586  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1587  $lp->setChecked(true);
1588  $this->form->addItem($lp);
1589  }
1590 
1592  $section->setTitle($this->lng->txt('event_section_information'));
1593  $this->form->addItem($section);
1594 
1595  // title
1596  $title = new ilTextInputGUI($this->lng->txt('event_title'),'title');
1597  $title->setValue($this->object->getTitle());
1598  $title->setSize(50);
1599  $title->setMaxLength(70);
1600  $this->form->addItem($title);
1601 
1602  // desc
1603  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'),'desc');
1604  $desc->setValue($this->object->getLongDescription());
1605  $desc->setRows(4);
1606  $desc->setCols(50);
1607  $this->form->addItem($desc);
1608 
1609  // location
1610  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'),'location');
1611  $desc->setValue($this->object->getLocation());
1612  $desc->setRows(4);
1613  $desc->setCols(50);
1614  $this->form->addItem($desc);
1615 
1616  // workflow
1617  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'),'details');
1618  $details->setValue($this->object->getDetails());
1619  $details->setCols(50);
1620  $details->setRows(4);
1621  $this->form->addItem($details);
1622 
1623  // section
1625  $section->setTitle($this->lng->txt('event_tutor_data'));
1626  $this->form->addItem($section);
1627 
1628  // name
1629  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'),'tutor_name');
1630  $tutor_name->setValue($this->object->getName());
1631  $tutor_name->setSize(20);
1632  $tutor_name->setMaxLength(70);
1633  $this->form->addItem($tutor_name);
1634 
1635  // email
1636  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'),'tutor_email');
1637  $tutor_email->setValue($this->object->getEmail());
1638  $tutor_email->setSize(20);
1639  $tutor_email->setMaxLength(70);
1640  $this->form->addItem($tutor_email);
1641 
1642  // phone
1643  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'),'tutor_phone');
1644  $tutor_phone->setValue($this->object->getPhone());
1645  $tutor_phone->setSize(20);
1646  $tutor_phone->setMaxLength(70);
1647  $this->form->addItem($tutor_phone);
1648 
1650  $section->setTitle($this->lng->txt('sess_section_reg'));
1651  $this->form->addItem($section);
1652 
1653  include_once './Modules/Session/classes/class.ilSessionMembershipRegistrationSettingsGUI.php';
1654  include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
1655  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1656  $this,
1657  $this->object,
1658  array(
1663  )
1664  );
1665  $reg_settings->addMembershipFormElements($this->form, '');
1666 
1667 
1669  $section->setTitle($this->lng->txt('event_assign_files'));
1670  $this->form->addItem($section);
1671 
1672  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'),'files');
1673  $files->setFilenames(array(0 => ''));
1674  $this->form->addItem($files);
1675 
1676  switch($a_mode)
1677  {
1678  case 'create':
1679  $this->form->setTitle($this->lng->txt('event_table_create'));
1680 
1681  $this->form->addCommandButton('save',$this->lng->txt('event_btn_add'));
1682  $this->form->addCommandButton('saveAndAssignMaterials',$this->lng->txt('event_btn_add_edit'));
1683  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
1684 
1685  return true;
1686 
1687  case 'edit':
1688  $this->form->setTitle($this->lng->txt('event_table_update'));
1689 
1690  $this->form->addCommandButton('update',$this->lng->txt('save'));
1691  $this->form->addCommandButton('cancelEdit',$this->lng->txt('cancel'));
1692 
1693  return true;
1694  }
1695  return true;
1696  }
1697 
1705  protected function load()
1706  {
1707  global $ilUser;
1708 
1709  $this->object->getFirstAppointment()->setStartingTime($this->__toUnix($_POST['event']['start']['date'],$_POST['event']['start']['time']));
1710  $this->object->getFirstAppointment()->setEndingTime($this->__toUnix($_POST['event']['end']['date'],$_POST['event']['end']['time']));
1711  $this->object->getFirstAppointment()->toggleFullTime((bool) $_POST['event']['fulltime']);
1712 
1713  include_once('./Services/Calendar/classes/class.ilDate.php');
1714  if($this->object->getFirstAppointment()->isFullday())
1715  {
1716  $start = new ilDate($_POST['event']['start']['date']['y'].'-'.$_POST['event']['start']['date']['m'].'-'.$_POST['event']['start']['date']['d'],
1717  IL_CAL_DATE);
1718  $this->object->getFirstAppointment()->setStart($start);
1719 
1720  $end = new ilDate($_POST['event']['end']['date']['y'].'-'.$_POST['event']['end']['date']['m'].'-'.$_POST['event']['end']['date']['d'],
1721  IL_CAL_DATE);
1722  $this->object->getFirstAppointment()->setEnd($end);
1723  }
1724  else
1725  {
1726  $start_dt['year'] = (int) $_POST['event']['start']['date']['y'];
1727  $start_dt['mon'] = (int) $_POST['event']['start']['date']['m'];
1728  $start_dt['mday'] = (int) $_POST['event']['start']['date']['d'];
1729  $start_dt['hours'] = (int) $_POST['event']['start']['time']['h'];
1730  $start_dt['minutes'] = (int) $_POST['event']['start']['time']['m'];
1731 
1732  $start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1733  $this->object->getFirstAppointment()->setStart($start);
1734 
1735  $end_dt['year'] = (int) $_POST['event']['end']['date']['y'];
1736  $end_dt['mon'] = (int) $_POST['event']['end']['date']['m'];
1737  $end_dt['mday'] = (int) $_POST['event']['end']['date']['d'];
1738  $end_dt['hours'] = (int) $_POST['event']['end']['time']['h'];
1739  $end_dt['minutes'] = (int) $_POST['event']['end']['time']['m'];
1740  $end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1741  $this->object->getFirstAppointment()->setEnd($end);
1742  }
1743 
1744  $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1745  $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1746  $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1747  $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1748  $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1749  $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1750  $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1751 
1752  $this->object->setRegistrationType((int) $_POST['registration_type']);
1753  // $this->object->setRegistrationMinUsers((int) $_POST['registration_min_members']);
1754  $this->object->setRegistrationMaxUsers((int) $_POST['registration_max_members']);
1755  $this->object->enableRegistrationUserLimit((int) $_POST['registration_membership_limited']);
1756 
1757  switch((int) $_POST['waiting_list'])
1758  {
1759  case 2:
1760  $this->object->enableRegistrationWaitingList(true);
1761  $this->object->setWaitingListAutoFill(true);
1762  break;
1763 
1764  case 1:
1765  $this->object->enableRegistrationWaitingList(true);
1766  $this->object->setWaitingListAutoFill(false);
1767  break;
1768 
1769  default:
1770  $this->object->enableRegistrationWaitingList(false);
1771  $this->object->setWaitingListAutoFill(false);
1772  break;
1773  }
1774  }
1775 
1782  protected function loadRecurrenceSettings()
1783  {
1784  include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1785  $this->rec = new ilSessionRecurrence();
1786 
1787  switch($_POST['frequence'])
1788  {
1789  case IL_CAL_FREQ_DAILY:
1790  $this->rec->setFrequenceType($_POST['frequence']);
1791  $this->rec->setInterval((int) $_POST['count_DAILY']);
1792  break;
1793 
1794  case IL_CAL_FREQ_WEEKLY:
1795  $this->rec->setFrequenceType($_POST['frequence']);
1796  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1797  if(is_array($_POST['byday_WEEKLY']))
1798  {
1799  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1800  }
1801  break;
1802 
1803  case IL_CAL_FREQ_MONTHLY:
1804  $this->rec->setFrequenceType($_POST['frequence']);
1805  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1806  switch((int) $_POST['subtype_MONTHLY'])
1807  {
1808  case 0:
1809  // nothing to do;
1810  break;
1811 
1812  case 1:
1813  switch((int) $_POST['monthly_byday_day'])
1814  {
1815  case 8:
1816  // Weekday
1817  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1818  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1819  break;
1820 
1821  case 9:
1822  // Day of month
1823  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1824  break;
1825 
1826  default:
1827  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1828  break;
1829  }
1830  break;
1831 
1832  case 2:
1833  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1834  break;
1835  }
1836  break;
1837 
1838  case IL_CAL_FREQ_YEARLY:
1839  $this->rec->setFrequenceType($_POST['frequence']);
1840  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1841  switch((int) $_POST['subtype_YEARLY'])
1842  {
1843  case 0:
1844  // nothing to do;
1845  break;
1846 
1847  case 1:
1848  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1849  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1850  break;
1851 
1852  case 2:
1853  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1854  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1855  break;
1856  }
1857  break;
1858  }
1859 
1860  // UNTIL
1861  switch((int) $_POST['until_type'])
1862  {
1863  case 1:
1864  $this->rec->setFrequenceUntilDate(null);
1865  // nothing to do
1866  break;
1867 
1868  case 2:
1869  $this->rec->setFrequenceUntilDate(null);
1870  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1871  break;
1872 
1873  case 3:
1874  $end_dt['year'] = (int) $_POST['until_end']['date']['y'];
1875  $end_dt['mon'] = (int) $_POST['until_end']['date']['m'];
1876  $end_dt['mday'] = (int) $_POST['until_end']['date']['d'];
1877 
1878  $this->rec->setFrequenceUntilCount(0);
1879  $this->rec->setFrequenceUntilDate(new ilDate($end_dt,IL_CAL_FKT_GETDATE,$this->timezone));
1880  break;
1881  }
1882  }
1883 
1884 
1892  protected function __toUnix($date,$time)
1893  {
1894  return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
1895  }
1896 
1903  public function addLocatorItems()
1904  {
1905  global $ilLocator;
1906 
1907  if (is_object($this->object))
1908  {
1909  // see prepareOutput()
1910  include_once './Modules/Session/classes/class.ilSessionAppointment.php';
1911  $title = strlen($this->object->getTitle()) ? (': '.$this->object->getTitle()) : '';
1912  $title = $this->object->getFirstAppointment()->appointmentToString().$title;
1913 
1914  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
1915  }
1916  }
1917 
1924  public function getTabs($tabs_gui)
1925  {
1926  global $ilAccess, $ilTabs, $tree, $ilCtrl, $ilHelp;
1927 
1928  $ilHelp->setScreenIdComponent("sess");
1929 
1930  $parent_id = $tree->getParentId($this->object->getRefId());
1931 
1932  // #11650
1933  $parent_type = ilObject::_lookupType($parent_id, true);
1934 
1935  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
1936  $tabs_gui->setBackTarget($this->lng->txt('back_to_'.$parent_type.'_content'),
1937  $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
1938  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1939 
1940  $tabs_gui->addTarget('info_short',
1941  $this->ctrl->getLinkTarget($this,'infoScreen'));
1942 
1943  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1944  {
1945  $tabs_gui->addTarget('settings',
1946  $this->ctrl->getLinkTarget($this,'edit'));
1947  $tabs_gui->addTarget('crs_materials',
1948  $this->ctrl->getLinkTarget($this,'materials'));
1949  $tabs_gui->addTarget('event_edit_members',
1950  $this->ctrl->getLinkTarget($this,'members'));
1951  }
1952 
1953  // learning progress
1954  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1955  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
1956  {
1957  $tabs_gui->addTarget('learning_progress',
1958  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'),''),
1959  '',
1960  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1961  }
1962 
1963  // export
1964  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1965  {
1966  $ilTabs->addTarget("export",
1967  $this->ctrl->getLinkTargetByClass("ilexportgui", ""), "", "ilexportgui");
1968  }
1969 
1970 
1971  // edit permissions
1972  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1973  {
1974  $tabs_gui->addTarget("perm_settings",
1975  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), array("perm","info","owner"), 'ilpermissiongui');
1976  }
1977 
1978  }
1979 
1985  public function afterSaveCallback(ilObject $a_obj)
1986  {
1987  // add new object to materials
1988  include_once './Modules/Session/classes/class.ilEventItems.php';
1989  $event_items = new ilEventItems($this->object->getId());
1990  $event_items->addItem($a_obj->getRefId());
1991  $event_items->update();
1992 
1993  /*
1994  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
1995  $this->ctrl->redirect($this, "materials");
1996  */
1997  }
1998 
2002  protected function sendMailToSelectedUsersObject()
2003  {
2004  $GLOBALS['ilCtrl']->setReturn($this,'members');
2005  $GLOBALS['ilCtrl']->setCmdClass('ilmembershipgui');
2006  include_once './Services/Membership/classes/class.ilMembershipGUI.php';
2007  $mem = new ilMembershipGUI($this);
2008  $GLOBALS['ilCtrl']->forwardCommand($mem);
2009  }
2010 
2014  public function readMemberData($a_usr_ids)
2015  {
2016  $tmp_data = array();
2017  foreach ($a_usr_ids as $usr_id)
2018  {
2019  $tmp_data[$usr_id] = array();
2020  }
2021  return $tmp_data;
2022  }
2023 
2032  {
2033  $this->checkPermission('write');
2034 
2035  if(!count($_POST["waiting"]))
2036  {
2037  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2038  $this->membersObject();
2039  return false;
2040  }
2041 
2042  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2043  $waiting_list = new ilSessionWaitingList($this->object->getId());
2044 
2045  include_once './Modules/Session/classes/class.ilEventParticipants.php';
2046  $part = new ilEventParticipants($this->object->getId());
2047 
2048  $added_users = 0;
2049  foreach($_POST["waiting"] as $user_id)
2050  {
2051  $part->register($user_id);
2052  $waiting_list->removeFromList($user_id);
2053 
2054  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2056  $noti->setRefId($this->object->getRefId());
2057  $noti->setRecipients(array($user_id));
2059  $noti->send();
2060 
2061  ++$added_users;
2062  }
2063  if($added_users)
2064  {
2065  ilUtil::sendSuccess($this->lng->txt("sess_users_added"));
2066  $this->membersObject();
2067 
2068  return true;
2069  }
2070  else
2071  {
2072  ilUtil::sendFailure($this->lng->txt("sess_users_already_assigned"));
2073  $this->searchObject();
2074  return false;
2075  }
2076  }
2077 
2084  public function refuseFromListObject()
2085  {
2086  $this->checkPermission('write');
2087 
2088  if(!count($_POST['waiting']))
2089  {
2090  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2091  $this->membersObject();
2092  return false;
2093  }
2094 
2095  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2096  $waiting_list = new ilSessionWaitingList($this->object->getId());
2097 
2098  foreach($_POST["waiting"] as $user_id)
2099  {
2100  $waiting_list->removeFromList($user_id);
2101 
2102  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2104  $noti->setRefId($this->object->getRefId());
2105  $noti->setRecipients(array($user_id));
2107  $noti->send();
2108 
2109  }
2110 
2111  ilUtil::sendSuccess($this->lng->txt('sess_users_removed_from_list'));
2112  $this->membersObject();
2113  return true;
2114  }
2115 
2122  public function assignSubscribersObject()
2123  {
2124  global $lng,$ilUser;
2125 
2126  $this->checkPermission('write');
2127 
2128  if(!count($_POST['subscribers']))
2129  {
2130  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2131  $this->membersObject();
2132  return false;
2133  }
2134 
2135  include_once './Services/Membership/classes/class.ilParticipants.php';
2136  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2137 
2138  foreach($_POST['subscribers'] as $usr_id)
2139  {
2140  $part->add($usr_id);
2141  $part->deleteSubscriber($usr_id);
2142 
2143  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2145  $noti->setRefId($this->object->getRefId());
2146  $noti->setRecipients(array($usr_id));
2148  $noti->send();
2149  }
2150  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_assigned"),true);
2151  $this->ctrl->redirect($this,'members');
2152  return true;
2153  }
2154 
2161  public function refuseSubscribersObject()
2162  {
2163  global $lng;
2164 
2165  $this->checkPermission('write');
2166 
2167  if(!count($_POST['subscribers']))
2168  {
2169  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2170  $this->membersObject();
2171  return false;
2172  }
2173 
2174  include_once './Services/Membership/classes/class.ilParticipants.php';
2175  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2176  foreach($_POST['subscribers'] as $usr_id)
2177  {
2178  $part->deleteSubscriber($usr_id);
2179 
2180  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2182  $noti->setRefId($this->object->getRefId());
2183  $noti->setRecipients(array($usr_id));
2185  $noti->send();
2186  }
2187  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_removed"));
2188  $this->membersObject();
2189  return true;
2190 
2191  }
2196  public function getContainerRefId()
2197  {
2198  if(!$this->container_ref_id)
2199  {
2200  $this->initContainer();
2201  }
2202  return $this->container_ref_id;
2203  }
2204 
2206  {
2207  if(!is_array($_POST["subscribers"]))
2208  {
2209  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2210  $this->membersObject();
2211 
2212  return false;
2213  }
2214 
2215  $this->lng->loadLanguageModule('mmbr');
2216 
2217  $this->checkPermission('write');
2218  $this->tabs_gui->setTabActive('event_edit_members');
2219 
2220  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2221  $c_gui = new ilConfirmationGUI();
2222 
2223  // set confirm/cancel commands
2224  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
2225  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2226  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2227  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
2228 
2229  foreach($_POST["subscribers"] as $subscribers)
2230  {
2231  $name = ilObjUser::_lookupName($subscribers);
2232 
2233  $c_gui->addItem('subscribers[]',
2234  $name['user_id'],
2235  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2236  ilUtil::getImagePath('icon_usr.svg'));
2237  }
2238 
2239  $this->tpl->setContent($c_gui->getHTML());
2240  return true;
2241  }
2242 
2244  {
2245  if(!is_array($_POST["subscribers"]))
2246  {
2247  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2248  $this->membersObject();
2249 
2250  return false;
2251  }
2252  $this->checkPermission('write');
2253  $this->tabs_gui->setTabActive('event_edit_members');
2254 
2255  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2256  $c_gui = new ilConfirmationGUI();
2257 
2258  // set confirm/cancel commands
2259  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
2260  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2261  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2262  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
2263 
2264  foreach($_POST["subscribers"] as $subscribers)
2265  {
2266  $name = ilObjUser::_lookupName($subscribers);
2267 
2268  $c_gui->addItem('subscribers[]',
2269  $name['user_id'],
2270  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2271  ilUtil::getImagePath('icon_usr.svg'));
2272  }
2273 
2274  $this->tpl->setContent($c_gui->getHTML());
2275  return true;
2276  }
2277 
2279  {
2280  if(!is_array($_POST["waiting"]))
2281  {
2282  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2283  $this->membersObject();
2284 
2285  return false;
2286  }
2287 
2288  $this->lng->loadLanguageModule('mmbr');
2289 
2290  $this->checkPermission('write');
2291  $this->tabs_gui->setTabActive('event_edit_members');
2292 
2293  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2294  $c_gui = new ilConfirmationGUI();
2295 
2296  // set confirm/cancel commands
2297  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
2298  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2299  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2300  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
2301 
2302  foreach($_POST["waiting"] as $waiting)
2303  {
2304  $name = ilObjUser::_lookupName($waiting);
2305 
2306  $c_gui->addItem('waiting[]',
2307  $name['user_id'],
2308  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2309  ilUtil::getImagePath('icon_usr.svg'));
2310  }
2311 
2312  $this->tpl->setContent($c_gui->getHTML());
2313  return true;
2314  }
2315 
2317  {
2318  if(!is_array($_POST["waiting"]))
2319  {
2320  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2321  $this->membersObject();
2322 
2323  return false;
2324  }
2325  $this->checkPermission('write');
2326  $this->tabs_gui->setTabActive('event_edit_members');
2327 
2328  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2329  $c_gui = new ilConfirmationGUI();
2330 
2331  // set confirm/cancel commands
2332  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
2333  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2334  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2335  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
2336 
2337  foreach($_POST["waiting"] as $waiting)
2338  {
2339  $name = ilObjUser::_lookupName($waiting);
2340 
2341  $c_gui->addItem('waiting[]',
2342  $name['user_id'],
2343  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2344  ilUtil::getImagePath('icon_usr.svg'));
2345  }
2346 
2347  $this->tpl->setContent($c_gui->getHTML());
2348  return true;
2349  }
2350 
2351  function cancelEditObject()
2352  {
2353  global $ilCtrl, $tree;
2354  $parent_id = $tree->getParentId($this->object->getRefId());
2355  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2356  $ilCtrl->redirectByClass("ilrepositorygui", "");
2357  }
2358 }
2359 ?>
getItems()
get assigned items
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 sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
loadRecurrenceSettings()
load recurrence settings
print $file
const IL_CAL_FREQ_MONTHLY
exit
Definition: login.php:54
eventsListObject()
list sessions of all user
Class ilInfoScreenGUI.
$_POST['username']
Definition: cron.php:12
static getItemsByEvent($a_event_id)
Get session material / event items.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
afterSaveCallback(ilObject $a_obj)
Custom callback after object is created (in parent containert.
$_SESSION["AccountId"]
initForm($a_mode)
Init Form.
registerObject()
register to session
removeFromList($a_usr_id)
remove usr from list
This class represents a property form user interface.
GUI class for the workflow of copying objects.
updateMembersObject()
update participants
membersObject()
Show participants table.
$_GET["client_id"]
$tbl
Definition: example_048.php:81
$location
Definition: buildRTE.php:44
This class represents a section header in a property form.
saveMaterialsObject()
save material assignment
updateObject()
update object
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...
Class ilObject Basic functions for all objects.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
This class represents a file wizard property in a property form.
__showButton($a_cmd, $a_text, $a_target='')
$cmd
Definition: sahs_server.php:35
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
static setUseRelativeDates($a_status)
set use relative dates
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
createObject()
create new object form
Class ilTableGUI.
_unregister($a_usr_id, $a_event_id)
showJoinRequestButton()
show join request
const IL_CAL_UNIX
static addToDesktop()
Add desktop item public.
class ilEvent
_register($a_usr_id, $a_event_id)
executeCommand()
execute command
allowUnlimitedRecurrences($a_status)
Allow unlimited recurrences.
getCurrentObject()
Get session object.
static _isRegistered($a_usr_id, $a_event_id)
Base class for attendance lists.
static _goto($a_target)
goto
global $ilCtrl
Definition: ilias.php:18
getAttendanceListUserData($a_user_id, $a_filters)
Get user data for attendance list.
assignFromWaitingListObject()
add from waiting list
setShowHidePrefs()
set preferences (show/hide tabel content)
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$section
Definition: Utf8Test.php:84
calculateDateList(ilDateTime $a_start, ilDateTime $a_end, $a_limit=-1)
calculate date list
readMemberData($a_usr_ids)
Used for waiting list.
addLocatorItems()
Add session locator.
Export User Interface Class.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
$info
Definition: example_052.php:80
input GUI for a time span (start and end date)
__toUnix($date, $time)
protected
createRecurringSessions($a_activate_lp=true)
create recurring sessions
Class for single dates.
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,7),&#39;usr_data&#39;,&#39;lastname&#39;,&#39;usr_id&#39;) => sorts by lastname.
Calculates an ilDateList for a given calendar entry and recurrence rule.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
assignSubscribersObject()
assign subscribers
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
saveObject()
save object
const IL_CAL_FREQ_YEARLY
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
initContainer($a_init_participants=false)
Class ilObjFile.
This class represents a text property in a property form.
static initDomEvent()
Init YUI DomEvent.
sendMailToSelectedUsersObject()
Send mail to selected users.
Date and time handling
GUI class for course/group subscriptions.
saveObject($a_redirect_on_success=true)
save object
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
static addListGUIActivationProperty(ilObjectListGUI $a_list_gui, array &$a_item)
Get timing details for list gui.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setStartText($a_txt)
Set text, which will be shown before the start date.
const IL_CAL_FKT_GETDATE
deleteFilesObject()
delete files
materialsObject()
show material assignment
_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.
refuseSubscribersObject()
refuse subscribers
static removeFromDesktop()
Remove item from personal desktop public.
const IL_CAL_DATE
joinObject()
Called from info screen.
global $ilUser
Definition: imgupload.php:15
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
Render add new item selector.
This class represents a text area property in a property form.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
getTabs($tabs_gui)
Build tabs.
GUI class for course/group waiting list.
getCreationMode()
get creation mode
getRefId()
get reference id public
modifyItemGUI($a_item_list_gui, $a_item_data, $a_show_path)
Modify Item ListGUI for presentation in container.
confirmDeleteFilesObject()
confirm delete files
getContainerRefId()
container ref id
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
static _getInstance($a_obj_id)
get instance by obj_id
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276
addItem($a_item_ref_id)
Add one item.
refuseFromListObject()
refuse from waiting list
setValue($a_value)
Set Value.
initAttendanceList()
Init attendance list object.
addHeaderAction()
Add header action menu.
static factory($a_type)
Get list gui by type This method caches all the returned list guis.
attendanceListObject()
show attendance list selection
saveAndAssignMaterialsObject()
Save and assign sessoin materials.
Class ilObjUserTrackingGUI.
$html
Definition: example_001.php:87
unregisterObject()
unregister from session
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
const IL_CAL_FREQ_WEEKLY
printAttendanceListObject()
print attendance list
class ilEvent
const IL_CAL_YEAR
Confirmation screen class.