ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules 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  {
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  $this->load();
817  $this->initForm('edit');
818 
819  $ilErr->setMessage('');
820  if(!$this->form->checkInput())
821  {
822  $ilErr->setMessage($this->lng->txt('err_check_input'));
823  }
824  $this->object->validate();
825  $this->object->getFirstAppointment()->validate();
826 
827  if(strlen($ilErr->getMessage()))
828  {
829  ilUtil::sendFailure($ilErr->getMessage());
830  $this->editObject();
831  return false;
832  }
833  // Update event
834  $this->object->update();
835  $this->object->getFirstAppointment()->update();
836 
837  $this->handleFileUpload();
838 
839  ilUtil::sendSuccess($this->lng->txt('event_updated'),true);
840  $this->ctrl->redirect($this,'edit');
841  #$this->object->initFiles();
842  #$this->editObject();
843  return true;
844  }
845 
853  public function confirmDeleteFilesObject()
854  {
855  $this->tabs_gui->setTabActive('settings');
856 
857  if(!count($_POST['file_id']))
858  {
859  ilUtil::sendFailure($this->lng->txt('select_one'));
860  $this->editObject();
861  return false;
862  }
863 
864  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
865  $c_gui = new ilConfirmationGUI();
866 
867  // set confirm/cancel commands
868  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
869  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
870  $c_gui->setCancel($this->lng->txt("cancel"), "edit");
871  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
872 
873  // add items to delete
874  foreach($_POST["file_id"] as $file_id)
875  {
876  $file = new ilSessionFile($file_id);
877  if($file->getSessionId() != $this->object->getEventId())
878  {
879  ilUtil::sendFailure($this->lng->txt('select_one'));
880  $this->edit();
881  return false;
882  }
883  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
884  }
885 
886  $this->tpl->setContent($c_gui->getHTML());
887  return true;
888  }
889 
897  public function deleteFilesObject()
898  {
899  if(!count($_POST['file_id']))
900  {
901  ilUtil::sendFailure($this->lng->txt('select_one'));
902  $this->editObject();
903  return false;
904  }
905  foreach($_POST['file_id'] as $id)
906  {
907  $file = new ilSessionFile($id);
908  $file->delete();
909  }
910  $this->object->initFiles();
911  $this->editObject();
912  return true;
913  }
914 
915  protected function initContainer($a_init_participants = false)
916  {
917  global $tree;
918 
919  $is_course = $is_group = false;
920 
921  // #13178
922  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'grp');
923  if($this->container_ref_id)
924  {
925  $is_group = true;
926  }
927  if(!$this->container_ref_id)
928  {
929  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
930  if($this->container_ref_id)
931  {
932  $is_course = true;
933  }
934  }
935  if(!$this->container_ref_id)
936  {
937  ilUtil::sendFailure('No container object found. Aborting');
938  return true;
939  }
940  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
941 
942  if($a_init_participants && $this->container_obj_id)
943  {
944  if($is_course)
945  {
946  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
947  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
948  }
949  else if($is_group)
950  {
951  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
952  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
953  }
954  }
955 
956  }
957 
965  public function materialsObject()
966  {
967  global $tree, $objDefinition;
968 
969  $this->tabs_gui->setTabActive('crs_materials');
970 
971  // #11337 - support ANY parent container (crs, grp, fld)
972  $parent_ref_id = $tree->getParentId($this->object->getRefId());
973 
974  include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
975  $gui = new ilObjectAddNewItemGUI($parent_ref_id);
976  $gui->setDisabledObjectTypes(array("itgr", "sess"));
977  $gui->setAfterCreationCallback($this->ref_id);
978  $gui->render();
979 
980  include_once 'Modules/Session/classes/class.ilEventItems.php';
981  $this->event_items = new ilEventItems($this->object->getId());
982 
983  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
984  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
985  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
986  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
987 
988  $tbl->setMaterialItems($this->event_items->getItems());
989  $tbl->setContainerRefId($this->getContainerRefId());
990  $tbl->getDataFromDb();
991 
992  $this->tpl->setContent($tbl->getHTML());
993  }
994 
1002  public function saveMaterialsObject()
1003  {
1004  include_once './Modules/Session/classes/class.ilEventItems.php';
1005 
1006  $this->event_items = new ilEventItems($this->object->getId());
1007 
1008  $list_items = is_array($_POST['all_items']) ? $_POST['all_items'] : array();
1009  $list_items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1010 
1011  $checked = $this->event_items->getItems();
1012  $checked = array_diff($checked, $list_items);//remove all visible items in list
1013  $checked = array_merge($checked, $list_items_checked);//add checked items in list
1014 
1015  $this->event_items->setItems($checked);
1016  $this->event_items->update();
1017 
1018  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1019  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1020  $tbl->setOffset(0);
1021  $tbl->storeNavParameter();//remove offset and go to page 1
1022 
1023  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1024  $this->ctrl->redirect($this,'materials');
1025  }
1026 
1031  protected function membersObject()
1032  {
1033  global $tree,$ilUser;
1034 
1035  $this->checkPermission('write');
1036  $this->tabs_gui->setTabActive('event_edit_members');
1037 
1038  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_members.html', 'Modules/Session');
1039 
1040  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1041  $toolbar = new ilToolbarGUI();
1042  $toolbar->addButton($this->lng->txt('sess_gen_attendance_list'),
1043  $this->ctrl->getLinkTarget($this,'attendanceList'));
1044 
1045  $this->tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
1046 
1047  $members_obj = $this->initContainer(true);
1048 
1049  include_once './Modules/Session/classes/class.ilEventParticipants.php';
1050 
1051  // Save hide/show table settings
1052  $this->setShowHidePrefs();
1053 
1054  // Waiting list table
1055  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
1056  $waiting_list = new ilSessionWaitingList($this->object->getId());
1057  if(count($wait = $waiting_list->getAllUsers()))
1058  {
1059  include_once('./Services/Membership/classes/class.ilWaitingListTableGUI.php');
1060  if($ilUser->getPref('sess_wait_hide'))
1061  {
1062  $table_gui = new ilWaitingListTableGUI($this,$waiting_list,false);
1063  $this->ctrl->setParameter($this,'wait_hide',0);
1064  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1065  $this->lng->txt('show'));
1066  $this->ctrl->clearParameters($this);
1067  }
1068  else
1069  {
1070  $table_gui = new ilWaitingListTableGUI($this,$waiting_list,true);
1071  $this->ctrl->setParameter($this,'wait_hide',1);
1072  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1073  $this->lng->txt('hide'));
1074  $this->ctrl->clearParameters($this);
1075  }
1076  $table_gui->setUsers($wait);
1077  $table_gui->setTitle($this->lng->txt('grp_header_waiting_list'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
1078  $this->tpl->setVariable('TABLE_WAIT',$table_gui->getHTML());
1079  }
1080 
1081  // subscribers
1082  // Subscriber table
1083  include_once './Services/Membership/classes/class.ilParticipants.php';
1084  $part = ilParticipants::getInstanceByObjId($this->object->getId());
1085  if($part->getSubscribers())
1086  {
1087  include_once('./Services/Membership/classes/class.ilSubscriberTableGUI.php');
1088  if($ilUser->getPref('grp_subscriber_hide'))
1089  {
1090  $table_gui = new ilSubscriberTableGUI($this,false, false);
1091  $this->ctrl->setParameter($this,'subscriber_hide',0);
1092  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1093  $this->lng->txt('show'));
1094  $this->ctrl->clearParameters($this);
1095  }
1096  else
1097  {
1098  $table_gui = new ilSubscriberTableGUI($this,true, false);
1099  $this->ctrl->setParameter($this,'subscriber_hide',1);
1100  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1101  $this->lng->txt('hide'));
1102  $this->ctrl->clearParameters($this);
1103  }
1104  $table_gui->readSubscriberData();
1105  $table_gui->setTitle($this->lng->txt('group_new_registrations'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
1106  $this->tpl->setVariable('TABLE_SUB',$table_gui->getHTML());
1107  }
1108 
1109 
1110  // Admins
1111  if(count($admins = $members_obj->getAdmins()))
1112  {
1113  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1114  if($ilUser->getPref('sess_admin_hide'))
1115  {
1117  $this->ctrl->setParameter($this,'admin_hide',0);
1118  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1119  $this->lng->txt('show'));
1120  $this->ctrl->clearParameters($this);
1121  }
1122  else
1123  {
1125  $this->ctrl->setParameter($this,'admin_hide',1);
1126  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1127  $this->lng->txt('hide'));
1128  $this->ctrl->clearParameters($this);
1129  }
1130 
1131  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1132  $table->setTitle($this->lng->txt('event_tbl_admins'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1133  $table->enableRegistration($this->object->enabledRegistration());
1134  $table->setParticipants($admins);
1135  $table->parse();
1136  $this->tpl->setVariable('ADMINS',$table->getHTML());
1137  }
1138 
1139  // Tutors
1140  if(count($tutors = $members_obj->getTutors()))
1141  {
1142  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1143  if($ilUser->getPref('sess_tutor_hide'))
1144  {
1146  $this->ctrl->setParameter($this,'tutor_hide',0);
1147  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1148  $this->lng->txt('show'));
1149  $this->ctrl->clearParameters($this);
1150  }
1151  else
1152  {
1154  $this->ctrl->setParameter($this,'tutor_hide',1);
1155  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1156  $this->lng->txt('hide'));
1157  $this->ctrl->clearParameters($this);
1158  }
1159  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1160  $table->setTitle($this->lng->txt('event_tbl_tutors'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1161  $table->enableRegistration($this->object->enabledRegistration());
1162  $table->setParticipants($tutors);
1163  $table->parse();
1164  $this->tpl->setVariable('TUTORS',$table->getHTML());
1165  }
1166 
1167  // Members
1168  if(count($members = $members_obj->getMembers()))
1169  {
1170  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1171  if($ilUser->getPref('sess_member_hide'))
1172  {
1174  $this->ctrl->setParameter($this,'member_hide',0);
1175  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1176  $this->lng->txt('show'));
1177  $this->ctrl->clearParameters($this);
1178  }
1179  else
1180  {
1182  $this->ctrl->setParameter($this,'member_hide',1);
1183  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1184  $this->lng->txt('hide'));
1185  $this->ctrl->clearParameters($this);
1186  }
1187  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1188  $table->setTitle($this->lng->txt('event_tbl_members'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1189  $table->enableRegistration($this->object->enabledRegistration());
1190  $table->setParticipants($members);
1191  $table->parse();
1192  $this->tpl->setVariable('MEMBERS',$table->getHTML());
1193  }
1194 
1195 
1196  $GLOBALS['lng']->loadLanguageModule('mmbr');
1197  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
1198  $this->tpl->setVariable('TXT_SELECTED_USER',$this->lng->txt('mmbr_selected_users'));
1199  $this->tpl->setVariable('BTN_FOOTER_MAIL',$this->lng->txt('mmbr_btn_mail_selected_users'));
1200  $this->tpl->setVariable('ARROW_DOWN',ilUtil::getImagePath('arrow_downright.svg'));
1201  }
1202 
1209  public function setShowHidePrefs()
1210  {
1211  global $ilUser;
1212 
1213  if(isset($_GET['admin_hide']))
1214  {
1215  $ilUser->writePref('sess_admin_hide',(int) $_GET['admin_hide']);
1216  }
1217  if(isset($_GET['tutor_hide']))
1218  {
1219  $ilUser->writePref('sess_tutor_hide',(int) $_GET['tutor_hide']);
1220  }
1221  if(isset($_GET['member_hide']))
1222  {
1223  $ilUser->writePref('sess_member_hide',(int) $_GET['member_hide']);
1224  }
1225  }
1226 
1234  public function updateMembersObject()
1235  {
1236  global $tree;
1237 
1238  $this->checkPermission('write');
1239 
1240 
1241 
1242  $this->initContainer();
1243 
1244  $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
1245  $_POST['registered'] = is_array($_POST['registered']) ? $_POST['registered'] : array();
1246 
1247  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1248 
1249  $visible = $_POST['visible_participants'] ? $_POST['visible_participants'] : array();
1250  foreach($visible as $user)
1251  {
1252  $part = new ilEventParticipants($this->object->getId());
1253  $part->setUserId($user);
1254  $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
1255  $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
1256  $part->setParticipated(isset($_POST['participants'][$user]) ? true : false);
1257  $part->setRegistered(isset($_POST['registered'][$user]) ? true : false);
1258  $part->updateUser();
1259  }
1260  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1261  $this->membersObject();
1262  }
1263 
1270  public function attendanceListObject()
1271  {
1272  global $tpl,$ilTabs;
1273 
1274  $this->checkPermission('write');
1275  $ilTabs->setTabActive('event_edit_members');
1276 
1277  $list = $this->initAttendanceList();
1278  $form = $list->initForm('printAttendanceList');
1279  $tpl->setContent($form->getHTML());
1280  }
1281 
1287  protected function initAttendanceList()
1288  {
1289  $members_obj = $this->initContainer(true);
1290 
1291  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1292  $list = new ilAttendanceList($this, $members_obj);
1293  $list->setId('sessattlst');
1294 
1295  $event_app = $this->object->getFirstAppointment();
1297  $desc = ilDatePresentation::formatPeriod($event_app->getStart(),$event_app->getEnd());
1299  $desc .= " ".$this->object->getTitle();
1300  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1301 
1302  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1303  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1304  if($this->object->enabledRegistration())
1305  {
1306  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1307  }
1308  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1309  $list->addBlank($this->lng->txt('sess_signature'));
1310 
1311  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1312 
1313  return $list;
1314  }
1315 
1321  protected function printAttendanceListObject()
1322  {
1323  $this->checkPermission('write');
1324 
1325  $list = $this->initAttendanceList();
1326  $list->initFromForm();
1327  $list->setCallback(array($this, 'getAttendanceListUserData'));
1328 
1329  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1330  $this->event_part = new ilEventParticipants($this->object->getId());
1331 
1332  echo $list->getFullscreenHTML();
1333  exit();
1334  }
1335 
1345  public function getAttendanceListUserData($a_user_id, $a_filters)
1346  {
1347  $data = $this->event_part->getUser($a_user_id);
1348 
1349  if($a_filters && $a_filters["registered"] && !$data["registered"])
1350  {
1351  return;
1352  }
1353 
1354  $data['registered'] = $data['registered'] ?
1355  $this->lng->txt('yes') :
1356  $this->lng->txt('no');
1357  $data['participated'] = $data['participated'] ?
1358  $this->lng->txt('yes') :
1359  $this->lng->txt('no');
1360 
1361  return $data;
1362  }
1363 
1371  public function eventsListObject()
1372  {
1373  global $ilErr,$ilAccess, $ilUser,$tree;
1374 
1375  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
1376  {
1377  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
1378  }
1379 
1380  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_list.html','Modules/Session');
1381  $this->__showButton($this->ctrl->getLinkTarget($this,'exportCSV'),$this->lng->txt('event_csv_export'));
1382 
1383  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1384 
1385  $this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
1386  $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.sess_list_row.html','Modules/Session');
1387 
1388  $members_obj = $this->initContainer(true);
1389  $members = $members_obj->getParticipants();
1390  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
1391 
1392  // Table
1393  $tbl = new ilTableGUI();
1394  $tbl->setTitle($this->lng->txt("event_overview"),
1395  'icon_usr.svg',
1396  $this->lng->txt('obj_usr'));
1397  $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
1398 
1399  $course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
1400  $events = array();
1401  foreach($tree->getSubtree($tree->getNodeData($course_ref_id),false,'sess') as $event_id)
1402  {
1403  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
1404  if(!is_object($tmp_event) or $tmp_event->getType() != 'sess')
1405  {
1406  continue;
1407  }
1408  $events[] = $tmp_event;
1409  }
1410 
1411  $headerNames = array();
1412  $headerVars = array();
1413  $colWidth = array();
1414 
1415  $headerNames[] = $this->lng->txt('name');
1416  $headerVars[] = "name";
1417  $colWidth[] = '20%';
1418 
1419  for ($i = 1; $i <= count($events); $i++)
1420  {
1421  $headerNames[] = $i;
1422  $headerVars[] = "event_".$i;
1423  $colWidth[] = 80/count($events)."%";
1424  }
1425 
1426  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1427  $tbl->setHeaderNames($headerNames);
1428  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'eventsList'));
1429  $tbl->setColumnWidth($colWidth);
1430 
1431  $tbl->setOrderColumn($_GET["sort_by"]);
1432  $tbl->setOrderDirection($_GET["sort_order"]);
1433  $tbl->setOffset($_GET["offset"]);
1434  $tbl->setLimit($ilUser->getPref("hits_per_page"));
1435  $tbl->setMaxCount(count($members));
1436  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1437 
1438  $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
1439  $tbl->disable('sort');
1440  $tbl->render();
1441 
1442  $counter = 0;
1443  foreach($sliced_users as $user_id)
1444  {
1445  foreach($events as $event_obj)
1446  {
1447  $this->tpl->setCurrentBlock("eventcols");
1448 
1449  $event_part = new ilEventParticipants($this->object->getId());
1450 
1451  {
1452  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1453  ilUtil::getImagePath('icon_ok.svg') :
1454  ilUtil::getImagePath('icon_not_ok.svg'));
1455 
1456  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1457  $this->lng->txt('event_participated') :
1458  $this->lng->txt('event_not_participated'));
1459  }
1460 
1461  $this->tpl->parseCurrentBlock();
1462  }
1463 
1464  $this->tpl->setCurrentBlock("tbl_content");
1465  $name = ilObjUser::_lookupName($user_id);
1466  $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1467  $this->tpl->setVariable("LASTNAME",$name['lastname']);
1468  $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
1469  $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
1470  $this->tpl->parseCurrentBlock();
1471  }
1472 
1473  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1474  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1475  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1476  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1477  $this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
1478  $i = 1;
1479  foreach($events as $event_obj)
1480  {
1481  $this->tpl->setCurrentBlock("legend_loop");
1482  $this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1483  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1484  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1485  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1486  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1487  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1488  $this->tpl->parseCurrentBlock();
1489  }
1490 
1491  }
1492 
1498  protected function initForm($a_mode)
1499  {
1500  global $ilUser;
1501 
1502  if(is_object($this->form))
1503  {
1504  return true;
1505  }
1506 
1507  $this->lng->loadLanguageModule('dateplaner');
1508 
1509  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1510 
1511  include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1513 
1514  $this->form = new ilPropertyFormGUI();
1515  $this->form->setMultipart(true);
1516  $this->form->setTableWidth('600px');
1517  $this->form->setFormAction($this->ctrl->getFormAction($this));
1518  $this->form->setMultipart(true);
1519 
1520  /*
1521  $full = new ilCheckboxInputGUI('','fulltime');
1522  $full->setChecked($this->object->getFirstAppointment()->enabledFulltime() ? true : false);
1523  $full->setOptionTitle($this->lng->txt('event_fulltime_info'));
1524  $full->setAdditionalAttributes('onchange="ilToggleSessionTime(this);"');
1525  #$this->form->addItem($full);
1526  */
1527 
1528  $this->lng->loadLanguageModule('dateplaner');
1529  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1530  #$this->tpl->addJavaScript('./Modules/Session/js/toggle_session_time.js');
1531  $this->tpl->addJavaScript('./Services/Form/js/date_duration.js');
1532  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'),'event');
1533  $dur->setStartText($this->lng->txt('event_start_date'));
1534  $dur->setEndText($this->lng->txt('event_end_date'));
1535  $dur->enableToggleFullTime(
1536  $this->lng->txt('event_fulltime_info'),
1537  $this->object->getFirstAppointment()->enabledFulltime() ? true : false
1538  );
1539  $dur->setShowTime(true);
1540  $dur->setStart($this->object->getFirstAppointment()->getStart());
1541  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1542 
1543  $this->form->addItem($dur);
1544 
1545  /*
1546  // start
1547  $start = new ilDateTimeInputGUI($this->lng->txt('event_start_date'),'start');
1548  $start->setMinuteStepSize(5);
1549  $start->setDate($this->object->getFirstAppointment()->getStart());
1550  $start->setShowTime(true);
1551  #$this->form->addItem($start);
1552 
1553  // end
1554  $end = new ilDateTimeInputGUI($this->lng->txt('event_end_date'),'end');
1555  $end->setMinuteStepSize(5);
1556  $end->setDate($this->object->getFirstAppointment()->getEnd());
1557  $end->setShowTime(true);
1558  #$this->form->addItem($end);
1559  */
1560 
1561  // Recurrence
1562  if($a_mode == 'create')
1563  {
1564  if(!is_object($this->rec))
1565  {
1566  include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1567  $this->rec = new ilEventRecurrence();
1568  }
1569  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1570  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
1571  $rec->allowUnlimitedRecurrences(false);
1572  $rec->setRecurrence($this->rec);
1573  $this->form->addItem($rec);
1574 
1575  // #14547
1576  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1577  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1578  $lp->setChecked(true);
1579  $this->form->addItem($lp);
1580  }
1581 
1583  $section->setTitle($this->lng->txt('event_section_information'));
1584  $this->form->addItem($section);
1585 
1586  // title
1587  $title = new ilTextInputGUI($this->lng->txt('event_title'),'title');
1588  $title->setValue($this->object->getTitle());
1589  $title->setSize(50);
1590  $title->setMaxLength(70);
1591  $this->form->addItem($title);
1592 
1593  // desc
1594  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'),'desc');
1595  $desc->setValue($this->object->getLongDescription());
1596  $desc->setRows(4);
1597  $desc->setCols(50);
1598  $this->form->addItem($desc);
1599 
1600  // location
1601  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'),'location');
1602  $desc->setValue($this->object->getLocation());
1603  $desc->setRows(4);
1604  $desc->setCols(50);
1605  $this->form->addItem($desc);
1606 
1607  // workflow
1608  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'),'details');
1609  $details->setValue($this->object->getDetails());
1610  $details->setCols(50);
1611  $details->setRows(4);
1612  $this->form->addItem($details);
1613 
1614  // section
1616  $section->setTitle($this->lng->txt('event_tutor_data'));
1617  $this->form->addItem($section);
1618 
1619  // name
1620  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'),'tutor_name');
1621  $tutor_name->setValue($this->object->getName());
1622  $tutor_name->setSize(20);
1623  $tutor_name->setMaxLength(70);
1624  $this->form->addItem($tutor_name);
1625 
1626  // email
1627  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'),'tutor_email');
1628  $tutor_email->setValue($this->object->getEmail());
1629  $tutor_email->setSize(20);
1630  $tutor_email->setMaxLength(70);
1631  $this->form->addItem($tutor_email);
1632 
1633  // phone
1634  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'),'tutor_phone');
1635  $tutor_phone->setValue($this->object->getPhone());
1636  $tutor_phone->setSize(20);
1637  $tutor_phone->setMaxLength(70);
1638  $this->form->addItem($tutor_phone);
1639 
1641  $section->setTitle($this->lng->txt('sess_section_reg'));
1642  $this->form->addItem($section);
1643 
1644  include_once './Modules/Session/classes/class.ilSessionMembershipRegistrationSettingsGUI.php';
1645  include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
1646  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1647  $this,
1648  $this->object,
1649  array(
1654  )
1655  );
1656  $reg_settings->addMembershipFormElements($this->form, '');
1657 
1658 
1660  $section->setTitle($this->lng->txt('event_assign_files'));
1661  $this->form->addItem($section);
1662 
1663  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'),'files');
1664  $files->setFilenames(array(0 => ''));
1665  $this->form->addItem($files);
1666 
1667  switch($a_mode)
1668  {
1669  case 'create':
1670  $this->form->setTitle($this->lng->txt('event_table_create'));
1671 
1672  $this->form->addCommandButton('save',$this->lng->txt('event_btn_add'));
1673  $this->form->addCommandButton('saveAndAssignMaterials',$this->lng->txt('event_btn_add_edit'));
1674  $this->form->addCommandButton('cancelEdit',$this->lng->txt('cancel'));
1675 
1676  return true;
1677 
1678  case 'edit':
1679  $this->form->setTitle($this->lng->txt('event_table_update'));
1680 
1681  $this->form->addCommandButton('update',$this->lng->txt('save'));
1682  $this->form->addCommandButton('cancelEdit',$this->lng->txt('cancel'));
1683 
1684  return true;
1685  }
1686  return true;
1687  }
1688 
1696  protected function load()
1697  {
1698  global $ilUser;
1699 
1700  $this->object->getFirstAppointment()->setStartingTime($this->__toUnix($_POST['event']['start']['date'],$_POST['event']['start']['time']));
1701  $this->object->getFirstAppointment()->setEndingTime($this->__toUnix($_POST['event']['end']['date'],$_POST['event']['end']['time']));
1702  $this->object->getFirstAppointment()->toggleFullTime((bool) $_POST['event']['fulltime']);
1703 
1704  include_once('./Services/Calendar/classes/class.ilDate.php');
1705  if($this->object->getFirstAppointment()->isFullday())
1706  {
1707  $start = new ilDate($_POST['event']['start']['date']['y'].'-'.$_POST['event']['start']['date']['m'].'-'.$_POST['event']['start']['date']['d'],
1708  IL_CAL_DATE);
1709  $this->object->getFirstAppointment()->setStart($start);
1710 
1711  $end = new ilDate($_POST['event']['end']['date']['y'].'-'.$_POST['event']['end']['date']['m'].'-'.$_POST['event']['end']['date']['d'],
1712  IL_CAL_DATE);
1713  $this->object->getFirstAppointment()->setEnd($end);
1714  }
1715  else
1716  {
1717  $start_dt['year'] = (int) $_POST['event']['start']['date']['y'];
1718  $start_dt['mon'] = (int) $_POST['event']['start']['date']['m'];
1719  $start_dt['mday'] = (int) $_POST['event']['start']['date']['d'];
1720  $start_dt['hours'] = (int) $_POST['event']['start']['time']['h'];
1721  $start_dt['minutes'] = (int) $_POST['event']['start']['time']['m'];
1722 
1723  $start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1724  $this->object->getFirstAppointment()->setStart($start);
1725 
1726  $end_dt['year'] = (int) $_POST['event']['end']['date']['y'];
1727  $end_dt['mon'] = (int) $_POST['event']['end']['date']['m'];
1728  $end_dt['mday'] = (int) $_POST['event']['end']['date']['d'];
1729  $end_dt['hours'] = (int) $_POST['event']['end']['time']['h'];
1730  $end_dt['minutes'] = (int) $_POST['event']['end']['time']['m'];
1731  $end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1732  $this->object->getFirstAppointment()->setEnd($end);
1733  }
1734 
1735  $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1736  $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1737  $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1738  $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1739  $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1740  $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1741  $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1742 
1743  $this->object->setRegistrationType((int) $_POST['registration_type']);
1744  $this->object->setRegistrationMaxUsers((int) $_POST['registration_max_members']);
1745  $this->object->enableRegistrationUserLimit((int) $_POST['registration_membership_limited']);
1746  $this->object->enableRegistrationWaitingList((int) $_POST['waiting_list']);
1747  }
1748 
1755  protected function loadRecurrenceSettings()
1756  {
1757  include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1758  $this->rec = new ilSessionRecurrence();
1759 
1760  switch($_POST['frequence'])
1761  {
1762  case IL_CAL_FREQ_DAILY:
1763  $this->rec->setFrequenceType($_POST['frequence']);
1764  $this->rec->setInterval((int) $_POST['count_DAILY']);
1765  break;
1766 
1767  case IL_CAL_FREQ_WEEKLY:
1768  $this->rec->setFrequenceType($_POST['frequence']);
1769  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1770  if(is_array($_POST['byday_WEEKLY']))
1771  {
1772  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1773  }
1774  break;
1775 
1776  case IL_CAL_FREQ_MONTHLY:
1777  $this->rec->setFrequenceType($_POST['frequence']);
1778  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1779  switch((int) $_POST['subtype_MONTHLY'])
1780  {
1781  case 0:
1782  // nothing to do;
1783  break;
1784 
1785  case 1:
1786  switch((int) $_POST['monthly_byday_day'])
1787  {
1788  case 8:
1789  // Weekday
1790  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1791  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1792  break;
1793 
1794  case 9:
1795  // Day of month
1796  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1797  break;
1798 
1799  default:
1800  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1801  break;
1802  }
1803  break;
1804 
1805  case 2:
1806  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1807  break;
1808  }
1809  break;
1810 
1811  case IL_CAL_FREQ_YEARLY:
1812  $this->rec->setFrequenceType($_POST['frequence']);
1813  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1814  switch((int) $_POST['subtype_YEARLY'])
1815  {
1816  case 0:
1817  // nothing to do;
1818  break;
1819 
1820  case 1:
1821  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1822  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1823  break;
1824 
1825  case 2:
1826  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1827  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1828  break;
1829  }
1830  break;
1831  }
1832 
1833  // UNTIL
1834  switch((int) $_POST['until_type'])
1835  {
1836  case 1:
1837  $this->rec->setFrequenceUntilDate(null);
1838  // nothing to do
1839  break;
1840 
1841  case 2:
1842  $this->rec->setFrequenceUntilDate(null);
1843  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1844  break;
1845 
1846  case 3:
1847  $end_dt['year'] = (int) $_POST['until_end']['date']['y'];
1848  $end_dt['mon'] = (int) $_POST['until_end']['date']['m'];
1849  $end_dt['mday'] = (int) $_POST['until_end']['date']['d'];
1850 
1851  $this->rec->setFrequenceUntilCount(0);
1852  $this->rec->setFrequenceUntilDate(new ilDate($end_dt,IL_CAL_FKT_GETDATE,$this->timezone));
1853  break;
1854  }
1855  }
1856 
1857 
1865  protected function __toUnix($date,$time)
1866  {
1867  return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
1868  }
1869 
1876  public function addLocatorItems()
1877  {
1878  global $ilLocator;
1879 
1880  if (is_object($this->object))
1881  {
1882  // see prepareOutput()
1883  include_once './Modules/Session/classes/class.ilSessionAppointment.php';
1884  $title = strlen($this->object->getTitle()) ? (': '.$this->object->getTitle()) : '';
1885  $title = $this->object->getFirstAppointment()->appointmentToString().$title;
1886 
1887  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
1888  }
1889  }
1890 
1897  public function getTabs($tabs_gui)
1898  {
1899  global $ilAccess, $ilTabs, $tree, $ilCtrl, $ilHelp;
1900 
1901  $ilHelp->setScreenIdComponent("sess");
1902 
1903  $parent_id = $tree->getParentId($this->object->getRefId());
1904 
1905  // #11650
1906  $parent_type = ilObject::_lookupType($parent_id, true);
1907 
1908  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
1909  $tabs_gui->setBackTarget($this->lng->txt('back_to_'.$parent_type.'_content'),
1910  $ilCtrl->getLinkTargetByClass("ilrepositorygui", ""));
1911  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
1912 
1913  $tabs_gui->addTarget('info_short',
1914  $this->ctrl->getLinkTarget($this,'infoScreen'));
1915 
1916  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1917  {
1918  $tabs_gui->addTarget('settings',
1919  $this->ctrl->getLinkTarget($this,'edit'));
1920  $tabs_gui->addTarget('crs_materials',
1921  $this->ctrl->getLinkTarget($this,'materials'));
1922  $tabs_gui->addTarget('event_edit_members',
1923  $this->ctrl->getLinkTarget($this,'members'));
1924  }
1925 
1926  // learning progress
1927  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1928  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
1929  {
1930  $tabs_gui->addTarget('learning_progress',
1931  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'),''),
1932  '',
1933  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1934  }
1935 
1936  // export
1937  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1938  {
1939  $ilTabs->addTarget("export",
1940  $this->ctrl->getLinkTargetByClass("ilexportgui", ""), "", "ilexportgui");
1941  }
1942 
1943 
1944  // edit permissions
1945  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1946  {
1947  $tabs_gui->addTarget("perm_settings",
1948  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), array("perm","info","owner"), 'ilpermissiongui');
1949  }
1950 
1951  }
1952 
1958  public function afterSaveCallback(ilObject $a_obj)
1959  {
1960  // add new object to materials
1961  include_once './Modules/Session/classes/class.ilEventItems.php';
1962  $event_items = new ilEventItems($this->object->getId());
1963  $event_items->addItem($a_obj->getRefId());
1964  $event_items->update();
1965 
1966  /*
1967  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
1968  $this->ctrl->redirect($this, "materials");
1969  */
1970  }
1971 
1975  protected function sendMailToSelectedUsersObject()
1976  {
1977  $GLOBALS['ilCtrl']->setReturn($this,'members');
1978  $GLOBALS['ilCtrl']->setCmdClass('ilmembershipgui');
1979  include_once './Services/Membership/classes/class.ilMembershipGUI.php';
1980  $mem = new ilMembershipGUI($this);
1981  $GLOBALS['ilCtrl']->forwardCommand($mem);
1982  }
1983 
1987  public function readMemberData($a_usr_ids)
1988  {
1989  $tmp_data = array();
1990  foreach ($a_usr_ids as $usr_id)
1991  {
1992  $tmp_data[$usr_id] = array();
1993  }
1994  return $tmp_data;
1995  }
1996 
2005  {
2006  $this->checkPermission('write');
2007 
2008  if(!count($_POST["waiting"]))
2009  {
2010  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2011  $this->membersObject();
2012  return false;
2013  }
2014 
2015  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2016  $waiting_list = new ilSessionWaitingList($this->object->getId());
2017 
2018  include_once './Modules/Session/classes/class.ilEventParticipants.php';
2019  $part = new ilEventParticipants($this->object->getId());
2020 
2021  $added_users = 0;
2022  foreach($_POST["waiting"] as $user_id)
2023  {
2024  $part->register($user_id);
2025  $waiting_list->removeFromList($user_id);
2026 
2027  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2029  $noti->setRefId($this->object->getRefId());
2030  $noti->setRecipients(array($user_id));
2032  $noti->send();
2033 
2034  ++$added_users;
2035  }
2036  if($added_users)
2037  {
2038  ilUtil::sendSuccess($this->lng->txt("sess_users_added"));
2039  $this->membersObject();
2040 
2041  return true;
2042  }
2043  else
2044  {
2045  ilUtil::sendFailure($this->lng->txt("sess_users_already_assigned"));
2046  $this->searchObject();
2047  return false;
2048  }
2049  }
2050 
2057  public function refuseFromListObject()
2058  {
2059  $this->checkPermission('write');
2060 
2061  if(!count($_POST['waiting']))
2062  {
2063  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2064  $this->membersObject();
2065  return false;
2066  }
2067 
2068  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2069  $waiting_list = new ilSessionWaitingList($this->object->getId());
2070 
2071  foreach($_POST["waiting"] as $user_id)
2072  {
2073  $waiting_list->removeFromList($user_id);
2074 
2075  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2077  $noti->setRefId($this->object->getRefId());
2078  $noti->setRecipients(array($user_id));
2080  $noti->send();
2081 
2082  }
2083 
2084  ilUtil::sendSuccess($this->lng->txt('sess_users_removed_from_list'));
2085  $this->membersObject();
2086  return true;
2087  }
2088 
2095  public function assignSubscribersObject()
2096  {
2097  global $lng,$ilUser;
2098 
2099  $this->checkPermission('write');
2100 
2101  if(!count($_POST['subscribers']))
2102  {
2103  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2104  $this->membersObject();
2105  return false;
2106  }
2107 
2108  include_once './Services/Membership/classes/class.ilParticipants.php';
2109  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2110 
2111  foreach($_POST['subscribers'] as $usr_id)
2112  {
2113  $part->add($usr_id);
2114  $part->deleteSubscriber($usr_id);
2115 
2116  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2118  $noti->setRefId($this->object->getRefId());
2119  $noti->setRecipients(array($usr_id));
2121  $noti->send();
2122  }
2123  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_assigned"),true);
2124  $this->ctrl->redirect($this,'members');
2125  return true;
2126  }
2127 
2134  public function refuseSubscribersObject()
2135  {
2136  global $lng;
2137 
2138  $this->checkPermission('write');
2139 
2140  if(!count($_POST['subscribers']))
2141  {
2142  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2143  $this->membersObject();
2144  return false;
2145  }
2146 
2147  include_once './Services/Membership/classes/class.ilParticipants.php';
2148  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2149  foreach($_POST['subscribers'] as $usr_id)
2150  {
2151  $part->deleteSubscriber($usr_id);
2152 
2153  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2155  $noti->setRefId($this->object->getRefId());
2156  $noti->setRecipients(array($usr_id));
2158  $noti->send();
2159  }
2160  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_removed"));
2161  $this->membersObject();
2162  return true;
2163 
2164  }
2169  public function getContainerRefId()
2170  {
2171  if(!$this->container_ref_id)
2172  {
2173  $this->initContainer();
2174  }
2175  return $this->container_ref_id;
2176  }
2177 
2179  {
2180  if(!is_array($_POST["subscribers"]))
2181  {
2182  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2183  $this->membersObject();
2184 
2185  return false;
2186  }
2187 
2188  $this->lng->loadLanguageModule('mmbr');
2189 
2190  $this->checkPermission('write');
2191  $this->tabs_gui->setTabActive('event_edit_members');
2192 
2193  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2194  $c_gui = new ilConfirmationGUI();
2195 
2196  // set confirm/cancel commands
2197  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
2198  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2199  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2200  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
2201 
2202  foreach($_POST["subscribers"] as $subscribers)
2203  {
2204  $name = ilObjUser::_lookupName($subscribers);
2205 
2206  $c_gui->addItem('subscribers[]',
2207  $name['user_id'],
2208  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2209  ilUtil::getImagePath('icon_usr.svg'));
2210  }
2211 
2212  $this->tpl->setContent($c_gui->getHTML());
2213  return true;
2214  }
2215 
2217  {
2218  if(!is_array($_POST["subscribers"]))
2219  {
2220  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2221  $this->membersObject();
2222 
2223  return false;
2224  }
2225  $this->checkPermission('write');
2226  $this->tabs_gui->setTabActive('event_edit_members');
2227 
2228  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2229  $c_gui = new ilConfirmationGUI();
2230 
2231  // set confirm/cancel commands
2232  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
2233  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2234  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2235  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
2236 
2237  foreach($_POST["subscribers"] as $subscribers)
2238  {
2239  $name = ilObjUser::_lookupName($subscribers);
2240 
2241  $c_gui->addItem('subscribers[]',
2242  $name['user_id'],
2243  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2244  ilUtil::getImagePath('icon_usr.svg'));
2245  }
2246 
2247  $this->tpl->setContent($c_gui->getHTML());
2248  return true;
2249  }
2250 
2252  {
2253  if(!is_array($_POST["waiting"]))
2254  {
2255  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2256  $this->membersObject();
2257 
2258  return false;
2259  }
2260 
2261  $this->lng->loadLanguageModule('mmbr');
2262 
2263  $this->checkPermission('write');
2264  $this->tabs_gui->setTabActive('event_edit_members');
2265 
2266  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2267  $c_gui = new ilConfirmationGUI();
2268 
2269  // set confirm/cancel commands
2270  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
2271  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2272  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2273  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
2274 
2275  foreach($_POST["waiting"] as $waiting)
2276  {
2277  $name = ilObjUser::_lookupName($waiting);
2278 
2279  $c_gui->addItem('waiting[]',
2280  $name['user_id'],
2281  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2282  ilUtil::getImagePath('icon_usr.svg'));
2283  }
2284 
2285  $this->tpl->setContent($c_gui->getHTML());
2286  return true;
2287  }
2288 
2290  {
2291  if(!is_array($_POST["waiting"]))
2292  {
2293  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2294  $this->membersObject();
2295 
2296  return false;
2297  }
2298  $this->checkPermission('write');
2299  $this->tabs_gui->setTabActive('event_edit_members');
2300 
2301  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2302  $c_gui = new ilConfirmationGUI();
2303 
2304  // set confirm/cancel commands
2305  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
2306  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2307  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2308  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
2309 
2310  foreach($_POST["waiting"] as $waiting)
2311  {
2312  $name = ilObjUser::_lookupName($waiting);
2313 
2314  $c_gui->addItem('waiting[]',
2315  $name['user_id'],
2316  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2317  ilUtil::getImagePath('icon_usr.svg'));
2318  }
2319 
2320  $this->tpl->setContent($c_gui->getHTML());
2321  return true;
2322  }
2323 
2324  function cancelEditObject()
2325  {
2326  global $ilCtrl, $tree;
2327  $parent_id = $tree->getParentId($this->object->getRefId());
2328  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2329  $ilCtrl->redirectByClass("ilrepositorygui", "");
2330  }
2331 }
2332 ?>
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
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 _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.
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"]
$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
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.
$GLOBALS['ct_recipient']
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.
_lookupLogin($a_user_id)
lookup login
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
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.
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.