ILIAS  release_4-4 Revision
ilObjBookingPoolGUI Class Reference

Class ilObjBookingPoolGUI. More...

+ Inheritance diagram for ilObjBookingPoolGUI:
+ Collaboration diagram for ilObjBookingPoolGUI:

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor. More...
 
 executeCommand ()
 main switch More...
 
 editObject ()
 
 setTabs ()
 get tabs More...
 
 bookObject ()
 First step in booking process. More...
 
 confirmedBookingObject ()
 Book object - either of type or specific - for given dates. More...
 
 confirmBookingNumbers (array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
 
 confirmedBookingNumbersObject ()
 
 processBooking ($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
 Book object for date. More...
 
 logObject ()
 List reservations. More...
 
 logDetailsObject ()
 
 changeStatusObject ()
 Change status of given reservations. More...
 
 applyLogFilterObject ()
 Apply filter from reservations table gui. More...
 
 resetLogFilterObject ()
 Reset filter in reservations table gui. More...
 
 _goto ($a_target)
 
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 infoScreen ()
 
 rsvConfirmCancelObject ()
 
 rsvCancelObject ()
 
 rsvInUseObject ()
 
 rsvNotInUseObject ()
 
 showProfileObject ()
 
 addLocatorItems ()
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Protected Member Functions

 initCreationForms ($a_new_type)
 
 afterSave (ilObject $a_new_object)
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 
 getEditFormCustomValues (array &$a_values)
 
 updateCustom (ilPropertyFormGUI $a_form)
 
 renderSlots (ilBookingSchedule $schedule, array $object_ids, $title)
 
 buildDatesBySchedule ($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
 
 handleBookingSuccess ($a_obj_id)
 
 initBookingNumbersForm (array $a_objects_counter, $a_group_id)
 
 getLogReservationIds ()
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 
- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjBookingPoolGUI::__construct (   $a_data,
  $a_id,
  $a_call_by_reference,
  $a_prepare_output = true 
)

Constructor.

Definition at line 23 of file class.ilObjBookingPoolGUI.php.

References ilObjectGUI\ilObjectGUI().

24  {
25  $this->type = "book";
26  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
27  $this->lng->loadLanguageModule("book");
28  }
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

ilObjBookingPoolGUI::_goto (   $a_target)

Definition at line 1069 of file class.ilObjBookingPoolGUI.php.

References $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and ilUtil\sendFailure().

1070  {
1071  global $ilAccess, $ilErr, $lng;
1072 
1073  if ($ilAccess->checkAccess("read", "", $a_target))
1074  {
1075  ilObjectGUI::_gotoRepositoryNode($a_target, "render");
1076  }
1077  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1078  {
1079  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1080  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1082  }
1083 
1084  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1085  }
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _lookupObjId($a_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjBookingPoolGUI::addLocatorItems ( )

Definition at line 1332 of file class.ilObjBookingPoolGUI.php.

References $_GET.

1333  {
1334  global $ilLocator;
1335 
1336  if (is_object($this->object))
1337  {
1338  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "render"), "", $_GET["ref_id"]);
1339  }
1340  }
$_GET["client_id"]

◆ afterSave()

ilObjBookingPoolGUI::afterSave ( ilObject  $a_new_object)
protected

Definition at line 124 of file class.ilObjBookingPoolGUI.php.

References ilObject\getRefId(), ilUtil\sendSuccess(), and ilObject\update().

125  {
126  $a_new_object->setOffline(true);
127  $a_new_object->update();
128 
129  // always send a message
130  ilUtil::sendSuccess($this->lng->txt("book_pool_added"),true);
131  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
132  $this->ctrl->redirect($this, "edit");
133  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getRefId()
get reference id public
update()
update object in db
+ Here is the call graph for this function:

◆ applyLogFilterObject()

ilObjBookingPoolGUI::applyLogFilterObject ( )

Apply filter from reservations table gui.

Definition at line 1034 of file class.ilObjBookingPoolGUI.php.

References logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1035  {
1036  global $ilAccess;
1037 
1038  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1039  $this->object->hasPublicLog());
1040 
1041  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1042  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1043  $this->object->getId(), $show_all,
1044  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1045  $table->resetOffset();
1046  $table->writeFilterToSession();
1047  $this->logObject();
1048  }
logObject()
List reservations.
+ Here is the call graph for this function:

◆ bookObject()

ilObjBookingPoolGUI::bookObject ( )

First step in booking process.

Definition at line 242 of file class.ilObjBookingPoolGUI.php.

References $_GET, ilObjectGUI\$tpl, renderSlots(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

Referenced by confirmedBookingObject().

243  {
244  global $tpl;
245 
246  $this->tabs_gui->clearTargets();
247  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
248 
249  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
250  $obj = new ilBookingObject((int)$_GET['object_id']);
251 
252  $this->lng->loadLanguageModule("dateplaner");
253  $this->ctrl->setParameter($this, 'object_id', $obj->getId());
254 
255  if($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
256  {
257  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
258  $schedule = new ilBookingSchedule($obj->getScheduleId());
259 
260  $tpl->setContent($this->renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
261  }
262  else
263  {
264  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
265  $cgui = new ilConfirmationGUI();
266  $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
267 
268  $cgui->setFormAction($this->ctrl->getFormAction($this));
269  $cgui->setCancel($this->lng->txt("cancel"), "render");
270  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
271 
272  $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
273 
274  $tpl->setContent($cgui->getHTML());
275  }
276  }
a bookable ressource
renderSlots(ilBookingSchedule $schedule, array $object_ids, $title)
$_GET["client_id"]
schedule for booking ressource
Confirmation screen class.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildDatesBySchedule()

ilObjBookingPoolGUI::buildDatesBySchedule (   $week_start,
array  $hours,
  $schedule,
array  $object_ids,
  $seed,
array &  $dates 
)
protected

Definition at line 472 of file class.ilObjBookingPoolGUI.php.

References $ilUser, $in, ilCalendarUtil\_buildWeekDayList(), ilCalendarUserSettings\_getInstanceByUserId(), ilDatePresentation\formatDate(), ilBookingReservation\getAvailableObject(), IL_CAL_FKT_GETDATE, IL_CAL_UNIX, and ilCalendarSettings\TIME_FORMAT_12.

Referenced by renderSlots().

473  {
474  global $ilUser;
475 
476  include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
477  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
478 
479  $map = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
480  $definition = $schedule->getDefinition();
481 
482  $has_open_slot = false;
483  foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
484  {
485  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
486 
487  $slots = array();
488  if(isset($definition[$map[$date_info['isoday']-1]]))
489  {
490  $slots = array();
491  foreach($definition[$map[$date_info['isoday']-1]] as $slot)
492  {
493  $slot = explode('-', $slot);
494  $slots[] = array('from'=>str_replace(':', '', $slot[0]),
495  'to'=>str_replace(':', '', $slot[1]));
496  }
497  }
498 
499  $last = array_pop(array_keys($hours));
500  $slot_captions = array();
501  foreach($hours as $hour => $period)
502  {
503  $dates[$hour][0] = $period;
504 
505  $period = explode("-", $period);
506 
507  // #13738
508  if($user_settings->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
509  {
510  if(stristr($period[0], "pm"))
511  {
512  $period[0] = (int)$period[0]+12;
513  }
514  else
515  {
516  $period[0] = (int)$period[0];
517  if($period[0] == 12)
518  {
519  $period[0] = 0;
520  }
521  }
522  if(sizeof($period) == 2)
523  {
524  if(stristr($period[1], "pm"))
525  {
526  $period[1] = (int)$period[1]+12;
527  }
528  else
529  {
530  $period[1] = (int)$period[1];
531  if($period[1] == 12)
532  {
533  $period[1] = 0;
534  }
535  }
536  }
537  }
538 
539  if(sizeof($period) == 1)
540  {
541  $period_from = (int)substr($period[0], 0, 2)."00";
542  $period_to = (int)substr($period[0], 0, 2)."59";
543  }
544  else
545  {
546  $period_from = (int)substr($period[0], 0, 2)."00";
547  $period_to = (int)substr($period[1], 0, 2)."59";
548  }
549 
550  $column = $date_info['isoday'];
551  if(!$week_start)
552  {
553  if($column < 7)
554  {
555  $column++;
556  }
557  else
558  {
559  $column = 1;
560  }
561  }
562 
563  if(sizeof($slots))
564  {
565  $in = false;
566  foreach($slots as $slot)
567  {
568  $slot_from = mktime(substr($slot['from'], 0, 2), substr($slot['from'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
569  $slot_to = mktime(substr($slot['to'], 0, 2), substr($slot['to'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
570 
571  // always single object, we can sum up
572  $nr_available = (array)ilBookingReservation::getAvailableObject($object_ids, $slot_from, $slot_to-1, false, true);
573 
574  // check deadline
575  if($slot_from < (time()+$schedule->getDeadline()*60*60) || !array_sum($nr_available))
576  {
577  continue;
578  }
579 
580  // is slot active in current hour?
581  if((int)$slot['from'] < $period_to && (int)$slot['to'] > $period_from)
582  {
583  $from = ilDatePresentation::formatDate(new ilDateTime($slot_from, IL_CAL_UNIX));
584  $from = array_pop(explode(' ', $from));
586  $to = array_pop(explode(' ', $to));
587 
588  // show caption (first hour) of slot
589  $id = $slot_from.'_'.$slot_to;
590  if(!in_array($id, $slot_captions))
591  {
592  $dates[$hour][$column]['captions'][$id] = $from.'-'.$to;
593  $dates[$hour][$column]['available'][$id] = array_sum($nr_available);
594  $slot_captions[] = $id;
595  }
596 
597  $in = true;
598  }
599  }
600  // (any) active slot
601  if($in)
602  {
603  $has_open_slot = true;
604  $dates[$hour][$column]['in_slot'] = $in;
605  }
606  }
607  }
608  }
609 
610  return $has_open_slot;
611  }
static _getInstanceByUserId($a_user_id)
get singleton instance
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
static getAvailableObject(array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
Check if any of given objects are bookable.
const IL_CAL_FKT_GETDATE
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changeStatusObject()

ilObjBookingPoolGUI::changeStatusObject ( )

Change status of given reservations.

Definition at line 1009 of file class.ilObjBookingPoolGUI.php.

References $_POST, ilBookingReservation\changeStatus(), logObject(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

1010  {
1011  global $ilAccess;
1012 
1013  $this->tabs_gui->setTabActive('log');
1014 
1015  if(!$_POST['reservation_id'])
1016  {
1017  ilUtil::sendFailure($this->lng->txt('select_one'));
1018  return $this->logObject();
1019  }
1020 
1021  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
1022  {
1023  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1024  ilBookingReservation::changeStatus($_POST['reservation_id'], (int)$_POST['tstatus']);
1025  }
1026 
1027  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1028  return $this->ctrl->redirect($this, 'log');
1029  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
logObject()
List reservations.
static changeStatus(array $a_ids, $a_status)
Batch update reservation status.
+ Here is the call graph for this function:

◆ confirmBookingNumbers()

ilObjBookingPoolGUI::confirmBookingNumbers ( array  $a_objects_counter,
  $a_group_id,
ilPropertyFormGUI  $a_form = null 
)

Definition at line 829 of file class.ilObjBookingPoolGUI.php.

References ilObjectGUI\$tpl, and initBookingNumbersForm().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

830  {
831  global $tpl;
832 
833  $this->tabs_gui->clearTargets();
834  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
835 
836  if(!$a_form)
837  {
838  $a_form = $this->initBookingNumbersForm($a_objects_counter, $a_group_id);
839  }
840 
841  $tpl->setContent($a_form->getHTML());
842  }
initBookingNumbersForm(array $a_objects_counter, $a_group_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmedBookingNumbersObject()

ilObjBookingPoolGUI::confirmedBookingNumbersObject ( )

Definition at line 844 of file class.ilObjBookingPoolGUI.php.

References $_POST, ilObjectGUI\$obj_id, $success, confirmBookingNumbers(), ilBookingReservation\getAvailableObject(), handleBookingSuccess(), initBookingNumbersForm(), processBooking(), and ilUtil\sendFailure().

845  {
846  // convert post data to initial form config
847  $counter = array();
848  foreach(array_keys($_POST) as $id)
849  {
850  if(substr($id, 0, 9) == "conf_nr__")
851  {
852  $id = explode("_", substr($id, 9));
853  $counter[$id[0]."_".$id[1]."_".$id[2]] = $id[3];
854  }
855  }
856 
857  $group_id = $_POST["grp_id"];
858 
859  $form = $this->initBookingNumbersForm($counter, $group_id);
860  if($form->checkInput())
861  {
862  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
863 
864  $success = false;
865  foreach($counter as $id => $all_nr)
866  {
867  $book_nr = $form->getInput("conf_nr__".$id."_".$all_nr);
868  $parts = explode("_", $id);
869  $obj_id = $parts[0];
870  $from = $parts[1];
871  $to = $parts[2]-1;
872 
873  // get currently available slots
874  $counter = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to, false, true);
875  $counter = $counter[$obj_id];
876  if($counter)
877  {
878  // we can only book what is left
879  $book_nr = min($book_nr, $counter);
880  for($loop = 0; $loop < $book_nr; $loop++)
881  {
882  $this->processBooking($obj_id, $from, $to, $group_id);
883  $success = $obj_id;
884  }
885  }
886  }
887  if($success)
888  {
890  }
891  else
892  {
893  ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
894  $this->ctrl->redirect($this, 'render');
895  }
896  }
897  else
898  {
899  $form->setValuesByPost();
900  return $this->confirmBookingNumbers($counter, $group_id, $form);
901  }
902  }
$_POST['username']
Definition: cron.php:12
initBookingNumbersForm(array $a_objects_counter, $a_group_id)
$success
Definition: Utf8Test.php:87
processBooking($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
Book object for date.
static getAvailableObject(array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
Check if any of given objects are bookable.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ confirmedBookingObject()

ilObjBookingPoolGUI::confirmedBookingObject ( )

Book object - either of type or specific - for given dates.

Definition at line 616 of file class.ilObjBookingPoolGUI.php.

References $_GET, $_POST, $success, bookObject(), confirmBookingNumbers(), ilBookingReservation\getAvailableObject(), ilBookingReservation\getNewGroupId(), ilBookingObject\getNrOfItemsForObjects(), handleBookingSuccess(), ilBookingReservation\isObjectAvailableNoSchedule(), processBooking(), ilUtil\sendFailure(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

617  {
618  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
619  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
620 
621  $success = false;
622 
623  if($this->object->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE)
624  {
625  if($_POST['object_id'])
626  {
627  $object_id = $_POST['object_id'];
628  if($object_id)
629  {
631  {
632  $this->processBooking($object_id);
633  $success = $object_id;
634  }
635  else
636  {
637  // #11852
638  ilUtil::sendFailure($this->lng->txt('book_reservation_failed_overbooked'), true);
639  $this->ctrl->redirect($this, 'render');
640  }
641  }
642  }
643  }
644  else
645  {
646  if(!isset($_POST['date']))
647  {
648  ilUtil::sendFailure($this->lng->txt('select_one'));
649  return $this->bookObject();
650  }
651 
652  // single object reservation(s)
653  if(isset($_GET['object_id']))
654  {
655  $confirm = array();
656 
657  $object_id = (int)$_GET['object_id'];
658  if($object_id)
659  {
660  $group_id = null;
661  $nr = ilBookingObject::getNrOfItemsForObjects(array($object_id));
662  if($nr[$object_id] > 1 || sizeof($_POST['date']) > 1)
663  {
665  }
666  foreach($_POST['date'] as $date)
667  {
668  $fromto = explode('_', $date);
669  $fromto[1]--;
670 
671  $counter = ilBookingReservation::getAvailableObject(array($object_id), $fromto[0], $fromto[1], false, true);
672  $counter = $counter[$object_id];
673  if($counter)
674  {
675  if($counter > 1)
676  {
677  $confirm[$object_id."_".$fromto[0]."_".($fromto[1]+1)] = $counter;
678  }
679  else
680  {
681  $this->processBooking($object_id, $fromto[0], $fromto[1], $group_id);
682  $success = $object_id;
683  }
684  }
685  }
686  }
687 
688  if(sizeof($confirm))
689  {
690  return $this->confirmBookingNumbers($confirm, $group_id);
691  }
692  }
693  /*
694  // group object reservation(s)
695  else
696  {
697  $all_object_ids = array();
698  foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
699  {
700  $all_object_ids[] = $item['booking_object_id'];
701  }
702 
703  $possible_objects = $counter = array();
704  sort($_POST['date']);
705  foreach($_POST['date'] as $date)
706  {
707  $fromto = explode('_', $date);
708  $fromto[1]--;
709  $possible_objects[$date] = ilBookingReservation::getAvailableObject($all_object_ids, $fromto[0], $fromto[1], false);
710  foreach($possible_objects[$date] as $obj_id)
711  {
712  $counter[$obj_id]++;
713  }
714  }
715 
716  if(max($counter))
717  {
718  // we prefer the objects which are available for most slots
719  arsort($counter);
720  $counter = array_keys($counter);
721 
722  // book each slot
723  foreach($possible_objects as $date => $available_ids)
724  {
725  $fromto = explode('_', $date);
726  $fromto[1]--;
727 
728  // find "best" object for slot
729  foreach($counter as $best_object_id)
730  {
731  if(in_array($best_object_id, $available_ids))
732  {
733  $object_id = $best_object_id;
734  break;
735  }
736  }
737  $this->processBooking($object_id, $fromto[0], $fromto[1]);
738  $success = true;
739  }
740  }
741  }
742  */
743  }
744 
745  if($success)
746  {
748  }
749  else
750  {
751  ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
752  $this->ctrl->redirect($this, 'book');
753  }
754  }
$_POST['username']
Definition: cron.php:12
static isObjectAvailableNoSchedule($a_obj_id)
bookObject()
First step in booking process.
$_GET["client_id"]
static getNewGroupId()
Get next group id.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
$success
Definition: Utf8Test.php:87
processBooking($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
Book object for date.
static getAvailableObject(array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
Check if any of given objects are bookable.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
+ Here is the call graph for this function:

◆ editObject()

ilObjBookingPoolGUI::editObject ( )

Definition at line 135 of file class.ilObjBookingPoolGUI.php.

References ilBookingSchedule\getList(), ilUtil\sendInfo(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

136  {
137  // if we have no schedules yet - show info
138  include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
139  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE &&
140  !sizeof(ilBookingSchedule::getList($this->object->getId())))
141  {
142  ilUtil::sendInfo($this->lng->txt("book_schedule_warning_edit"));
143  }
144 
145  return parent::editObject();
146  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getList($a_pool_id)
Get list of booking objects for given pool.
+ Here is the call graph for this function:

◆ executeCommand()

ilObjBookingPoolGUI::executeCommand ( )

main switch

Definition at line 33 of file class.ilObjBookingPoolGUI.php.

References $_GET, $cmd, $ret, ilObjectGUI\$tpl, ilObjectGUI\addHeaderAction(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreen(), and ilObjectGUI\prepareOutput().

34  {
35  global $tpl, $ilTabs, $ilNavigationHistory;
36 
37  $next_class = $this->ctrl->getNextClass($this);
38  $cmd = $this->ctrl->getCmd();
39 
40  if(!$next_class && $cmd == 'render')
41  {
42  $this->ctrl->setCmdClass('ilBookingObjectGUI');
43  $next_class = $this->ctrl->getNextClass($this);
44  }
45 
46  if(substr($cmd, 0, 4) == 'book')
47  {
48  $next_class = '';
49  }
50 
51  $ilNavigationHistory->addItem($this->ref_id,
52  "./goto.php?target=book_".$this->ref_id, "book");
53 
54  $this->prepareOutput();
55 
56  switch($next_class)
57  {
58  case 'ilpermissiongui':
59  $this->tabs_gui->setTabActive('perm_settings');
60  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
61  $perm_gui =& new ilPermissionGUI($this);
62  $ret =& $this->ctrl->forwardCommand($perm_gui);
63  break;
64 
65  case 'ilbookingobjectgui':
66  $this->tabs_gui->setTabActive('render');
67  include_once("Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
68  $object_gui =& new ilBookingObjectGUI($this);
69  $ret =& $this->ctrl->forwardCommand($object_gui);
70  break;
71 
72  case 'ilbookingschedulegui':
73  $this->tabs_gui->setTabActive('schedules');
74  include_once("Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
75  $schedule_gui =& new ilBookingScheduleGUI($this);
76  $ret =& $this->ctrl->forwardCommand($schedule_gui);
77  break;
78 
79  case 'ilpublicuserprofilegui':
80  $ilTabs->clearTargets();
81  include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
82  $profile = new ilPublicUserProfileGUI((int)$_GET["user_id"]);
83  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
84  $ret = $this->ctrl->forwardCommand($profile);
85  $tpl->setContent($ret);
86  break;
87 
88  case 'ilinfoscreengui':
89  $this->infoScreen();
90  break;
91 
92  case "ilcommonactiondispatchergui":
93  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
95  $this->ctrl->forwardCommand($gui);
96  break;
97 
98  case "ilobjectcopygui":
99  include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
100  $cp = new ilObjectCopyGUI($this);
101  $cp->setType("book");
102  $this->ctrl->forwardCommand($cp);
103  break;
104 
105  default:
106  $cmd = $this->ctrl->getCmd();
107  $cmd .= 'Object';
108  $this->$cmd();
109  break;
110  }
111 
112  $this->addHeaderAction();
113  return true;
114  }
GUI class for the workflow of copying objects.
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
GUI class for public user profile presentation.
Class ilBookingObjectGUI.
prepareOutput()
prepare output
Class ilBookingScheduleGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
addHeaderAction()
Add header action menu.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjBookingPoolGUI::getEditFormCustomValues ( array &  $a_values)
protected

Definition at line 177 of file class.ilObjBookingPoolGUI.php.

178  {
179  $a_values["online"] = !$this->object->isOffline();
180  $a_values["public"] = $this->object->hasPublicLog();
181  $a_values["stype"] = $this->object->getScheduleType();
182  }

◆ getLogReservationIds()

ilObjBookingPoolGUI::getLogReservationIds ( )
protected

Definition at line 1145 of file class.ilObjBookingPoolGUI.php.

References $_GET, and $_POST.

Referenced by rsvConfirmCancelObject(), rsvInUseObject(), and rsvNotInUseObject().

1146  {
1147  if($_POST["mrsv"])
1148  {
1149  return $_POST["mrsv"];
1150  }
1151  else if((int)$_GET["reservation_id"])
1152  {
1153  return array((int)$_GET["reservation_id"]);
1154  }
1155  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ handleBookingSuccess()

ilObjBookingPoolGUI::handleBookingSuccess (   $a_obj_id)
protected

Definition at line 756 of file class.ilObjBookingPoolGUI.php.

References ilUtil\sendSuccess().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

757  {
758  ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
759 
760  // show post booking information?
761  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
762  $obj = new ilBookingObject($a_obj_id);
763  $pfile = $obj->getPostFile();
764  $ptext = $obj->getPostText();
765  if(trim($ptext) || $pfile)
766  {
767  $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
768  $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
769  }
770  else
771  {
772  $this->ctrl->redirect($this, 'render');
773  }
774  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjBookingPoolGUI::infoScreen ( )

Definition at line 1099 of file class.ilObjBookingPoolGUI.php.

References $_GET, and $ilCtrl.

Referenced by executeCommand(), and infoScreenObject().

1100  {
1101  global $ilAccess, $ilCtrl;
1102 
1103  $this->tabs_gui->setTabActive('info');
1104 
1105  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
1106  {
1107  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1108  }
1109 
1110  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1111  $info = new ilInfoScreenGUI($this);
1112 
1113  $info->enablePrivateNotes();
1114 
1115  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
1116  {
1117  $info->enableNews();
1118  }
1119 
1120  // no news editing for files, just notifications
1121  $info->enableNewsEditing(false);
1122  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1123  {
1124  $news_set = new ilSetting("news");
1125  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1126 
1127  if ($enable_internal_rss)
1128  {
1129  $info->setBlockProperty("news", "settings", true);
1130  $info->setBlockProperty("news", "public_notifications_option", true);
1131  }
1132  }
1133 
1134  // forward the command
1135  if ($ilCtrl->getNextClass() == "ilinfoscreengui")
1136  {
1137  $ilCtrl->forwardCommand($info);
1138  }
1139  else
1140  {
1141  return $ilCtrl->getHTML($info);
1142  }
1143  }
ILIAS Setting Class.
Class ilInfoScreenGUI.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjBookingPoolGUI::infoScreenObject ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 1092 of file class.ilObjBookingPoolGUI.php.

References infoScreen().

1093  {
1094  $this->ctrl->setCmd("showSummary");
1095  $this->ctrl->setCmdClass("ilinfoscreengui");
1096  $this->infoScreen();
1097  }
+ Here is the call graph for this function:

◆ initBookingNumbersForm()

ilObjBookingPoolGUI::initBookingNumbersForm ( array  $a_objects_counter,
  $a_group_id 
)
protected

Definition at line 776 of file class.ilObjBookingPoolGUI.php.

References $section, ilDatePresentation\formatPeriod(), and IL_CAL_UNIX.

Referenced by confirmBookingNumbers(), and confirmedBookingNumbersObject().

777  {
778  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
779  $form = new ilPropertyFormGUI();
780  $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking"));
781  $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects"));
782  $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info"));
783 
784  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
785  $section = false;
786  foreach($a_objects_counter as $id => $counter)
787  {
788  $id = explode("_", $id);
789  $book_id = $id[0]."_".$id[1]."_".$id[2]."_".$counter;
790 
791  $obj = new ilBookingObject($id[0]);
792 
793  if(!$section)
794  {
796  $section->setTitle($obj->getTitle());
797  $form->addItem($section);
798 
799  $section = true;
800  }
801 
802  $period = /* $this->lng->txt("book_period").": ". */
804  new ilDateTime($id[1], IL_CAL_UNIX),
805  new ilDateTime($id[2], IL_CAL_UNIX));
806 
807  $nr_field = new ilNumberInputGUI($period, "conf_nr__".$book_id);
808  $nr_field->setValue(1);
809  $nr_field->setSize(3);
810  $nr_field->setMaxValue($counter);
811  $nr_field->setMinValue(1);
812  $nr_field->setRequired(true);
813  $form->addItem($nr_field);
814  }
815 
816  if($a_group_id)
817  {
818  $grp = new ilHiddenInputGUI("grp_id");
819  $grp->setValue($a_group_id);
820  $form->addItem($grp);
821  }
822 
823  $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm"));
824  $form->addCommandButton("render", $this->lng->txt("cancel"));
825 
826  return $form;
827  }
a bookable ressource
This class represents a property form user interface.
This class represents a section header in a property form.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
const IL_CAL_UNIX
$section
Definition: Utf8Test.php:84
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
Date and time handling
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjBookingPoolGUI::initCreationForms (   $a_new_type)
protected

Definition at line 116 of file class.ilObjBookingPoolGUI.php.

117  {
118  $forms = parent::initCreationForms($a_new_type);
119  unset($forms[self::CFORM_IMPORT]);
120 
121  return $forms;
122  }

◆ initEditCustomForm()

ilObjBookingPoolGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Definition at line 148 of file class.ilObjBookingPoolGUI.php.

References ilPropertyFormGUI\addItem(), ilBookingObject\getList(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilObjBookingPool\TYPE_FIX_SCHEDULE, and ilObjBookingPool\TYPE_NO_SCHEDULE.

149  {
150  $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
151  $a_form->addItem($online);
152 
153  $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype");
154  $type->setRequired(true);
155  $a_form->addItem($type);
156 
157  // #14478
158  include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
159  if(sizeof(ilBookingObject::getList($this->object->getId())))
160  {
161  $type->setDisabled(true);
162  }
163 
164  $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE);
165  $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info"));
166  $type->addOption($fixed);
167 
168  $none = new ilRadioOption($this->lng->txt("book_schedule_type_none"), ilObjBookingPool::TYPE_NO_SCHEDULE);
169  $none->setInfo($this->lng->txt("book_schedule_type_none_info"));
170  $type->addOption($none);
171 
172  $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
173  $public->setInfo($this->lng->txt("book_public_log_info"));
174  $a_form->addItem($public);
175  }
This class represents an option in a radio group.
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
static getList($a_pool_id)
Get list of booking objects for given type.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ logDetailsObject()

ilObjBookingPoolGUI::logDetailsObject ( )

Definition at line 981 of file class.ilObjBookingPoolGUI.php.

References $_GET, ilObjectGUI\$tpl, and ilObjBookingPool\TYPE_NO_SCHEDULE.

982  {
983  global $tpl, $ilAccess;
984 
985  $this->tabs_gui->clearTargets();
986  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
987  $this->ctrl->getLinkTarget($this, "log"));
988 
989  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
990  $this->object->hasPublicLog());
991 
992  $filter = null;
993  if($_GET["object_id"])
994  {
995  $filter["object"] = (int)$_GET["object_id"];
996  }
997 
998  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
999  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1000  $this->object->getId(), $show_all,
1001  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1002  $filter, $_GET["reservation_id"]);
1003  $tpl->setContent($table->getHTML());
1004  }
$_GET["client_id"]

◆ logObject()

ilObjBookingPoolGUI::logObject ( )

List reservations.

Definition at line 958 of file class.ilObjBookingPoolGUI.php.

References $_GET, ilObjectGUI\$tpl, and ilObjBookingPool\TYPE_NO_SCHEDULE.

Referenced by applyLogFilterObject(), changeStatusObject(), resetLogFilterObject(), rsvCancelObject(), rsvInUseObject(), and rsvNotInUseObject().

959  {
960  global $tpl, $ilAccess;
961 
962  $this->tabs_gui->setTabActive('log');
963 
964  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
965  $this->object->hasPublicLog());
966 
967  $filter = null;
968  if($_GET["object_id"])
969  {
970  $filter["object"] = (int)$_GET["object_id"];
971  }
972 
973  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
974  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
975  $this->object->getId(), $show_all,
976  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
977  $filter);
978  $tpl->setContent($table->getHTML());
979  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ processBooking()

ilObjBookingPoolGUI::processBooking (   $a_object_id,
  $a_from = null,
  $a_to = null,
  $a_group_id = null 
)

Book object for date.

Parameters
int$a_object_id
int$a_fromtimestamp
int$a_totimestamp
int$a_group_id

Definition at line 912 of file class.ilObjBookingPoolGUI.php.

References $ilUser, ilObjectGUI\$object, ilCalendarCategoryAssignments\addAssignment(), IL_CAL_UNIX, ilCalendarUtil\initDefaultCalendarByType(), ilCalendarEntry\setStart(), and ilCalendarCategory\TYPE_BOOK.

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

913  {
914  global $ilUser, $ilAccess;
915 
916  // #11995
917  if(!$ilAccess->checkAccess('read', '', $this->object->getRefId()))
918  {
919  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
920  };
921 
922  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
923  $reservation = new ilBookingReservation();
924  $reservation->setObjectId($a_object_id);
925  $reservation->setUserId($ilUser->getID());
926  $reservation->setFrom($a_from);
927  $reservation->setTo($a_to);
928  $reservation->setGroupId($a_group_id);
929  $reservation->save();
930 
931  if($a_from)
932  {
933  $this->lng->loadLanguageModule('dateplaner');
934  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
935  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
936  $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK,$ilUser->getId(),$this->lng->txt('cal_ch_personal_book'),true);
937 
938  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
939  $object = new ilBookingObject($a_object_id);
940 
941  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
942  $entry = new ilCalendarEntry;
943  $entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
944  $entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
945  $entry->setTitle($this->lng->txt('book_cal_entry').' '.$object->getTitle());
946  $entry->setContextId($reservation->getId());
947  $entry->save();
948 
949  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
950  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
951  $assignment->addAssignment($def_cat->getCategoryId());
952  }
953  }
a bookable ressource
Model for a calendar entry.
setStart(ilDateTime $a_start)
public
const IL_CAL_UNIX
Date and time handling
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilUser
Definition: imgupload.php:15
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderSlots()

ilObjBookingPoolGUI::renderSlots ( ilBookingSchedule  $schedule,
array  $object_ids,
  $title 
)
protected

Definition at line 278 of file class.ilObjBookingPoolGUI.php.

References $_GET, $ilUser, ilCalendarUtil\_buildWeekDayList(), ilCalendarAppointmentColors\_getColorsByType(), ilCalendarUserSettings\_getInstanceByUserId(), ilCalendarUtil\_numericDayToString(), ilCalendarUtil\_numericMonthToString(), buildDatesBySchedule(), ilCalendarUtil\calculateFontColor(), ilBookingSchedule\getRaster(), IL_CAL_DATE, IL_CAL_FKT_GETDATE, IL_CAL_UNIX, ilCalendarSettings\TIME_FORMAT_12, ilCalendarSettings\TIME_FORMAT_24, ilDateTime\WEEK, and ilDateTime\YEAR.

Referenced by bookObject().

279  {
280  global $ilUser;
281 
282  // fix
283  if(!$schedule->getRaster())
284  {
285  $mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager');
286 
287  $mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
288  $mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title'));
289  $mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info'));
290  $mytpl->setVariable('TXT_OBJECT', $title);
291  $mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking'));
292  $mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel'));
293 
294  include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
295 
296  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
297 
298  $morning_aggr = $user_settings->getDayStart();
299  $evening_aggr = $user_settings->getDayEnd();
300  $hours = array();
301  for($i = $morning_aggr;$i <= $evening_aggr;$i++)
302  {
303  switch($user_settings->getTimeFormat())
304  {
306  if ($morning_aggr > 0 && $i == $morning_aggr)
307  {
308  $hours[$i] = sprintf('%02d:00',0)."-";
309  }
310  $hours[$i].= sprintf('%02d:00',$i);
311  if ($evening_aggr < 23 && $i == $evening_aggr)
312  {
313  $hours[$i].= "-".sprintf('%02d:00',23);
314  }
315  break;
316 
318  if ($morning_aggr > 0 && $i == $morning_aggr)
319  {
320  $hours[$i] = date('h a',mktime(0,0,0,1,1,2000))."-";
321  }
322  $hours[$i].= date('h a',mktime($i,0,0,1,1,2000));
323  if ($evening_aggr < 23 && $i == $evening_aggr)
324  {
325  $hours[$i].= "-".date('h a',mktime(23,0,0,1,1,2000));
326  }
327  break;
328  }
329  }
330 
331  if(isset($_GET['seed']))
332  {
333  $find_first_open = false;
334  $seed = new ilDate($_GET['seed'], IL_CAL_DATE);
335  }
336  else
337  {
338  $find_first_open = true;
339  $seed = new ilDate(time(), IL_CAL_UNIX);
340  }
341 
342  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
343  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
344  $week_start = $user_settings->getWeekStart();
345 
346  if(!$find_first_open)
347  {
348  $dates = array();
349  $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
350  }
351  else
352  {
353  $dates = array();
354  $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
355 
356  // find first open slot
357  if(!$has_open_slot)
358  {
359  // 1 year is limit for search
360  $limit = clone($seed);
361  $limit->increment(ilDate::YEAR, 1);
362  $limit = $limit->get(IL_CAL_UNIX);
363 
364  while(!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit)
365  {
366  $seed->increment(ilDate::WEEK, 1);
367 
368  $dates = array();
369  $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
370  }
371  }
372  }
373 
374  include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
375  $navigation = new ilCalendarHeaderNavigationGUI($this,$seed,ilDateTime::WEEK,'book');
376  $mytpl->setVariable('NAVIGATION', $navigation->getHTML());
377 
378  foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
379  {
380  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
381 
382  $mytpl->setCurrentBlock('weekdays');
383  $mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil:: _numericDayToString($date_info['wday']));
384  $mytpl->setVariable('TXT_DATE', $date_info['mday'].' '.ilCalendarUtil:: _numericMonthToString($date_info['mon']));
385  $mytpl->parseCurrentBlock();
386  }
387 
388  include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
389  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
390  $color = array();
392  for($loop = 0; $loop < 7; $loop++)
393  {
394  $col = $all[$loop];
396  $color[$loop+1] = 'border-bottom: 1px solid '.$col.'; background-color: '.$col.'; color: '.$fnt;
397  }
398 
399  $counter = 0;
400  foreach($dates as $hour => $days)
401  {
402  $caption = $days;
403  $caption = array_shift($caption);
404 
405  for($loop = 1; $loop < 8; $loop++)
406  {
407  if(!isset($days[$loop]))
408  {
409  $mytpl->setCurrentBlock('dates');
410  $mytpl->setVariable('DUMMY', '&nbsp;');
411  $mytpl->parseCurrentBlock();
412  }
413  else
414  {
415  if(isset($days[$loop]['captions']))
416  {
417  foreach($days[$loop]['captions'] as $slot_id => $slot_caption)
418  {
419  $mytpl->setCurrentBlock('choice');
420  $mytpl->setVariable('TXT_DATE', $slot_caption);
421  $mytpl->setVariable('VALUE_DATE', $slot_id);
422  $mytpl->setVariable('DATE_COLOR', $color[$loop]);
423  $mytpl->setVariable('TXT_AVAILABLE',
424  sprintf($this->lng->txt('book_reservation_available'),
425  $days[$loop]['available'][$slot_id]));
426  $mytpl->parseCurrentBlock();
427  }
428 
429  $mytpl->setCurrentBlock('dates');
430  $mytpl->setVariable('DUMMY', '');
431  $mytpl->parseCurrentBlock();
432  }
433  else if(isset($days[$loop]['in_slot']))
434  {
435  $mytpl->setCurrentBlock('dates');
436  $mytpl->setVariable('DATE_COLOR', $color[$loop]);
437  $mytpl->parseCurrentBlock();
438  }
439  else
440  {
441  $mytpl->setCurrentBlock('dates');
442  $mytpl->setVariable('DUMMY', '&nbsp;');
443  $mytpl->parseCurrentBlock();
444  }
445  }
446  }
447 
448  $mytpl->setCurrentBlock('slots');
449  $mytpl->setVariable('TXT_HOUR', $caption);
450  if($counter%2)
451  {
452  $mytpl->setVariable('CSS_ROW', 'tblrow1');
453  }
454  else
455  {
456  $mytpl->setVariable('CSS_ROW', 'tblrow2');
457  }
458  $mytpl->parseCurrentBlock();
459 
460  $counter++;
461  }
462  }
463  // flexible
464  else
465  {
466  // :TODO: inactive for now
467  }
468 
469  return $mytpl->get();
470  }
static _getColorsByType($a_type)
get selectable colors
static _numericDayToString($a_day, $a_long=true)
get
$_GET["client_id"]
static _getInstanceByUserId($a_user_id)
get singleton instance
buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
getRaster()
Get booking raster.
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
const IL_CAL_UNIX
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
Class for single dates.
special template class to simplify handling of ITX/PEAR
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
const IL_CAL_FKT_GETDATE
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetLogFilterObject()

ilObjBookingPoolGUI::resetLogFilterObject ( )

Reset filter in reservations table gui.

Definition at line 1053 of file class.ilObjBookingPoolGUI.php.

References logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1054  {
1055  global $ilAccess;
1056 
1057  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1058  $this->object->hasPublicLog());
1059 
1060  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1061  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1062  $this->object->getId(), $show_all,
1063  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1064  $table->resetOffset();
1065  $table->resetFilter();
1066  $this->logObject();
1067  }
logObject()
List reservations.
+ Here is the call graph for this function:

◆ rsvCancelObject()

ilObjBookingPoolGUI::rsvCancelObject ( )

Definition at line 1199 of file class.ilObjBookingPoolGUI.php.

References $_POST, $ilUser, logObject(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilBookingReservation\STATUS_CANCELLED, and ilObjBookingPool\TYPE_NO_SCHEDULE.

1200  {
1201  global $ilAccess, $ilUser;
1202 
1203  $ids = $_POST["rsv_id"];
1204  if($ids)
1205  {
1206  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1207  foreach($ids as $id)
1208  {
1209  $obj = new ilBookingReservation($id);
1210 
1211  if (!$ilAccess->checkAccess("write", "", $this->ref_id) && $obj->getUserId() != $ilUser->getId())
1212  {
1213  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1214  $this->ctrl->redirect($this, 'log');
1215  }
1216 
1217  $obj->setStatus(ilBookingReservation::STATUS_CANCELLED);
1218  $obj->update();
1219 
1220  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1221  {
1222  // remove user calendar entry (#11086)
1223  $cal_entry_id = $obj->getCalendarEntry();
1224  if($cal_entry_id)
1225  {
1226  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1227  $entry = new ilCalendarEntry($cal_entry_id);
1228  $entry->delete();
1229  }
1230  }
1231  }
1232  }
1233 
1234  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1235  $this->logObject();
1236  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$_POST['username']
Definition: cron.php:12
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
logObject()
List reservations.
+ Here is the call graph for this function:

◆ rsvConfirmCancelObject()

ilObjBookingPoolGUI::rsvConfirmCancelObject ( )

Definition at line 1157 of file class.ilObjBookingPoolGUI.php.

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, getLogReservationIds(), ilBookingObject\getTitle(), IL_CAL_UNIX, and ilObjBookingPool\TYPE_NO_SCHEDULE.

1158  {
1159  global $ilCtrl, $lng, $tpl;
1160 
1161  $ids = $this->getLogReservationIds();
1162  if(!$ids)
1163  {
1164  $this->ctrl->redirect($this, 'log');
1165  }
1166 
1167  $this->tabs_gui->clearTargets();
1168  $this->tabs_gui->setBackTarget($lng->txt("back"),
1169  $ilCtrl->getLinkTarget($this, "log"));
1170 
1171  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1172  $conf = new ilConfirmationGUI();
1173  $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
1174  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
1175  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
1176  $conf->setCancel($lng->txt('cancel'), 'log');
1177 
1178  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1179  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1180  foreach($ids as $id)
1181  {
1182  $rsv = new ilBookingReservation($id);
1183  $obj = new ilBookingObject($rsv->getObjectId());
1184 
1185  $details = $obj->getTitle();
1186  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1187  {
1188  $details .= ", ".ilDatePresentation::formatPeriod(
1189  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1190  new ilDateTime($rsv->getTo(), IL_CAL_UNIX));
1191  }
1192 
1193  $conf->addItem('rsv_id[]', $id, $details);
1194  }
1195 
1196  $tpl->setContent($conf->getHTML());
1197  }
a bookable ressource
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
getTitle()
Get object title.
Date and time handling
Confirmation screen class.
+ Here is the call graph for this function:

◆ rsvInUseObject()

ilObjBookingPoolGUI::rsvInUseObject ( )

Definition at line 1266 of file class.ilObjBookingPoolGUI.php.

References getLogReservationIds(), logObject(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilBookingReservation\STATUS_IN_USE.

1267  {
1268  global $ilAccess;
1269 
1270  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
1271  {
1272  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1273  $this->ctrl->redirect($this, 'log');
1274  }
1275 
1276  $ids = $this->getLogReservationIds();
1277  if($ids)
1278  {
1279  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1280  foreach($ids as $id)
1281  {
1282  $obj = new ilBookingReservation($id);
1283  $obj->setStatus(ilBookingReservation::STATUS_IN_USE);
1284  $obj->update();
1285  }
1286  }
1287 
1288  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1289  $this->logObject();
1290  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
logObject()
List reservations.
+ Here is the call graph for this function:

◆ rsvNotInUseObject()

ilObjBookingPoolGUI::rsvNotInUseObject ( )

Definition at line 1292 of file class.ilObjBookingPoolGUI.php.

References getLogReservationIds(), logObject(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

1293  {
1294  global $ilAccess;
1295 
1296  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
1297  {
1298  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1299  $this->ctrl->redirect($this, 'log');
1300  }
1301 
1302  $ids = $this->getLogReservationIds();
1303  if($ids)
1304  {
1305  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1306  foreach($ids as $id)
1307  {
1308  $obj = new ilBookingReservation($id);
1309  $obj->setStatus(NULL);
1310  $obj->update();
1311  }
1312  }
1313 
1314  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1315  $this->logObject();
1316  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
logObject()
List reservations.
+ Here is the call graph for this function:

◆ setTabs()

ilObjBookingPoolGUI::setTabs ( )

get tabs

Definition at line 194 of file class.ilObjBookingPoolGUI.php.

References ilObjBookingPool\TYPE_NO_SCHEDULE.

195  {
196  global $ilAccess, $ilHelp;
197 
198  if (in_array($this->ctrl->getCmd(), array("create", "save")) && !$this->ctrl->getNextClass())
199  {
200  return;
201  }
202 
203  $ilHelp->setScreenIdComponent("book");
204 
205  $this->tabs_gui->addTab("render",
206  $this->lng->txt("book_booking_types"),
207  $this->ctrl->getLinkTarget($this, "render"));
208 
209  $this->tabs_gui->addTab("info",
210  $this->lng->txt("info_short"),
211  $this->ctrl->getLinkTarget($this, "infoscreen"));
212 
213  $this->tabs_gui->addTab("log",
214  $this->lng->txt("book_log"),
215  $this->ctrl->getLinkTarget($this, "log"));
216 
217  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
218  {
219  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
220  {
221  $this->tabs_gui->addTab("schedules",
222  $this->lng->txt("book_schedules"),
223  $this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render"));
224  }
225 
226  $this->tabs_gui->addTab("settings",
227  $this->lng->txt("settings"),
228  $this->ctrl->getLinkTarget($this, "edit"));
229  }
230 
231  if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
232  {
233  $this->tabs_gui->addTab("perm_settings",
234  $this->lng->txt("perm_settings"),
235  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
236  }
237  }

◆ showProfileObject()

ilObjBookingPoolGUI::showProfileObject ( )

Definition at line 1318 of file class.ilObjBookingPoolGUI.php.

References $_GET, $ilCtrl, and ilObjectGUI\$tpl.

1319  {
1320  global $tpl, $ilCtrl;
1321 
1322  $this->tabs_gui->clearTargets();
1323 
1324  $user_id = (int)$_GET['user_id'];
1325 
1326  include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1327  $profile = new ilPublicUserProfileGUI($user_id);
1328  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
1329  $tpl->setContent($ilCtrl->getHTML($profile));
1330  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
GUI class for public user profile presentation.

◆ updateCustom()

ilObjBookingPoolGUI::updateCustom ( ilPropertyFormGUI  $a_form)
protected

Definition at line 184 of file class.ilObjBookingPoolGUI.php.

References ilPropertyFormGUI\getInput().

185  {
186  $this->object->setOffline(!$a_form->getInput('online'));
187  $this->object->setPublicLog($a_form->getInput('public'));
188  $this->object->setScheduleType($a_form->getInput('stype'));
189  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: