ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 {
25  protected $logger = null;
26 
27 
28  public $lng;
29  public $ctrl;
30  public $tpl;
31 
32  protected $container_ref_id = 0;
33  protected $container_obj_id = 0;
34 
35  protected $files = array();
36 
44  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
45  {
46  global $ilCtrl, $lng, $tpl;
47 
48  $this->type = "sess";
49  parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
50 
51  $this->lng = $lng;
52  $this->lng->loadLanguageModule("event");
53  $this->lng->loadLanguageModule('crs');
54  $this->lng->loadLanguageModule('trac');
55  $this->lng->loadLanguageModule('sess');
56 
57 
58  $this->tpl = $tpl;
59  $this->ctrl = $ilCtrl;
60 
61  $this->logger = $GLOBALS['DIC']->logger()->sess();
62  }
63 
64 
71  public function executeCommand()
72  {
73  global $ilUser,$ilCtrl;
74 
75  $next_class = $this->ctrl->getNextClass($this);
76  $cmd = $this->ctrl->getCmd();
77 
78  if(
79  !$this->getCreationMode() &&
80  $GLOBALS['DIC']->access()->checkAccess('read','', $_GET['ref_id'])
81  )
82  {
83  include_once("./Services/Link/classes/class.ilLink.php");
84  $GLOBALS['DIC']['ilNavigationHistory']->addItem(
85  (int) $_GET['ref_id'],
86  ilLink::_getLink((int) $_GET['ref_id'], 'sess'),
87  'sess'
88  );
89  }
90 
91  $this->prepareOutput();
92  switch($next_class)
93  {
94  case "ilinfoscreengui":
95  $this->checkPermission("visible");
96  $this->infoScreen(); // forwards command
97  break;
98 
99  case 'ilpermissiongui':
100  $this->tabs_gui->setTabActive('perm_settings');
101  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
102  $perm_gui = new ilPermissionGUI($this);
103  $ret = $this->ctrl->forwardCommand($perm_gui);
104  break;
105 
106  case 'ilobjectcopygui':
107  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
108  $cp = new ilObjectCopyGUI($this);
109  $cp->setType('sess');
110  $this->ctrl->forwardCommand($cp);
111  break;
112 
113  case "ilexportgui":
114 // $this->prepareOutput();
115  $this->tabs_gui->setTabActive("export");
116  include_once("./Services/Export/classes/class.ilExportGUI.php");
117  $exp_gui = new ilExportGUI($this);
118  $exp_gui->addFormat("xml");
119  $ret = $this->ctrl->forwardCommand($exp_gui);
120 // $this->tpl->show();
121  break;
122 
123  case "ilcommonactiondispatchergui":
124  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
126  $this->ctrl->forwardCommand($gui);
127  break;
128 
129  case 'ilmembershipgui':
130  $this->ctrl->setReturn($this,'members');
131  include_once './Services/Membership/classes/class.ilMembershipMailGUI.php';
132  $mem = new ilMembershipMailGUI($this);
133  $this->ctrl->forwardCommand($mem);
134  break;
135 
136  case "illearningprogressgui":
137  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
139  $this->object->getRefId(),
140  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
141  $this->ctrl->forwardCommand($new_gui);
142  $this->tabs_gui->setTabActive('learning_progress');
143  break;
144 
145  default:
146  if(!$cmd)
147  {
148  $cmd = "infoScreen";
149  }
150  $cmd .= "Object";
151  if ($cmd != "infoScreenObject")
152  {
153  $this->checkPermission("read");
154  }
155  else
156  {
157  $this->checkPermission("visible");
158  }
159  $this->$cmd();
160 
161  break;
162  }
163 
164  $this->addHeaderAction();
165 
166  return true;
167  }
168 
173  public function getCurrentObject()
174  {
175  return $this->object;
176  }
177 
181  public function prepareOutput($a_show_subobjects = true)
182  {
183  parent::prepareOutput($a_show_subobjects);
184 
185  if (!$this->getCreationMode())
186  {
187  $title = strlen($this->object->getTitle()) ? (': '.$this->object->getTitle()) : '';
188 
189  include_once './Modules/Session/classes/class.ilSessionAppointment.php';
190  $this->tpl->setTitle(
191  $this->object->getFirstAppointment()->appointmentToString().$title);
192  }
193  }
194 
202  public function registerObject()
203  {
204  global $ilUser;
205 
206  $this->checkPermission('read');
207 
208  include_once './Services/Membership/classes/class.ilParticipants.php';
209  $part = ilParticipants::getInstanceByObjId($this->getCurrentObject()->getId());
210 
211  include_once './Modules/Session/classes/class.ilEventParticipants.php';
212  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
213  if(
214  $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
215  $this->getCurrentObject()->getRegistrationMaxUsers() and
216  (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
217  )
218  {
219  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
220  $wait = new ilSessionWaitingList($this->getCurrentObject()->getId());
221  $wait->addToList($ilUser->getId());
222  ilUtil::sendInfo($this->lng->txt('sess_reg_added_to_wl'),TRUE);
223  $this->ctrl->redirect($this,'infoScreen');
224  return TRUE;
225  }
226 
227 
228  switch($this->getCurrentObject()->getRegistrationType())
229  {
231  $this->ctrl->redirect($this,'info');
232  break;
233 
235  $part->add($ilUser->getId());
236  ilUtil::sendSuccess($this->lng->txt('event_registered'),true);
237  $this->ctrl->redirect($this,'infoScreen');
238  break;
239 
241  ilUtil::sendSuccess($this->lng->txt('sess_registered_confirm'),true);
242  $part->addSubscriber($ilUser->getId());
243  $this->ctrl->redirect($this,'infoScreen');
244  break;
245  }
246  }
247 
252  public function joinObject()
253  {
254  global $ilUser;
255 
256  $this->checkPermission('read');
257 
258  if($ilUser->isAnonymous())
259  {
260  $this->ctrl->redirect($this,'infoScreen');
261  }
262 
263  include_once './Modules/Session/classes/class.ilEventParticipants.php';
264 
265  if(ilEventParticipants::_isRegistered($ilUser->getId(),$this->object->getId()))
266  {
267  $_SESSION['sess_hide_info'] = true;
268  ilEventParticipants::_unregister($ilUser->getId(),$this->object->getId());
269  ilUtil::sendSuccess($this->lng->txt('event_unregistered'),true);
270  }
271  else
272  {
273  ilEventParticipants::_register($ilUser->getId(),$this->object->getId());
274  ilUtil::sendSuccess($this->lng->txt('event_registered'),true);
275  }
276 
277  $this->ctrl->redirect($this,'infoScreen');
278  }
279 
286  public function unregisterObject()
287  {
288  global $ilUser;
289 
290  include_once './Modules/Session/classes/class.ilSessionParticipants.php';
291  $part = ilSessionParticipants::getInstanceByObjId($this->object->getId());
292  if($part->isSubscriber($ilUser->getId()))
293  {
294  $part->deleteSubscriber($ilUser->getId());
295  }
296 
297  include_once './Modules/Session/classes/class.ilEventParticipants.php';
298  ilEventParticipants::_unregister($ilUser->getId(),$this->object->getId());
299 
300  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
301  ilSessionWaitingList::deleteUserEntry($ilUser->getId(), $this->getCurrentObject()->getId());
302 
303  ilUtil::sendSuccess($this->lng->txt('event_unregistered'),true);
304  $this->ctrl->returnToParent($this);
305  }
306 
315  public static function _goto($a_target)
316  {
317  global $ilAccess,$ilErr,$lng;
318 
319  if($ilAccess->checkAccess('visible', "", $a_target))
320  {
321  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
322  }
323  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
324  }
325 
329  public function addToDeskObject()
330  {
331  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
333  $this->infoScreenObject();
334  }
335 
339  public function removeFromDeskObject()
340  {
341  include_once './Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php';
343  $this->infoScreenObject();
344  }
345 
346 
352  public function infoScreenObject()
353  {
354  $this->ctrl->setCmd("showSummary");
355  $this->ctrl->setCmdClass("ilinfoscreengui");
356  $this->infoScreen();
357  }
358 
366  public function modifyItemGUI($a_item_list_gui,$a_item_data, $a_show_path)
367  {
368  global $tree;
369 
370  // if folder is in a course, modify item list gui according to course requirements
371  if ($course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs'))
372  {
373  // #10611
374  include_once "Services/Object/classes/class.ilObjectActivation.php";
375  ilObjectActivation::addListGUIActivationProperty($a_item_list_gui, $a_item_data);
376 
377  include_once("./Modules/Course/classes/class.ilObjCourse.php");
378  include_once("./Modules/Course/classes/class.ilObjCourseGUI.php");
379  $course_obj_id = ilObject::_lookupObjId($course_ref_id);
381  $a_item_list_gui,
382  get_class($this),
383  $a_item_data,
384  $a_show_path,
385  ilObjCourse::_lookupAboStatus($course_obj_id),
386  $course_ref_id,
387  $course_obj_id,
388  $this->object->getRefId());
389  }
390  }
391 
395  protected function showJoinRequestButton()
396  {
397  global $ilToolbar, $ilUser;
398 
399  if(!$this->getCurrentObject()->enabledRegistration() || $ilUser->isAnonymous())
400  {
401  return FALSE;
402  }
403 
404  include_once './Modules/Session/classes/class.ilSessionWaitingList.php';
405 
406  include_once './Services/Membership/classes/class.ilParticipants.php';
407  $part = ilParticipants::getInstanceByObjId($this->getCurrentObject()->getId());
408 
409  include_once './Modules/Session/classes/class.ilEventParticipants.php';
410  if(ilEventParticipants::_isRegistered($ilUser->getId(), $this->getCurrentObject()->getId()))
411  {
412  $ilToolbar->addFormButton($this->lng->txt('event_unregister'),'unregister');
413  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
414  return TRUE;
415  }
416  elseif($part->isSubscriber($ilUser->getId()))
417  {
418  $ilToolbar->addFormButton($this->lng->txt('event_unregister'),'unregister');
419  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
420  return TRUE;
421  }
422  elseif(ilSessionWaitingList::_isOnList($ilUser->getId(), $this->getCurrentObject()->getId()))
423  {
424  $ilToolbar->addFormButton($this->lng->txt('leave_waiting_list'),'unregister');
425  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
426  return TRUE;
427  }
428 
429  $event_part = new ilEventParticipants($this->getCurrentObject()->getId());
430 
431  if(
432  $this->getCurrentObject()->isRegistrationUserLimitEnabled() and
433  $this->getCurrentObject()->getRegistrationMaxUsers() and
434  (count($event_part->getRegistered()) >= $this->getCurrentObject()->getRegistrationMaxUsers())
435  )
436  {
437  if($this->getCurrentObject()->isRegistrationWaitingListEnabled())
438  {
439  ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded_wl'));
440  $ilToolbar->addFormButton($this->lng->txt('mem_add_to_wl'),'register');
441  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
442  return TRUE;
443  }
444  else
445  {
446  ilUtil::sendInfo($this->lng->txt('sess_reg_max_users_exceeded'));
447  return TRUE;
448  }
449  }
450  else
451  {
452  if(!isset($_SESSION['sess_hide_info']))
453  {
454  ilUtil::sendInfo($this->lng->txt('sess_join_info'));
455  $ilToolbar->addFormButton($this->lng->txt('join_session'),'register', '', true);
456  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
457  return TRUE;
458  }
459  }
460  }
461 
462 
463 
471  public function infoScreen()
472  {
473  global $ilAccess, $ilUser,$ilCtrl,$tree,$ilToolbar,$lng;
474 
475  $this->checkPermission('visible');
476  $this->tabs_gui->setTabActive('info_short');
477 
478  $appointment_obj = $this->object->getFirstAppointment();
479 
480  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
481  $info = new ilInfoScreenGUI($this);
482 
483  $this->showJoinRequestButton();
484 
485  // Session information
486  if(strlen($this->object->getLocation()) or strlen($this->object->getDetails()))
487  {
488  $info->addSection($this->lng->txt('event_section_information'));
489  }
490  if(strlen($location = $this->object->getLocation()))
491  {
492  $info->addProperty($this->lng->txt('event_location'),
493  nl2br($this->object->getLocation()));
494  }
495  if(strlen($this->object->getDetails()))
496  {
497  $info->addProperty($this->lng->txt('event_details_workflow'),
498  nl2br($this->object->getDetails()));
499  }
500 
501  // Tutor information
502  if($this->object->hasTutorSettings())
503  {
504  $info->addSection($this->lng->txt('event_tutor_data'));
505  if(strlen($fullname = $this->object->getName()))
506  {
507  $info->addProperty($this->lng->txt('event_lecturer'),
508  $fullname);
509  }
510  if(strlen($email = $this->object->getEmail()))
511  {
512  $info->addProperty($this->lng->txt('tutor_email'),
513  $email);
514  }
515  if(strlen($phone = $this->object->getPhone()))
516  {
517  $info->addProperty($this->lng->txt('tutor_phone'),
518  $phone);
519  }
520  }
521 
522 
523  $html = '';
524 
525  include_once './Services/Object/classes/class.ilObjectActivation.php';
526  include_once './Services/Container/classes/class.ilContainerSorting.php';
527  include_once './Modules/Session/classes/class.ilSessionObjectListGUIFactory.php';
528 
529  $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId());
530  $parent_id = $tree->getParentId($this->object->getRefId());
531  $parent_id = ilObject::_lookupObjId($parent_id);
532  $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems(
533  'sess',
534  $this->object->getId(),
535  $eventItems
536  );
537 
538  $lng->loadLanguageModule("cntr");// #14158
539 
540  foreach($eventItems as $item)
541  {
542  $list_gui = ilSessionObjectListGUIFactory::factory($item['type']);
543  $list_gui->setContainerObject($this);
544 
545  $this->modifyItemGUI($list_gui, $item, false);
546 
547  $html .= $list_gui->getListItemHTML(
548  $item['ref_id'],
549  $item['obj_id'],
550  $item['title'],
551  $item['description']
552  );
553  }
554 
555  if(strlen($html))
556  {
557  $info->addSection($this->lng->txt('event_materials'));
558  $info->addProperty(
559  '&nbsp;',
560  $html);
561  }
562 
563  // forward the command
564  $this->ctrl->forwardCommand($info);
565 
566  // store read event
567  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
568  ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(),
569  $this->object->getId(), $ilUser->getId());
570  }
571 
577  public function sendFileObject()
578  {
579  $file = new ilSessionFile((int) $_GET['file_id']);
580 
581  ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
582  return true;
583  }
584 
585  protected function initCreateForm($a_new_type)
586  {
587  if(!is_object($this->object))
588  {
589  $this->object = new ilObjSession();
590  }
591  $this->initForm('create');
592  return $this->form;
593  }
594 
601  {
602  global $ilLog;
603 
604  $this->saveObject(false);
605 
606  $this->ctrl->setParameter($this,'ref_id',$this->object->getRefId());
607  $this->ctrl->setParameter($this,'new_type', '');
608  $this->ctrl->redirect($this,'materials');
609  }
610 
618  public function saveObject($a_redirect_on_success = true)
619  {
620  global $ilErr,$ilUser;
621 
622  $this->object = new ilObjSession();
623 
624  $this->ctrl->saveParameter($this, "new_type");
625 
626  $this->initForm('create');
627  $ilErr->setMessage('');
628  if(!$this->form->checkInput())
629  {
630  $ilErr->setMessage($this->lng->txt('err_check_input'));
631  }
632 
633  $this->load();
634  $this->loadRecurrenceSettings();
635 
636  $this->object->validate();
637  $this->object->getFirstAppointment()->validate();
638 
639  if(strlen($ilErr->getMessage()))
640  {
641  ilUtil::sendFailure($ilErr->getMessage());
642  $this->form->setValuesByPost();
643  $this->createObject();
644  return false;
645  }
646  // Create session
647  $this->object->create();
648  $this->object->createReference();
649  $this->object->putInTree($_GET["ref_id"]);
650  $this->object->setPermissions($_GET["ref_id"]);
651 
652  // #14547 - active is default
653  if(!$this->form->getInput("lp_preset"))
654  {
655  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
656  $lp_obj_settings = new ilLPObjSettings($this->object->getId());
657  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
658  $lp_obj_settings->update(false);
659  }
660 
661  // create appointment
662  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
663  $this->object->getFirstAppointment()->create();
664 
665  $this->handleFileUpload();
666 
667  $this->createRecurringSessions($this->form->getInput("lp_preset"));
668 
669  if($a_redirect_on_success)
670  {
671  ilUtil::sendInfo($this->lng->txt('event_add_new_event'),true);
672  $this->ctrl->returnToParent($this);
673  }
674 
675  return true;
676 
677  }
678 
679  public function handleFileUpload()
680  {
681  global $tree;
682 
683  include_once './Modules/Session/classes/class.ilEventItems.php';
684  $ev = new ilEventItems($this->object->getId());
685  $items = $ev->getItems();
686 
687  $counter = 0;
688  while(true)
689  {
690  if(!isset($_FILES['files']['name'][$counter]))
691  {
692  break;
693  }
694  if(!strlen($_FILES['files']['name'][$counter]))
695  {
696  $counter++;
697  continue;
698  }
699 
700  include_once './Modules/File/classes/class.ilObjFile.php';
701  $file = new ilObjFile();
702  $file->setTitle(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
703  $file->setDescription('');
704  $file->setFileName(ilUtil::stripSlashes($_FILES['files']['name'][$counter]));
705  $file->setFileType($_FILES['files']['type'][$counter]);
706  $file->setFileSize($_FILES['files']['size'][$counter]);
707  $file->create();
708  $new_ref_id = $file->createReference();
709  $file->putInTree($tree->getParentId($this->object->getRefId()));
710  $file->setPermissions($tree->getParentId($this->object->getRefId()));
711  $file->createDirectory();
712  $file->getUploadFile(
713  $_FILES['files']['tmp_name'][$counter],
714  $_FILES['files']['name'][$counter]
715  );
716 
717  $items[] = $new_ref_id;
718  $counter++;
719 
720  }
721 
722  $ev->setItems($items);
723  $ev->update();
724  }
725 
726 
727 
735  protected function createRecurringSessions($a_activate_lp = true)
736  {
737  global $tree;
738 
739  if(!$this->rec->getFrequenceType())
740  {
741  return true;
742  }
743  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
744  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(),$this->rec);
745 
746  $period_start = clone $this->object->getFirstAppointment()->getStart();
747 
748 
749  $period_end = clone $this->object->getFirstAppointment()->getStart();
750  $period_end->increment(IL_CAL_YEAR,5);
751  $date_list = $calc->calculateDateList($period_start,$period_end);
752 
753  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
754  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
755  $parent_id = $tree->getParentId($this->object->getRefId());
756 
757  include_once './Modules/Session/classes/class.ilEventItems.php';
758  $evi = new ilEventItems($this->object->getId());
759  $eitems = $evi->getItems();
760 
761  $counter = 0;
762  foreach($date_list->get() as $date)
763  {
764  if(!$counter++)
765  {
766  continue;
767  }
768 
769  $new_obj = $this->object->cloneObject($parent_id);
770  $new_obj->read();
771  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
772  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
773  $new_obj->getFirstAppointment()->update();
774  $new_obj->update();
775 
776  // #14547 - active is default
777  if(!$a_activate_lp)
778  {
779  include_once "Services/Tracking/classes/class.ilLPObjSettings.php";
780  $lp_obj_settings = new ilLPObjSettings($new_obj->getId());
781  $lp_obj_settings->setMode(ilLPObjSettings::LP_MODE_DEACTIVATED);
782  $lp_obj_settings->update(false);
783  }
784 
785  $new_evi = new ilEventItems($new_obj->getId());
786  $new_evi->setItems($eitems);
787  $new_evi->update();
788  }
789  }
790 
791 
799  public function editObject()
800  {
801  $this->tabs_gui->setTabActive('settings');
802 
803  $this->initForm('edit');
804  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_edit.html','Modules/Session');
805  $this->tpl->setVariable('EVENT_EDIT_TABLE',$this->form->getHTML());
806 
807  if(!count($this->object->getFiles()))
808  {
809  return true;
810  }
811  $rows = array();
812  foreach($this->object->getFiles() as $file)
813  {
814  $table_data['id'] = $file->getFileId();
815  $table_data['filename'] = $file->getFileName();
816  $table_data['filetype'] = $file->getFileType();
817  $table_data['filesize'] = $file->getFileSize();
818 
819  $rows[] = $table_data;
820  }
821 
822  include_once("./Modules/Session/classes/class.ilSessionFileTableGUI.php");
823  $table_gui = new ilSessionFileTableGUI($this, "edit");
824  $table_gui->setTitle($this->lng->txt("event_files"));
825  $table_gui->setData($rows);
826  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
827  $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
828  $table_gui->setSelectAllCheckbox("file_id");
829  $this->tpl->setVariable('EVENT_FILE_TABLE',$table_gui->getHTML());
830 
831  return true;
832  }
833 
841  public function updateObject()
842  {
843  global $ilErr;
844 
845  $old_autofill = $this->object->hasWaitingListAutoFill();
846 
847  $this->initForm('edit');
848  $ilErr->setMessage('');
849  if(!$this->form->checkInput())
850  {
851  $ilErr->setMessage($this->lng->txt('err_check_input'));
852  }
853 
854  $this->load();
855 
856  $this->object->validate();
857  $this->object->getFirstAppointment()->validate();
858 
859  if(strlen($ilErr->getMessage()))
860  {
861  ilUtil::sendFailure($ilErr->getMessage());
862  $this->editObject();
863  return false;
864  }
865  // Update event
866  $this->object->update();
867  $this->object->getFirstAppointment()->update();
868 
869  $this->handleFileUpload();
870 
871  // if autofill has been activated trigger process
872  if(!$old_autofill &&
873  $this->object->hasWaitingListAutoFill())
874  {
875  $this->object->handleAutoFill();
876  }
877 
878  ilUtil::sendSuccess($this->lng->txt('event_updated'),true);
879  $this->ctrl->redirect($this,'edit');
880  #$this->object->initFiles();
881  #$this->editObject();
882  return true;
883  }
884 
892  public function confirmDeleteFilesObject()
893  {
894  $this->tabs_gui->setTabActive('settings');
895 
896  if(!count($_POST['file_id']))
897  {
898  ilUtil::sendFailure($this->lng->txt('select_one'));
899  $this->editObject();
900  return false;
901  }
902 
903  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
904  $c_gui = new ilConfirmationGUI();
905 
906  // set confirm/cancel commands
907  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
908  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
909  $c_gui->setCancel($this->lng->txt("cancel"), "edit");
910  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
911 
912  // add items to delete
913  foreach($_POST["file_id"] as $file_id)
914  {
915  $file = new ilSessionFile($file_id);
916  if($file->getSessionId() != $this->object->getEventId())
917  {
918  ilUtil::sendFailure($this->lng->txt('select_one'));
919  $this->edit();
920  return false;
921  }
922  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
923  }
924 
925  $this->tpl->setContent($c_gui->getHTML());
926  return true;
927  }
928 
936  public function deleteFilesObject()
937  {
938  if(!count($_POST['file_id']))
939  {
940  ilUtil::sendFailure($this->lng->txt('select_one'));
941  $this->editObject();
942  return false;
943  }
944  foreach($_POST['file_id'] as $id)
945  {
946  $file = new ilSessionFile($id);
947  $file->delete();
948  }
949  $this->object->initFiles();
950  $this->editObject();
951  return true;
952  }
953 
954  protected function initContainer($a_init_participants = false)
955  {
956  global $tree;
957 
958  $is_course = $is_group = false;
959 
960  // #13178
961  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'grp');
962  if($this->container_ref_id)
963  {
964  $is_group = true;
965  }
966  if(!$this->container_ref_id)
967  {
968  $this->container_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
969  if($this->container_ref_id)
970  {
971  $is_course = true;
972  }
973  }
974  if(!$this->container_ref_id)
975  {
976  ilUtil::sendFailure('No container object found. Aborting');
977  return true;
978  }
979  $this->container_obj_id = ilObject::_lookupObjId($this->container_ref_id);
980 
981  if($a_init_participants && $this->container_obj_id)
982  {
983  if($is_course)
984  {
985  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
986  return ilCourseParticipants::_getInstanceByObjId($this->container_obj_id);
987  }
988  else if($is_group)
989  {
990  include_once './Modules/Group/classes/class.ilGroupParticipants.php';
991  return ilGroupParticipants::_getInstanceByObjId($this->container_obj_id);
992  }
993  }
994 
995  }
996 
1004  public function materialsObject()
1005  {
1006  global $tree, $objDefinition;
1007 
1008  $this->tabs_gui->setTabActive('crs_materials');
1009 
1010  // #11337 - support ANY parent container (crs, grp, fld)
1011  $parent_ref_id = $tree->getParentId($this->object->getRefId());
1012 
1013  include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
1014  $gui = new ilObjectAddNewItemGUI($parent_ref_id);
1015  $gui->setDisabledObjectTypes(array("itgr", "sess"));
1016  $gui->setAfterCreationCallback($this->ref_id);
1017  $gui->render();
1018 
1019  include_once 'Modules/Session/classes/class.ilEventItems.php';
1020  $this->event_items = new ilEventItems($this->object->getId());
1021 
1022  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1023  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1024  $tbl->setTitle($this->lng->txt("event_assign_materials_table"));
1025  $tbl->setDescription($this->lng->txt('event_assign_materials_info'));
1026 
1027  $tbl->setMaterialItems($this->event_items->getItems());
1028  $tbl->setContainerRefId($this->getContainerRefId());
1029  $tbl->getDataFromDb();
1030 
1031  $this->tpl->setContent($tbl->getHTML());
1032  }
1033 
1041  public function saveMaterialsObject()
1042  {
1043  include_once './Modules/Session/classes/class.ilEventItems.php';
1044 
1045  $this->event_items = new ilEventItems($this->object->getId());
1046 
1047  $list_items = is_array($_POST['all_items']) ? $_POST['all_items'] : array();
1048  $list_items_checked = is_array($_POST['items']) ? $_POST['items'] : array();
1049 
1050  $checked = $this->event_items->getItems();
1051  $checked = array_diff($checked, $list_items);//remove all visible items in list
1052  $checked = array_merge($checked, $list_items_checked);//add checked items in list
1053 
1054  $this->event_items->setItems($checked);
1055  $this->event_items->update();
1056 
1057  include_once 'Modules/Session/classes/class.ilSessionMaterialsTableGUI.php';
1058  $tbl = new ilSessionMaterialsTableGUI($this, "materials");
1059  $tbl->setOffset(0);
1060  $tbl->storeNavParameter();//remove offset and go to page 1
1061 
1062  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1063  $this->ctrl->redirect($this,'materials');
1064  }
1065 
1070  protected function membersObject()
1071  {
1072  global $tree,$ilUser;
1073 
1074  $this->checkPermission('write');
1075  $this->tabs_gui->setTabActive('event_edit_members');
1076 
1077  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_members.html', 'Modules/Session');
1078 
1079  include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
1080  $toolbar = new ilToolbarGUI();
1081  $toolbar->addButton($this->lng->txt('crs_print_list'),
1082  $this->ctrl->getLinkTarget($this,'attendanceList'));
1083 
1084  $this->tpl->setVariable('ACTION_BUTTONS',$toolbar->getHTML());
1085 
1086  $members_obj = $this->initContainer(true);
1087 
1088  include_once './Modules/Session/classes/class.ilEventParticipants.php';
1089 
1090  // Save hide/show table settings
1091  $this->setShowHidePrefs();
1092 
1093  // Waiting list table
1094  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
1095  $waiting_list = new ilSessionWaitingList($this->object->getId());
1096  if(count($wait = $waiting_list->getAllUsers()))
1097  {
1098  include_once('./Services/Membership/classes/class.ilWaitingListTableGUI.php');
1099  if($ilUser->getPref('sess_wait_hide'))
1100  {
1101  $table_gui = new ilWaitingListTableGUI($this,$this->object, $waiting_list,false);
1102  $this->ctrl->setParameter($this,'wait_hide',0);
1103  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1104  $this->lng->txt('show'));
1105  $this->ctrl->clearParameters($this);
1106  }
1107  else
1108  {
1109  $table_gui = new ilWaitingListTableGUI($this,$this->object, $waiting_list,true);
1110  $this->ctrl->setParameter($this,'wait_hide',1);
1111  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1112  $this->lng->txt('hide'));
1113  $this->ctrl->clearParameters($this);
1114  }
1115  $table_gui->setUsers($wait);
1116  $table_gui->setTitle($this->lng->txt('grp_header_waiting_list'),'icon_usr.svg',$this->lng->txt('group_new_registrations'));
1117  $this->tpl->setVariable('TABLE_WAIT',$table_gui->getHTML());
1118  }
1119 
1120  // subscribers
1121  // Subscriber table
1122  include_once './Services/Membership/classes/class.ilParticipants.php';
1123  $part = ilParticipants::getInstanceByObjId($this->object->getId());
1124  if($part->getSubscribers())
1125  {
1126  include_once('./Services/Membership/classes/class.ilSubscriberTableGUI.php');
1127  if($ilUser->getPref('grp_subscriber_hide'))
1128  {
1129  $table_gui = new ilSubscriberTableGUI($this,$this->object, false, false);
1130  $this->ctrl->setParameter($this,'subscriber_hide',0);
1131  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1132  $this->lng->txt('show'));
1133  $this->ctrl->clearParameters($this);
1134  }
1135  else
1136  {
1137  $table_gui = new ilSubscriberTableGUI($this,$this->object, true, false);
1138  $this->ctrl->setParameter($this,'subscriber_hide',1);
1139  $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1140  $this->lng->txt('hide'));
1141  $this->ctrl->clearParameters($this);
1142  }
1143  $table_gui->readSubscriberData();
1144  $table_gui->setTitle($this->lng->txt('sess_new_registrations'),'icon_usr.svg',$this->lng->txt('sess_new_registrations'));
1145  $this->tpl->setVariable('TABLE_SUB',$table_gui->getHTML());
1146  }
1147 
1148 
1149  // Admins
1150  if(count($admins = $members_obj->getAdmins()))
1151  {
1152  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1153  if($ilUser->getPref('sess_admin_hide'))
1154  {
1156  $this->ctrl->setParameter($this,'admin_hide',0);
1157  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1158  $this->lng->txt('show'));
1159  $this->ctrl->clearParameters($this);
1160  }
1161  else
1162  {
1164  $this->ctrl->setParameter($this,'admin_hide',1);
1165  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1166  $this->lng->txt('hide'));
1167  $this->ctrl->clearParameters($this);
1168  }
1169 
1170  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1171  $table->setTitle($this->lng->txt('event_tbl_admins'),'icon_usr.svg',$this->lng->txt('event_tbl_admins'));
1172  $table->enableRegistration($this->object->enabledRegistration());
1173  $table->setParticipants($admins);
1174  $table->parse();
1175  $this->tpl->setVariable('ADMINS',$table->getHTML());
1176  }
1177 
1178  // Tutors
1179  if(count($tutors = $members_obj->getTutors()))
1180  {
1181  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1182  if($ilUser->getPref('sess_tutor_hide'))
1183  {
1185  $this->ctrl->setParameter($this,'tutor_hide',0);
1186  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1187  $this->lng->txt('show'));
1188  $this->ctrl->clearParameters($this);
1189  }
1190  else
1191  {
1193  $this->ctrl->setParameter($this,'tutor_hide',1);
1194  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1195  $this->lng->txt('hide'));
1196  $this->ctrl->clearParameters($this);
1197  }
1198  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1199  $table->setTitle($this->lng->txt('event_tbl_tutors'),'icon_usr.svg',$this->lng->txt('event_tbl_tutors'));
1200  $table->enableRegistration($this->object->enabledRegistration());
1201  $table->setParticipants($tutors);
1202  $table->parse();
1203  $this->tpl->setVariable('TUTORS',$table->getHTML());
1204  }
1205 
1206  // Members
1207  if(count($members = $members_obj->getMembers()))
1208  {
1209  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
1210  if($ilUser->getPref('sess_member_hide'))
1211  {
1213  $this->ctrl->setParameter($this,'member_hide',0);
1214  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1215  $this->lng->txt('show'));
1216  $this->ctrl->clearParameters($this);
1217  }
1218  else
1219  {
1221  $this->ctrl->setParameter($this,'member_hide',1);
1222  $table->addHeaderCommand($this->ctrl->getLinkTarget($this,'members'),
1223  $this->lng->txt('hide'));
1224  $this->ctrl->clearParameters($this);
1225  }
1226  $table->addCommandButton('updateMembers',$this->lng->txt('save'));
1227  $table->setTitle($this->lng->txt('event_tbl_members'),'icon_usr.svg',$this->lng->txt('event_tbl_members'));
1228  $table->enableRegistration($this->object->enabledRegistration());
1229  $table->setParticipants($members);
1230  $table->parse();
1231  $this->tpl->setVariable('MEMBERS',$table->getHTML());
1232  }
1233 
1234 
1235  $GLOBALS['lng']->loadLanguageModule('mmbr');
1236  $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
1237  $this->tpl->setVariable('TXT_SELECTED_USER',$this->lng->txt('mmbr_selected_users'));
1238  $this->tpl->setVariable('BTN_FOOTER_MAIL',$this->lng->txt('mmbr_btn_mail_selected_users'));
1239  $this->tpl->setVariable('ARROW_DOWN',ilUtil::getImagePath('arrow_downright.svg'));
1240  }
1241 
1248  public function setShowHidePrefs()
1249  {
1250  global $ilUser;
1251 
1252  if(isset($_GET['admin_hide']))
1253  {
1254  $ilUser->writePref('sess_admin_hide',(int) $_GET['admin_hide']);
1255  }
1256  if(isset($_GET['tutor_hide']))
1257  {
1258  $ilUser->writePref('sess_tutor_hide',(int) $_GET['tutor_hide']);
1259  }
1260  if(isset($_GET['member_hide']))
1261  {
1262  $ilUser->writePref('sess_member_hide',(int) $_GET['member_hide']);
1263  }
1264  }
1265 
1273  public function updateMembersObject()
1274  {
1275  global $tree;
1276 
1277  $this->checkPermission('write');
1278 
1279 
1280 
1281  $this->initContainer();
1282 
1283  $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
1284  $_POST['registered'] = is_array($_POST['registered']) ? $_POST['registered'] : array();
1285 
1286  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1287 
1288  $visible = $_POST['visible_participants'] ? $_POST['visible_participants'] : array();
1289  foreach($visible as $user)
1290  {
1291  $part = new ilEventParticipants($this->object->getId());
1292  $part->setUserId($user);
1293  $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
1294  $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
1295  $part->setParticipated(isset($_POST['participants'][$user]) ? true : false);
1296  $part->setRegistered(isset($_POST['registered'][$user]) ? true : false);
1297  $part->updateUser();
1298  }
1299  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1300  $this->membersObject();
1301  }
1302 
1309  public function attendanceListObject()
1310  {
1311  global $tpl,$ilTabs;
1312 
1313  $this->checkPermission('write');
1314  $ilTabs->setTabActive('event_edit_members');
1315 
1316  $list = $this->initAttendanceList();
1317  $form = $list->initForm('printAttendanceList');
1318  $tpl->setContent($form->getHTML());
1319  }
1320 
1326  protected function initAttendanceList()
1327  {
1328  $members_obj = $this->initContainer(true);
1329 
1330  include_once 'Services/Membership/classes/class.ilAttendanceList.php';
1331  $list = new ilAttendanceList(
1332  $this,
1333  $this->object,
1334  $members_obj);
1335  $list->setId('sessattlst');
1336 
1337  $event_app = $this->object->getFirstAppointment();
1339  $desc = ilDatePresentation::formatPeriod($event_app->getStart(),$event_app->getEnd());
1341  $desc .= " ".$this->object->getTitle();
1342  $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
1343 
1344  $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
1345  $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
1346  if($this->object->enabledRegistration())
1347  {
1348  $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
1349  }
1350  $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
1351  $list->addBlank($this->lng->txt('sess_signature'));
1352 
1353  $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
1354 
1355  return $list;
1356  }
1357 
1363  protected function printAttendanceListObject()
1364  {
1365  $this->checkPermission('write');
1366 
1367  $list = $this->initAttendanceList();
1368  $list->initFromForm();
1369  $list->setCallback(array($this, 'getAttendanceListUserData'));
1370 
1371  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1372  $this->event_part = new ilEventParticipants($this->object->getId());
1373 
1374  echo $list->getFullscreenHTML();
1375  exit();
1376  }
1377 
1387  public function getAttendanceListUserData($a_user_id, $a_filters)
1388  {
1389  $data = $this->event_part->getUser($a_user_id);
1390 
1391  if($a_filters && $a_filters["registered"] && !$data["registered"])
1392  {
1393  return;
1394  }
1395 
1396  $data['registered'] = $data['registered'] ?
1397  $this->lng->txt('yes') :
1398  $this->lng->txt('no');
1399  $data['participated'] = $data['participated'] ?
1400  $this->lng->txt('yes') :
1401  $this->lng->txt('no');
1402 
1403  return $data;
1404  }
1405 
1413  public function eventsListObject()
1414  {
1415  global $ilErr,$ilAccess, $ilUser,$tree;
1416 
1417  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
1418  {
1419  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
1420  }
1421 
1422  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_list.html','Modules/Session');
1423  $this->__showButton($this->ctrl->getLinkTarget($this,'exportCSV'),$this->lng->txt('event_csv_export'));
1424 
1425  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1426 
1427  $this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
1428  $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.sess_list_row.html','Modules/Session');
1429 
1430  $members_obj = $this->initContainer(true);
1431  $members = $members_obj->getParticipants();
1432  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
1433 
1434  // Table
1435  $tbl = new ilTableGUI();
1436  $tbl->setTitle($this->lng->txt("event_overview"),
1437  'icon_usr.svg',
1438  $this->lng->txt('obj_usr'));
1439  $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
1440 
1441  $course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
1442  $events = array();
1443  foreach($tree->getSubtree($tree->getNodeData($course_ref_id),false,'sess') as $event_id)
1444  {
1445  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
1446  if(!is_object($tmp_event) or $tmp_event->getType() != 'sess')
1447  {
1448  continue;
1449  }
1450  $events[] = $tmp_event;
1451  }
1452 
1453  $headerNames = array();
1454  $headerVars = array();
1455  $colWidth = array();
1456 
1457  $headerNames[] = $this->lng->txt('name');
1458  $headerVars[] = "name";
1459  $colWidth[] = '20%';
1460 
1461  for ($i = 1; $i <= count($events); $i++)
1462  {
1463  $headerNames[] = $i;
1464  $headerVars[] = "event_".$i;
1465  $colWidth[] = 80/count($events)."%";
1466  }
1467 
1468  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1469  $tbl->setHeaderNames($headerNames);
1470  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'eventsList'));
1471  $tbl->setColumnWidth($colWidth);
1472 
1473  $tbl->setOrderColumn($_GET["sort_by"]);
1474  $tbl->setOrderDirection($_GET["sort_order"]);
1475  $tbl->setOffset($_GET["offset"]);
1476  $tbl->setLimit($ilUser->getPref("hits_per_page"));
1477  $tbl->setMaxCount(count($members));
1478  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1479 
1480  $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
1481  $tbl->disable('sort');
1482  $tbl->render();
1483 
1484  $counter = 0;
1485  foreach($sliced_users as $user_id)
1486  {
1487  foreach($events as $event_obj)
1488  {
1489  $this->tpl->setCurrentBlock("eventcols");
1490 
1491  $event_part = new ilEventParticipants($this->object->getId());
1492 
1493  {
1494  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1495  ilUtil::getImagePath('icon_ok.svg') :
1496  ilUtil::getImagePath('icon_not_ok.svg'));
1497 
1498  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1499  $this->lng->txt('event_participated') :
1500  $this->lng->txt('event_not_participated'));
1501  }
1502 
1503  $this->tpl->parseCurrentBlock();
1504  }
1505 
1506  $this->tpl->setCurrentBlock("tbl_content");
1507  $name = ilObjUser::_lookupName($user_id);
1508  $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1509  $this->tpl->setVariable("LASTNAME",$name['lastname']);
1510  $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
1511  $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
1512  $this->tpl->parseCurrentBlock();
1513  }
1514 
1515  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1516  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1517  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1518  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1519  $this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
1520  $i = 1;
1521  foreach($events as $event_obj)
1522  {
1523  $this->tpl->setCurrentBlock("legend_loop");
1524  $this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1525  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1526  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1527  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1528  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1529  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1530  $this->tpl->parseCurrentBlock();
1531  }
1532 
1533  }
1534 
1540  protected function initForm($a_mode)
1541  {
1542  global $ilUser;
1543 
1544  if(is_object($this->form))
1545  {
1546  return true;
1547  }
1548 
1549  $this->lng->loadLanguageModule('dateplaner');
1550 
1551  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1552 
1553  include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1555 
1556  $this->form = new ilPropertyFormGUI();
1557  $this->form->setMultipart(true);
1558  $this->form->setTableWidth('600px');
1559  $this->form->setFormAction($this->ctrl->getFormAction($this));
1560  $this->form->setMultipart(true);
1561 
1562  /*
1563  $full = new ilCheckboxInputGUI('','fulltime');
1564  $full->setChecked($this->object->getFirstAppointment()->enabledFulltime() ? true : false);
1565  $full->setOptionTitle($this->lng->txt('event_fulltime_info'));
1566  $full->setAdditionalAttributes('onchange="ilToggleSessionTime(this);"');
1567  #$this->form->addItem($full);
1568  */
1569 
1570  $this->lng->loadLanguageModule('dateplaner');
1571  include_once './Services/Form/classes/class.ilDateDurationInputGUI.php';
1572  $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'),'event');
1573  $dur->setRequired(true);
1574  $dur->enableToggleFullTime(
1575  $this->lng->txt('event_fulltime_info'),
1576  $this->object->getFirstAppointment()->enabledFulltime() ? true : false
1577  );
1578  $dur->setShowTime(true);
1579  $dur->setStart($this->object->getFirstAppointment()->getStart());
1580  $dur->setEnd($this->object->getFirstAppointment()->getEnd());
1581 
1582  $this->form->addItem($dur);
1583 
1584  /*
1585  // start
1586  $start = new ilDateTimeInputGUI($this->lng->txt('event_start_date'),'start');
1587  $start->setMinuteStepSize(5);
1588  $start->setDate($this->object->getFirstAppointment()->getStart());
1589  $start->setShowTime(true);
1590  #$this->form->addItem($start);
1591 
1592  // end
1593  $end = new ilDateTimeInputGUI($this->lng->txt('event_end_date'),'end');
1594  $end->setMinuteStepSize(5);
1595  $end->setDate($this->object->getFirstAppointment()->getEnd());
1596  $end->setShowTime(true);
1597  #$this->form->addItem($end);
1598  */
1599 
1600  // Recurrence
1601  if($a_mode == 'create')
1602  {
1603  if(!is_object($this->rec))
1604  {
1605  include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1606  $this->rec = new ilEventRecurrence();
1607  }
1608  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1609  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
1610  $rec->allowUnlimitedRecurrences(false);
1611  $rec->setRecurrence($this->rec);
1612  $this->form->addItem($rec);
1613 
1614  // #14547
1615  $lp = new ilCheckboxInputGUI($this->lng->txt("sess_lp_preset"), "lp_preset");
1616  $lp->setInfo($this->lng->txt("sess_lp_preset_info"));
1617  $lp->setChecked(true);
1618  $this->form->addItem($lp);
1619  }
1620 
1622  $section->setTitle($this->lng->txt('event_section_information'));
1623  $this->form->addItem($section);
1624 
1625  // title
1626  $title = new ilTextInputGUI($this->lng->txt('event_title'),'title');
1627  $title->setValue($this->object->getTitle());
1628  $title->setSize(50);
1629  $title->setMaxLength(70);
1630  $this->form->addItem($title);
1631 
1632  // desc
1633  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'),'desc');
1634  $desc->setValue($this->object->getLongDescription());
1635  $desc->setRows(4);
1636  $desc->setCols(50);
1637  $this->form->addItem($desc);
1638 
1639  // location
1640  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'),'location');
1641  $desc->setValue($this->object->getLocation());
1642  $desc->setRows(4);
1643  $desc->setCols(50);
1644  $this->form->addItem($desc);
1645 
1646  // workflow
1647  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'),'details');
1648  $details->setValue($this->object->getDetails());
1649  $details->setCols(50);
1650  $details->setRows(4);
1651  $this->form->addItem($details);
1652 
1653  // section
1655  $section->setTitle($this->lng->txt('event_tutor_data'));
1656  $this->form->addItem($section);
1657 
1658  // name
1659  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'),'tutor_name');
1660  $tutor_name->setValue($this->object->getName());
1661  $tutor_name->setSize(20);
1662  $tutor_name->setMaxLength(70);
1663  $this->form->addItem($tutor_name);
1664 
1665  // email
1666  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'),'tutor_email');
1667  $tutor_email->setValue($this->object->getEmail());
1668  $tutor_email->setSize(20);
1669  $tutor_email->setMaxLength(70);
1670  $this->form->addItem($tutor_email);
1671 
1672  // phone
1673  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'),'tutor_phone');
1674  $tutor_phone->setValue($this->object->getPhone());
1675  $tutor_phone->setSize(20);
1676  $tutor_phone->setMaxLength(70);
1677  $this->form->addItem($tutor_phone);
1678 
1680  $section->setTitle($this->lng->txt('sess_section_reg'));
1681  $this->form->addItem($section);
1682 
1683  include_once './Modules/Session/classes/class.ilSessionMembershipRegistrationSettingsGUI.php';
1684  include_once './Services/Membership/classes/class.ilMembershipRegistrationSettings.php';
1685  $reg_settings = new ilSessionMembershipRegistrationSettingsGUI(
1686  $this,
1687  $this->object,
1688  array(
1693  )
1694  );
1695  $reg_settings->addMembershipFormElements($this->form, '');
1696 
1697 
1699  $section->setTitle($this->lng->txt('event_assign_files'));
1700  $this->form->addItem($section);
1701 
1702  $files = new ilFileWizardInputGUI($this->lng->txt('objs_file'),'files');
1703  $files->setFilenames(array(0 => ''));
1704  $this->form->addItem($files);
1705 
1706  switch($a_mode)
1707  {
1708  case 'create':
1709  $this->form->setTitle($this->lng->txt('event_table_create'));
1710 
1711  $this->form->addCommandButton('save',$this->lng->txt('event_btn_add'));
1712  $this->form->addCommandButton('saveAndAssignMaterials',$this->lng->txt('event_btn_add_edit'));
1713  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
1714 
1715  return true;
1716 
1717  case 'edit':
1718  $this->form->setTitle($this->lng->txt('event_table_update'));
1719 
1720  $this->form->addCommandButton('update',$this->lng->txt('save'));
1721  $this->form->addCommandButton('cancelEdit',$this->lng->txt('cancel'));
1722 
1723  return true;
1724  }
1725  return true;
1726  }
1727 
1735  protected function load()
1736  {
1737  $event = $this->form->getItemByPostVar('event');
1738  if($event->getStart() && $event->getEnd())
1739  {
1740  $this->object->getFirstAppointment()->setStartingTime($event->getStart()->get(IL_CAL_UNIX));
1741  $this->object->getFirstAppointment()->setEndingTime($event->getStart()->get(IL_CAL_UNIX));
1742  $this->object->getFirstAppointment()->setStart($event->getStart());
1743  $this->object->getFirstAppointment()->setEnd($event->getEnd());
1744  $this->object->getFirstAppointment()->toggleFulltime($event->getStart() instanceof ilDate);
1745  }
1746 
1747  $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1748  $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1749  $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1750  $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1751  $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1752  $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1753  $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1754 
1755  $this->object->setRegistrationType((int) $_POST['registration_type']);
1756  // $this->object->setRegistrationMinUsers((int) $_POST['registration_min_members']);
1757  $this->object->setRegistrationMaxUsers((int) $_POST['registration_max_members']);
1758  $this->object->enableRegistrationUserLimit((int) $_POST['registration_membership_limited']);
1759 
1760  switch((int) $_POST['waiting_list'])
1761  {
1762  case 2:
1763  $this->object->enableRegistrationWaitingList(true);
1764  $this->object->setWaitingListAutoFill(true);
1765  break;
1766 
1767  case 1:
1768  $this->object->enableRegistrationWaitingList(true);
1769  $this->object->setWaitingListAutoFill(false);
1770  break;
1771 
1772  default:
1773  $this->object->enableRegistrationWaitingList(false);
1774  $this->object->setWaitingListAutoFill(false);
1775  break;
1776  }
1777  }
1778 
1785  protected function loadRecurrenceSettings()
1786  {
1787  include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1788  $this->rec = new ilSessionRecurrence();
1789 
1790  switch($_POST['frequence'])
1791  {
1792  case IL_CAL_FREQ_DAILY:
1793  $this->rec->setFrequenceType($_POST['frequence']);
1794  $this->rec->setInterval((int) $_POST['count_DAILY']);
1795  break;
1796 
1797  case IL_CAL_FREQ_WEEKLY:
1798  $this->rec->setFrequenceType($_POST['frequence']);
1799  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1800  if(is_array($_POST['byday_WEEKLY']))
1801  {
1802  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1803  }
1804  break;
1805 
1806  case IL_CAL_FREQ_MONTHLY:
1807  $this->rec->setFrequenceType($_POST['frequence']);
1808  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1809  switch((int) $_POST['subtype_MONTHLY'])
1810  {
1811  case 0:
1812  // nothing to do;
1813  break;
1814 
1815  case 1:
1816  switch((int) $_POST['monthly_byday_day'])
1817  {
1818  case 8:
1819  // Weekday
1820  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1821  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1822  break;
1823 
1824  case 9:
1825  // Day of month
1826  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1827  break;
1828 
1829  default:
1830  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1831  break;
1832  }
1833  break;
1834 
1835  case 2:
1836  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1837  break;
1838  }
1839  break;
1840 
1841  case IL_CAL_FREQ_YEARLY:
1842  $this->rec->setFrequenceType($_POST['frequence']);
1843  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1844  switch((int) $_POST['subtype_YEARLY'])
1845  {
1846  case 0:
1847  // nothing to do;
1848  break;
1849 
1850  case 1:
1851  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1852  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1853  break;
1854 
1855  case 2:
1856  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1857  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1858  break;
1859  }
1860  break;
1861  }
1862 
1863  // UNTIL
1864  switch((int) $_POST['until_type'])
1865  {
1866  case 1:
1867  $this->rec->setFrequenceUntilDate(null);
1868  // nothing to do
1869  break;
1870 
1871  case 2:
1872  $this->rec->setFrequenceUntilDate(null);
1873  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1874  break;
1875 
1876  case 3:
1877  $frequence = $this->form->getItemByPostVar('frequence');
1878  $end = $frequence->getRecurrence()->getFrequenceUntilDate();
1879  $this->rec->setFrequenceUntilCount(0);
1880  $this->rec->setFrequenceUntilDate($end);
1881  break;
1882  }
1883  }
1884 
1885 
1893  protected function __toUnix($date,$time)
1894  {
1895  return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
1896  }
1897 
1904  public function addLocatorItems()
1905  {
1906  global $ilLocator;
1907 
1908  if (!$this->getCreationMode())
1909  {
1910  // see prepareOutput()
1911  include_once './Modules/Session/classes/class.ilSessionAppointment.php';
1912  $title = strlen($this->object->getTitle()) ? (': '.$this->object->getTitle()) : '';
1913  $title = $this->object->getFirstAppointment()->appointmentToString().$title;
1914 
1915  $ilLocator->addItem($title, $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
1916  }
1917  }
1918 
1919 
1924  {
1925  global $DIC;
1926 
1927  $objDefinition = $DIC['objDefinition'];
1928 
1929  $tree = $DIC->repositoryTree();
1930  $ctrl = $DIC->ctrl();
1931 
1932  $parent_id = $tree->getParentId($this->object->getRefId());
1933 
1934  // #11650
1935  $parent_type = ilObject::_lookupType($parent_id, true);
1936 
1937  $parent_class = $objDefinition->getClassName($parent_type);
1938  $parent_class = 'ilObj'.$parent_class.'GUI';
1939 
1940  $ctrl->setParameterByClass($parent_class, "ref_id", $parent_id);
1941  $ctrl->redirectByClass($parent_class, "view");
1942  }
1943 
1944 
1951  public function getTabs()
1952  {
1953  global $ilAccess, $ilTabs, $tree, $ilCtrl, $ilHelp;
1954 
1955  $ilHelp->setScreenIdComponent("sess");
1956 
1957  $parent_id = $tree->getParentId($this->object->getRefId());
1958 
1959  // #11650
1960  $parent_type = ilObject::_lookupType($parent_id, true);
1961 
1962  $this->tabs_gui->setBackTarget($this->lng->txt('back_to_'.$parent_type.'_content'),
1963  $ilCtrl->getLinkTarget($this, "redirectToParentContentPage"));
1964 
1965  $this->tabs_gui->addTarget('info_short',
1966  $this->ctrl->getLinkTarget($this,'infoScreen'));
1967 
1968  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1969  {
1970  $this->tabs_gui->addTarget('settings',
1971  $this->ctrl->getLinkTarget($this,'edit'));
1972  $this->tabs_gui->addTarget('crs_materials',
1973  $this->ctrl->getLinkTarget($this,'materials'));
1974  $this->tabs_gui->addTarget('event_edit_members',
1975  $this->ctrl->getLinkTarget($this,'members'));
1976  }
1977 
1978  // learning progress
1979  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1980  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
1981  {
1982  $this->tabs_gui->addTarget('learning_progress',
1983  $this->ctrl->getLinkTargetByClass(array('ilobjsessiongui','illearningprogressgui'),''),
1984  '',
1985  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
1986  }
1987 
1988  // export
1989  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1990  {
1991  $this->tabs_gui->addTarget("export",
1992  $this->ctrl->getLinkTargetByClass("ilexportgui", ""), "", "ilexportgui");
1993  }
1994 
1995 
1996  // edit permissions
1997  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1998  {
1999  $this->tabs_gui->addTarget("perm_settings",
2000  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), array("perm","info","owner"), 'ilpermissiongui');
2001  }
2002 
2003  }
2004 
2010  public function afterSaveCallback(ilObject $a_obj)
2011  {
2012  // add new object to materials
2013  include_once './Modules/Session/classes/class.ilEventItems.php';
2014  $event_items = new ilEventItems($this->object->getId());
2015  $event_items->addItem($a_obj->getRefId());
2016  $event_items->update();
2017 
2018  /*
2019  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
2020  $this->ctrl->redirect($this, "materials");
2021  */
2022  }
2023 
2027  protected function sendMailToSelectedUsersObject()
2028  {
2029  $GLOBALS['ilCtrl']->setReturn($this,'members');
2030  $GLOBALS['ilCtrl']->setCmdClass('ilmembershipmailgui');
2031  include_once './Services/Membership/classes/class.ilMembershipMailGUI.php';
2032  $mem = new ilMembershipMailGUI($this);
2033  $GLOBALS['ilCtrl']->forwardCommand($mem);
2034  }
2035 
2039  public function readMemberData($a_usr_ids)
2040  {
2041  $tmp_data = array();
2042  foreach ($a_usr_ids as $usr_id)
2043  {
2044  $tmp_data[$usr_id] = array();
2045  }
2046  return $tmp_data;
2047  }
2048 
2057  {
2058  $this->checkPermission('write');
2059 
2060  if(!count($_POST["waiting"]))
2061  {
2062  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2063  $this->membersObject();
2064  return false;
2065  }
2066 
2067  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2068  $waiting_list = new ilSessionWaitingList($this->object->getId());
2069 
2070  include_once './Modules/Session/classes/class.ilEventParticipants.php';
2071  $part = new ilEventParticipants($this->object->getId());
2072 
2073  $added_users = 0;
2074  foreach($_POST["waiting"] as $user_id)
2075  {
2076  $part->register($user_id);
2077  $waiting_list->removeFromList($user_id);
2078 
2079  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2081  $noti->setRefId($this->object->getRefId());
2082  $noti->setRecipients(array($user_id));
2084  $noti->send();
2085 
2086  ++$added_users;
2087  }
2088  if($added_users)
2089  {
2090  ilUtil::sendSuccess($this->lng->txt("sess_users_added"));
2091  $this->membersObject();
2092 
2093  return true;
2094  }
2095  else
2096  {
2097  ilUtil::sendFailure($this->lng->txt("sess_users_already_assigned"));
2098  $this->searchObject();
2099  return false;
2100  }
2101  }
2102 
2109  public function refuseFromListObject()
2110  {
2111  $this->checkPermission('write');
2112 
2113  if(!count($_POST['waiting']))
2114  {
2115  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2116  $this->membersObject();
2117  return false;
2118  }
2119 
2120  include_once('./Modules/Session/classes/class.ilSessionWaitingList.php');
2121  $waiting_list = new ilSessionWaitingList($this->object->getId());
2122 
2123  foreach($_POST["waiting"] as $user_id)
2124  {
2125  $waiting_list->removeFromList($user_id);
2126 
2127  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2129  $noti->setRefId($this->object->getRefId());
2130  $noti->setRecipients(array($user_id));
2132  $noti->send();
2133 
2134  }
2135 
2136  ilUtil::sendSuccess($this->lng->txt('sess_users_removed_from_list'));
2137  $this->membersObject();
2138  return true;
2139  }
2140 
2147  public function assignSubscribersObject()
2148  {
2149  global $lng,$ilUser;
2150 
2151  $this->checkPermission('write');
2152 
2153  if(!count($_POST['subscribers']))
2154  {
2155  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2156  $this->membersObject();
2157  return false;
2158  }
2159 
2160  include_once './Services/Membership/classes/class.ilParticipants.php';
2161  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2162 
2163  foreach($_POST['subscribers'] as $usr_id)
2164  {
2165  $part->add($usr_id);
2166  $part->deleteSubscriber($usr_id);
2167 
2168  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2170  $noti->setRefId($this->object->getRefId());
2171  $noti->setRecipients(array($usr_id));
2173  $noti->send();
2174  }
2175  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_assigned"),true);
2176  $this->ctrl->redirect($this,'members');
2177  return true;
2178  }
2179 
2186  public function refuseSubscribersObject()
2187  {
2188  global $lng;
2189 
2190  $this->checkPermission('write');
2191 
2192  if(!count($_POST['subscribers']))
2193  {
2194  ilUtil::sendFailure($this->lng->txt('no_checkbox'));
2195  $this->membersObject();
2196  return false;
2197  }
2198 
2199  include_once './Services/Membership/classes/class.ilParticipants.php';
2200  $part = ilParticipants::getInstanceByObjId($this->object->getId());
2201  foreach($_POST['subscribers'] as $usr_id)
2202  {
2203  $part->deleteSubscriber($usr_id);
2204 
2205  include_once './Modules/Session/classes/class.ilSessionMembershipMailNotification.php';
2207  $noti->setRefId($this->object->getRefId());
2208  $noti->setRecipients(array($usr_id));
2210  $noti->send();
2211  }
2212  ilUtil::sendSuccess($this->lng->txt("sess_msg_applicants_removed"));
2213  $this->membersObject();
2214  return true;
2215 
2216  }
2221  public function getContainerRefId()
2222  {
2223  if(!$this->container_ref_id)
2224  {
2225  $this->initContainer();
2226  }
2227  return $this->container_ref_id;
2228  }
2229 
2231  {
2232  if(!is_array($_POST["subscribers"]))
2233  {
2234  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2235  $this->membersObject();
2236 
2237  return false;
2238  }
2239 
2240  $this->lng->loadLanguageModule('mmbr');
2241 
2242  $this->checkPermission('write');
2243  $this->tabs_gui->setTabActive('event_edit_members');
2244 
2245  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2246  $c_gui = new ilConfirmationGUI();
2247 
2248  // set confirm/cancel commands
2249  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseSubscribers"));
2250  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2251  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2252  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseSubscribers");
2253 
2254  foreach($_POST["subscribers"] as $subscribers)
2255  {
2256  $name = ilObjUser::_lookupName($subscribers);
2257 
2258  $c_gui->addItem('subscribers[]',
2259  $name['user_id'],
2260  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2261  ilUtil::getImagePath('icon_usr.svg'));
2262  }
2263 
2264  $this->tpl->setContent($c_gui->getHTML());
2265  return true;
2266  }
2267 
2269  {
2270  if(!is_array($_POST["subscribers"]))
2271  {
2272  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2273  $this->membersObject();
2274 
2275  return false;
2276  }
2277  $this->checkPermission('write');
2278  $this->tabs_gui->setTabActive('event_edit_members');
2279 
2280  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2281  $c_gui = new ilConfirmationGUI();
2282 
2283  // set confirm/cancel commands
2284  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignSubscribers"));
2285  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2286  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2287  $c_gui->setConfirm($this->lng->txt("confirm"), "assignSubscribers");
2288 
2289  foreach($_POST["subscribers"] as $subscribers)
2290  {
2291  $name = ilObjUser::_lookupName($subscribers);
2292 
2293  $c_gui->addItem('subscribers[]',
2294  $name['user_id'],
2295  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2296  ilUtil::getImagePath('icon_usr.svg'));
2297  }
2298 
2299  $this->tpl->setContent($c_gui->getHTML());
2300  return true;
2301  }
2302 
2304  {
2305  if(!is_array($_POST["waiting"]))
2306  {
2307  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2308  $this->membersObject();
2309 
2310  return false;
2311  }
2312 
2313  $this->lng->loadLanguageModule('mmbr');
2314 
2315  $this->checkPermission('write');
2316  $this->tabs_gui->setTabActive('event_edit_members');
2317 
2318  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2319  $c_gui = new ilConfirmationGUI();
2320 
2321  // set confirm/cancel commands
2322  $c_gui->setFormAction($this->ctrl->getFormAction($this, "refuseFromList"));
2323  $c_gui->setHeaderText($this->lng->txt("info_refuse_sure"));
2324  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2325  $c_gui->setConfirm($this->lng->txt("confirm"), "refuseFromList");
2326 
2327  foreach($_POST["waiting"] as $waiting)
2328  {
2329  $name = ilObjUser::_lookupName($waiting);
2330 
2331  $c_gui->addItem('waiting[]',
2332  $name['user_id'],
2333  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2334  ilUtil::getImagePath('icon_usr.svg'));
2335  }
2336 
2337  $this->tpl->setContent($c_gui->getHTML());
2338  return true;
2339  }
2340 
2342  {
2343  if(!is_array($_POST["waiting"]))
2344  {
2345  ilUtil::sendFailure($this->lng->txt("no_checkbox"));
2346  $this->membersObject();
2347 
2348  return false;
2349  }
2350  $this->checkPermission('write');
2351  $this->tabs_gui->setTabActive('event_edit_members');
2352 
2353  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
2354  $c_gui = new ilConfirmationGUI();
2355 
2356  // set confirm/cancel commands
2357  $c_gui->setFormAction($this->ctrl->getFormAction($this, "assignFromWaitingList"));
2358  $c_gui->setHeaderText($this->lng->txt("info_assign_sure"));
2359  $c_gui->setCancel($this->lng->txt("cancel"), "members");
2360  $c_gui->setConfirm($this->lng->txt("confirm"), "assignFromWaitingList");
2361 
2362  foreach($_POST["waiting"] as $waiting)
2363  {
2364  $name = ilObjUser::_lookupName($waiting);
2365 
2366  $c_gui->addItem('waiting[]',
2367  $name['user_id'],
2368  $name['lastname'].', '.$name['firstname'].' ['.$name['login'].']',
2369  ilUtil::getImagePath('icon_usr.svg'));
2370  }
2371 
2372  $this->tpl->setContent($c_gui->getHTML());
2373  return true;
2374  }
2375 
2376 
2382  protected function cancelEditObject()
2383  {
2384  global $ilCtrl, $tree;
2385 
2386  $parent_id = $tree->getParentId((int) $_REQUEST['ref_id']);
2387 
2388  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $parent_id);
2389 
2390  $ilCtrl->redirectByClass("ilrepositorygui", "");
2391  }
2392 
2393 }
2394 ?>
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
global $ilErr
Definition: raiseError.php:16
loadRecurrenceSettings()
load recurrence settings
const IL_CAL_FREQ_MONTHLY
redirectToParentContentPageObject()
Redirect to parent content page.
eventsListObject()
list sessions of all user
Class ilInfoScreenGUI.
static getItemsByEvent($a_event_id)
Get session material / event items.
afterSaveCallback(ilObject $a_obj)
Custom callback after object is created (in parent containert.
static _unregister($a_usr_id, $a_event_id)
$_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='')
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$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.
showJoinRequestButton()
show join request
const IL_CAL_UNIX
static addToDesktop()
Add desktop item public.
class ilEvent
prepareOutput($a_show_subobjects=true)
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.
$counter
$section
Definition: Utf8Test.php:83
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.
GUI class for course/group subscriptions.
$ilUser
Definition: imgupload.php:18
static _register($a_usr_id, $a_event_id)
static _recordReadEvent($a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
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.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
cancelEditObject()
Cancel editigin type $ilCtrl type $tree.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
deleteFilesObject()
delete files
materialsObject()
show material assignment
refuseSubscribersObject()
refuse subscribers
static removeFromDesktop()
Remove item from personal desktop public.
joinObject()
Called from info screen.
static _lookupAboStatus($a_id)
Interface for gui classes (e.g ilLuceneSearchGUI) that offer add/remove to/from desktop.
Create new PHPExcel object
obj_idprivate
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) ...
$ret
Definition: parser.php:6
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 type $tree.
confirmDeleteFilesObject()
confirm delete files
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
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.
global $DIC
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
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.
$_POST["username"]
$html
Definition: example_001.php:87
unregisterObject()
unregister from session
static getInstanceByObjId($a_obj_id)
Get instance by obj type.
setRequired($a_required)
Set Required.
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.