ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjBookingPoolGUI Class Reference

Class ilObjBookingPoolGUI. More...

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

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor.
 executeCommand ()
 main switch
 editObject ()
 edit object
 setTabs ()
 get tabs
 bookObject ()
 First step in booking process.
 confirmedBookingObject ()
 Book object - either of type or specific - for given dates.
 processBooking ($a_object_id, $a_from, $a_to)
 Book object for date.
 logObject ()
 List reservations.
 changeStatusObject ()
 Change status of given reservations.
 applyLogFilterObject ()
 Apply filter from reservations table gui.
 resetLogFilterObject ()
 Reset filter in reservations table gui.
 _goto ($a_target)
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed
 infoScreen ()
 rsvCancelObject ()
 rsvUncancelObject ()
 rsvInUseObject ()
 rsvNotInUseObject ()
 showProfileObject ()
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not)
 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
 getCreationMode ()
 get creation mode
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 getHTML ()
 undeleteObject ()
 Get objects back from trash.
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
 cancelDeleteObject ()
 cancel deletion of object
 removeFromSystemObject ()
 remove objects from trash bin and all entries therefore every object needs a specific deleteObject() method
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 createObject ()
 create new object form
 cancelCreation ()
 cancel create action and go back to repository parent
 saveObject ()
 save object
 updateObject ()
 updates object entry in object_data
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 isVisible ($a_ref_id, $a_type)
 viewObject ()
 list childs of current object
 deleteObject ($a_error=false)
 Display deletion confirmation screen.
 trashObject ()
 Show trash content of object.
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.
 copyWizardHasOptions ($a_mode)
 Check if there is any modules specific option.

Protected Member Functions

 initCreationForms ($a_new_type)
 Init creation froms.
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook.
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form.
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields.
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object.
 renderBookingByObject ($a_object_id)
 Render list of available dates for object.
 renderBookingByType ($a_type_id)
 Render list of available dates for type.
 renderList (ilBookingSchedule $schedule, array $object_ids, $title)
 buildDatesBySchedule ($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu.
 insertHeaderAction ($a_list_gui)
 Insert header action into main template.
 addHeaderAction ()
 Add header action menu.
 redrawHeaderActionObject ()
 Ajax call: redraw action header only.
 showUpperIcon ()
 setAdminTabs ()
 set admin tabs public
 setLocator ()
 set Locator
 omitLocator ($a_omit=true)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion)
 initCreateForm ($a_new_type)
 Init object creation form.
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types.
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates.
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen.
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position.
 initEditForm ()
 Init object edit form.
 getEditFormValues ()
 Get values for edit form.
 afterUpdate ()
 Post (successful) object update hook.
 initImportForm ($a_new_type)
 Init object import form.
 importFileObject ($parent_id=null)
 Import.
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook.
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g.
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste
 getTabs (&$tabs_gui)
 get tabs abstract method.
 __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
 __showClipboardTable ($a_result_set, $a_from="")
 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
 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.
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error.
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission.

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 $ilias
 $objDefinition
 $tpl
 $tree
 $lng
 $data
 $object
 $ref_id
 $obj_id
 $maxcount
 $formaction
 $return_location
 $target_frame
 $tab_target_script
 $actions
 $sub_objects
 $omit_locator = false
const CFORM_NEW = 1
const CFORM_IMPORT = 2
const CFORM_CLONE = 3

Detailed Description

Constructor & Destructor Documentation

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

{
$this->type = "book";
$this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
$this->lng->loadLanguageModule("book");
}

+ Here is the call graph for this function:

Member Function Documentation

ilObjBookingPoolGUI::_goto (   $a_target)

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

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

{
global $ilAccess, $ilErr, $lng;
if ($ilAccess->checkAccess("read", "", $a_target))
{
$_GET["cmd"] = "render";
$_GET["ref_id"] = $a_target;
include("repository.php");
}
else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
{
$_GET["cmd"] = "frameset";
$_GET["target"] = "";
$_GET["ref_id"] = ROOT_FOLDER_ID;
ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
include("repository.php");
}
$ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::addLocatorItems ( )

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

Reimplemented from ilObjectGUI.

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

References $_GET.

{
global $ilLocator;
if (is_object($this->object))
{
$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
}
}
ilObjBookingPoolGUI::afterSave ( ilObject  $a_new_object)
protected

Post (successful) object creation hook.

Parameters
ilObject$a_new_object

Reimplemented from ilObjectGUI.

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

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

{
$a_new_object->setOffline(true);
$a_new_object->setNumberOfSlots(4);
$a_new_object->update();
// always send a message
ilUtil::sendSuccess($this->lng->txt("book_pool_added"),true);
$this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
$this->ctrl->redirect($this, "edit");
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::applyLogFilterObject ( )

Apply filter from reservations table gui.

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

References logObject().

{
include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
$table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id);
$table->resetOffset();
$table->writeFilterToSession();
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::bookObject ( )

First step in booking process.

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

References $_GET, renderBookingByObject(), and renderBookingByType().

Referenced by confirmedBookingObject().

{
$this->tabs_gui->clearTargets();
$this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
if(isset($_GET['object_id']))
{
$this->ctrl->setParameter($this, 'object_id', (int)$_GET['object_id']);
$this->renderBookingByObject((int)$_GET['object_id']);
}
else
{
$this->ctrl->setParameter($this, 'type_id', (int)$_GET['type_id']);
$this->renderBookingByType((int)$_GET['type_id']);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $in, ilCalendarUtil\_buildWeekDayList(), ilDatePresentation\formatDate(), ilBookingReservation\getAvailableObject(), IL_CAL_FKT_GETDATE, and IL_CAL_UNIX.

Referenced by renderList().

{
$map = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
$definition = $schedule->getDefinition();
$has_open_slot = false;
foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
{
$date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
$slots = array();
if(isset($definition[$map[$date_info['isoday']-1]]))
{
$slots = array();
foreach($definition[$map[$date_info['isoday']-1]] as $slot)
{
$slot = explode('-', $slot);
$slots[] = array('from'=>str_replace(':', '', $slot[0]),
'to'=>str_replace(':', '', $slot[1]));
}
}
$last = array_pop(array_keys($hours));
$slot_captions = array();
foreach($hours as $hour => $period)
{
$dates[$hour][0] = $period;
$period = explode("-", $period);
if(sizeof($period) == 1)
{
$period_from = (int)substr($period[0], 0, 2)."00";
$period_to = (int)substr($period[0], 0, 2)."59";
}
else
{
$period_from = (int)substr($period[0], 0, 2)."00";
$period_to = (int)substr($period[1], 0, 2)."59";
}
$column = $date_info['isoday'];
if(!$week_start)
{
if($column < 7)
{
$column++;
}
else
{
$column = 1;
}
}
if(sizeof($slots))
{
$in = false;
foreach($slots as $slot)
{
$slot_from = mktime(substr($slot['from'], 0, 2), substr($slot['from'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
$slot_to = mktime(substr($slot['to'], 0, 2), substr($slot['to'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
// check deadline
if($slot_from < (time()+$schedule->getDeadline()*60*60) || !ilBookingReservation::getAvailableObject($object_ids, $slot_from, $slot_to-1))
{
continue;
}
// is slot active in current hour?
if((int)$slot['from'] <= $period_to && (int)$slot['to'] >= $period_from)
{
$from = array_pop(explode(' ', $from));
$to = array_pop(explode(' ', $to));
// show caption (first hour) of slot
$id = $slot_from.'_'.$slot_to;
if(!in_array($id, $slot_captions))
{
$dates[$hour][$column]['captions'][$id] = $from.'-'.$to;
$slot_captions[] = $id;
}
$in = true;
}
}
// (any) active slot
if($in)
{
$has_open_slot = true;
$dates[$hour][$column]['in_slot'] = $in;
}
}
}
}
return $has_open_slot;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBookingPoolGUI::changeStatusObject ( )

Change status of given reservations.

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

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

{
global $ilAccess;
$this->tabs_gui->setTabActive('log');
if(!$_POST['reservation_id'])
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $this->logObject();
}
if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
{
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
ilBookingReservation::changeStatus($_POST['reservation_id'], (int)$_POST['tstatus']);
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
return $this->ctrl->redirect($this, 'log');
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::confirmedBookingObject ( )

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

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

References $_GET, $_POST, ilObjectGUI\$obj_id, $success, bookObject(), ilBookingReservation\getAvailableObject(), ilBookingObject\getList(), processBooking(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilUser;
if(!isset($_POST['date']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $this->bookObject();
}
$success = false;
// single object reservation(s)
if(isset($_GET['object_id']))
{
foreach($_POST['date'] as $date)
{
$fromto = explode('_', $date);
$fromto[1]--;
$object_id = (int)$_GET['object_id'];
if($object_id)
{
$this->processBooking($object_id, $fromto[0], $fromto[1]);
$success = true;
}
}
}
// group object reservation(s)
else
{
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$all_object_ids = array();
foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
{
$all_object_ids[] = $item['booking_object_id'];
}
$possible_objects = $counter = array();
sort($_POST['date']);
foreach($_POST['date'] as $date)
{
$fromto = explode('_', $date);
$fromto[1]--;
$possible_objects[$date] = ilBookingReservation::getAvailableObject($all_object_ids, $fromto[0], $fromto[1], false);
foreach($possible_objects[$date] as $obj_id)
{
$counter[$obj_id]++;
}
}
if(max($counter))
{
// we prefer the objects which are available for most slots
arsort($counter);
$counter = array_keys($counter);
// book each slot
foreach($possible_objects as $date => $available_ids)
{
$fromto = explode('_', $date);
$fromto[1]--;
// find "best" object for slot
foreach($counter as $best_object_id)
{
if(in_array($best_object_id, $available_ids))
{
$object_id = $best_object_id;
break;
}
}
$this->processBooking($object_id, $fromto[0], $fromto[1]);
$success = true;
}
}
}
{
ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
$this->ctrl->redirect($this, 'render');
}
else
{
ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
$this->ctrl->redirect($this, 'book');
}
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::editObject ( )

edit object

public

Reimplemented from ilObjectGUI.

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

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

{
// if we have no schedules yet - show info
include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
if(!sizeof(ilBookingSchedule::getList($this->object->getId())))
{
ilUtil::sendInfo($this->lng->txt("book_schedule_warning_edit"));
}
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::executeCommand ( )

main switch

Reimplemented from ilObjectGUI.

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

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

{
global $tpl, $ilTabs, $ilNavigationHistory;
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
if(!$next_class && $cmd == 'render')
{
$this->ctrl->setCmdClass('ilBookingTypeGUI');
$next_class = $this->ctrl->getNextClass($this);
}
if(substr($cmd, 0, 4) == 'book')
{
$next_class = '';
}
$ilNavigationHistory->addItem($this->ref_id,
"./goto.php?target=book_".$this->ref_id, "book");
$this->prepareOutput();
switch($next_class)
{
case 'ilpermissiongui':
$this->tabs_gui->setTabActive('perm_settings');
include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
$perm_gui =& new ilPermissionGUI($this);
$ret =& $this->ctrl->forwardCommand($perm_gui);
break;
case 'ilbookingtypegui':
$this->tabs_gui->setTabActive('render');
include_once("Modules/BookingManager/classes/class.ilBookingTypeGUI.php");
$type_gui =& new ilBookingTypeGUI($this);
$ret =& $this->ctrl->forwardCommand($type_gui);
break;
case 'ilbookingobjectgui':
$this->tabs_gui->setTabActive('render');
include_once("Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
$object_gui =& new ilBookingObjectGUI($this);
$ret =& $this->ctrl->forwardCommand($object_gui);
break;
case 'ilbookingschedulegui':
$this->tabs_gui->setTabActive('schedules');
include_once("Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
$schedule_gui =& new ilBookingScheduleGUI($this);
$ret =& $this->ctrl->forwardCommand($schedule_gui);
break;
case 'ilpublicuserprofilegui':
$ilTabs->clearTargets();
include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
$profile = new ilPublicUserProfileGUI((int)$_GET["user_id"]);
$profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
$ret = $this->ctrl->forwardCommand($profile);
$tpl->setContent($ret);
break;
case 'ilinfoscreengui':
$this->infoScreen();
break;
case "ilcommonactiondispatchergui":
include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
$this->ctrl->forwardCommand($gui);
break;
default:
$cmd = $this->ctrl->getCmd();
$cmd .= 'Object';
$this->$cmd();
break;
}
$this->addHeaderAction();
return true;
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::getEditFormCustomValues ( array &  $a_values)
protected

Add values to custom edit fields.

Parameters
array$a_values

Reimplemented from ilObjectGUI.

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

{
$a_values["online"] = !$this->object->isOffline();
$a_values["public"] = $this->object->hasPublicLog();
$a_values["slots"] = $this->object->getNumberOfSlots();
}
ilObjBookingPoolGUI::infoScreen ( )

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

References $_GET, and $ilCtrl.

Referenced by executeCommand(), and infoScreenObject().

{
global $ilAccess, $ilCtrl;
$this->tabs_gui->setTabActive('info');
if (!$ilAccess->checkAccess("visible", "", $this->ref_id))
{
$this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
}
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI($this);
$info->enablePrivateNotes();
if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
{
$info->enableNews();
}
// no news editing for files, just notifications
$info->enableNewsEditing(false);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
{
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
if ($enable_internal_rss)
{
$info->setBlockProperty("news", "settings", true);
$info->setBlockProperty("news", "public_notifications_option", true);
}
}
// forward the command
if ($ilCtrl->getNextClass() == "ilinfoscreengui")
{
$ilCtrl->forwardCommand($info);
}
else
{
return $ilCtrl->getHTML($info);
}
}

+ Here is the caller graph for this function:

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

References infoScreen().

{
$this->ctrl->setCmd("showSummary");
$this->ctrl->setCmdClass("ilinfoscreengui");
$this->infoScreen();
}

+ Here is the call graph for this function:

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

References ilObjectGUI\initCreateForm().

{
return array(self::CFORM_NEW => $this->initCreateForm($a_new_type));
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::initEditCustomForm ( ilPropertyFormGUI  $a_form)
protected

Add custom fields to update form.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

References ilPropertyFormGUI\addItem(), ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

{
$online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
$a_form->addItem($online);
$public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
$public->setInfo($this->lng->txt("book_public_log_info"));
$a_form->addItem($public);
$slots = new ilNumberInputGUI($this->lng->txt("book_slots_no"), "slots");
$slots->setRequired(true);
$slots->setSize(4);
$slots->setMinValue(1);
$slots->setMaxValue(24);
$slots->setInfo($this->lng->txt("book_slots_no_info"));
$a_form->addItem($slots);
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::logObject ( )

List reservations.

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

References ilObjectGUI\$tpl.

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

{
global $tpl;
$this->tabs_gui->setTabActive('log');
include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
$table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id);
$tpl->setContent($table->getHTML());
}

+ Here is the caller graph for this function:

ilObjBookingPoolGUI::processBooking (   $a_object_id,
  $a_from,
  $a_to 
)

Book object for date.

Parameters
int$a_object_id
int$a_fromtimestamp
int$a_totimestamp

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

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

Referenced by confirmedBookingObject().

{
global $ilUser;
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$reservation = new ilBookingReservation();
$reservation->setObjectId($a_object_id);
$reservation->setUserId($ilUser->getID());
$reservation->setFrom($a_from);
$reservation->setTo($a_to);
$reservation->save();
$this->lng->loadLanguageModule('dateplaner');
include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
$def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK,$ilUser->getId(),$this->lng->txt('cal_ch_personal_book'),true);
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$object = new ilBookingObject($a_object_id);
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
$entry = new ilCalendarEntry;
$entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
$entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
$entry->setTitle($this->lng->txt('book_cal_entry').' '.$object->getTitle());
$entry->setContextId($reservation->getId());
$entry->save();
include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
$assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
$assignment->addAssignment($def_cat->getCategoryId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBookingPoolGUI::renderBookingByObject (   $a_object_id)
protected

Render list of available dates for object.

Parameters
int$a_object_id

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

References ilObjectGUI\$tpl, and renderList().

Referenced by bookObject().

{
global $tpl;
$this->lng->loadLanguageModule("dateplaner");
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
$obj = new ilBookingObject($a_object_id);
$schedule = new ilBookingSchedule($obj->getScheduleId());
$tpl->setContent($this->renderList($schedule, array($a_object_id), $obj->getTitle()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBookingPoolGUI::renderBookingByType (   $a_type_id)
protected

Render list of available dates for type.

Parameters
int$a_type_id

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

References ilObjectGUI\$tpl, ilBookingObject\getList(), ilBookingSchedule\getTitle(), and renderList().

Referenced by bookObject().

{
global $tpl;
$this->lng->loadLanguageModule("dateplaner");
include_once 'Modules/BookingManager/classes/class.ilBookingType.php';
include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$type = new ilBookingType($a_type_id);
$schedule = new ilBookingSchedule($type->getScheduleId());
$object_ids = array();
foreach(ilBookingObject::getList($a_type_id) as $item)
{
$object_ids[] = $item['booking_object_id'];
}
$tpl->setContent($this->renderList($schedule, $object_ids, $type->getTitle()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

References $_GET, $title, 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 renderBookingByObject(), and renderBookingByType().

{
global $ilUser;
// fix
if(!$schedule->getRaster())
{
$mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager');
$mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
$mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title'));
$mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info'));
$mytpl->setVariable('TXT_OBJECT', $title);
$mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking'));
$mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel'));
include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
$user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
$morning_aggr = $user_settings->getDayStart();
$evening_aggr = $user_settings->getDayEnd();
$hours = array();
for($i = $morning_aggr;$i <= $evening_aggr;$i++)
{
switch($user_settings->getTimeFormat())
{
if ($morning_aggr > 0 && $i == $morning_aggr)
{
$hours[$i] = sprintf('%02d:00',0)."-";
}
$hours[$i].= sprintf('%02d:00',$i);
if ($evening_aggr < 23 && $i == $evening_aggr)
{
$hours[$i].= "-".sprintf('%02d:00',23);
}
break;
if ($morning_aggr > 0 && $i == $morning_aggr)
{
$hours[$i] = date('h a',mktime(0,0,0,1,1,2000))."-";
}
$hours[$i].= date('h a',mktime($i,0,0,1,1,2000));
if ($evening_aggr < 23 && $i == $evening_aggr)
{
$hours[$i].= "-".date('h a',mktime(23,0,0,1,1,2000));
}
break;
}
}
if(isset($_GET['seed']))
{
$find_first_open = false;
$seed = new ilDate($_GET['seed'], IL_CAL_DATE);
}
else
{
$find_first_open = true;
$seed = new ilDate(time(), IL_CAL_UNIX);
}
include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$week_start = $user_settings->getWeekStart();
if(!$find_first_open)
{
$dates = array();
$this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
}
else
{
$dates = array();
$has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
// find first open slot
if(!$has_open_slot)
{
// 1 year is limit for search
$limit = clone($seed);
$limit->increment(ilDate::YEAR, 1);
$limit = $limit->get(IL_CAL_UNIX);
while(!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit)
{
$seed->increment(ilDate::WEEK, 1);
$dates = array();
$has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
}
}
}
include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
$navigation = new ilCalendarHeaderNavigationGUI($this,$seed,ilDateTime::WEEK,'book');
$mytpl->setVariable('NAVIGATION', $navigation->getHTML());
foreach(ilCalendarUtil::_buildWeekDayList($seed,$week_start)->get() as $date)
{
$date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
$mytpl->setCurrentBlock('weekdays');
$mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil:: _numericDayToString($date_info['wday']));
$mytpl->setVariable('TXT_DATE', $date_info['mday'].' '.ilCalendarUtil:: _numericMonthToString($date_info['mon']));
$mytpl->parseCurrentBlock();
}
include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
$color = array();
for($loop = 0; $loop < 7; $loop++)
{
$col = $all[$loop];
$color[$loop+1] = 'border-bottom: 1px solid '.$col.'; background-color: '.$col.'; color: '.$fnt;
}
$counter = 0;
foreach($dates as $hour => $days)
{
$caption = $days;
$caption = array_shift($caption);
for($loop = 1; $loop < 8; $loop++)
{
if(!isset($days[$loop]))
{
$mytpl->setCurrentBlock('dates');
$mytpl->setVariable('DUMMY', '&nbsp;');
$mytpl->parseCurrentBlock();
}
else
{
if(isset($days[$loop]['captions']))
{
foreach($days[$loop]['captions'] as $slot_id => $slot_caption)
{
$mytpl->setCurrentBlock('choice');
$mytpl->setVariable('TXT_DATE', $slot_caption);
$mytpl->setVariable('VALUE_DATE', $slot_id);
$mytpl->setVariable('DATE_COLOR', $color[$loop]);
$mytpl->parseCurrentBlock();
}
$mytpl->setCurrentBlock('dates');
$mytpl->setVariable('DUMMY', '');
$mytpl->parseCurrentBlock();
}
else if(isset($days[$loop]['in_slot']))
{
$mytpl->setCurrentBlock('dates');
$mytpl->setVariable('DATE_COLOR', $color[$loop]);
$mytpl->parseCurrentBlock();
}
else
{
$mytpl->setCurrentBlock('dates');
$mytpl->setVariable('DUMMY', '&nbsp;');
$mytpl->parseCurrentBlock();
}
}
}
$mytpl->setCurrentBlock('slots');
$mytpl->setVariable('TXT_HOUR', $caption);
if($counter%2)
{
$mytpl->setVariable('CSS_ROW', 'tblrow1');
}
else
{
$mytpl->setVariable('CSS_ROW', 'tblrow2');
}
$mytpl->parseCurrentBlock();
$counter++;
}
}
// flexible
else
{
// :TODO: inactive for now
}
return $mytpl->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBookingPoolGUI::resetLogFilterObject ( )

Reset filter in reservations table gui.

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

References logObject().

{
include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
$table = new ilBookingReservationsTableGUI($this, 'log', $this->ref_id);
$table->resetOffset();
$table->resetFilter();
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::rsvCancelObject ( )

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

References $_GET, logObject(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilBookingReservation\STATUS_CANCELLED.

{
global $ilAccess, $ilUser;
$this->tabs_gui->setTabActive('log');
$id = (int)$_GET['reservation_id'];
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$obj = new ilBookingReservation($id);
if (!$ilAccess->checkAccess("write", "", $this->ref_id) && $obj->getUserId() != $ilUser->getId())
{
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirect($this, 'log');
}
$obj->update();
// remove user calendar entry (#11086)
$cal_entry_id = $obj->getCalendarEntry();
if($cal_entry_id)
{
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
$entry = new ilCalendarEntry($cal_entry_id);
$entry->delete();
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::rsvInUseObject ( )

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

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

{
global $ilAccess;
$this->tabs_gui->setTabActive('log');
if (!$ilAccess->checkAccess("write", "", $this->ref_id))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirect($this, 'log');
}
$id = (int)$_GET['reservation_id'];
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$obj = new ilBookingReservation($id);
$obj->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::rsvNotInUseObject ( )

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

References $_GET, logObject(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilAccess;
$this->tabs_gui->setTabActive('log');
if (!$ilAccess->checkAccess("write", "", $this->ref_id))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirect($this, 'log');
}
$id = (int)$_GET['reservation_id'];
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$obj = new ilBookingReservation($id);
$obj->setStatus(NULL);
$obj->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::rsvUncancelObject ( )

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

References $_GET, logObject(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

{
global $ilAccess;
$this->tabs_gui->setTabActive('log');
if (!$ilAccess->checkAccess("write", "", $this->ref_id))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
$this->ctrl->redirect($this, 'log');
}
$id = (int)$_GET['reservation_id'];
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$obj = new ilBookingReservation($id);
$obj->setStatus(NULL);
$obj->update();
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::setTabs ( )

get tabs

Reimplemented from ilObjectGUI.

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

{
global $ilAccess;
if (in_array($this->ctrl->getCmd(), array("create", "save")) && !$this->ctrl->getNextClass())
{
return;
}
$this->tabs_gui->addTab("render",
$this->lng->txt("book_booking_types"),
$this->ctrl->getLinkTarget($this, "render"));
$this->tabs_gui->addTab("info",
$this->lng->txt("info_short"),
$this->ctrl->getLinkTarget($this, "infoscreen"));
if ($ilAccess->checkAccess('write', '', $this->object->getRefId()) ||
$this->object->hasPublicLog())
{
$this->tabs_gui->addTab("log",
$this->lng->txt("book_log"),
$this->ctrl->getLinkTarget($this, "log"));
}
if ($ilAccess->checkAccess('write', '', $this->object->getRefId()))
{
$this->tabs_gui->addTab("schedules",
$this->lng->txt("book_schedules"),
$this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render"));
$this->tabs_gui->addTab("settings",
$this->lng->txt("settings"),
$this->ctrl->getLinkTarget($this, "edit"));
}
if($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
{
$this->tabs_gui->addTab("perm_settings",
$this->lng->txt("perm_settings"),
$this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
}
}
ilObjBookingPoolGUI::showProfileObject ( )

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

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

{
global $tpl, $ilCtrl;
$this->tabs_gui->clearTargets();
$user_id = (int)$_GET['user_id'];
include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
$profile = new ilPublicUserProfileGUI($user_id);
$profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
$tpl->setContent($ilCtrl->getHTML($profile));
}
ilObjBookingPoolGUI::updateCustom ( ilPropertyFormGUI  $a_form)
protected

Insert custom update form values into object.

Parameters
ilPropertyFormGUI$a_form

Reimplemented from ilObjectGUI.

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

References ilPropertyFormGUI\getInput().

{
$this->object->setOffline(!$a_form->getInput('online'));
$this->object->setPublicLog($a_form->getInput('public'));
$this->object->setNumberOfSlots($a_form->getInput('slots'));
}

+ Here is the call graph for this function:


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