ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 editObject ()
 edit object More...
 
 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 ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
- Public Member Functions inherited from ilObjectGUI
 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...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 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 ()
 cancel action and go back to previous page @access 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)
 Init creation froms. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 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 ()
 
 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 @access public More...
 
 setAdminTabs ()
 set admin tabs @access 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...
 
 getTabs ()
 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 (ilColumnGUI $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
 
 $tabs_gui = null
 
 $ctrl
 

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.

24 {
25 $this->type = "book";
26 parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
27 $this->lng->loadLanguageModule("book");
28
29 include_once("./Modules/BookingManager/classes/class.ilBookingObject.php");
30 if ((int) $_REQUEST['object_id'] > 0 && ilBookingObject::lookupPoolId((int) $_REQUEST['object_id']) != $this->object->getId())
31 {
32 throw new ilException("Booking Object ID does not match Booking Pool.");
33 }
34 }
static lookupPoolId($object_id)
Lookup pool id.
Base class for ILIAS Exception handling.

References ilBookingObject\lookupPoolId().

+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjBookingPoolGUI::_goto (   $a_target)
static

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

1336 {
1337 global $ilAccess, $lng;
1338
1339 if ($ilAccess->checkAccess("read", "", $a_target))
1340 {
1341 ilObjectGUI::_gotoRepositoryNode($a_target, "render");
1342 }
1343 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1344 {
1345 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1348 }
1349 }
sprintf('%.4f', $callTime)
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

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

+ Here is the call graph for this function:

◆ addDaysDate()

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

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

1031 {
1032 $date = date_parse($a_date);
1033 $stamp = mktime(0, 0, 1, $date["month"], $date["day"]+$a_days, $date["year"]);
1034 return date("Y-m-d", $stamp);
1035 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())

References date.

Referenced by confirmedBookingNumbersObject().

+ Here is the caller graph for this function:

◆ addDaysStamp()

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

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

1038 {
1039 $date = getDate($a_stamp);
1040 return mktime($date["hours"], $date["minutes"], $date["seconds"],
1041 $date["mon"], $date["mday"]+$a_days, $date["year"]);
1042 }

Referenced by confirmedBookingNumbersObject().

+ Here is the caller graph for this function:

◆ addExternalEditFormCustom()

ilObjBookingPoolGUI::addExternalEditFormCustom ( ilPropertyFormGUI  $a_form)

Reimplemented from ilObjectGUI.

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

259 {
260 include_once './Services/Container/classes/class.ilContainer.php';
261 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
263 $this->object->getId(),
264 $a_form,
266 );
267 }
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.

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

+ Here is the call graph for this function:

◆ addLocatorItems()

ilObjBookingPoolGUI::addLocatorItems ( )

should be overwritten to add object specific items (repository items are preloaded)

Reimplemented from ilObjectGUI.

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

1734 {
1735 global $ilLocator;
1736
1737 if (is_object($this->object))
1738 {
1739 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "render"), "", $_GET["ref_id"]);
1740 }
1741 }
$_GET["client_id"]

References $_GET.

◆ afterSave()

ilObjBookingPoolGUI::afterSave ( ilObject  $a_new_object)
protected

Post (successful) object creation hook.

Parameters
ilObject$a_new_object

Reimplemented from ilObjectGUI.

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

161 {
162 $a_new_object->setOffline(true);
163 $a_new_object->update();
164
165 // always send a message
166 ilUtil::sendSuccess($this->lng->txt("book_pool_added"),true);
167 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
168 $this->ctrl->redirect($this, "edit");
169 }
update()
update object in db
getRefId()
get reference id @access public
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ applyLogFilterObject()

ilObjBookingPoolGUI::applyLogFilterObject ( )

Apply filter from reservations table gui.

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

1307 {
1308 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1309
1310 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1311 $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1312 $this->object->getId(), $show_all,
1313 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1314 $table->resetOffset();
1315 $table->writeFilterToSession();
1316 $this->logObject();
1317 }
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.

References ilObjectGUI\checkPermissionBool(), logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ bookObject()

ilObjBookingPoolGUI::bookObject ( )

First step in booking process.

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

355 {
356 global $tpl;
357
358 $this->tabs_gui->clearTargets();
359 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
360
361 $this->setHelpId("book");
362
363 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
364 $obj = new ilBookingObject((int)$_GET['object_id']);
365
366 $this->lng->loadLanguageModule("dateplaner");
367 $this->ctrl->setParameter($this, 'object_id', $obj->getId());
368
369 if($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
370 {
371 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
372 $schedule = new ilBookingSchedule($obj->getScheduleId());
373
374 $tpl->setContent($this->renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
375 }
376 else
377 {
378 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
379 $cgui = new ilConfirmationGUI();
380 $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
381
382 $cgui->setFormAction($this->ctrl->getFormAction($this));
383 $cgui->setCancel($this->lng->txt("cancel"), "render");
384 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
385
386 $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
387
388 $tpl->setContent($cgui->getHTML());
389 }
390 }
a bookable ressource
schedule for booking ressource
Confirmation screen class.
renderSlots(ilBookingSchedule $schedule, array $object_ids, $title)

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

Referenced by confirmedBookingObject().

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

591 {
592 global $ilUser;
593
594 include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
595 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
596
597 $map = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
598 $definition = $schedule->getDefinition();
599
600 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
601 ? $schedule->getAvailabilityFrom()->get(IL_CAL_DATE)
602 : null;
603 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
604 ? $schedule->getAvailabilityTo()->get(IL_CAL_DATE)
605 : null;
606
607 $has_open_slot = false;
608 foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
609 {
610 $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
611
612 #24045 and #24936
613 if($av_from || $av_to)
614 {
615 $today = $date->get(IL_CAL_DATE);
616
617 if ($av_from && $av_from > $today)
618 {
619 continue;
620 }
621
622 if($av_to && $av_to < $today)
623 {
624 continue;
625 }
626 }
627
628 $slots = array();
629 if(isset($definition[$map[$date_info['isoday']-1]]))
630 {
631 $slots = array();
632 foreach($definition[$map[$date_info['isoday']-1]] as $slot)
633 {
634 $slot = explode('-', $slot);
635 $slots[] = array('from'=>str_replace(':', '', $slot[0]),
636 'to'=>str_replace(':', '', $slot[1]));
637 }
638 }
639
640 $last = array_pop(array_keys($hours));
641 $slot_captions = array();
642 foreach($hours as $hour => $period)
643 {
644 $dates[$hour][0] = $period;
645
646 $period = explode("-", $period);
647
648 // #13738
649 if($user_settings->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12)
650 {
651 $period[0] = date("H", strtotime($period[0]));
652 if(sizeof($period) == 2)
653 {
654 $period[1] = date("H", strtotime($period[1]));
655 }
656 }
657
658 if(sizeof($period) == 1)
659 {
660 $period_from = (int)substr($period[0], 0, 2)."00";
661 $period_to = (int)substr($period[0], 0, 2)."59";
662 }
663 else
664 {
665 $period_from = (int)substr($period[0], 0, 2)."00";
666 $period_to = (int)substr($period[1], 0, 2)."59";
667 }
668
669 $column = $date_info['isoday'];
670 if(!$week_start)
671 {
672 if($column < 7)
673 {
674 $column++;
675 }
676 else
677 {
678 $column = 1;
679 }
680 }
681
682 if(sizeof($slots))
683 {
684 $in = false;
685 foreach($slots as $slot)
686 {
687 $slot_from = mktime(substr($slot['from'], 0, 2), substr($slot['from'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
688 $slot_to = mktime(substr($slot['to'], 0, 2), substr($slot['to'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
689
690 // always single object, we can sum up
691 $nr_available = (array)ilBookingReservation::getAvailableObject($object_ids, $slot_from, $slot_to-1, false, true);
692
693 // any objects available?
694 if(!array_sum($nr_available))
695 {
696 continue;
697 }
698
699 // check deadline
700 if($schedule->getDeadline() >= 0)
701 {
702 // 0-n hours before slots begins
703 if($slot_from < (time()+$schedule->getDeadline()*60*60))
704 {
705 continue;
706 }
707 }
708 else
709 {
710 // running slots can be booked, only ended slots are invalid
711 if($slot_to < time())
712 {
713 continue;
714 }
715 }
716
717 // is slot active in current hour?
718 if((int)$slot['from'] < $period_to && (int)$slot['to'] > $period_from)
719 {
720 $from = ilDatePresentation::formatDate(new ilDateTime($slot_from, IL_CAL_UNIX));
721 $from = array_pop(explode(' ', $from));
723 $to = array_pop(explode(' ', $to));
724
725 // show caption (first hour) of slot
726 $id = $slot_from.'_'.$slot_to;
727 if(!in_array($id, $slot_captions))
728 {
729 $dates[$hour][$column]['captions'][$id] = $from.'-'.$to;
730 $dates[$hour][$column]['available'][$id] = array_sum($nr_available);
731 $slot_captions[] = $id;
732 }
733
734 $in = true;
735 }
736 }
737 // (any) active slot
738 if($in)
739 {
740 $has_open_slot = true;
741 $dates[$hour][$column]['in_slot'] = $in;
742 }
743 }
744 }
745 }
746
747 return $has_open_slot;
748 }
$column
Definition: 39dropdown.php:62
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
const IL_CAL_FKT_GETDATE
const IL_CAL_DATE
const IL_CAL_UNIX
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 _getInstanceByUserId($a_user_id)
get singleton instance
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
$ilUser
Definition: imgupload.php:18

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

Referenced by renderSlots().

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

1284 {
1285 $this->tabs_gui->setTabActive('log');
1286
1287 if(!$_POST['reservation_id'])
1288 {
1289 ilUtil::sendFailure($this->lng->txt('select_one'));
1290 return $this->logObject();
1291 }
1292
1293 if ($this->checkPermissionBool('write'))
1294 {
1295 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1296 ilBookingReservation::changeStatus($_POST['reservation_id'], (int)$_POST['tstatus']);
1297 }
1298
1299 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1300 return $this->ctrl->redirect($this, 'log');
1301 }
$_POST["username"]
static changeStatus(array $a_ids, $a_status)
List all reservations.

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

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

1016 {
1017 global $tpl;
1018
1019 $this->tabs_gui->clearTargets();
1020 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
1021
1022 if(!$a_form)
1023 {
1024 $a_form = $this->initBookingNumbersForm($a_objects_counter, $a_group_id);
1025 }
1026
1027 $tpl->setContent($a_form->getHTML());
1028 }
initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload=false)

References ilObjectGUI\$tpl, and initBookingNumbersForm().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmedBookingNumbersObject()

ilObjBookingPoolGUI::confirmedBookingNumbersObject ( )

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

1045 {
1046 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1047 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1048
1049 // convert post data to initial form config
1050 $counter = array();
1051 $current_first = $obj_id = null;
1052 foreach(array_keys($_POST) as $id)
1053 {
1054 if(substr($id, 0, 9) == "conf_nr__")
1055 {
1056 $id = explode("_", substr($id, 9));
1057 $counter[$id[0]."_".$id[1]."_".$id[2]] = (int)$id[3];
1058 if(!$current_first)
1059 {
1060 $current_first = date("Y-m-d", $id[1]);
1061 }
1062 }
1063 }
1064
1065 // recurrence
1066
1067 // checkInput() has not been called yet, so we have to improvise
1068 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
1069 $end = ilCalendarUtil::parseIncomingDate($_POST["rece"], null);
1070
1071 if((int)$_POST["recm"] > 0 && $end && $current_first)
1072 {
1073 ksort($counter);
1074 $end = $end->get(IL_CAL_DATE);
1075 $cycle = (int)$_POST["recm"]*7;
1076 $cut = 0;
1077 $org = $counter;
1078 while($cut < 1000 && $this->addDaysDate($current_first, $cycle) <= $end)
1079 {
1080 $cut++;
1081 $current_first = null;
1082 foreach($org as $item_id => $max)
1083 {
1084 $parts = explode("_", $item_id);
1085 $obj_id = $parts[0];
1086
1087 $from = $this->addDaysStamp($parts[1], $cycle*$cut);
1088 $to = $this->addDaysStamp($parts[2], $cycle*$cut);
1089
1090 $new_item_id = $obj_id."_".$from."_".$to;
1091
1092 // form reload because of validation errors
1093 if(!isset($counter[$new_item_id]) && date("Y-m-d", $to) <= $end)
1094 {
1095 // get max available for added dates
1096 $new_max = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to-1, false, true);
1097 $new_max = (int)$new_max[$obj_id];
1098
1099 $counter[$new_item_id] = $new_max;
1100
1101 if(!$current_first)
1102 {
1103 $current_first = date("Y-m-d", $from);
1104 }
1105
1106 // clone input
1107 $_POST["conf_nr__".$new_item_id."_".$new_max] = $_POST["conf_nr__".$item_id."_".$max];
1108 }
1109 }
1110 }
1111 }
1112
1113 $group_id = $_POST["grp_id"];
1114
1115 $form = $this->initBookingNumbersForm($counter, $group_id, true);
1116 if($form->checkInput())
1117 {
1118 $success = false;
1119 $rsv_ids = array();
1120 foreach($counter as $id => $all_nr)
1121 {
1122 $book_nr = $form->getInput("conf_nr__".$id."_".$all_nr);
1123 $parts = explode("_", $id);
1124 $obj_id = $parts[0];
1125 $from = $parts[1];
1126 $to = $parts[2]-1;
1127
1128 // get currently available slots
1129 $counter = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to, false, true);
1131 if($counter)
1132 {
1133 // we can only book what is left
1134 $book_nr = min($book_nr, $counter);
1135 for($loop = 0; $loop < $book_nr; $loop++)
1136 {
1137 $rsv_ids[] = $this->processBooking($obj_id, $from, $to, $group_id);
1138 $success = $obj_id;
1139 }
1140 }
1141 }
1142 if($success)
1143 {
1144 $this->handleBookingSuccess($success, $rsv_ids);
1145 }
1146 else
1147 {
1148 ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
1149 $this->ctrl->redirect($this, 'render');
1150 }
1151 }
1152 else
1153 {
1154 // ilDateTimeInputGUI does NOT add hidden values on disabled!
1155
1156 $rece_array = explode(".", $_POST['rece']);
1157
1158 $rece_day = str_pad($rece_array[0], 2, "0", STR_PAD_LEFT);
1159 $rece_month = str_pad($rece_array[1], 2, "0", STR_PAD_LEFT);
1160 $rece_year = $rece_array[2];
1161
1162 // ilDateTimeInputGUI will choke on POST array format
1163 $_POST["rece"] = null;
1164
1165 $form->setValuesByPost();
1166
1167 $rece_date = new ilDate($rece_year."-".$rece_month."-".$rece_day, IL_CAL_DATE);
1168
1169 $form->getItemByPostVar("rece")->setDate($rece_date);
1170 $form->getItemByPostVar("recm")->setHideSubForm($_POST["recm"] < 1);
1171
1172 $hidden_date = new ilHiddenInputGUI("rece");
1173 $hidden_date->setValue($rece_date);
1174 $form->addItem($hidden_date);
1175
1176 return $this->confirmBookingNumbers($counter, $group_id, $form);
1177 }
1178 }
$success
Definition: Utf8Test.php:86
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
Class for single dates.
This class represents a hidden form property in a property form.
confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
processBooking($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
Book object for date.
handleBookingSuccess($a_obj_id, array $a_rsv_ids=null)
$counter

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

+ Here is the call graph for this function:

◆ confirmedBookingObject()

ilObjBookingPoolGUI::confirmedBookingObject ( )

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

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

754 {
755 global $ilUser;
756
757 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
758 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
759
760 $success = false;
761 $rsv_ids = array();
762
763 if($this->object->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE)
764 {
765 if($_POST['object_id'])
766 {
767 $object_id = $_POST['object_id'];
768 if($object_id)
769 {
771 !ilBookingReservation::getObjectReservationForUser($object_id, $ilUser->getId())) // #18304
772 {
773 $rsv_ids[] = $this->processBooking($object_id);
774 $success = $object_id;
775 }
776 else
777 {
778 // #11852
779 ilUtil::sendFailure($this->lng->txt('book_reservation_failed_overbooked'), true);
780 $this->ctrl->redirect($this, 'render');
781 }
782 }
783 }
784 }
785 else
786 {
787 if(!isset($_POST['date']))
788 {
789 ilUtil::sendFailure($this->lng->txt('select_one'));
790 return $this->bookObject();
791 }
792
793 // single object reservation(s)
794 if(isset($_GET['object_id']))
795 {
796 $confirm = array();
797
798 $object_id = (int)$_GET['object_id'];
799 if($object_id)
800 {
801 $group_id = null;
802 $nr = ilBookingObject::getNrOfItemsForObjects(array($object_id));
803 // needed for recurrence
804 if(true) // if($nr[$object_id] > 1 || sizeof($_POST['date']) > 1)
805 {
807 }
808 foreach($_POST['date'] as $date)
809 {
810 $fromto = explode('_', $date);
811 $fromto[1]--;
812
813 $counter = ilBookingReservation::getAvailableObject(array($object_id), $fromto[0], $fromto[1], false, true);
814 $counter = $counter[$object_id];
815 if($counter)
816 {
817 // needed for recurrence
818 if(true) // if($counter > 1)
819 {
820 $confirm[$object_id."_".$fromto[0]."_".($fromto[1]+1)] = $counter;
821 }
822 else
823 {
824 $rsv_ids[] = $this->processBooking($object_id, $fromto[0], $fromto[1], $group_id);
825 $success = $object_id;
826 }
827 }
828 }
829 }
830
831 if(sizeof($confirm))
832 {
833 return $this->confirmBookingNumbers($confirm, $group_id);
834 }
835 }
836 /*
837 // group object reservation(s)
838 else
839 {
840 $all_object_ids = array();
841 foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
842 {
843 $all_object_ids[] = $item['booking_object_id'];
844 }
845
846 $possible_objects = $counter = array();
847 sort($_POST['date']);
848 foreach($_POST['date'] as $date)
849 {
850 $fromto = explode('_', $date);
851 $fromto[1]--;
852 $possible_objects[$date] = ilBookingReservation::getAvailableObject($all_object_ids, $fromto[0], $fromto[1], false);
853 foreach($possible_objects[$date] as $obj_id)
854 {
855 $counter[$obj_id]++;
856 }
857 }
858
859 if(max($counter))
860 {
861 // we prefer the objects which are available for most slots
862 arsort($counter);
863 $counter = array_keys($counter);
864
865 // book each slot
866 foreach($possible_objects as $date => $available_ids)
867 {
868 $fromto = explode('_', $date);
869 $fromto[1]--;
870
871 // find "best" object for slot
872 foreach($counter as $best_object_id)
873 {
874 if(in_array($best_object_id, $available_ids))
875 {
876 $object_id = $best_object_id;
877 break;
878 }
879 }
880 $this->processBooking($object_id, $fromto[0], $fromto[1]);
881 $success = true;
882 }
883 }
884 }
885 */
886 }
887
888 if($success)
889 {
890 $this->handleBookingSuccess($success, $rsv_ids);
891 }
892 else
893 {
894 ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
895 $this->ctrl->redirect($this, 'book');
896 }
897 }
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static getNewGroupId()
Get next group id
static isObjectAvailableNoSchedule($a_obj_id)
bookObject()
First step in booking process.

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

+ Here is the call graph for this function:

◆ editObject()

ilObjBookingPoolGUI::editObject ( )

edit object

@access public

Reimplemented from ilObjectGUI.

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

172 {
173 // if we have no schedules yet - show info
174 include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
175 if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE &&
176 !sizeof(ilBookingSchedule::getList($this->object->getId())))
177 {
178 ilUtil::sendInfo($this->lng->txt("book_schedule_warning_edit"));
179 }
180
181 return parent::editObject();
182 }
static getList($a_pool_id)
Get list of booking objects for given pool.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

◆ executeCommand()

ilObjBookingPoolGUI::executeCommand ( )
Returns
bool
Exceptions
ilCtrlException
ilObjectException

Reimplemented from ilObjectGUI.

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

42 {
43 global $tpl, $ilTabs, $ilNavigationHistory, $ilUser;
44
45 $next_class = $this->ctrl->getNextClass($this);
46 $cmd = $this->ctrl->getCmd();
47
48 if(!$next_class && $cmd == 'render')
49 {
50 if($ilUser->getId() != ANONYMOUS_USER_ID)
51 {
52 $this->ctrl->setCmdClass('ilBookingObjectGUI');
53 $next_class = $this->ctrl->getNextClass($this);
54 }
55 else
56 {
57 $this->ctrl->redirect($this, "infoscreen");
58 }
59 }
60
61 if(substr($cmd, 0, 4) == 'book')
62 {
63 $next_class = '';
64 }
65
66 $ilNavigationHistory->addItem($this->ref_id,
67 "./goto.php?target=book_".$this->ref_id, "book");
68
69 $this->prepareOutput();
70
71 switch($next_class)
72 {
73 case 'ilpermissiongui':
74 $this->checkPermission('edit_permission');
75 $this->tabs_gui->setTabActive('perm_settings');
76 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
77 $perm_gui = new ilPermissionGUI($this);
78 $ret =& $this->ctrl->forwardCommand($perm_gui);
79 break;
80
81 case 'ilbookingobjectgui':
82 if (!$this->checkPermissionBool('read') && $this->checkPermissionBool('visible')) {
83 $this->ctrl->redirect($this, "infoScreen");
84 }
85 $this->checkPermission('read');
86 $this->tabs_gui->setTabActive('render');
87 include_once("Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
88 $object_gui = new ilBookingObjectGUI($this);
89 $ret =& $this->ctrl->forwardCommand($object_gui);
90 break;
91
92 case 'ilbookingschedulegui':
93 $this->checkPermission('write');
94 $this->tabs_gui->setTabActive('schedules');
95 include_once("Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
96 $schedule_gui = new ilBookingScheduleGUI($this);
97 $ret =& $this->ctrl->forwardCommand($schedule_gui);
98 break;
99
100 case 'ilpublicuserprofilegui':
101 $this->checkPermission('read');
102 $ilTabs->clearTargets();
103 include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
104 $profile = new ilPublicUserProfileGUI((int)$_GET["user_id"]);
105 $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
106 $ret = $this->ctrl->forwardCommand($profile);
107 $tpl->setContent($ret);
108 break;
109
110 case 'ilinfoscreengui':
111 $this->checkPermission('visible');
112 $this->infoScreen();
113 break;
114
115 case "ilcommonactiondispatchergui":
116 $this->checkPermission('read');
117 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
119 $this->ctrl->forwardCommand($gui);
120 break;
121
122 case "ilobjectcopygui":
123 $this->checkPermission('copy');
124 include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
125 $cp = new ilObjectCopyGUI($this);
126 $cp->setType("book");
127 $this->ctrl->forwardCommand($cp);
128 break;
129
130 case 'ilobjectmetadatagui';
131 $this->checkPermission('write');
132 $this->tabs_gui->setTabActive('meta_data');
133 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
134 $md_gui = new ilObjectMetaDataGUI($this->object, 'bobj');
135 $this->ctrl->forwardCommand($md_gui);
136 break;
137
138 default:
139 if (!in_array($cmd, ["create", "save", "infoScreen"])) {
140 $this->checkPermission('read');
141 }
142 $cmd = $this->ctrl->getCmd();
143 $cmd .= 'Object';
144 $this->$cmd();
145 break;
146 }
147
148 $this->addHeaderAction();
149 return true;
150 }
Class ilBookingObjectGUI.
Class ilBookingScheduleGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
GUI class for the workflow of copying objects.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
addHeaderAction()
Add header action menu.
Class ilObjectMetaDataGUI.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
GUI class for public user profile presentation.
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ getEditFormCustomValues()

ilObjBookingPoolGUI::getEditFormCustomValues ( array &  $a_values)
protected

Add values to custom edit fields.

Parameters
array$a_values

Reimplemented from ilObjectGUI.

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

233 {
234 $a_values["online"] = !$this->object->isOffline();
235 $a_values["public"] = $this->object->hasPublicLog();
236 $a_values["stype"] = $this->object->getScheduleType();
237 $a_values["limit"] = $this->object->getOverallLimit();
238 $a_values["period"] = $this->object->getReservationFilterPeriod();
239 }

◆ getLogReservationIds()

ilObjBookingPoolGUI::getLogReservationIds ( )
protected

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

1407 {
1408 if($_POST["mrsv"])
1409 {
1410 return $_POST["mrsv"];
1411 }
1412 else if($_GET["reservation_id"])
1413 {
1414 return array($_GET["reservation_id"]);
1415 }
1416 }

References $_GET, and $_POST.

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

+ Here is the caller graph for this function:

◆ handleBookingSuccess()

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

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

900 {
901 ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
902
903 // show post booking information?
904 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
905 $obj = new ilBookingObject($a_obj_id);
906 $pfile = $obj->getPostFile();
907 $ptext = $obj->getPostText();
908 if(trim($ptext) || $pfile)
909 {
910 if(sizeof($a_rsv_ids))
911 {
912 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'rsv_ids', implode(";", $a_rsv_ids));
913 }
914 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
915 $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
916 }
917 else
918 {
919 $this->ctrl->redirect($this, 'render');
920 }
921 }

References ilUtil\sendSuccess().

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreen()

ilObjBookingPoolGUI::infoScreen ( )

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

1364 {
1365 global $ilCtrl;
1366
1367 $this->tabs_gui->setTabActive('info');
1368
1369 $this->checkPermission("visible");
1370
1371 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1372 $info = new ilInfoScreenGUI($this);
1373
1374 $info->enablePrivateNotes();
1375
1376 if ($this->checkPermissionBool("read"))
1377 {
1378 $info->enableNews();
1379 }
1380
1381 // no news editing for files, just notifications
1382 $info->enableNewsEditing(false);
1383 if ($this->checkPermissionBool("write"))
1384 {
1385 $news_set = new ilSetting("news");
1386 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1387
1388 if ($enable_internal_rss)
1389 {
1390 $info->setBlockProperty("news", "settings", true);
1391 $info->setBlockProperty("news", "public_notifications_option", true);
1392 }
1393 }
1394
1395 // forward the command
1396 if ($ilCtrl->getNextClass() == "ilinfoscreengui")
1397 {
1398 $ilCtrl->forwardCommand($info);
1399 }
1400 else
1401 {
1402 return $ilCtrl->getHTML($info);
1403 }
1404 }
Class ilInfoScreenGUI.
ILIAS Setting Class.
$info
Definition: example_052.php:80
global $ilCtrl
Definition: ilias.php:18

References $ilCtrl, $info, ilObjectGUI\checkPermission(), and ilObjectGUI\checkPermissionBool().

Referenced by executeCommand(), and infoScreenObject().

+ Here is the call graph for this function:
+ 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 1356 of file class.ilObjBookingPoolGUI.php.

1357 {
1358 $this->ctrl->setCmd("showSummary");
1359 $this->ctrl->setCmdClass("ilinfoscreengui");
1360 $this->infoScreen();
1361 }

References infoScreen().

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

924 {
925 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
926 $form = new ilPropertyFormGUI();
927 $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking"));
928 $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects"));
929 $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info"));
930
931 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
932 $section = false;
933 $min_date = null;
934 foreach($a_objects_counter as $id => $counter)
935 {
936 $id = explode("_", $id);
937 $book_id = $id[0]."_".$id[1]."_".$id[2]."_".$counter;
938
939 $obj = new ilBookingObject($id[0]);
940
941 if(!$section)
942 {
944 $section->setTitle($obj->getTitle());
945 $form->addItem($section);
946
947 $section = true;
948 }
949
950 $period = /* $this->lng->txt("book_period").": ". */
952 new ilDateTime($id[1], IL_CAL_UNIX),
953 new ilDateTime($id[2], IL_CAL_UNIX));
954
955 $nr_field = new ilNumberInputGUI($period, "conf_nr__".$book_id);
956 $nr_field->setValue(1);
957 $nr_field->setSize(3);
958 $nr_field->setMaxValue($counter);
959 $nr_field->setMinValue($counter ? 1 : 0);
960 $nr_field->setRequired(true);
961 $form->addItem($nr_field);
962
963 if(!$min_date || $id[1] < $min_date)
964 {
965 $min_date = $id[1];
966 }
967 }
968
969 // recurrence
970 $this->lng->loadLanguageModule("dateplaner");
971 $rec_mode = new ilSelectInputGUI($this->lng->txt("cal_recurrences"), "recm");
972 $rec_mode->setRequired(true);
973 $rec_mode->setOptions(array(
974 "-1" => $this->lng->txt("cal_no_recurrence"),
975 1 => $this->lng->txt("cal_weekly"),
976 2 => $this->lng->txt("r_14"),
977 4 => $this->lng->txt("r_4_weeks")
978 ));
979 $form->addItem($rec_mode);
980
981 $rec_end = new ilDateTimeInputGUI($this->lng->txt("cal_repeat_until"), "rece");
982 $rec_end->setRequired(true);
983 $rec_mode->addSubItem($rec_end);
984
985 if(!$a_reload)
986 {
987 // show date only if active recurrence
988 $rec_mode->setHideSubForm(true, '>= 1');
989
990 if($min_date)
991 {
992 $rec_end->setDate(new ilDateTime($min_date, IL_CAL_UNIX));
993 }
994 }
995 else
996 {
997 // recurrence may not be changed on reload
998 $rec_mode->setDisabled(true);
999 $rec_end->setDisabled(true);
1000 }
1001
1002 if($a_group_id)
1003 {
1004 $grp = new ilHiddenInputGUI("grp_id");
1005 $grp->setValue($a_group_id);
1006 $form->addItem($grp);
1007 }
1008
1009 $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm"));
1010 $form->addCommandButton("render", $this->lng->txt("cancel"));
1011
1012 return $form;
1013 }
$section
Definition: Utf8Test.php:83
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
This class represents a date/time property in a property form.
This class represents a section header in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a selection list property in a property form.

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

Referenced by confirmBookingNumbers(), and confirmedBookingNumbersObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjBookingPoolGUI::initCreationForms (   $a_new_type)
protected

Init creation froms.

this will create the default creation forms: new, import, clone

Parameters
string$a_new_type
Returns
array

Reimplemented from ilObjectGUI.

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

153 {
154 $forms = parent::initCreationForms($a_new_type);
155 unset($forms[self::CFORM_IMPORT]);
156
157 return $forms;
158 }

◆ initEditCustomForm()

ilObjBookingPoolGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Add custom fields to update form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

185 {
186 $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
187 $a_form->addItem($online);
188
189 $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype");
190 $type->setRequired(true);
191 $a_form->addItem($type);
192
193 // #14478
194 include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
195 if(sizeof(ilBookingObject::getList($this->object->getId())))
196 {
197 $type->setDisabled(true);
198 }
199
200 $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE);
201 $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info"));
202 $type->addOption($fixed);
203
204 $none = new ilRadioOption($this->lng->txt("book_schedule_type_none"), ilObjBookingPool::TYPE_NO_SCHEDULE);
205 $none->setInfo($this->lng->txt("book_schedule_type_none_info"));
206 $type->addOption($none);
207
208 $limit = new ilNumberInputGUI($this->lng->txt("book_overall_limit"), "limit");
209 $limit->setSize(4);
210 $limit->setMinValue(1);
211 $limit->setInfo($this->lng->txt("book_overall_limit_info"));
212 $none->addSubItem($limit);
213
214 $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
215 $public->setInfo($this->lng->txt("book_public_log_info"));
216 $a_form->addItem($public);
217
218 $period = new ilNumberInputGUI($this->lng->txt("book_reservation_filter_period"), "period");
219 $period->setInfo($this->lng->txt("book_reservation_filter_period_info"));
220 $period->setSuffix($this->lng->txt("days"));
221 $period->setSize(3);
222 $period->setMinValue(0);
223 $a_form->addItem($period);
224
225 // additional features
226 $feat = new ilFormSectionHeaderGUI();
227 $feat->setTitle($this->lng->txt('obj_features'));
228 $a_form->addItem($feat);
229
230 }
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type
This class represents a checkbox property in a property form.
addItem($a_item)
Add Item (Property, SectionHeader).
This class represents a property in a property form.
This class represents an option in a radio group.

References ilPropertyFormGUI\addItem(), ilBookingObject\getList(), ilObjBookingPool\TYPE_FIX_SCHEDULE, and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ logDetailsObject()

ilObjBookingPoolGUI::logDetailsObject ( )

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

1257 {
1258 global $tpl;
1259
1260 $this->tabs_gui->clearTargets();
1261 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
1262 $this->ctrl->getLinkTarget($this, "log"));
1263
1264 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1265
1266 $filter = null;
1267 if($_GET["object_id"])
1268 {
1269 $filter["object"] = (int)$_GET["object_id"];
1270 }
1271
1272 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1273 $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1274 $this->object->getId(), $show_all,
1275 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1276 $filter, $_GET["reservation_id"]);
1277 $tpl->setContent($table->getHTML());
1278 }

References $_GET, ilObjectGUI\$tpl, ilObjectGUI\checkPermissionBool(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ logObject()

ilObjBookingPoolGUI::logObject ( )

List reservations.

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

1235 {
1236 global $tpl;
1237
1238 $this->tabs_gui->setTabActive('log');
1239
1240 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1241
1242 $filter = null;
1243 if($_GET["object_id"])
1244 {
1245 $filter["object"] = (int)$_GET["object_id"];
1246 }
1247
1248 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1249 $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1250 $this->object->getId(), $show_all,
1251 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1252 $filter);
1253 $tpl->setContent($table->getHTML());
1254 }

References $_GET, ilObjectGUI\$tpl, ilObjectGUI\checkPermissionBool(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

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

+ Here is the call graph for this function:
+ 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 1189 of file class.ilObjBookingPoolGUI.php.

1190 {
1191 global $ilUser;
1192
1193 // #11995
1194 $this->checkPermission('read');
1195
1196 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1197 $reservation = new ilBookingReservation();
1198 $reservation->setObjectId($a_object_id);
1199 $reservation->setUserId($ilUser->getID());
1200 $reservation->setFrom($a_from);
1201 $reservation->setTo($a_to);
1202 $reservation->setGroupId($a_group_id);
1203 $reservation->save();
1204
1205 if($a_from)
1206 {
1207 $this->lng->loadLanguageModule('dateplaner');
1208 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
1209 include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1210 $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK,$ilUser->getId(),$this->lng->txt('cal_ch_personal_book'),true);
1211
1212 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1213 $object = new ilBookingObject($a_object_id);
1214
1215 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1216 $entry = new ilCalendarEntry;
1217 $entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
1218 $entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
1219 $entry->setTitle($this->lng->txt('book_cal_entry').' '.$object->getTitle());
1220 $entry->setContextId($reservation->getId());
1221 $entry->save();
1222
1223 include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1224 $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1225 $assignment->addAssignment($def_cat->getCategoryId());
1226 }
1227
1228 return $reservation->getId();
1229 }
Model for a calendar entry.
setStart($a_start)
@access public
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.

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

Referenced by confirmedBookingNumbersObject(), and confirmedBookingObject().

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

393 {
394 global $ilUser;
395
396 // fix
397 if(!$schedule->getRaster())
398 {
399 $mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager');
400
401 $mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
402 $mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title'));
403 $mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info'));
404 $mytpl->setVariable('TXT_OBJECT', $title);
405 $mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking'));
406 $mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel'));
407
408 include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
409
410 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
411
412 $morning_aggr = $user_settings->getDayStart();
413 $evening_aggr = $user_settings->getDayEnd();
414 $hours = array();
415 for($i = $morning_aggr;$i <= $evening_aggr;$i++)
416 {
417 switch($user_settings->getTimeFormat())
418 {
420 if ($morning_aggr > 0 && $i == $morning_aggr)
421 {
422 $hours[$i] = sprintf('%02d:00',0)."-";
423 }
424 $hours[$i].= sprintf('%02d:00',$i);
425 if ($evening_aggr < 23 && $i == $evening_aggr)
426 {
427 $hours[$i].= "-".sprintf('%02d:00',23);
428 }
429 break;
430
432 if ($morning_aggr > 0 && $i == $morning_aggr)
433 {
434 $hours[$i] = date('h a',mktime(0,0,0,1,1,2000))."-";
435 }
436 $hours[$i].= date('h a',mktime($i,0,0,1,1,2000));
437 if ($evening_aggr < 23 && $i == $evening_aggr)
438 {
439 $hours[$i].= "-".date('h a',mktime(23,0,0,1,1,2000));
440 }
441 break;
442 }
443 }
444
445 if(isset($_GET['seed']))
446 {
447 $find_first_open = false;
448 $seed = new ilDate($_GET['seed'], IL_CAL_DATE);
449 }
450 else
451 {
452 $find_first_open = true;
453 $seed = isset($_GET['sseed'])
454 ? new ilDate($_GET['sseed'], IL_CAL_DATE)
455 : new ilDate(time(), IL_CAL_UNIX);
456 }
457
458 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
459 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
460 $week_start = $user_settings->getWeekStart();
461
462 if(!$find_first_open)
463 {
464 $dates = array();
465 $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
466 }
467 else
468 {
469 $dates = array();
470
471 //loop for 1 week
472 $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
473
474 // find first open slot
475 if(!$has_open_slot)
476 {
477 // 1 year is limit for search
478 $limit = clone($seed);
479 $limit->increment(ilDate::YEAR, 1);
480 $limit = $limit->get(IL_CAL_UNIX);
481
482 while(!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit)
483 {
484 $seed->increment(ilDate::WEEK, 1);
485
486 $dates = array();
487 $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
488 }
489 }
490 }
491
492 include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
493 $navigation = new ilCalendarHeaderNavigationGUI($this,$seed,ilDateTime::WEEK,'book');
494 $mytpl->setVariable('NAVIGATION', $navigation->getHTML());
495
496 foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
497 {
498 $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
499
500 $mytpl->setCurrentBlock('weekdays');
501 $mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil:: _numericDayToString($date_info['wday']));
502 $mytpl->setVariable('TXT_DATE', $date_info['mday'].' '.ilCalendarUtil:: _numericMonthToString($date_info['mon']));
503 $mytpl->parseCurrentBlock();
504 }
505
506 include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
507 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
508 $color = array();
510 for($loop = 0; $loop < 7; $loop++)
511 {
512 $col = $all[$loop];
514 $color[$loop+1] = 'border-bottom: 1px solid '.$col.'; background-color: '.$col.'; color: '.$fnt;
515 }
516
517 $counter = 0;
518 foreach($dates as $hour => $days)
519 {
520 $caption = $days;
521 $caption = array_shift($caption);
522
523 for($loop = 1; $loop < 8; $loop++)
524 {
525 if(!isset($days[$loop]))
526 {
527 $mytpl->setCurrentBlock('dates');
528 $mytpl->setVariable('DUMMY', '&nbsp;');
529 $mytpl->parseCurrentBlock();
530 }
531 else
532 {
533 if(isset($days[$loop]['captions']))
534 {
535 foreach($days[$loop]['captions'] as $slot_id => $slot_caption)
536 {
537 $mytpl->setCurrentBlock('choice');
538 $mytpl->setVariable('TXT_DATE', $slot_caption);
539 $mytpl->setVariable('VALUE_DATE', $slot_id);
540 $mytpl->setVariable('DATE_COLOR', $color[$loop]);
541 $mytpl->setVariable('TXT_AVAILABLE',
542 sprintf($this->lng->txt('book_reservation_available'),
543 $days[$loop]['available'][$slot_id]));
544 $mytpl->parseCurrentBlock();
545 }
546
547 $mytpl->setCurrentBlock('dates');
548 $mytpl->setVariable('DUMMY', '');
549 $mytpl->parseCurrentBlock();
550 }
551 else if(isset($days[$loop]['in_slot']))
552 {
553 $mytpl->setCurrentBlock('dates');
554 $mytpl->setVariable('DATE_COLOR', $color[$loop]);
555 $mytpl->parseCurrentBlock();
556 }
557 else
558 {
559 $mytpl->setCurrentBlock('dates');
560 $mytpl->setVariable('DUMMY', '&nbsp;');
561 $mytpl->parseCurrentBlock();
562 }
563 }
564 }
565
566 $mytpl->setCurrentBlock('slots');
567 $mytpl->setVariable('TXT_HOUR', $caption);
568 if($counter%2)
569 {
570 $mytpl->setVariable('CSS_ROW', 'tblrow1');
571 }
572 else
573 {
574 $mytpl->setVariable('CSS_ROW', 'tblrow2');
575 }
576 $mytpl->parseCurrentBlock();
577
578 $counter++;
579 }
580 }
581 // flexible
582 else
583 {
584 // :TODO: inactive for now
585 }
586
587 return $mytpl->get();
588 }
getRaster()
Get booking raster.
static _getColorsByType($a_type)
get selectable colors
static _numericDayToString($a_day, $a_long=true)
get
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
special template class to simplify handling of ITX/PEAR

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

Referenced by bookObject().

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

1323 {
1324 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1325
1326 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1327 $table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id,
1328 $this->object->getId(), $show_all,
1329 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE));
1330 $table->resetOffset();
1331 $table->resetFilter();
1332 $this->logObject();
1333 }

References ilObjectGUI\checkPermissionBool(), logObject(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ rsvCancelObject()

ilObjBookingPoolGUI::rsvCancelObject ( )

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

1608 {
1609 global $ilUser, $tpl, $lng, $ilCtrl;
1610
1611 $ids = $_POST["rsv_id"];
1612
1613 // parse aggregation form
1614 if($_POST["rsv_aggr"])
1615 {
1616 $form = $this->rsvConfirmCancelAggregationForm($_POST["rsv_aggr"]);
1617 if(!$form->checkInput())
1618 {
1619 $this->tabs_gui->clearTargets();
1620 $this->tabs_gui->setBackTarget($lng->txt("back"),
1621 $ilCtrl->getLinkTarget($this, "log"));
1622
1623 return $tpl->setContent($form->getHTML());
1624 }
1625
1626 $ids = array();
1627 foreach($_POST["rsv_aggr"] as $idx => $aggr_ids)
1628 {
1629 $max = (int)$_POST["rsv_id_".$idx];
1630 if($max)
1631 {
1632 if(!is_array($aggr_ids))
1633 {
1634 $ids[] = $aggr_ids;
1635 }
1636 else
1637 {
1638 $aggr_ids = array_slice($aggr_ids, 0, $max);
1639 $ids = array_merge($ids, $aggr_ids);
1640 }
1641 }
1642 }
1643 }
1644
1645 if($ids)
1646 {
1647 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1648 foreach($ids as $id)
1649 {
1650 $obj = new ilBookingReservation($id);
1651
1652 if (!$this->checkPermissionBool("write") && $obj->getUserId() != $ilUser->getId())
1653 {
1654 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1655 $this->ctrl->redirect($this, 'log');
1656 }
1657
1659 $obj->update();
1660
1661 if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1662 {
1663 // remove user calendar entry (#11086)
1664 $cal_entry_id = $obj->getCalendarEntry();
1665 if($cal_entry_id)
1666 {
1667 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1668 $entry = new ilCalendarEntry($cal_entry_id);
1669 $entry->delete();
1670 }
1671 }
1672 }
1673 }
1674
1675 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1676 $this->logObject();
1677 }

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

+ Here is the call graph for this function:

◆ rsvConfirmCancelAggregationForm()

ilObjBookingPoolGUI::rsvConfirmCancelAggregationForm (   $a_ids)

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

1515 {
1516 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1517 $form = new ilPropertyFormGUI();
1518 $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
1519 $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
1520
1521 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1522 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1523
1525
1526 foreach($a_ids as $idx => $ids)
1527 {
1528 if(is_array($ids))
1529 {
1530 $first = $ids;
1531 $first = array_shift($first);
1532 }
1533 else
1534 {
1535 $first = $ids;
1536 }
1537
1538 $rsv = new ilBookingReservation($first);
1539 $obj = new ilBookingObject($rsv->getObjectId());
1540
1541 $caption = $obj->getTitle().", ".ilDatePresentation::formatPeriod(
1542 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1543 new ilDateTime($rsv->getTo()+1, IL_CAL_UNIX));
1544
1545 // #17869
1546 if(is_array($ids))
1547 {
1548 $caption .= " (".sizeof($ids).")";
1549 }
1550
1551 $item = new ilNumberInputGUI($caption, "rsv_id_".$idx);
1552 $item->setRequired(true);
1553 $item->setMinValue(0);
1554 $item->setSize(4);
1555 $form->addItem($item);
1556
1557 if(is_array($ids))
1558 {
1559 $item->setMaxValue(sizeof($ids));
1560
1561 foreach($ids as $id)
1562 {
1563 $hidden = new ilHiddenInputGUI("rsv_aggr[".$idx."][]");
1564 $hidden->setValue($id);
1565 $form->addItem($hidden);
1566 }
1567 }
1568 else
1569 {
1570 $item->setMaxValue(1);
1571
1572 $hidden = new ilHiddenInputGUI("rsv_aggr[".$idx."]");
1573 $hidden->setValue($ids);
1574 $form->addItem($hidden);
1575 }
1576
1577 if($_POST["rsv_id_".$idx])
1578 {
1579 $item->setValue((int)$_POST["rsv_id_".$idx]);
1580 }
1581 }
1582
1583 $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
1584 $form->addCommandButton("log", $this->lng->txt("cancel"));
1585
1586 return $form;
1587 }
static setUseRelativeDates($a_status)
set use relative dates

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

Referenced by rsvCancelObject(), and rsvConfirmCancelAggregationObject().

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

1590 {
1591 global $tpl, $ilCtrl, $lng;
1592
1593 $this->tabs_gui->clearTargets();
1594 $this->tabs_gui->setBackTarget($lng->txt("back"),
1595 $ilCtrl->getLinkTarget($this, "log"));
1596
1597 $this->setHelpId("cancel_booking");
1598
1599 // #13511
1600 ilUtil::sendQuestion($lng->txt("book_confirm_cancel"));
1601
1602 $form = $this->rsvConfirmCancelAggregationForm($a_ids);
1603
1604 $tpl->setContent($form->getHTML());
1605 }
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.

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

Referenced by rsvConfirmCancelObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rsvConfirmCancelObject()

ilObjBookingPoolGUI::rsvConfirmCancelObject ( )

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

1419 {
1420 global $ilCtrl, $lng, $tpl, $ilUser;
1421
1422 $ids = $this->getLogReservationIds();
1423 if(!sizeof($ids))
1424 {
1425 $this->ctrl->redirect($this, 'log');
1426 }
1427
1428 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1429 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1430
1431 $max = array();
1432 foreach($ids as $idx => $id)
1433 {
1434 if(!is_numeric($id))
1435 {
1436 list($obj_id, $user_id, $from, $to) = explode("_", $id);
1437
1438 $valid_ids = array();
1439 foreach(ilBookingObject::getList($this->object->getId()) as $item)
1440 {
1441 $valid_ids[$item["booking_object_id"]] = $item["title"];
1442 }
1443
1444 if(($this->checkPermissionBool("write") || $user_id == $ilUser->getId()) &&
1445 $from > time() &&
1446 in_array($obj_id, array_keys($valid_ids)))
1447 {
1448 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
1449 if(!sizeof($rsv_ids))
1450 {
1451 unset($ids[$idx]);
1452 }
1453 if(sizeof($rsv_ids) > 1)
1454 {
1455 $max[$id] = sizeof($rsv_ids);
1456 $ids[$idx] = $rsv_ids;
1457 }
1458 else
1459 {
1460 // only 1 in group? treat as normal reservation
1461 $ids[$idx] = array_shift($rsv_ids);
1462 }
1463 }
1464 else
1465 {
1466 unset($ids[$idx]);
1467 }
1468 }
1469 }
1470
1471 if(!sizeof($ids))
1472 {
1473 $this->ctrl->redirect($this, 'log');
1474 }
1475
1476 // show form instead
1477 if(sizeof($max) && max($max) > 1)
1478 {
1479 return $this->rsvConfirmCancelAggregationObject($ids);
1480 }
1481
1482 $this->tabs_gui->clearTargets();
1483 $this->tabs_gui->setBackTarget($lng->txt("back"),
1484 $ilCtrl->getLinkTarget($this, "log"));
1485
1486 $this->setHelpId("cancel_booking");
1487
1488 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1489 $conf = new ilConfirmationGUI();
1490 $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
1491 $conf->setHeaderText($lng->txt('book_confirm_cancel'));
1492 $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
1493 $conf->setCancel($lng->txt('cancel'), 'log');
1494
1495 foreach($ids as $id)
1496 {
1497 $rsv = new ilBookingReservation($id);
1498 $obj = new ilBookingObject($rsv->getObjectId());
1499
1500 $details = $obj->getTitle();
1501 if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1502 {
1503 $details .= ", ".ilDatePresentation::formatPeriod(
1504 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1505 new ilDateTime($rsv->getTo()+1, IL_CAL_UNIX));
1506 }
1507
1508 $conf->addItem('rsv_id[]', $id, $details);
1509 }
1510
1511 $tpl->setContent($conf->getHTML());
1512 }
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
rsvConfirmCancelAggregationObject(array $a_ids=null)

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

+ Here is the call graph for this function:

◆ rsvInUseObject()

ilObjBookingPoolGUI::rsvInUseObject ( )

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

1680 {
1681 $this->checkPermission("write");
1682
1683 $ids = $this->getLogReservationIds();
1684 if($ids)
1685 {
1686 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1687 foreach($ids as $id)
1688 {
1689 $obj = new ilBookingReservation($id);
1690 $obj->setStatus(ilBookingReservation::STATUS_IN_USE);
1691 $obj->update();
1692 }
1693 }
1694
1695 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1696 $this->logObject();
1697 }

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

+ Here is the call graph for this function:

◆ rsvNotInUseObject()

ilObjBookingPoolGUI::rsvNotInUseObject ( )

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

1700 {
1701 $this->checkPermission("write");
1702
1703 $ids = $this->getLogReservationIds();
1704 if($ids)
1705 {
1706 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1707 foreach($ids as $id)
1708 {
1709 $obj = new ilBookingReservation($id);
1710 $obj->setStatus(NULL);
1711 $obj->update();
1712 }
1713 }
1714
1715 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1716 $this->logObject();
1717 }

References ilObjectGUI\checkPermission(), getLogReservationIds(), logObject(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setHelpId()

ilObjBookingPoolGUI::setHelpId (   $a_id)
protected

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

339 {
340 global $ilHelp;
341
342 $object_subtype = ($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
343 ? '-schedule'
344 : '-nonschedule';
345
346 $ilHelp->setScreenIdComponent('book');
347 $ilHelp->setScreenId('object'.$object_subtype);
348 $ilHelp->setSubScreenId($a_id);
349 }

References ilObjBookingPool\TYPE_FIX_SCHEDULE.

Referenced by bookObject(), rsvConfirmCancelAggregationObject(), and rsvConfirmCancelObject().

+ Here is the caller graph for this function:

◆ setTabs()

ilObjBookingPoolGUI::setTabs ( )

get tabs

Reimplemented from ilObjectGUI.

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

273 {
274 global $ilHelp, $ilUser;
275
276 if (in_array($this->ctrl->getCmd(), array("create", "save")) && !$this->ctrl->getNextClass())
277 {
278 return;
279 }
280
281 $ilHelp->setScreenIdComponent("book");
282
283 if ($this->checkPermissionBool('read'))
284 {
285 if($ilUser->getId() != ANONYMOUS_USER_ID)
286 {
287 $this->tabs_gui->addTab("render",
288 $this->lng->txt("book_booking_types"),
289 $this->ctrl->getLinkTarget($this, "render"));
290 }
291
292 $this->tabs_gui->addTab("info",
293 $this->lng->txt("info_short"),
294 $this->ctrl->getLinkTarget($this, "infoscreen"));
295
296 if($ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog())
297 {
298 $this->tabs_gui->addTab("log",
299 $this->lng->txt("book_log"),
300 $this->ctrl->getLinkTarget($this, "log"));
301 }
302 }
303
304 if ($this->checkPermissionBool('write'))
305 {
306 if($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
307 {
308 $this->tabs_gui->addTab("schedules",
309 $this->lng->txt("book_schedules"),
310 $this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render"));
311 }
312
313 $this->tabs_gui->addTab("settings",
314 $this->lng->txt("settings"),
315 $this->ctrl->getLinkTarget($this, "edit"));
316
317 // meta data
318 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
319 $mdgui = new ilObjectMetaDataGUI($this->object, "bobj");
320 $mdtab = $mdgui->getTab();
321 if($mdtab)
322 {
323 $this->tabs_gui->addTarget("meta_data",
324 $mdtab,
325 "",
326 "ilobjectmetadatagui");
327 }
328 }
329
330 if($this->checkPermissionBool('edit_permission'))
331 {
332 $this->tabs_gui->addTab("perm_settings",
333 $this->lng->txt("perm_settings"),
334 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
335 }
336 }

References $ilUser, ilObjectGUI\checkPermissionBool(), and ilObjBookingPool\TYPE_NO_SCHEDULE.

+ Here is the call graph for this function:

◆ showProfileObject()

ilObjBookingPoolGUI::showProfileObject ( )

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

1720 {
1721 global $tpl, $ilCtrl;
1722
1723 $this->tabs_gui->clearTargets();
1724
1725 $user_id = (int)$_GET['user_id'];
1726
1727 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1728 $profile = new ilPublicUserProfileGUI($user_id);
1729 $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
1730 $tpl->setContent($ilCtrl->getHTML($profile));
1731 }

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

◆ updateCustom()

ilObjBookingPoolGUI::updateCustom ( ilPropertyFormGUI  $a_form)
protected

Insert custom update form values into object.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

242 {
243 $this->object->setOffline(!$a_form->getInput('online'));
244 $this->object->setPublicLog($a_form->getInput('public'));
245 $this->object->setScheduleType($a_form->getInput('stype'));
246 $this->object->setOverallLimit($a_form->getInput('limit') ? $a_form->getInput('limit') : null);
247 $this->object->setReservationFilterPeriod(strlen($a_form->getInput('period')) ? (int)$a_form->getInput('period') : null);
248
249 include_once './Services/Container/classes/class.ilContainer.php';
250 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
252 $this->object->getId(),
253 $a_form,
255 );
256 }
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.

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

+ Here is the call graph for this function:

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