ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
 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 ()
 
 rsvConfirmCancelAggregationForm ($a_ids)
 
 rsvConfirmCancelAggregationObject (array $a_ids=null)
 
 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...
 

Static Public Member Functions

static _goto ($a_target)
 
- 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...
 

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, array $a_rsv_ids=null)
 
 initBookingNumbersForm (array $a_objects_counter, $a_group_id, $a_reload=false)
 
 addDaysDate ($a_date, $a_days)
 
 addDaysStamp ($a_stamp, $a_days)
 
 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...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) 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

- 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()

static ilObjBookingPoolGUI::_goto (   $a_target)
static

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

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

1230  {
1231  global $ilAccess, $ilErr, $lng;
1232 
1233  if ($ilAccess->checkAccess("read", "", $a_target))
1234  {
1235  ilObjectGUI::_gotoRepositoryNode($a_target, "render");
1236  }
1237  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1238  {
1239  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1240  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1242  }
1243 
1244  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1245  }
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:

◆ addDaysDate()

ilObjBookingPoolGUI::addDaysDate (   $a_date,
  $a_days 
)
protected

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

Referenced by confirmedBookingNumbersObject().

917  {
918  $date = date_parse($a_date);
919  $stamp = mktime(0, 0, 1, $date["month"], $date["day"]+$a_days, $date["year"]);
920  return date("Y-m-d", $stamp);
921  }
+ Here is the caller graph for this function:

◆ addDaysStamp()

ilObjBookingPoolGUI::addDaysStamp (   $a_stamp,
  $a_days 
)
protected

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

Referenced by confirmedBookingNumbersObject().

924  {
925  $date = getDate($a_stamp);
926  return mktime($date["hours"], $date["minutes"], $date["seconds"],
927  $date["mon"], $date["mday"]+$a_days, $date["year"]);
928  }
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjBookingPoolGUI::addLocatorItems ( )

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

References $_GET.

1663  {
1664  global $ilLocator;
1665 
1666  if (is_object($this->object))
1667  {
1668  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "render"), "", $_GET["ref_id"]);
1669  }
1670  }
$_GET["client_id"]

◆ afterSave()

ilObjBookingPoolGUI::afterSave ( ilObject  $a_new_object)
protected

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

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

132  {
133  $a_new_object->setOffline(true);
134  $a_new_object->update();
135 
136  // always send a message
137  ilUtil::sendSuccess($this->lng->txt("book_pool_added"),true);
138  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
139  $this->ctrl->redirect($this, "edit");
140  }
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 1194 of file class.ilObjBookingPoolGUI.php.

References logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1195  {
1196  global $ilAccess;
1197 
1198  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1199  $this->object->hasPublicLog());
1200 
1201  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1202  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1203  $this->object->getId(), $show_all,
1204  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1205  $table->resetOffset();
1206  $table->writeFilterToSession();
1207  $this->logObject();
1208  }
logObject()
List reservations.
+ Here is the call graph for this function:

◆ bookObject()

ilObjBookingPoolGUI::bookObject ( )

First step in booking process.

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

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

Referenced by confirmedBookingObject().

267  {
268  global $tpl;
269 
270  $this->tabs_gui->clearTargets();
271  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
272 
273  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
274  $obj = new ilBookingObject((int)$_GET['object_id']);
275 
276  $this->lng->loadLanguageModule("dateplaner");
277  $this->ctrl->setParameter($this, 'object_id', $obj->getId());
278 
279  if($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
280  {
281  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
282  $schedule = new ilBookingSchedule($obj->getScheduleId());
283 
284  $tpl->setContent($this->renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
285  }
286  else
287  {
288  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
289  $cgui = new ilConfirmationGUI();
290  $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
291 
292  $cgui->setFormAction($this->ctrl->getFormAction($this));
293  $cgui->setCancel($this->lng->txt("cancel"), "render");
294  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
295 
296  $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
297 
298  $tpl->setContent($cgui->getHTML());
299  }
300  }
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 496 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().

497  {
498  global $ilUser;
499 
500  include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
501  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
502 
503  $map = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
504  $definition = $schedule->getDefinition();
505 
506  $has_open_slot = false;
507  foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
508  {
509  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
510 
511  $slots = array();
512  if(isset($definition[$map[$date_info['isoday']-1]]))
513  {
514  $slots = array();
515  foreach($definition[$map[$date_info['isoday']-1]] as $slot)
516  {
517  $slot = explode('-', $slot);
518  $slots[] = array('from'=>str_replace(':', '', $slot[0]),
519  'to'=>str_replace(':', '', $slot[1]));
520  }
521  }
522 
523  $last = array_pop(array_keys($hours));
524  $slot_captions = array();
525  foreach($hours as $hour => $period)
526  {
527  $dates[$hour][0] = $period;
528 
529  $period = explode("-", $period);
530 
531  // #13738
532  if($user_settings->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
533  {
534  if(stristr($period[0], "pm"))
535  {
536  $period[0] = (int)$period[0]+12;
537  }
538  else
539  {
540  $period[0] = (int)$period[0];
541  if($period[0] == 12)
542  {
543  $period[0] = 0;
544  }
545  }
546  if(sizeof($period) == 2)
547  {
548  if(stristr($period[1], "pm"))
549  {
550  $period[1] = (int)$period[1]+12;
551  }
552  else
553  {
554  $period[1] = (int)$period[1];
555  if($period[1] == 12)
556  {
557  $period[1] = 0;
558  }
559  }
560  }
561  }
562 
563  if(sizeof($period) == 1)
564  {
565  $period_from = (int)substr($period[0], 0, 2)."00";
566  $period_to = (int)substr($period[0], 0, 2)."59";
567  }
568  else
569  {
570  $period_from = (int)substr($period[0], 0, 2)."00";
571  $period_to = (int)substr($period[1], 0, 2)."59";
572  }
573 
574  $column = $date_info['isoday'];
575  if(!$week_start)
576  {
577  if($column < 7)
578  {
579  $column++;
580  }
581  else
582  {
583  $column = 1;
584  }
585  }
586 
587  if(sizeof($slots))
588  {
589  $in = false;
590  foreach($slots as $slot)
591  {
592  $slot_from = mktime(substr($slot['from'], 0, 2), substr($slot['from'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
593  $slot_to = mktime(substr($slot['to'], 0, 2), substr($slot['to'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
594 
595  // always single object, we can sum up
596  $nr_available = (array)ilBookingReservation::getAvailableObject($object_ids, $slot_from, $slot_to-1, false, true);
597 
598  // check deadline
599  if($slot_from < (time()+$schedule->getDeadline()*60*60) || !array_sum($nr_available))
600  {
601  continue;
602  }
603 
604  // is slot active in current hour?
605  if((int)$slot['from'] < $period_to && (int)$slot['to'] > $period_from)
606  {
607  $from = ilDatePresentation::formatDate(new ilDateTime($slot_from, IL_CAL_UNIX));
608  $from = array_pop(explode(' ', $from));
610  $to = array_pop(explode(' ', $to));
611 
612  // show caption (first hour) of slot
613  $id = $slot_from.'_'.$slot_to;
614  if(!in_array($id, $slot_captions))
615  {
616  $dates[$hour][$column]['captions'][$id] = $from.'-'.$to;
617  $dates[$hour][$column]['available'][$id] = array_sum($nr_available);
618  $slot_captions[] = $id;
619  }
620 
621  $in = true;
622  }
623  }
624  // (any) active slot
625  if($in)
626  {
627  $has_open_slot = true;
628  $dates[$hour][$column]['in_slot'] = $in;
629  }
630  }
631  }
632  }
633 
634  return $has_open_slot;
635  }
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 1169 of file class.ilObjBookingPoolGUI.php.

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

1170  {
1171  global $ilAccess;
1172 
1173  $this->tabs_gui->setTabActive('log');
1174 
1175  if(!$_POST['reservation_id'])
1176  {
1177  ilUtil::sendFailure($this->lng->txt('select_one'));
1178  return $this->logObject();
1179  }
1180 
1181  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
1182  {
1183  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1184  ilBookingReservation::changeStatus($_POST['reservation_id'], (int)$_POST['tstatus']);
1185  }
1186 
1187  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1188  return $this->ctrl->redirect($this, 'log');
1189  }
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)
List all reservations.
+ 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 901 of file class.ilObjBookingPoolGUI.php.

References ilObjectGUI\$tpl, and initBookingNumbersForm().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

902  {
903  global $tpl;
904 
905  $this->tabs_gui->clearTargets();
906  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
907 
908  if(!$a_form)
909  {
910  $a_form = $this->initBookingNumbersForm($a_objects_counter, $a_group_id);
911  }
912 
913  $tpl->setContent($a_form->getHTML());
914  }
initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmedBookingNumbersObject()

ilObjBookingPoolGUI::confirmedBookingNumbersObject ( )

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

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

931  {
932  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
933  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
934 
935  // convert post data to initial form config
936  $counter = array();
937  $current_first = $obj_id = null;
938  foreach(array_keys($_POST) as $id)
939  {
940  if(substr($id, 0, 9) == "conf_nr__")
941  {
942  $id = explode("_", substr($id, 9));
943  $counter[$id[0]."_".$id[1]."_".$id[2]] = (int)$id[3];
944  if(!$current_first)
945  {
946  $current_first = date("Y-m-d", $id[1]);
947  }
948  }
949  }
950 
951  // recurrence
952  if((int)$_POST["recm"] > 0 && $current_first)
953  {
954  ksort($counter);
955  $end = $_POST["rece"]["date"];
956  $end = date("Y-m-d", mktime(23, 59, 59, $end["m"], $end["d"], $end["y"]));
957  $cycle = (int)$_POST["recm"]*7;
958  $cut = 0;
959  $org = $counter;
960  while($cut < 1000 && $this->addDaysDate($current_first, $cycle) <= $end)
961  {
962  $cut++;
963  $current_first = null;
964  foreach($org as $item_id => $max)
965  {
966  $parts = explode("_", $item_id);
967  $obj_id = $parts[0];
968 
969  $from = $this->addDaysStamp($parts[1], $cycle*$cut);
970  $to = $this->addDaysStamp($parts[2], $cycle*$cut);
971 
972  $new_item_id = $obj_id."_".$from."_".$to;
973 
974  // form reload because of validation errors
975  if(!isset($counter[$new_item_id]) && date("Y-m-d", $to) <= $end)
976  {
977  // get max available for added dates
978  $new_max = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to-1, false, true);
979  $new_max = (int)$new_max[$obj_id];
980 
981  $counter[$new_item_id] = $new_max;
982 
983  if(!$current_first)
984  {
985  $current_first = date("Y-m-d", $from);
986  }
987 
988  // clone input
989  $_POST["conf_nr__".$new_item_id."_".$new_max] = $_POST["conf_nr__".$item_id."_".$max];
990  }
991  }
992  }
993  }
994 
995  $group_id = $_POST["grp_id"];
996 
997  $form = $this->initBookingNumbersForm($counter, $group_id, true);
998  if($form->checkInput())
999  {
1000  $success = false;
1001  $rsv_ids = array();
1002  foreach($counter as $id => $all_nr)
1003  {
1004  $book_nr = $form->getInput("conf_nr__".$id."_".$all_nr);
1005  $parts = explode("_", $id);
1006  $obj_id = $parts[0];
1007  $from = $parts[1];
1008  $to = $parts[2]-1;
1009 
1010  // get currently available slots
1011  $counter = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to, false, true);
1012  $counter = $counter[$obj_id];
1013  if($counter)
1014  {
1015  // we can only book what is left
1016  $book_nr = min($book_nr, $counter);
1017  for($loop = 0; $loop < $book_nr; $loop++)
1018  {
1019  $rsv_ids[] = $this->processBooking($obj_id, $from, $to, $group_id);
1020  $success = $obj_id;
1021  }
1022  }
1023  }
1024  if($success)
1025  {
1026  $this->handleBookingSuccess($success, $rsv_ids);
1027  }
1028  else
1029  {
1030  ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
1031  $this->ctrl->redirect($this, 'render');
1032  }
1033  }
1034  else
1035  {
1036  $form->setValuesByPost();
1037 
1038  // ilDateTimeInputGUI does NOT add hidden values on disabled!
1039 
1040  $rece_year = $_POST["rece"]["date"]["y"];
1041  $rece_month = str_pad($_POST["rece"]["date"]["m"], 2, "0", STR_PAD_LEFT);
1042  $rece_day = str_pad($_POST["rece"]["date"]["d"], 2, "0", STR_PAD_LEFT);
1043 
1044  $form->getItemByPostVar("rece")->setDate(new ilDate($rece_year."-".$rece_month."-".$rece_day, IL_CAL_DATE));
1045  $form->getItemByPostVar("recm")->setHideSubForm($_POST["recm"] < 1);
1046 
1047  $hidden_date = new ilHiddenInputGUI("rece[date][y]");
1048  $hidden_date->setValue($rece_year);
1049  $form->addItem($hidden_date);
1050  $hidden_date = new ilHiddenInputGUI("rece[date][m]");
1051  $hidden_date->setValue($rece_month);
1052  $form->addItem($hidden_date);
1053  $hidden_date = new ilHiddenInputGUI("rece[date][d]");
1054  $hidden_date->setValue($rece_day);
1055  $form->addItem($hidden_date);
1056 
1057  return $this->confirmBookingNumbers($counter, $group_id, $form);
1058  }
1059  }
$_POST['username']
Definition: cron.php:12
handleBookingSuccess($a_obj_id, array $a_rsv_ids=null)
initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload=false)
This class represents a hidden form property in a property form.
$success
Definition: Utf8Test.php:87
Class for single dates.
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.
const IL_CAL_DATE
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 640 of file class.ilObjBookingPoolGUI.php.

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

641  {
642  global $ilUser;
643 
644  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
645  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
646 
647  $success = false;
648  $rsv_ids = array();
649 
650  if($this->object->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE)
651  {
652  if($_POST['object_id'])
653  {
654  $object_id = $_POST['object_id'];
655  if($object_id)
656  {
658  !ilBookingReservation::getObjectReservationForUser($object_id, $ilUser->getId())) // #18304
659  {
660  $rsv_ids[] = $this->processBooking($object_id);
661  $success = $object_id;
662  }
663  else
664  {
665  // #11852
666  ilUtil::sendFailure($this->lng->txt('book_reservation_failed_overbooked'), true);
667  $this->ctrl->redirect($this, 'render');
668  }
669  }
670  }
671  }
672  else
673  {
674  if(!isset($_POST['date']))
675  {
676  ilUtil::sendFailure($this->lng->txt('select_one'));
677  return $this->bookObject();
678  }
679 
680  // single object reservation(s)
681  if(isset($_GET['object_id']))
682  {
683  $confirm = array();
684 
685  $object_id = (int)$_GET['object_id'];
686  if($object_id)
687  {
688  $group_id = null;
689  $nr = ilBookingObject::getNrOfItemsForObjects(array($object_id));
690  // needed for recurrence
691  if(true) // if($nr[$object_id] > 1 || sizeof($_POST['date']) > 1)
692  {
694  }
695  foreach($_POST['date'] as $date)
696  {
697  $fromto = explode('_', $date);
698  $fromto[1]--;
699 
700  $counter = ilBookingReservation::getAvailableObject(array($object_id), $fromto[0], $fromto[1], false, true);
701  $counter = $counter[$object_id];
702  if($counter)
703  {
704  // needed for recurrence
705  if(true) // if($counter > 1)
706  {
707  $confirm[$object_id."_".$fromto[0]."_".($fromto[1]+1)] = $counter;
708  }
709  else
710  {
711  $rsv_ids[] = $this->processBooking($object_id, $fromto[0], $fromto[1], $group_id);
712  $success = $object_id;
713  }
714  }
715  }
716  }
717 
718  if(sizeof($confirm))
719  {
720  return $this->confirmBookingNumbers($confirm, $group_id);
721  }
722  }
723  /*
724  // group object reservation(s)
725  else
726  {
727  $all_object_ids = array();
728  foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
729  {
730  $all_object_ids[] = $item['booking_object_id'];
731  }
732 
733  $possible_objects = $counter = array();
734  sort($_POST['date']);
735  foreach($_POST['date'] as $date)
736  {
737  $fromto = explode('_', $date);
738  $fromto[1]--;
739  $possible_objects[$date] = ilBookingReservation::getAvailableObject($all_object_ids, $fromto[0], $fromto[1], false);
740  foreach($possible_objects[$date] as $obj_id)
741  {
742  $counter[$obj_id]++;
743  }
744  }
745 
746  if(max($counter))
747  {
748  // we prefer the objects which are available for most slots
749  arsort($counter);
750  $counter = array_keys($counter);
751 
752  // book each slot
753  foreach($possible_objects as $date => $available_ids)
754  {
755  $fromto = explode('_', $date);
756  $fromto[1]--;
757 
758  // find "best" object for slot
759  foreach($counter as $best_object_id)
760  {
761  if(in_array($best_object_id, $available_ids))
762  {
763  $object_id = $best_object_id;
764  break;
765  }
766  }
767  $this->processBooking($object_id, $fromto[0], $fromto[1]);
768  $success = true;
769  }
770  }
771  }
772  */
773  }
774 
775  if($success)
776  {
777  $this->handleBookingSuccess($success, $rsv_ids);
778  }
779  else
780  {
781  ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
782  $this->ctrl->redirect($this, 'book');
783  }
784  }
$_POST['username']
Definition: cron.php:12
static isObjectAvailableNoSchedule($a_obj_id)
bookObject()
First step in booking process.
$_GET["client_id"]
handleBookingSuccess($a_obj_id, array $a_rsv_ids=null)
static getNewGroupId()
Get next group id.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
$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.
global $ilUser
Definition: imgupload.php:15
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 142 of file class.ilObjBookingPoolGUI.php.

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

143  {
144  // if we have no schedules yet - show info
145  include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
146  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE &&
147  !sizeof(ilBookingSchedule::getList($this->object->getId())))
148  {
149  ilUtil::sendInfo($this->lng->txt("book_schedule_warning_edit"));
150  }
151 
152  return parent::editObject();
153  }
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, $ilUser, $ret, ilObjectGUI\$tpl, ilObjectGUI\addHeaderAction(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreen(), and ilObjectGUI\prepareOutput().

34  {
35  global $tpl, $ilTabs, $ilNavigationHistory, $ilUser;
36 
37  $next_class = $this->ctrl->getNextClass($this);
38  $cmd = $this->ctrl->getCmd();
39 
40  if(!$next_class && $cmd == 'render')
41  {
42  if($ilUser->getId() != ANONYMOUS_USER_ID)
43  {
44  $this->ctrl->setCmdClass('ilBookingObjectGUI');
45  $next_class = $this->ctrl->getNextClass($this);
46  }
47  else
48  {
49  $this->ctrl->redirect($this, "infoscreen");
50  }
51  }
52 
53  if(substr($cmd, 0, 4) == 'book')
54  {
55  $next_class = '';
56  }
57 
58  $ilNavigationHistory->addItem($this->ref_id,
59  "./goto.php?target=book_".$this->ref_id, "book");
60 
61  $this->prepareOutput();
62 
63  switch($next_class)
64  {
65  case 'ilpermissiongui':
66  $this->tabs_gui->setTabActive('perm_settings');
67  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
68  $perm_gui =& new ilPermissionGUI($this);
69  $ret =& $this->ctrl->forwardCommand($perm_gui);
70  break;
71 
72  case 'ilbookingobjectgui':
73  $this->tabs_gui->setTabActive('render');
74  include_once("Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
75  $object_gui =& new ilBookingObjectGUI($this);
76  $ret =& $this->ctrl->forwardCommand($object_gui);
77  break;
78 
79  case 'ilbookingschedulegui':
80  $this->tabs_gui->setTabActive('schedules');
81  include_once("Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
82  $schedule_gui =& new ilBookingScheduleGUI($this);
83  $ret =& $this->ctrl->forwardCommand($schedule_gui);
84  break;
85 
86  case 'ilpublicuserprofilegui':
87  $ilTabs->clearTargets();
88  include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
89  $profile = new ilPublicUserProfileGUI((int)$_GET["user_id"]);
90  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
91  $ret = $this->ctrl->forwardCommand($profile);
92  $tpl->setContent($ret);
93  break;
94 
95  case 'ilinfoscreengui':
96  $this->infoScreen();
97  break;
98 
99  case "ilcommonactiondispatchergui":
100  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
102  $this->ctrl->forwardCommand($gui);
103  break;
104 
105  case "ilobjectcopygui":
106  include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
107  $cp = new ilObjectCopyGUI($this);
108  $cp->setType("book");
109  $this->ctrl->forwardCommand($cp);
110  break;
111 
112  default:
113  $cmd = $this->ctrl->getCmd();
114  $cmd .= 'Object';
115  $this->$cmd();
116  break;
117  }
118 
119  $this->addHeaderAction();
120  return true;
121  }
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
global $ilUser
Definition: imgupload.php:15
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 190 of file class.ilObjBookingPoolGUI.php.

191  {
192  $a_values["online"] = !$this->object->isOffline();
193  $a_values["public"] = $this->object->hasPublicLog();
194  $a_values["stype"] = $this->object->getScheduleType();
195  $a_values["limit"] = $this->object->getOverallLimit();
196  }

◆ getLogReservationIds()

ilObjBookingPoolGUI::getLogReservationIds ( )
protected

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

References $_GET, and $_POST.

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

1306  {
1307  if($_POST["mrsv"])
1308  {
1309  return $_POST["mrsv"];
1310  }
1311  else if($_GET["reservation_id"])
1312  {
1313  return array($_GET["reservation_id"]);
1314  }
1315  }
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ handleBookingSuccess()

ilObjBookingPoolGUI::handleBookingSuccess (   $a_obj_id,
array  $a_rsv_ids = null 
)
protected

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

References ilUtil\sendSuccess().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

787  {
788  ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
789 
790  // show post booking information?
791  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
792  $obj = new ilBookingObject($a_obj_id);
793  $pfile = $obj->getPostFile();
794  $ptext = $obj->getPostText();
795  if(trim($ptext) || $pfile)
796  {
797  if(sizeof($a_rsv_ids))
798  {
799  $this->ctrl->setParameterByClass('ilbookingobjectgui', 'rsv_ids', implode(";", $a_rsv_ids));
800  }
801  $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
802  $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
803  }
804  else
805  {
806  $this->ctrl->redirect($this, 'render');
807  }
808  }
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 1259 of file class.ilObjBookingPoolGUI.php.

References $_GET, and $ilCtrl.

Referenced by executeCommand(), and infoScreenObject().

1260  {
1261  global $ilAccess, $ilCtrl;
1262 
1263  $this->tabs_gui->setTabActive('info');
1264 
1265  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
1266  {
1267  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1268  }
1269 
1270  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1271  $info = new ilInfoScreenGUI($this);
1272 
1273  $info->enablePrivateNotes();
1274 
1275  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
1276  {
1277  $info->enableNews();
1278  }
1279 
1280  // no news editing for files, just notifications
1281  $info->enableNewsEditing(false);
1282  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1283  {
1284  $news_set = new ilSetting("news");
1285  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1286 
1287  if ($enable_internal_rss)
1288  {
1289  $info->setBlockProperty("news", "settings", true);
1290  $info->setBlockProperty("news", "public_notifications_option", true);
1291  }
1292  }
1293 
1294  // forward the command
1295  if ($ilCtrl->getNextClass() == "ilinfoscreengui")
1296  {
1297  $ilCtrl->forwardCommand($info);
1298  }
1299  else
1300  {
1301  return $ilCtrl->getHTML($info);
1302  }
1303  }
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 1252 of file class.ilObjBookingPoolGUI.php.

References infoScreen().

1253  {
1254  $this->ctrl->setCmd("showSummary");
1255  $this->ctrl->setCmdClass("ilinfoscreengui");
1256  $this->infoScreen();
1257  }
+ Here is the call graph for this function:

◆ initBookingNumbersForm()

ilObjBookingPoolGUI::initBookingNumbersForm ( array  $a_objects_counter,
  $a_group_id,
  $a_reload = false 
)
protected

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

References $section, ilSubEnabledFormPropertyGUI\addSubItem(), ilDatePresentation\formatPeriod(), IL_CAL_UNIX, and ilFormPropertyGUI\setRequired().

Referenced by confirmBookingNumbers(), and confirmedBookingNumbersObject().

811  {
812  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
813  $form = new ilPropertyFormGUI();
814  $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking"));
815  $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects"));
816  $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info"));
817 
818  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
819  $section = false;
820  $min_date = null;
821  foreach($a_objects_counter as $id => $counter)
822  {
823  $id = explode("_", $id);
824  $book_id = $id[0]."_".$id[1]."_".$id[2]."_".$counter;
825 
826  $obj = new ilBookingObject($id[0]);
827 
828  if(!$section)
829  {
831  $section->setTitle($obj->getTitle());
832  $form->addItem($section);
833 
834  $section = true;
835  }
836 
837  $period = /* $this->lng->txt("book_period").": ". */
839  new ilDateTime($id[1], IL_CAL_UNIX),
840  new ilDateTime($id[2], IL_CAL_UNIX));
841 
842  $nr_field = new ilNumberInputGUI($period, "conf_nr__".$book_id);
843  $nr_field->setValue(1);
844  $nr_field->setSize(3);
845  $nr_field->setMaxValue($counter);
846  $nr_field->setMinValue($counter ? 1 : 0);
847  $nr_field->setRequired(true);
848  $form->addItem($nr_field);
849 
850  if(!$min_date || $id[1] < $min_date)
851  {
852  $min_date = $id[1];
853  }
854  }
855 
856  // recurrence
857  $this->lng->loadLanguageModule("dateplaner");
858  $rec_mode = new ilSelectInputGUI($this->lng->txt("cal_recurrences"), "recm");
859  $rec_mode->setRequired(true);
860  $rec_mode->setOptions(array(
861  "-1" => $this->lng->txt("cal_no_recurrence"),
862  1 => $this->lng->txt("cal_weekly"),
863  2 => $this->lng->txt("r_14"),
864  4 => $this->lng->txt("r_4_weeks")
865  ));
866  $form->addItem($rec_mode);
867 
868  $rec_end = new ilDateTimeInputGUI($this->lng->txt("cal_repeat_until"), "rece");
869  $rec_mode->addSubItem($rec_end);
870 
871  if(!$a_reload)
872  {
873  // show date only if active recurrence
874  $rec_mode->setHideSubForm(true, '>= 1');
875 
876  if($min_date)
877  {
878  $rec_end->setDate(new ilDateTime($min_date, IL_CAL_UNIX));
879  }
880  }
881  else
882  {
883  // recurrence may not be changed on reload
884  $rec_mode->setDisabled(true);
885  $rec_end->setDisabled(true);
886  }
887 
888  if($a_group_id)
889  {
890  $grp = new ilHiddenInputGUI("grp_id");
891  $grp->setValue($a_group_id);
892  $form->addItem($grp);
893  }
894 
895  $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm"));
896  $form->addCommandButton("render", $this->lng->txt("cancel"));
897 
898  return $form;
899  }
a bookable ressource
This class represents a selection list property in a property form.
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
This class represents a date/time property in a property form.
$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
setRequired($a_required)
Set Required.
+ 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 123 of file class.ilObjBookingPoolGUI.php.

124  {
125  $forms = parent::initCreationForms($a_new_type);
126  unset($forms[self::CFORM_IMPORT]);
127 
128  return $forms;
129  }

◆ initEditCustomForm()

ilObjBookingPoolGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

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

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

156  {
157  $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
158  $a_form->addItem($online);
159 
160  $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype");
161  $type->setRequired(true);
162  $a_form->addItem($type);
163 
164  // #14478
165  include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
166  if(sizeof(ilBookingObject::getList($this->object->getId())))
167  {
168  $type->setDisabled(true);
169  }
170 
171  $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE);
172  $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info"));
173  $type->addOption($fixed);
174 
175  $none = new ilRadioOption($this->lng->txt("book_schedule_type_none"), ilObjBookingPool::TYPE_NO_SCHEDULE);
176  $none->setInfo($this->lng->txt("book_schedule_type_none_info"));
177  $type->addOption($none);
178 
179  $limit = new ilNumberInputGUI($this->lng->txt("book_overall_limit"), "limit");
180  $limit->setSize(4);
181  $limit->setMinValue(1);
182  $limit->setInfo($this->lng->txt("book_overall_limit_info"));
183  $none->addSubItem($limit);
184 
185  $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
186  $public->setInfo($this->lng->txt("book_public_log_info"));
187  $a_form->addItem($public);
188  }
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.
This class represents a number property in a property form.
static getList($a_pool_id)
Get list of booking objects for given type.
setSize($a_size)
Set Size.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ logDetailsObject()

ilObjBookingPoolGUI::logDetailsObject ( )

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

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

1142  {
1143  global $tpl, $ilAccess;
1144 
1145  $this->tabs_gui->clearTargets();
1146  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
1147  $this->ctrl->getLinkTarget($this, "log"));
1148 
1149  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1150  $this->object->hasPublicLog());
1151 
1152  $filter = null;
1153  if($_GET["object_id"])
1154  {
1155  $filter["object"] = (int)$_GET["object_id"];
1156  }
1157 
1158  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1159  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1160  $this->object->getId(), $show_all,
1161  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1162  $filter, $_GET["reservation_id"]);
1163  $tpl->setContent($table->getHTML());
1164  }
$_GET["client_id"]

◆ logObject()

ilObjBookingPoolGUI::logObject ( )

List reservations.

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

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

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

1119  {
1120  global $tpl, $ilAccess;
1121 
1122  $this->tabs_gui->setTabActive('log');
1123 
1124  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1125  $this->object->hasPublicLog());
1126 
1127  $filter = null;
1128  if($_GET["object_id"])
1129  {
1130  $filter["object"] = (int)$_GET["object_id"];
1131  }
1132 
1133  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1134  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1135  $this->object->getId(), $show_all,
1136  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1137  $filter);
1138  $tpl->setContent($table->getHTML());
1139  }
$_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
Returns
int

Definition at line 1070 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().

1071  {
1072  global $ilUser, $ilAccess;
1073 
1074  // #11995
1075  if(!$ilAccess->checkAccess('read', '', $this->object->getRefId()))
1076  {
1077  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1078  };
1079 
1080  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1081  $reservation = new ilBookingReservation();
1082  $reservation->setObjectId($a_object_id);
1083  $reservation->setUserId($ilUser->getID());
1084  $reservation->setFrom($a_from);
1085  $reservation->setTo($a_to);
1086  $reservation->setGroupId($a_group_id);
1087  $reservation->save();
1088 
1089  if($a_from)
1090  {
1091  $this->lng->loadLanguageModule('dateplaner');
1092  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
1093  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1094  $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK,$ilUser->getId(),$this->lng->txt('cal_ch_personal_book'),true);
1095 
1096  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1097  $object = new ilBookingObject($a_object_id);
1098 
1099  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1100  $entry = new ilCalendarEntry;
1101  $entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
1102  $entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
1103  $entry->setTitle($this->lng->txt('book_cal_entry').' '.$object->getTitle());
1104  $entry->setContextId($reservation->getId());
1105  $entry->save();
1106 
1107  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1108  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1109  $assignment->addAssignment($def_cat->getCategoryId());
1110  }
1111 
1112  return $reservation->getId();
1113  }
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 302 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().

303  {
304  global $ilUser;
305 
306  // fix
307  if(!$schedule->getRaster())
308  {
309  $mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager');
310 
311  $mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
312  $mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title'));
313  $mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info'));
314  $mytpl->setVariable('TXT_OBJECT', $title);
315  $mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking'));
316  $mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel'));
317 
318  include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
319 
320  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
321 
322  $morning_aggr = $user_settings->getDayStart();
323  $evening_aggr = $user_settings->getDayEnd();
324  $hours = array();
325  for($i = $morning_aggr;$i <= $evening_aggr;$i++)
326  {
327  switch($user_settings->getTimeFormat())
328  {
330  if ($morning_aggr > 0 && $i == $morning_aggr)
331  {
332  $hours[$i] = sprintf('%02d:00',0)."-";
333  }
334  $hours[$i].= sprintf('%02d:00',$i);
335  if ($evening_aggr < 23 && $i == $evening_aggr)
336  {
337  $hours[$i].= "-".sprintf('%02d:00',23);
338  }
339  break;
340 
342  if ($morning_aggr > 0 && $i == $morning_aggr)
343  {
344  $hours[$i] = date('h a',mktime(0,0,0,1,1,2000))."-";
345  }
346  $hours[$i].= date('h a',mktime($i,0,0,1,1,2000));
347  if ($evening_aggr < 23 && $i == $evening_aggr)
348  {
349  $hours[$i].= "-".date('h a',mktime(23,0,0,1,1,2000));
350  }
351  break;
352  }
353  }
354 
355  if(isset($_GET['seed']))
356  {
357  $find_first_open = false;
358  $seed = new ilDate($_GET['seed'], IL_CAL_DATE);
359  }
360  else
361  {
362  $find_first_open = true;
363  $seed = new ilDate(time(), IL_CAL_UNIX);
364  }
365 
366  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
367  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
368  $week_start = $user_settings->getWeekStart();
369 
370  if(!$find_first_open)
371  {
372  $dates = array();
373  $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
374  }
375  else
376  {
377  $dates = array();
378  $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
379 
380  // find first open slot
381  if(!$has_open_slot)
382  {
383  // 1 year is limit for search
384  $limit = clone($seed);
385  $limit->increment(ilDate::YEAR, 1);
386  $limit = $limit->get(IL_CAL_UNIX);
387 
388  while(!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit)
389  {
390  $seed->increment(ilDate::WEEK, 1);
391 
392  $dates = array();
393  $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
394  }
395  }
396  }
397 
398  include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
399  $navigation = new ilCalendarHeaderNavigationGUI($this,$seed,ilDateTime::WEEK,'book');
400  $mytpl->setVariable('NAVIGATION', $navigation->getHTML());
401 
402  foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
403  {
404  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
405 
406  $mytpl->setCurrentBlock('weekdays');
407  $mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil:: _numericDayToString($date_info['wday']));
408  $mytpl->setVariable('TXT_DATE', $date_info['mday'].' '.ilCalendarUtil:: _numericMonthToString($date_info['mon']));
409  $mytpl->parseCurrentBlock();
410  }
411 
412  include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
413  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
414  $color = array();
416  for($loop = 0; $loop < 7; $loop++)
417  {
418  $col = $all[$loop];
420  $color[$loop+1] = 'border-bottom: 1px solid '.$col.'; background-color: '.$col.'; color: '.$fnt;
421  }
422 
423  $counter = 0;
424  foreach($dates as $hour => $days)
425  {
426  $caption = $days;
427  $caption = array_shift($caption);
428 
429  for($loop = 1; $loop < 8; $loop++)
430  {
431  if(!isset($days[$loop]))
432  {
433  $mytpl->setCurrentBlock('dates');
434  $mytpl->setVariable('DUMMY', '&nbsp;');
435  $mytpl->parseCurrentBlock();
436  }
437  else
438  {
439  if(isset($days[$loop]['captions']))
440  {
441  foreach($days[$loop]['captions'] as $slot_id => $slot_caption)
442  {
443  $mytpl->setCurrentBlock('choice');
444  $mytpl->setVariable('TXT_DATE', $slot_caption);
445  $mytpl->setVariable('VALUE_DATE', $slot_id);
446  $mytpl->setVariable('DATE_COLOR', $color[$loop]);
447  $mytpl->setVariable('TXT_AVAILABLE',
448  sprintf($this->lng->txt('book_reservation_available'),
449  $days[$loop]['available'][$slot_id]));
450  $mytpl->parseCurrentBlock();
451  }
452 
453  $mytpl->setCurrentBlock('dates');
454  $mytpl->setVariable('DUMMY', '');
455  $mytpl->parseCurrentBlock();
456  }
457  else if(isset($days[$loop]['in_slot']))
458  {
459  $mytpl->setCurrentBlock('dates');
460  $mytpl->setVariable('DATE_COLOR', $color[$loop]);
461  $mytpl->parseCurrentBlock();
462  }
463  else
464  {
465  $mytpl->setCurrentBlock('dates');
466  $mytpl->setVariable('DUMMY', '&nbsp;');
467  $mytpl->parseCurrentBlock();
468  }
469  }
470  }
471 
472  $mytpl->setCurrentBlock('slots');
473  $mytpl->setVariable('TXT_HOUR', $caption);
474  if($counter%2)
475  {
476  $mytpl->setVariable('CSS_ROW', 'tblrow1');
477  }
478  else
479  {
480  $mytpl->setVariable('CSS_ROW', 'tblrow2');
481  }
482  $mytpl->parseCurrentBlock();
483 
484  $counter++;
485  }
486  }
487  // flexible
488  else
489  {
490  // :TODO: inactive for now
491  }
492 
493  return $mytpl->get();
494  }
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 1213 of file class.ilObjBookingPoolGUI.php.

References logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1214  {
1215  global $ilAccess;
1216 
1217  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1218  $this->object->hasPublicLog());
1219 
1220  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1221  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1222  $this->object->getId(), $show_all,
1223  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1224  $table->resetOffset();
1225  $table->resetFilter();
1226  $this->logObject();
1227  }
logObject()
List reservations.
+ Here is the call graph for this function:

◆ rsvCancelObject()

ilObjBookingPoolGUI::rsvCancelObject ( )

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

References $_POST, $ilCtrl, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$tpl, logObject(), rsvConfirmCancelAggregationForm(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilBookingReservation\STATUS_CANCELLED, and ilObjBookingPool\TYPE_NO_SCHEDULE.

1497  {
1498  global $ilAccess, $ilUser, $tpl, $lng, $ilCtrl;
1499 
1500  $ids = $_POST["rsv_id"];
1501 
1502  // parse aggregation form
1503  if($_POST["rsv_aggr"])
1504  {
1505  $form = $this->rsvConfirmCancelAggregationForm($_POST["rsv_aggr"]);
1506  if(!$form->checkInput())
1507  {
1508  $this->tabs_gui->clearTargets();
1509  $this->tabs_gui->setBackTarget($lng->txt("back"),
1510  $ilCtrl->getLinkTarget($this, "log"));
1511 
1512  return $tpl->setContent($form->getHTML());
1513  }
1514 
1515  $ids = array();
1516  foreach($_POST["rsv_aggr"] as $idx => $aggr_ids)
1517  {
1518  $max = (int)$_POST["rsv_id_".$idx];
1519  if($max)
1520  {
1521  if(!is_array($aggr_ids))
1522  {
1523  $ids[] = $aggr_ids;
1524  }
1525  else
1526  {
1527  $aggr_ids = array_slice($aggr_ids, 0, $max);
1528  $ids = array_merge($ids, $aggr_ids);
1529  }
1530  }
1531  }
1532  }
1533 
1534  if($ids)
1535  {
1536  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1537  foreach($ids as $id)
1538  {
1539  $obj = new ilBookingReservation($id);
1540 
1541  if (!$ilAccess->checkAccess("write", "", $this->ref_id) && $obj->getUserId() != $ilUser->getId())
1542  {
1543  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1544  $this->ctrl->redirect($this, 'log');
1545  }
1546 
1547  $obj->setStatus(ilBookingReservation::STATUS_CANCELLED);
1548  $obj->update();
1549 
1550  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1551  {
1552  // remove user calendar entry (#11086)
1553  $cal_entry_id = $obj->getCalendarEntry();
1554  if($cal_entry_id)
1555  {
1556  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1557  $entry = new ilCalendarEntry($cal_entry_id);
1558  $entry->delete();
1559  }
1560  }
1561  }
1562  }
1563 
1564  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1565  $this->logObject();
1566  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
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:

◆ rsvConfirmCancelAggregationForm()

ilObjBookingPoolGUI::rsvConfirmCancelAggregationForm (   $a_ids)

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

References $_POST, ilDatePresentation\formatPeriod(), ilBookingObject\getTitle(), IL_CAL_UNIX, and ilDatePresentation\setUseRelativeDates().

Referenced by rsvCancelObject(), and rsvConfirmCancelAggregationObject().

1412  {
1413  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1414  $form = new ilPropertyFormGUI();
1415  $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
1416  $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
1417 
1418  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1419  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1420 
1422 
1423  foreach($a_ids as $idx => $ids)
1424  {
1425  if(is_array($ids))
1426  {
1427  $first = $ids;
1428  $first = array_shift($first);
1429  }
1430  else
1431  {
1432  $first = $ids;
1433  }
1434 
1435  $rsv = new ilBookingReservation($first);
1436  $obj = new ilBookingObject($rsv->getObjectId());
1437 
1438  $caption = $obj->getTitle().", ".ilDatePresentation::formatPeriod(
1439  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1440  new ilDateTime($rsv->getTo()+1, IL_CAL_UNIX));
1441 
1442  $item = new ilNumberInputGUI($caption, "rsv_id_".$idx);
1443  $item->setRequired(true);
1444  $item->setMinValue(0);
1445  $item->setSize(4);
1446  $form->addItem($item);
1447 
1448  if(is_array($ids))
1449  {
1450  $item->setMaxValue(sizeof($ids));
1451 
1452  foreach($ids as $id)
1453  {
1454  $hidden = new ilHiddenInputGUI("rsv_aggr[".$idx."][]");
1455  $hidden->setValue($id);
1456  $form->addItem($hidden);
1457  }
1458  }
1459  else
1460  {
1461  $item->setMaxValue(1);
1462 
1463  $hidden = new ilHiddenInputGUI("rsv_aggr[".$idx."]");
1464  $hidden->setValue($ids);
1465  $form->addItem($hidden);
1466  }
1467 
1468  if($_POST["rsv_id_".$idx])
1469  {
1470  $item->setValue((int)$_POST["rsv_id_".$idx]);
1471  }
1472  }
1473 
1474  $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
1475  $form->addCommandButton("log", $this->lng->txt("cancel"));
1476 
1477  return $form;
1478  }
a bookable ressource
$_POST['username']
Definition: cron.php:12
This class represents a property form user interface.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
This class represents a hidden form property in a property form.
getTitle()
Get object title.
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:

◆ rsvConfirmCancelAggregationObject()

ilObjBookingPoolGUI::rsvConfirmCancelAggregationObject ( array  $a_ids = null)

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

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, rsvConfirmCancelAggregationForm(), and ilUtil\sendQuestion().

Referenced by rsvConfirmCancelObject().

1481  {
1482  global $tpl, $ilCtrl, $lng;
1483 
1484  $this->tabs_gui->clearTargets();
1485  $this->tabs_gui->setBackTarget($lng->txt("back"),
1486  $ilCtrl->getLinkTarget($this, "log"));
1487 
1488  // #13511
1489  ilUtil::sendQuestion($lng->txt("book_confirm_cancel"));
1490 
1491  $form = $this->rsvConfirmCancelAggregationForm($a_ids);
1492 
1493  $tpl->setContent($form->getHTML());
1494  }
global $ilCtrl
Definition: ilias.php:18
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rsvConfirmCancelObject()

ilObjBookingPoolGUI::rsvConfirmCancelObject ( )

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

References $ilCtrl, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$obj_id, ilObjectGUI\$tpl, ilBookingReservation\getCancelDetails(), ilBookingObject\getList(), getLogReservationIds(), ilBookingObject\getTitle(), IL_CAL_UNIX, rsvConfirmCancelAggregationObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1318  {
1319  global $ilCtrl, $lng, $tpl, $ilAccess, $ilUser;
1320 
1321  $ids = $this->getLogReservationIds();
1322  if(!sizeof($ids))
1323  {
1324  $this->ctrl->redirect($this, 'log');
1325  }
1326 
1327  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1328  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1329 
1330  $max = array();
1331  foreach($ids as $idx => $id)
1332  {
1333  if(!is_numeric($id))
1334  {
1335  list($obj_id, $user_id, $from, $to) = explode("_", $id);
1336 
1337  $valid_ids = array();
1338  foreach(ilBookingObject::getList($this->object->getId()) as $item)
1339  {
1340  $valid_ids[$item["booking_object_id"]] = $item["title"];
1341  }
1342 
1343  if(($ilAccess->checkAccess("write", "", $this->ref_id) || $user_id == $ilUser->getId()) &&
1344  $from > time() &&
1345  in_array($obj_id, array_keys($valid_ids)))
1346  {
1347  $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
1348  if(!sizeof($rsv_ids))
1349  {
1350  unset($ids[$idx]);
1351  }
1352  if(sizeof($rsv_ids) > 1)
1353  {
1354  $max[$id] = sizeof($rsv_ids);
1355  $ids[$idx] = $rsv_ids;
1356  }
1357  else
1358  {
1359  // only 1 in group? treat as normal reservation
1360  $ids[$idx] = array_shift($rsv_ids);
1361  }
1362  }
1363  else
1364  {
1365  unset($ids[$idx]);
1366  }
1367  }
1368  }
1369 
1370  if(!sizeof($ids))
1371  {
1372  $this->ctrl->redirect($this, 'log');
1373  }
1374 
1375  // show form instead
1376  if(sizeof($max) && max($max) > 1)
1377  {
1378  return $this->rsvConfirmCancelAggregationObject($ids);
1379  }
1380 
1381  $this->tabs_gui->clearTargets();
1382  $this->tabs_gui->setBackTarget($lng->txt("back"),
1383  $ilCtrl->getLinkTarget($this, "log"));
1384 
1385  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1386  $conf = new ilConfirmationGUI();
1387  $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
1388  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
1389  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
1390  $conf->setCancel($lng->txt('cancel'), 'log');
1391 
1392  foreach($ids as $id)
1393  {
1394  $rsv = new ilBookingReservation($id);
1395  $obj = new ilBookingObject($rsv->getObjectId());
1396 
1397  $details = $obj->getTitle();
1398  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1399  {
1400  $details .= ", ".ilDatePresentation::formatPeriod(
1401  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1402  new ilDateTime($rsv->getTo()+1, IL_CAL_UNIX));
1403  }
1404 
1405  $conf->addItem('rsv_id[]', $id, $details);
1406  }
1407 
1408  $tpl->setContent($conf->getHTML());
1409  }
a bookable ressource
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
getTitle()
Get object title.
Date and time handling
static getList($a_pool_id)
Get list of booking objects for given type.
rsvConfirmCancelAggregationObject(array $a_ids=null)
global $ilUser
Definition: imgupload.php:15
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
Confirmation screen class.
+ Here is the call graph for this function:

◆ rsvInUseObject()

ilObjBookingPoolGUI::rsvInUseObject ( )

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

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

1597  {
1598  global $ilAccess;
1599 
1600  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
1601  {
1602  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1603  $this->ctrl->redirect($this, 'log');
1604  }
1605 
1606  $ids = $this->getLogReservationIds();
1607  if($ids)
1608  {
1609  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1610  foreach($ids as $id)
1611  {
1612  $obj = new ilBookingReservation($id);
1613  $obj->setStatus(ilBookingReservation::STATUS_IN_USE);
1614  $obj->update();
1615  }
1616  }
1617 
1618  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1619  $this->logObject();
1620  }
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 1622 of file class.ilObjBookingPoolGUI.php.

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

1623  {
1624  global $ilAccess;
1625 
1626  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
1627  {
1628  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1629  $this->ctrl->redirect($this, 'log');
1630  }
1631 
1632  $ids = $this->getLogReservationIds();
1633  if($ids)
1634  {
1635  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1636  foreach($ids as $id)
1637  {
1638  $obj = new ilBookingReservation($id);
1639  $obj->setStatus(NULL);
1640  $obj->update();
1641  }
1642  }
1643 
1644  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1645  $this->logObject();
1646  }
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 209 of file class.ilObjBookingPoolGUI.php.

References $ilUser, and ilObjBookingPool\TYPE_NO_SCHEDULE.

210  {
211  global $ilAccess, $ilHelp, $ilUser;
212 
213  if (in_array($this->ctrl->getCmd(), array("create", "save")) && !$this->ctrl->getNextClass())
214  {
215  return;
216  }
217 
218  $ilHelp->setScreenIdComponent("book");
219 
220  if ($ilAccess->checkAccess('read', '', $this->object->getRefId()))
221  {
222  if($ilUser->getId() != ANONYMOUS_USER_ID)
223  {
224  $this->tabs_gui->addTab("render",
225  $this->lng->txt("book_booking_types"),
226  $this->ctrl->getLinkTarget($this, "render"));
227  }
228 
229  $this->tabs_gui->addTab("info",
230  $this->lng->txt("info_short"),
231  $this->ctrl->getLinkTarget($this, "infoscreen"));
232 
233  if($ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog())
234  {
235  $this->tabs_gui->addTab("log",
236  $this->lng->txt("book_log"),
237  $this->ctrl->getLinkTarget($this, "log"));
238  }
239  }
240 
241  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
242  {
243  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
244  {
245  $this->tabs_gui->addTab("schedules",
246  $this->lng->txt("book_schedules"),
247  $this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render"));
248  }
249 
250  $this->tabs_gui->addTab("settings",
251  $this->lng->txt("settings"),
252  $this->ctrl->getLinkTarget($this, "edit"));
253  }
254 
255  if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
256  {
257  $this->tabs_gui->addTab("perm_settings",
258  $this->lng->txt("perm_settings"),
259  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
260  }
261  }
global $ilUser
Definition: imgupload.php:15

◆ showProfileObject()

ilObjBookingPoolGUI::showProfileObject ( )

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

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

1649  {
1650  global $tpl, $ilCtrl;
1651 
1652  $this->tabs_gui->clearTargets();
1653 
1654  $user_id = (int)$_GET['user_id'];
1655 
1656  include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1657  $profile = new ilPublicUserProfileGUI($user_id);
1658  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
1659  $tpl->setContent($ilCtrl->getHTML($profile));
1660  }
$_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 198 of file class.ilObjBookingPoolGUI.php.

References ilPropertyFormGUI\getInput().

199  {
200  $this->object->setOffline(!$a_form->getInput('online'));
201  $this->object->setPublicLog($a_form->getInput('public'));
202  $this->object->setScheduleType($a_form->getInput('stype'));
203  $this->object->setOverallLimit($a_form->getInput('limit') ? $a_form->getInput('limit') : null);
204  }
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: