ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 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...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 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)
 
 setHelpId ($a_id)
 
 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, $a_catch_errors=true)
 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
 
- Protected Attributes inherited from ilObjectGUI
 $tmp_import_dir
 

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 1312 of file class.ilObjBookingPoolGUI.php.

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

1313  {
1314  global $ilAccess, $ilErr, $lng;
1315 
1316  if ($ilAccess->checkAccess("read", "", $a_target))
1317  {
1318  ilObjectGUI::_gotoRepositoryNode($a_target, "render");
1319  }
1320  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1321  {
1322  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1323  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1325  }
1326 
1327  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1328  }
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 996 of file class.ilObjBookingPoolGUI.php.

Referenced by confirmedBookingNumbersObject().

997  {
998  $date = date_parse($a_date);
999  $stamp = mktime(0, 0, 1, $date["month"], $date["day"]+$a_days, $date["year"]);
1000  return date("Y-m-d", $stamp);
1001  }
+ Here is the caller graph for this function:

◆ addDaysStamp()

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

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

Referenced by confirmedBookingNumbersObject().

1004  {
1005  $date = getDate($a_stamp);
1006  return mktime($date["hours"], $date["minutes"], $date["seconds"],
1007  $date["mon"], $date["mday"]+$a_days, $date["year"]);
1008  }
+ Here is the caller graph for this function:

◆ addExternalEditFormCustom()

ilObjBookingPoolGUI::addExternalEditFormCustom ( ilPropertyFormGUI  $a_form)

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

References ilObjectServiceSettingsGUI\CUSTOM_METADATA, and ilObjectServiceSettingsGUI\initServiceSettingsForm().

229  {
230  include_once './Services/Container/classes/class.ilContainer.php';
231  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
233  $this->object->getId(),
234  $a_form,
236  );
237  }
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjBookingPoolGUI::addLocatorItems ( )

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

References $_GET.

1754  {
1755  global $ilLocator;
1756 
1757  if (is_object($this->object))
1758  {
1759  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "render"), "", $_GET["ref_id"]);
1760  }
1761  }
$_GET["client_id"]

◆ afterSave()

ilObjBookingPoolGUI::afterSave ( ilObject  $a_new_object)
protected

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

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

140  {
141  $a_new_object->setOffline(true);
142  $a_new_object->update();
143 
144  // always send a message
145  ilUtil::sendSuccess($this->lng->txt("book_pool_added"),true);
146  $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
147  $this->ctrl->redirect($this, "edit");
148  }
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 1277 of file class.ilObjBookingPoolGUI.php.

References logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1278  {
1279  global $ilAccess;
1280 
1281  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1282  $this->object->hasPublicLog());
1283 
1284  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1285  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1286  $this->object->getId(), $show_all,
1287  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1288  $table->resetOffset();
1289  $table->writeFilterToSession();
1290  $this->logObject();
1291  }
logObject()
List reservations.
+ Here is the call graph for this function:

◆ bookObject()

ilObjBookingPoolGUI::bookObject ( )

First step in booking process.

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

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

Referenced by confirmedBookingObject().

325  {
326  global $tpl;
327 
328  $this->tabs_gui->clearTargets();
329  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
330 
331  $this->setHelpId("book");
332 
333  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
334  $obj = new ilBookingObject((int)$_GET['object_id']);
335 
336  $this->lng->loadLanguageModule("dateplaner");
337  $this->ctrl->setParameter($this, 'object_id', $obj->getId());
338 
339  if($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
340  {
341  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
342  $schedule = new ilBookingSchedule($obj->getScheduleId());
343 
344  $tpl->setContent($this->renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
345  }
346  else
347  {
348  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
349  $cgui = new ilConfirmationGUI();
350  $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
351 
352  $cgui->setFormAction($this->ctrl->getFormAction($this));
353  $cgui->setCancel($this->lng->txt("cancel"), "render");
354  $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
355 
356  $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
357 
358  $tpl->setContent($cgui->getHTML());
359  }
360  }
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 558 of file class.ilObjBookingPoolGUI.php.

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

Referenced by renderSlots().

559  {
560  global $ilUser;
561 
562  include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
563  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
564 
565  $map = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
566  $definition = $schedule->getDefinition();
567 
568  $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
569  ? $schedule->getAvailabilityFrom()->get(IL_CAL_DATE)
570  : null;
571  $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
572  ? $schedule->getAvailabilityTo()->get(IL_CAL_DATE)
573  : null;
574 
575  $has_open_slot = false;
576  foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
577  {
578  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
579 
580  if($av_from ||
581  $av_to)
582  {
583  $today = $date->get(IL_CAL_DATE);
584  if($av_from > $today ||
585  $av_to < $today)
586  {
587  continue;
588  }
589  }
590 
591  $slots = array();
592  if(isset($definition[$map[$date_info['isoday']-1]]))
593  {
594  $slots = array();
595  foreach($definition[$map[$date_info['isoday']-1]] as $slot)
596  {
597  $slot = explode('-', $slot);
598  $slots[] = array('from'=>str_replace(':', '', $slot[0]),
599  'to'=>str_replace(':', '', $slot[1]));
600  }
601  }
602 
603  $last = array_pop(array_keys($hours));
604  $slot_captions = array();
605  foreach($hours as $hour => $period)
606  {
607  $dates[$hour][0] = $period;
608 
609  $period = explode("-", $period);
610 
611  // #13738
612  if($user_settings->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
613  {
614  if(stristr($period[0], "pm"))
615  {
616  $period[0] = (int)$period[0]+12;
617  }
618  else
619  {
620  $period[0] = (int)$period[0];
621  if($period[0] == 12)
622  {
623  $period[0] = 0;
624  }
625  }
626  if(sizeof($period) == 2)
627  {
628  if(stristr($period[1], "pm"))
629  {
630  $period[1] = (int)$period[1]+12;
631  }
632  else
633  {
634  $period[1] = (int)$period[1];
635  if($period[1] == 12)
636  {
637  $period[1] = 0;
638  }
639  }
640  }
641  }
642 
643  if(sizeof($period) == 1)
644  {
645  $period_from = (int)substr($period[0], 0, 2)."00";
646  $period_to = (int)substr($period[0], 0, 2)."59";
647  }
648  else
649  {
650  $period_from = (int)substr($period[0], 0, 2)."00";
651  $period_to = (int)substr($period[1], 0, 2)."59";
652  }
653 
654  $column = $date_info['isoday'];
655  if(!$week_start)
656  {
657  if($column < 7)
658  {
659  $column++;
660  }
661  else
662  {
663  $column = 1;
664  }
665  }
666 
667  if(sizeof($slots))
668  {
669  $in = false;
670  foreach($slots as $slot)
671  {
672  $slot_from = mktime(substr($slot['from'], 0, 2), substr($slot['from'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
673  $slot_to = mktime(substr($slot['to'], 0, 2), substr($slot['to'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
674 
675  // always single object, we can sum up
676  $nr_available = (array)ilBookingReservation::getAvailableObject($object_ids, $slot_from, $slot_to-1, false, true);
677 
678  // check deadline
679  if($slot_from < (time()+$schedule->getDeadline()*60*60) || !array_sum($nr_available))
680  {
681  continue;
682  }
683 
684  // is slot active in current hour?
685  if((int)$slot['from'] < $period_to && (int)$slot['to'] > $period_from)
686  {
687  $from = ilDatePresentation::formatDate(new ilDateTime($slot_from, IL_CAL_UNIX));
688  $from = array_pop(explode(' ', $from));
690  $to = array_pop(explode(' ', $to));
691 
692  // show caption (first hour) of slot
693  $id = $slot_from.'_'.$slot_to;
694  if(!in_array($id, $slot_captions))
695  {
696  $dates[$hour][$column]['captions'][$id] = $from.'-'.$to;
697  $dates[$hour][$column]['available'][$id] = array_sum($nr_available);
698  $slot_captions[] = $id;
699  }
700 
701  $in = true;
702  }
703  }
704  // (any) active slot
705  if($in)
706  {
707  $has_open_slot = true;
708  $dates[$hour][$column]['in_slot'] = $in;
709  }
710  }
711  }
712  }
713 
714  return $has_open_slot;
715  }
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
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:

◆ changeStatusObject()

ilObjBookingPoolGUI::changeStatusObject ( )

Change status of given reservations.

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

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

1253  {
1254  global $ilAccess;
1255 
1256  $this->tabs_gui->setTabActive('log');
1257 
1258  if(!$_POST['reservation_id'])
1259  {
1260  ilUtil::sendFailure($this->lng->txt('select_one'));
1261  return $this->logObject();
1262  }
1263 
1264  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
1265  {
1266  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1267  ilBookingReservation::changeStatus($_POST['reservation_id'], (int)$_POST['tstatus']);
1268  }
1269 
1270  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1271  return $this->ctrl->redirect($this, 'log');
1272  }
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 981 of file class.ilObjBookingPoolGUI.php.

References ilObjectGUI\$tpl, and initBookingNumbersForm().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

982  {
983  global $tpl;
984 
985  $this->tabs_gui->clearTargets();
986  $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
987 
988  if(!$a_form)
989  {
990  $a_form = $this->initBookingNumbersForm($a_objects_counter, $a_group_id);
991  }
992 
993  $tpl->setContent($a_form->getHTML());
994  }
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 1010 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().

1011  {
1012  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1013  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1014 
1015  // convert post data to initial form config
1016  $counter = array();
1017  $current_first = $obj_id = null;
1018  foreach(array_keys($_POST) as $id)
1019  {
1020  if(substr($id, 0, 9) == "conf_nr__")
1021  {
1022  $id = explode("_", substr($id, 9));
1023  $counter[$id[0]."_".$id[1]."_".$id[2]] = (int)$id[3];
1024  if(!$current_first)
1025  {
1026  $current_first = date("Y-m-d", $id[1]);
1027  }
1028  }
1029  }
1030 
1031  // recurrence
1032  if((int)$_POST["recm"] > 0 && $current_first)
1033  {
1034  ksort($counter);
1035  $end = $_POST["rece"]["date"];
1036  $end = date("Y-m-d", mktime(23, 59, 59, $end["m"], $end["d"], $end["y"]));
1037  $cycle = (int)$_POST["recm"]*7;
1038  $cut = 0;
1039  $org = $counter;
1040  while($cut < 1000 && $this->addDaysDate($current_first, $cycle) <= $end)
1041  {
1042  $cut++;
1043  $current_first = null;
1044  foreach($org as $item_id => $max)
1045  {
1046  $parts = explode("_", $item_id);
1047  $obj_id = $parts[0];
1048 
1049  $from = $this->addDaysStamp($parts[1], $cycle*$cut);
1050  $to = $this->addDaysStamp($parts[2], $cycle*$cut);
1051 
1052  $new_item_id = $obj_id."_".$from."_".$to;
1053 
1054  // form reload because of validation errors
1055  if(!isset($counter[$new_item_id]) && date("Y-m-d", $to) <= $end)
1056  {
1057  // get max available for added dates
1058  $new_max = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to-1, false, true);
1059  $new_max = (int)$new_max[$obj_id];
1060 
1061  $counter[$new_item_id] = $new_max;
1062 
1063  if(!$current_first)
1064  {
1065  $current_first = date("Y-m-d", $from);
1066  }
1067 
1068  // clone input
1069  $_POST["conf_nr__".$new_item_id."_".$new_max] = $_POST["conf_nr__".$item_id."_".$max];
1070  }
1071  }
1072  }
1073  }
1074 
1075  $group_id = $_POST["grp_id"];
1076 
1077  $form = $this->initBookingNumbersForm($counter, $group_id, true);
1078  if($form->checkInput())
1079  {
1080  $success = false;
1081  $rsv_ids = array();
1082  foreach($counter as $id => $all_nr)
1083  {
1084  $book_nr = $form->getInput("conf_nr__".$id."_".$all_nr);
1085  $parts = explode("_", $id);
1086  $obj_id = $parts[0];
1087  $from = $parts[1];
1088  $to = $parts[2]-1;
1089 
1090  // get currently available slots
1091  $counter = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to, false, true);
1092  $counter = $counter[$obj_id];
1093  if($counter)
1094  {
1095  // we can only book what is left
1096  $book_nr = min($book_nr, $counter);
1097  for($loop = 0; $loop < $book_nr; $loop++)
1098  {
1099  $rsv_ids[] = $this->processBooking($obj_id, $from, $to, $group_id);
1100  $success = $obj_id;
1101  }
1102  }
1103  }
1104  if($success)
1105  {
1106  $this->handleBookingSuccess($success, $rsv_ids);
1107  }
1108  else
1109  {
1110  ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
1111  $this->ctrl->redirect($this, 'render');
1112  }
1113  }
1114  else
1115  {
1116  // ilDateTimeInputGUI does NOT add hidden values on disabled!
1117 
1118  $rece_year = $_POST["rece"]["date"]["y"];
1119  $rece_month = str_pad($_POST["rece"]["date"]["m"], 2, "0", STR_PAD_LEFT);
1120  $rece_day = str_pad($_POST["rece"]["date"]["d"], 2, "0", STR_PAD_LEFT);
1121 
1122  // ilDateTimeInputGUI will choke on POST array format
1123  $_POST["rece"] = null;
1124 
1125  $form->setValuesByPost();
1126 
1127  $form->getItemByPostVar("rece")->setDate(new ilDate($rece_year."-".$rece_month."-".$rece_day, IL_CAL_DATE));
1128  $form->getItemByPostVar("recm")->setHideSubForm($_POST["recm"] < 1);
1129 
1130  $hidden_date = new ilHiddenInputGUI("rece[date][y]");
1131  $hidden_date->setValue($rece_year);
1132  $form->addItem($hidden_date);
1133  $hidden_date = new ilHiddenInputGUI("rece[date][m]");
1134  $hidden_date->setValue($rece_month);
1135  $form->addItem($hidden_date);
1136  $hidden_date = new ilHiddenInputGUI("rece[date][d]");
1137  $hidden_date->setValue($rece_day);
1138  $form->addItem($hidden_date);
1139 
1140  return $this->confirmBookingNumbers($counter, $group_id, $form);
1141  }
1142  }
$_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 720 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.

721  {
722  global $ilUser;
723 
724  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
725  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
726 
727  $success = false;
728  $rsv_ids = array();
729 
730  if($this->object->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE)
731  {
732  if($_POST['object_id'])
733  {
734  $object_id = $_POST['object_id'];
735  if($object_id)
736  {
738  !ilBookingReservation::getObjectReservationForUser($object_id, $ilUser->getId())) // #18304
739  {
740  $rsv_ids[] = $this->processBooking($object_id);
741  $success = $object_id;
742  }
743  else
744  {
745  // #11852
746  ilUtil::sendFailure($this->lng->txt('book_reservation_failed_overbooked'), true);
747  $this->ctrl->redirect($this, 'render');
748  }
749  }
750  }
751  }
752  else
753  {
754  if(!isset($_POST['date']))
755  {
756  ilUtil::sendFailure($this->lng->txt('select_one'));
757  return $this->bookObject();
758  }
759 
760  // single object reservation(s)
761  if(isset($_GET['object_id']))
762  {
763  $confirm = array();
764 
765  $object_id = (int)$_GET['object_id'];
766  if($object_id)
767  {
768  $group_id = null;
769  $nr = ilBookingObject::getNrOfItemsForObjects(array($object_id));
770  // needed for recurrence
771  if(true) // if($nr[$object_id] > 1 || sizeof($_POST['date']) > 1)
772  {
774  }
775  foreach($_POST['date'] as $date)
776  {
777  $fromto = explode('_', $date);
778  $fromto[1]--;
779 
780  $counter = ilBookingReservation::getAvailableObject(array($object_id), $fromto[0], $fromto[1], false, true);
781  $counter = $counter[$object_id];
782  if($counter)
783  {
784  // needed for recurrence
785  if(true) // if($counter > 1)
786  {
787  $confirm[$object_id."_".$fromto[0]."_".($fromto[1]+1)] = $counter;
788  }
789  else
790  {
791  $rsv_ids[] = $this->processBooking($object_id, $fromto[0], $fromto[1], $group_id);
792  $success = $object_id;
793  }
794  }
795  }
796  }
797 
798  if(sizeof($confirm))
799  {
800  return $this->confirmBookingNumbers($confirm, $group_id);
801  }
802  }
803  /*
804  // group object reservation(s)
805  else
806  {
807  $all_object_ids = array();
808  foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
809  {
810  $all_object_ids[] = $item['booking_object_id'];
811  }
812 
813  $possible_objects = $counter = array();
814  sort($_POST['date']);
815  foreach($_POST['date'] as $date)
816  {
817  $fromto = explode('_', $date);
818  $fromto[1]--;
819  $possible_objects[$date] = ilBookingReservation::getAvailableObject($all_object_ids, $fromto[0], $fromto[1], false);
820  foreach($possible_objects[$date] as $obj_id)
821  {
822  $counter[$obj_id]++;
823  }
824  }
825 
826  if(max($counter))
827  {
828  // we prefer the objects which are available for most slots
829  arsort($counter);
830  $counter = array_keys($counter);
831 
832  // book each slot
833  foreach($possible_objects as $date => $available_ids)
834  {
835  $fromto = explode('_', $date);
836  $fromto[1]--;
837 
838  // find "best" object for slot
839  foreach($counter as $best_object_id)
840  {
841  if(in_array($best_object_id, $available_ids))
842  {
843  $object_id = $best_object_id;
844  break;
845  }
846  }
847  $this->processBooking($object_id, $fromto[0], $fromto[1]);
848  $success = true;
849  }
850  }
851  }
852  */
853  }
854 
855  if($success)
856  {
857  $this->handleBookingSuccess($success, $rsv_ids);
858  }
859  else
860  {
861  ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
862  $this->ctrl->redirect($this, 'book');
863  }
864  }
$_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 150 of file class.ilObjBookingPoolGUI.php.

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

151  {
152  // if we have no schedules yet - show info
153  include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
154  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE &&
155  !sizeof(ilBookingSchedule::getList($this->object->getId())))
156  {
157  ilUtil::sendInfo($this->lng->txt("book_schedule_warning_edit"));
158  }
159 
160  return parent::editObject();
161  }
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(), ilObjectGUI\checkPermissionBool(), 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  case 'ilobjectmetadatagui';
113  $this->checkPermissionBool('write');
114  $this->tabs_gui->setTabActive('meta_data');
115  include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
116  $md_gui = new ilObjectMetaDataGUI($this->object, 'bobj');
117  $this->ctrl->forwardCommand($md_gui);
118  break;
119 
120  default:
121  $cmd = $this->ctrl->getCmd();
122  $cmd .= 'Object';
123  $this->$cmd();
124  break;
125  }
126 
127  $this->addHeaderAction();
128  return true;
129  }
Class ilObjectMetaDataGUI.
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.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
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 204 of file class.ilObjBookingPoolGUI.php.

205  {
206  $a_values["online"] = !$this->object->isOffline();
207  $a_values["public"] = $this->object->hasPublicLog();
208  $a_values["stype"] = $this->object->getScheduleType();
209  $a_values["limit"] = $this->object->getOverallLimit();
210  }

◆ getLogReservationIds()

ilObjBookingPoolGUI::getLogReservationIds ( )
protected

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

References $_GET, and $_POST.

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

1389  {
1390  if($_POST["mrsv"])
1391  {
1392  return $_POST["mrsv"];
1393  }
1394  else if($_GET["reservation_id"])
1395  {
1396  return array($_GET["reservation_id"]);
1397  }
1398  }
$_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 866 of file class.ilObjBookingPoolGUI.php.

References ilUtil\sendSuccess().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

867  {
868  ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
869 
870  // show post booking information?
871  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
872  $obj = new ilBookingObject($a_obj_id);
873  $pfile = $obj->getPostFile();
874  $ptext = $obj->getPostText();
875  if(trim($ptext) || $pfile)
876  {
877  if(sizeof($a_rsv_ids))
878  {
879  $this->ctrl->setParameterByClass('ilbookingobjectgui', 'rsv_ids', implode(";", $a_rsv_ids));
880  }
881  $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
882  $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
883  }
884  else
885  {
886  $this->ctrl->redirect($this, 'render');
887  }
888  }
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 1342 of file class.ilObjBookingPoolGUI.php.

References $_GET, $ilCtrl, and $info.

Referenced by executeCommand(), and infoScreenObject().

1343  {
1344  global $ilAccess, $ilCtrl;
1345 
1346  $this->tabs_gui->setTabActive('info');
1347 
1348  if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
1349  {
1350  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1351  }
1352 
1353  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1354  $info = new ilInfoScreenGUI($this);
1355 
1356  $info->enablePrivateNotes();
1357 
1358  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
1359  {
1360  $info->enableNews();
1361  }
1362 
1363  // no news editing for files, just notifications
1364  $info->enableNewsEditing(false);
1365  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1366  {
1367  $news_set = new ilSetting("news");
1368  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1369 
1370  if ($enable_internal_rss)
1371  {
1372  $info->setBlockProperty("news", "settings", true);
1373  $info->setBlockProperty("news", "public_notifications_option", true);
1374  }
1375  }
1376 
1377  // forward the command
1378  if ($ilCtrl->getNextClass() == "ilinfoscreengui")
1379  {
1380  $ilCtrl->forwardCommand($info);
1381  }
1382  else
1383  {
1384  return $ilCtrl->getHTML($info);
1385  }
1386  }
ILIAS Setting Class.
Class ilInfoScreenGUI.
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
$info
Definition: example_052.php:80
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 1335 of file class.ilObjBookingPoolGUI.php.

References infoScreen().

1336  {
1337  $this->ctrl->setCmd("showSummary");
1338  $this->ctrl->setCmdClass("ilinfoscreengui");
1339  $this->infoScreen();
1340  }
+ 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 890 of file class.ilObjBookingPoolGUI.php.

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

Referenced by confirmBookingNumbers(), and confirmedBookingNumbersObject().

891  {
892  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
893  $form = new ilPropertyFormGUI();
894  $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking"));
895  $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects"));
896  $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info"));
897 
898  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
899  $section = false;
900  $min_date = null;
901  foreach($a_objects_counter as $id => $counter)
902  {
903  $id = explode("_", $id);
904  $book_id = $id[0]."_".$id[1]."_".$id[2]."_".$counter;
905 
906  $obj = new ilBookingObject($id[0]);
907 
908  if(!$section)
909  {
911  $section->setTitle($obj->getTitle());
912  $form->addItem($section);
913 
914  $section = true;
915  }
916 
917  $period = /* $this->lng->txt("book_period").": ". */
919  new ilDateTime($id[1], IL_CAL_UNIX),
920  new ilDateTime($id[2], IL_CAL_UNIX));
921 
922  $nr_field = new ilNumberInputGUI($period, "conf_nr__".$book_id);
923  $nr_field->setValue(1);
924  $nr_field->setSize(3);
925  $nr_field->setMaxValue($counter);
926  $nr_field->setMinValue($counter ? 1 : 0);
927  $nr_field->setRequired(true);
928  $form->addItem($nr_field);
929 
930  if(!$min_date || $id[1] < $min_date)
931  {
932  $min_date = $id[1];
933  }
934  }
935 
936  // recurrence
937  $this->lng->loadLanguageModule("dateplaner");
938  $rec_mode = new ilSelectInputGUI($this->lng->txt("cal_recurrences"), "recm");
939  $rec_mode->setRequired(true);
940  $rec_mode->setOptions(array(
941  "-1" => $this->lng->txt("cal_no_recurrence"),
942  1 => $this->lng->txt("cal_weekly"),
943  2 => $this->lng->txt("r_14"),
944  4 => $this->lng->txt("r_4_weeks")
945  ));
946  $form->addItem($rec_mode);
947 
948  $rec_end = new ilDateTimeInputGUI($this->lng->txt("cal_repeat_until"), "rece");
949  $rec_mode->addSubItem($rec_end);
950 
951  if(!$a_reload)
952  {
953  // show date only if active recurrence
954  $rec_mode->setHideSubForm(true, '>= 1');
955 
956  if($min_date)
957  {
958  $rec_end->setDate(new ilDateTime($min_date, IL_CAL_UNIX));
959  }
960  }
961  else
962  {
963  // recurrence may not be changed on reload
964  $rec_mode->setDisabled(true);
965  $rec_end->setDisabled(true);
966  }
967 
968  if($a_group_id)
969  {
970  $grp = new ilHiddenInputGUI("grp_id");
971  $grp->setValue($a_group_id);
972  $form->addItem($grp);
973  }
974 
975  $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm"));
976  $form->addCommandButton("render", $this->lng->txt("cancel"));
977 
978  return $form;
979  }
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 131 of file class.ilObjBookingPoolGUI.php.

132  {
133  $forms = parent::initCreationForms($a_new_type);
134  unset($forms[self::CFORM_IMPORT]);
135 
136  return $forms;
137  }

◆ initEditCustomForm()

ilObjBookingPoolGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Definition at line 163 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.

164  {
165  $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
166  $a_form->addItem($online);
167 
168  $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype");
169  $type->setRequired(true);
170  $a_form->addItem($type);
171 
172  // #14478
173  include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
174  if(sizeof(ilBookingObject::getList($this->object->getId())))
175  {
176  $type->setDisabled(true);
177  }
178 
179  $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE);
180  $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info"));
181  $type->addOption($fixed);
182 
183  $none = new ilRadioOption($this->lng->txt("book_schedule_type_none"), ilObjBookingPool::TYPE_NO_SCHEDULE);
184  $none->setInfo($this->lng->txt("book_schedule_type_none_info"));
185  $type->addOption($none);
186 
187  $limit = new ilNumberInputGUI($this->lng->txt("book_overall_limit"), "limit");
188  $limit->setSize(4);
189  $limit->setMinValue(1);
190  $limit->setInfo($this->lng->txt("book_overall_limit_info"));
191  $none->addSubItem($limit);
192 
193  $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
194  $public->setInfo($this->lng->txt("book_public_log_info"));
195  $a_form->addItem($public);
196 
197  // additional features
198  $feat = new ilFormSectionHeaderGUI();
199  $feat->setTitle($this->lng->txt('obj_features'));
200  $a_form->addItem($feat);
201 
202  }
This class represents an option in a radio group.
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
This class represents a section header in a property form.
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.
setSize($a_size)
Set Size.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:

◆ logDetailsObject()

ilObjBookingPoolGUI::logDetailsObject ( )

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

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

1225  {
1226  global $tpl, $ilAccess;
1227 
1228  $this->tabs_gui->clearTargets();
1229  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
1230  $this->ctrl->getLinkTarget($this, "log"));
1231 
1232  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1233  $this->object->hasPublicLog());
1234 
1235  $filter = null;
1236  if($_GET["object_id"])
1237  {
1238  $filter["object"] = (int)$_GET["object_id"];
1239  }
1240 
1241  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1242  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1243  $this->object->getId(), $show_all,
1244  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1245  $filter, $_GET["reservation_id"]);
1246  $tpl->setContent($table->getHTML());
1247  }
$_GET["client_id"]

◆ logObject()

ilObjBookingPoolGUI::logObject ( )

List reservations.

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

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

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

1202  {
1203  global $tpl, $ilAccess;
1204 
1205  $this->tabs_gui->setTabActive('log');
1206 
1207  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1208  $this->object->hasPublicLog());
1209 
1210  $filter = null;
1211  if($_GET["object_id"])
1212  {
1213  $filter["object"] = (int)$_GET["object_id"];
1214  }
1215 
1216  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1217  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1218  $this->object->getId(), $show_all,
1219  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1220  $filter);
1221  $tpl->setContent($table->getHTML());
1222  }
$_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 1153 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().

1154  {
1155  global $ilUser, $ilAccess;
1156 
1157  // #11995
1158  if(!$ilAccess->checkAccess('read', '', $this->object->getRefId()))
1159  {
1160  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1161  };
1162 
1163  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1164  $reservation = new ilBookingReservation();
1165  $reservation->setObjectId($a_object_id);
1166  $reservation->setUserId($ilUser->getID());
1167  $reservation->setFrom($a_from);
1168  $reservation->setTo($a_to);
1169  $reservation->setGroupId($a_group_id);
1170  $reservation->save();
1171 
1172  if($a_from)
1173  {
1174  $this->lng->loadLanguageModule('dateplaner');
1175  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
1176  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1177  $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK,$ilUser->getId(),$this->lng->txt('cal_ch_personal_book'),true);
1178 
1179  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1180  $object = new ilBookingObject($a_object_id);
1181 
1182  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1183  $entry = new ilCalendarEntry;
1184  $entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
1185  $entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
1186  $entry->setTitle($this->lng->txt('book_cal_entry').' '.$object->getTitle());
1187  $entry->setContextId($reservation->getId());
1188  $entry->save();
1189 
1190  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1191  $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1192  $assignment->addAssignment($def_cat->getCategoryId());
1193  }
1194 
1195  return $reservation->getId();
1196  }
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 362 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().

363  {
364  global $ilUser;
365 
366  // fix
367  if(!$schedule->getRaster())
368  {
369  $mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager');
370 
371  $mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
372  $mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title'));
373  $mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info'));
374  $mytpl->setVariable('TXT_OBJECT', $title);
375  $mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking'));
376  $mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel'));
377 
378  include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
379 
380  $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
381 
382  $morning_aggr = $user_settings->getDayStart();
383  $evening_aggr = $user_settings->getDayEnd();
384  $hours = array();
385  for($i = $morning_aggr;$i <= $evening_aggr;$i++)
386  {
387  switch($user_settings->getTimeFormat())
388  {
390  if ($morning_aggr > 0 && $i == $morning_aggr)
391  {
392  $hours[$i] = sprintf('%02d:00',0)."-";
393  }
394  $hours[$i].= sprintf('%02d:00',$i);
395  if ($evening_aggr < 23 && $i == $evening_aggr)
396  {
397  $hours[$i].= "-".sprintf('%02d:00',23);
398  }
399  break;
400 
402  if ($morning_aggr > 0 && $i == $morning_aggr)
403  {
404  $hours[$i] = date('h a',mktime(0,0,0,1,1,2000))."-";
405  }
406  $hours[$i].= date('h a',mktime($i,0,0,1,1,2000));
407  if ($evening_aggr < 23 && $i == $evening_aggr)
408  {
409  $hours[$i].= "-".date('h a',mktime(23,0,0,1,1,2000));
410  }
411  break;
412  }
413  }
414 
415  if(isset($_GET['seed']))
416  {
417  $find_first_open = false;
418  $seed = new ilDate($_GET['seed'], IL_CAL_DATE);
419  }
420  else
421  {
422  $find_first_open = true;
423  $seed = isset($_GET['sseed'])
424  ? new ilDate($_GET['sseed'], IL_CAL_DATE)
425  : new ilDate(time(), IL_CAL_UNIX);
426  }
427 
428  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
429  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
430  $week_start = $user_settings->getWeekStart();
431 
432  if(!$find_first_open)
433  {
434  $dates = array();
435  $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
436  }
437  else
438  {
439  $dates = array();
440  $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
441 
442  // find first open slot
443  if(!$has_open_slot)
444  {
445  // 1 year is limit for search
446  $limit = clone($seed);
447  $limit->increment(ilDate::YEAR, 1);
448  $limit = $limit->get(IL_CAL_UNIX);
449 
450  while(!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit)
451  {
452  $seed->increment(ilDate::WEEK, 1);
453 
454  $dates = array();
455  $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
456  }
457  }
458  }
459 
460  include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
461  $navigation = new ilCalendarHeaderNavigationGUI($this,$seed,ilDateTime::WEEK,'book');
462  $mytpl->setVariable('NAVIGATION', $navigation->getHTML());
463 
464  foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
465  {
466  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
467 
468  $mytpl->setCurrentBlock('weekdays');
469  $mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil:: _numericDayToString($date_info['wday']));
470  $mytpl->setVariable('TXT_DATE', $date_info['mday'].' '.ilCalendarUtil:: _numericMonthToString($date_info['mon']));
471  $mytpl->parseCurrentBlock();
472  }
473 
474  include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
475  include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
476  $color = array();
478  for($loop = 0; $loop < 7; $loop++)
479  {
480  $col = $all[$loop];
482  $color[$loop+1] = 'border-bottom: 1px solid '.$col.'; background-color: '.$col.'; color: '.$fnt;
483  }
484 
485  $counter = 0;
486  foreach($dates as $hour => $days)
487  {
488  $caption = $days;
489  $caption = array_shift($caption);
490 
491  for($loop = 1; $loop < 8; $loop++)
492  {
493  if(!isset($days[$loop]))
494  {
495  $mytpl->setCurrentBlock('dates');
496  $mytpl->setVariable('DUMMY', '&nbsp;');
497  $mytpl->parseCurrentBlock();
498  }
499  else
500  {
501  if(isset($days[$loop]['captions']))
502  {
503  foreach($days[$loop]['captions'] as $slot_id => $slot_caption)
504  {
505  $mytpl->setCurrentBlock('choice');
506  $mytpl->setVariable('TXT_DATE', $slot_caption);
507  $mytpl->setVariable('VALUE_DATE', $slot_id);
508  $mytpl->setVariable('DATE_COLOR', $color[$loop]);
509  $mytpl->setVariable('TXT_AVAILABLE',
510  sprintf($this->lng->txt('book_reservation_available'),
511  $days[$loop]['available'][$slot_id]));
512  $mytpl->parseCurrentBlock();
513  }
514 
515  $mytpl->setCurrentBlock('dates');
516  $mytpl->setVariable('DUMMY', '');
517  $mytpl->parseCurrentBlock();
518  }
519  else if(isset($days[$loop]['in_slot']))
520  {
521  $mytpl->setCurrentBlock('dates');
522  $mytpl->setVariable('DATE_COLOR', $color[$loop]);
523  $mytpl->parseCurrentBlock();
524  }
525  else
526  {
527  $mytpl->setCurrentBlock('dates');
528  $mytpl->setVariable('DUMMY', '&nbsp;');
529  $mytpl->parseCurrentBlock();
530  }
531  }
532  }
533 
534  $mytpl->setCurrentBlock('slots');
535  $mytpl->setVariable('TXT_HOUR', $caption);
536  if($counter%2)
537  {
538  $mytpl->setVariable('CSS_ROW', 'tblrow1');
539  }
540  else
541  {
542  $mytpl->setVariable('CSS_ROW', 'tblrow2');
543  }
544  $mytpl->parseCurrentBlock();
545 
546  $counter++;
547  }
548  }
549  // flexible
550  else
551  {
552  // :TODO: inactive for now
553  }
554 
555  return $mytpl->get();
556  }
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 1296 of file class.ilObjBookingPoolGUI.php.

References logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1297  {
1298  global $ilAccess;
1299 
1300  $show_all = ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
1301  $this->object->hasPublicLog());
1302 
1303  include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1304  $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1305  $this->object->getId(), $show_all,
1306  ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1307  $table->resetOffset();
1308  $table->resetFilter();
1309  $this->logObject();
1310  }
logObject()
List reservations.
+ Here is the call graph for this function:

◆ rsvCancelObject()

ilObjBookingPoolGUI::rsvCancelObject ( )

Definition at line 1587 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.

1588  {
1589  global $ilAccess, $ilUser, $tpl, $lng, $ilCtrl;
1590 
1591  $ids = $_POST["rsv_id"];
1592 
1593  // parse aggregation form
1594  if($_POST["rsv_aggr"])
1595  {
1596  $form = $this->rsvConfirmCancelAggregationForm($_POST["rsv_aggr"]);
1597  if(!$form->checkInput())
1598  {
1599  $this->tabs_gui->clearTargets();
1600  $this->tabs_gui->setBackTarget($lng->txt("back"),
1601  $ilCtrl->getLinkTarget($this, "log"));
1602 
1603  return $tpl->setContent($form->getHTML());
1604  }
1605 
1606  $ids = array();
1607  foreach($_POST["rsv_aggr"] as $idx => $aggr_ids)
1608  {
1609  $max = (int)$_POST["rsv_id_".$idx];
1610  if($max)
1611  {
1612  if(!is_array($aggr_ids))
1613  {
1614  $ids[] = $aggr_ids;
1615  }
1616  else
1617  {
1618  $aggr_ids = array_slice($aggr_ids, 0, $max);
1619  $ids = array_merge($ids, $aggr_ids);
1620  }
1621  }
1622  }
1623  }
1624 
1625  if($ids)
1626  {
1627  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1628  foreach($ids as $id)
1629  {
1630  $obj = new ilBookingReservation($id);
1631 
1632  if (!$ilAccess->checkAccess("write", "", $this->ref_id) && $obj->getUserId() != $ilUser->getId())
1633  {
1634  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1635  $this->ctrl->redirect($this, 'log');
1636  }
1637 
1638  $obj->setStatus(ilBookingReservation::STATUS_CANCELLED);
1639  $obj->update();
1640 
1641  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1642  {
1643  // remove user calendar entry (#11086)
1644  $cal_entry_id = $obj->getCalendarEntry();
1645  if($cal_entry_id)
1646  {
1647  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1648  $entry = new ilCalendarEntry($cal_entry_id);
1649  $entry->delete();
1650  }
1651  }
1652  }
1653  }
1654 
1655  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1656  $this->logObject();
1657  }
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 1496 of file class.ilObjBookingPoolGUI.php.

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

Referenced by rsvCancelObject(), and rsvConfirmCancelAggregationObject().

1497  {
1498  include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1499  $form = new ilPropertyFormGUI();
1500  $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
1501  $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
1502 
1503  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1504  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1505 
1507 
1508  foreach($a_ids as $idx => $ids)
1509  {
1510  if(is_array($ids))
1511  {
1512  $first = $ids;
1513  $first = array_shift($first);
1514  }
1515  else
1516  {
1517  $first = $ids;
1518  }
1519 
1520  $rsv = new ilBookingReservation($first);
1521  $obj = new ilBookingObject($rsv->getObjectId());
1522 
1523  $caption = $obj->getTitle().", ".ilDatePresentation::formatPeriod(
1524  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1525  new ilDateTime($rsv->getTo()+1, IL_CAL_UNIX));
1526 
1527  // #17869
1528  if(is_array($ids))
1529  {
1530  $caption .= " (".sizeof($ids).")";
1531  }
1532 
1533  $item = new ilNumberInputGUI($caption, "rsv_id_".$idx);
1534  $item->setRequired(true);
1535  $item->setMinValue(0);
1536  $item->setSize(4);
1537  $form->addItem($item);
1538 
1539  if(is_array($ids))
1540  {
1541  $item->setMaxValue(sizeof($ids));
1542 
1543  foreach($ids as $id)
1544  {
1545  $hidden = new ilHiddenInputGUI("rsv_aggr[".$idx."][]");
1546  $hidden->setValue($id);
1547  $form->addItem($hidden);
1548  }
1549  }
1550  else
1551  {
1552  $item->setMaxValue(1);
1553 
1554  $hidden = new ilHiddenInputGUI("rsv_aggr[".$idx."]");
1555  $hidden->setValue($ids);
1556  $form->addItem($hidden);
1557  }
1558 
1559  if($_POST["rsv_id_".$idx])
1560  {
1561  $item->setValue((int)$_POST["rsv_id_".$idx]);
1562  }
1563  }
1564 
1565  $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
1566  $form->addCommandButton("log", $this->lng->txt("cancel"));
1567 
1568  return $form;
1569  }
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 1571 of file class.ilObjBookingPoolGUI.php.

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

Referenced by rsvConfirmCancelObject().

1572  {
1573  global $tpl, $ilCtrl, $lng;
1574 
1575  $this->tabs_gui->clearTargets();
1576  $this->tabs_gui->setBackTarget($lng->txt("back"),
1577  $ilCtrl->getLinkTarget($this, "log"));
1578 
1579  // #13511
1580  ilUtil::sendQuestion($lng->txt("book_confirm_cancel"));
1581 
1582  $form = $this->rsvConfirmCancelAggregationForm($a_ids);
1583 
1584  $tpl->setContent($form->getHTML());
1585  }
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 1400 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(), setHelpId(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

1401  {
1402  global $ilCtrl, $lng, $tpl, $ilAccess, $ilUser;
1403 
1404  $ids = $this->getLogReservationIds();
1405  if(!sizeof($ids))
1406  {
1407  $this->ctrl->redirect($this, 'log');
1408  }
1409 
1410  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1411  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1412 
1413  $max = array();
1414  foreach($ids as $idx => $id)
1415  {
1416  if(!is_numeric($id))
1417  {
1418  list($obj_id, $user_id, $from, $to) = explode("_", $id);
1419 
1420  $valid_ids = array();
1421  foreach(ilBookingObject::getList($this->object->getId()) as $item)
1422  {
1423  $valid_ids[$item["booking_object_id"]] = $item["title"];
1424  }
1425 
1426  if(($ilAccess->checkAccess("write", "", $this->ref_id) || $user_id == $ilUser->getId()) &&
1427  $from > time() &&
1428  in_array($obj_id, array_keys($valid_ids)))
1429  {
1430  $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
1431  if(!sizeof($rsv_ids))
1432  {
1433  unset($ids[$idx]);
1434  }
1435  if(sizeof($rsv_ids) > 1)
1436  {
1437  $max[$id] = sizeof($rsv_ids);
1438  $ids[$idx] = $rsv_ids;
1439  }
1440  else
1441  {
1442  // only 1 in group? treat as normal reservation
1443  $ids[$idx] = array_shift($rsv_ids);
1444  }
1445  }
1446  else
1447  {
1448  unset($ids[$idx]);
1449  }
1450  }
1451  }
1452 
1453  if(!sizeof($ids))
1454  {
1455  $this->ctrl->redirect($this, 'log');
1456  }
1457 
1458  // show form instead
1459  if(sizeof($max) && max($max) > 1)
1460  {
1461  return $this->rsvConfirmCancelAggregationObject($ids);
1462  }
1463 
1464  $this->tabs_gui->clearTargets();
1465  $this->tabs_gui->setBackTarget($lng->txt("back"),
1466  $ilCtrl->getLinkTarget($this, "log"));
1467 
1468  $this->setHelpId("cancel_booking");
1469 
1470  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1471  $conf = new ilConfirmationGUI();
1472  $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
1473  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
1474  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
1475  $conf->setCancel($lng->txt('cancel'), 'log');
1476 
1477  foreach($ids as $id)
1478  {
1479  $rsv = new ilBookingReservation($id);
1480  $obj = new ilBookingObject($rsv->getObjectId());
1481 
1482  $details = $obj->getTitle();
1483  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1484  {
1485  $details .= ", ".ilDatePresentation::formatPeriod(
1486  new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1487  new ilDateTime($rsv->getTo()+1, IL_CAL_UNIX));
1488  }
1489 
1490  $conf->addItem('rsv_id[]', $id, $details);
1491  }
1492 
1493  $tpl->setContent($conf->getHTML());
1494  }
a bookable ressource
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
getTitle()
Get object title.
Date and time handling
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 1687 of file class.ilObjBookingPoolGUI.php.

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

1688  {
1689  global $ilAccess;
1690 
1691  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
1692  {
1693  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1694  $this->ctrl->redirect($this, 'log');
1695  }
1696 
1697  $ids = $this->getLogReservationIds();
1698  if($ids)
1699  {
1700  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1701  foreach($ids as $id)
1702  {
1703  $obj = new ilBookingReservation($id);
1704  $obj->setStatus(ilBookingReservation::STATUS_IN_USE);
1705  $obj->update();
1706  }
1707  }
1708 
1709  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1710  $this->logObject();
1711  }
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 1713 of file class.ilObjBookingPoolGUI.php.

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

1714  {
1715  global $ilAccess;
1716 
1717  if(!$ilAccess->checkAccess("write", "", $this->ref_id))
1718  {
1719  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1720  $this->ctrl->redirect($this, 'log');
1721  }
1722 
1723  $ids = $this->getLogReservationIds();
1724  if($ids)
1725  {
1726  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1727  foreach($ids as $id)
1728  {
1729  $obj = new ilBookingReservation($id);
1730  $obj->setStatus(NULL);
1731  $obj->update();
1732  }
1733  }
1734 
1735  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1736  $this->logObject();
1737  }
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:

◆ setHelpId()

ilObjBookingPoolGUI::setHelpId (   $a_id)
protected

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

References ilObjBookingPool\TYPE_FIX_SCHEDULE.

Referenced by bookObject(), and rsvConfirmCancelObject().

309  {
310  global $ilHelp;
311 
312  $object_subtype = ($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
313  ? '-schedule'
314  : '-nonschedule';
315 
316  $ilHelp->setScreenIdComponent('book');
317  $ilHelp->setScreenId('object'.$object_subtype);
318  $ilHelp->setSubScreenId($a_id);
319  }
+ Here is the caller graph for this function:

◆ setTabs()

ilObjBookingPoolGUI::setTabs ( )

get tabs

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

References $ilUser, and ilObjBookingPool\TYPE_NO_SCHEDULE.

243  {
244  global $ilAccess, $ilHelp, $ilUser;
245 
246  if (in_array($this->ctrl->getCmd(), array("create", "save")) && !$this->ctrl->getNextClass())
247  {
248  return;
249  }
250 
251  $ilHelp->setScreenIdComponent("book");
252 
253  if ($ilAccess->checkAccess('read', '', $this->object->getRefId()))
254  {
255  if($ilUser->getId() != ANONYMOUS_USER_ID)
256  {
257  $this->tabs_gui->addTab("render",
258  $this->lng->txt("book_booking_types"),
259  $this->ctrl->getLinkTarget($this, "render"));
260  }
261 
262  $this->tabs_gui->addTab("info",
263  $this->lng->txt("info_short"),
264  $this->ctrl->getLinkTarget($this, "infoscreen"));
265 
266  if($ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog())
267  {
268  $this->tabs_gui->addTab("log",
269  $this->lng->txt("book_log"),
270  $this->ctrl->getLinkTarget($this, "log"));
271  }
272  }
273 
274  if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
275  {
276  if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
277  {
278  $this->tabs_gui->addTab("schedules",
279  $this->lng->txt("book_schedules"),
280  $this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render"));
281  }
282 
283  $this->tabs_gui->addTab("settings",
284  $this->lng->txt("settings"),
285  $this->ctrl->getLinkTarget($this, "edit"));
286 
287  // meta data
288  include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
289  $mdgui = new ilObjectMetaDataGUI($this->object, "bobj");
290  $mdtab = $mdgui->getTab();
291  if($mdtab)
292  {
293  $this->tabs_gui->addTarget("meta_data",
294  $mdtab,
295  "",
296  "ilobjectmetadatagui");
297  }
298  }
299 
300  if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
301  {
302  $this->tabs_gui->addTab("perm_settings",
303  $this->lng->txt("perm_settings"),
304  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
305  }
306  }
Class ilObjectMetaDataGUI.
global $ilUser
Definition: imgupload.php:15

◆ showProfileObject()

ilObjBookingPoolGUI::showProfileObject ( )

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

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

1740  {
1741  global $tpl, $ilCtrl;
1742 
1743  $this->tabs_gui->clearTargets();
1744 
1745  $user_id = (int)$_GET['user_id'];
1746 
1747  include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1748  $profile = new ilPublicUserProfileGUI($user_id);
1749  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
1750  $tpl->setContent($ilCtrl->getHTML($profile));
1751  }
$_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 212 of file class.ilObjBookingPoolGUI.php.

References ilObjectServiceSettingsGUI\CUSTOM_METADATA, ilPropertyFormGUI\getInput(), and ilObjectServiceSettingsGUI\updateServiceSettingsForm().

213  {
214  $this->object->setOffline(!$a_form->getInput('online'));
215  $this->object->setPublicLog($a_form->getInput('public'));
216  $this->object->setScheduleType($a_form->getInput('stype'));
217  $this->object->setOverallLimit($a_form->getInput('limit') ? $a_form->getInput('limit') : null);
218 
219  include_once './Services/Container/classes/class.ilContainer.php';
220  include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
222  $this->object->getId(),
223  $a_form,
225  );
226  }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
+ Here is the call graph for this function:

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