ILIAS  eassessment Revision 61809
 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
 createObject ()
 Display creation form.
 editObject ()
 Display update form.
 initForm ($a_mode="create")
 Init property form.
 saveObject ()
 create new dataset
 updateObject ()
 update dataset
 afterUpdate ()
 setTabs ()
 get tabs
 bookObject ()
 First step in booking process.
 confirmedBookingObject ()
 Book object - either of type or specific - for given dates.
 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 ()
- 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
 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

 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
 showUpperIcon ()
 setAdminTabs ()
 set admin tabs public
 setLocator ()
 set Locator
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 omitLocator ($a_omit=true)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 displayEditForm ($fields)
 display edit form (usually called by editObject)
 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="")

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

Detailed Description

Constructor & Destructor Documentation

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

Constructor.

Definition at line 21 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 784 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::afterUpdate ( )

Reimplemented from ilObjectGUI.

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

{
}
ilObjBookingPoolGUI::applyLogFilterObject ( )

Apply filter from 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->writeFilterToSession();
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::bookObject ( )

First step in booking process.

Definition at line 313 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 563 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;
$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))
{
continue;
}
// is slot active in current hour?
if((int)$slot['from'] < (int)$hour."59" && (int)$slot['to'] > (int)$hour."00")
{
$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 738 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 653 of file class.ilObjBookingPoolGUI.php.

References $_GET, $_POST, ilObjectGUI\$object, ilCalendarCategoryAssignments\addAssignment(), bookObject(), ilBookingReservation\getAvailableObject(), ilBookingObject\getList(), IL_CAL_UNIX, ilCalendarUtil\initDefaultCalendarByType(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilCalendarEntry\setStart(), and ilCalendarCategory\TYPE_BOOK.

{
global $ilUser;
if(!isset($_POST['date']))
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return $this->bookObject();
}
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$fromto = explode('_', $_POST['date']);
if(isset($_GET['object_id']))
{
$object_id = (int)$_GET['object_id'];
}
// choose object of type
else
{
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$ids = array();
foreach(ilBookingObject::getList((int)$_GET['type_id']) as $item)
{
$ids[] = $item['booking_object_id'];
}
$object_id = ilBookingReservation::getAvailableObject($ids, $fromto[0], $fromto[1]);
}
if($object_id)
{
$reservation = new ilBookingReservation();
$reservation->setObjectId($object_id);
$reservation->setUserId($ilUser->getID());
$reservation->setFrom($fromto[0]);
$reservation->setTo($fromto[1]);
$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($object_id);
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
$entry = new ilCalendarEntry;
$entry->setStart(new ilDateTime($fromto[0], IL_CAL_UNIX));
$entry->setEnd(new ilDateTime($fromto[1], 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());
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::createObject ( )

Display creation form.

Reimplemented from ilObjectGUI.

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

References ilObjectGUI\$tpl, and initForm().

{
global $tpl;
$form = $this->initForm();
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::editObject ( )

Display update form.

Reimplemented from ilObjectGUI.

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

References ilObjectGUI\$tpl, and initForm().

{
global $tpl;
$this->tabs_gui->setTabActive('edit');
$form = $this->initForm("edit");
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::executeCommand ( )

main switch

Reimplemented from ilObjectGUI.

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

References $_GET, $cmd, $ret, ilObjectGUI\$tpl, 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':
$this->tabs_gui->setTabActive('schedules');
include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
$profile =& new ilPublicUserProfileGUI((int)$_GET["user"]);
$ret =& $this->ctrl->forwardCommand($profile);
break;
case 'ilinfoscreengui':
$this->infoScreen();
break;
default:
$cmd = $this->ctrl->getCmd();
$cmd .= 'Object';
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::infoScreen ( )

Definition at line 821 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 814 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::initForm (   $a_mode = "create")

Init property form.

Returns
object

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

References $desc, $title, ilFormPropertyGUI\setInfo(), and ilFormPropertyGUI\setRequired().

Referenced by createObject(), editObject(), saveObject(), and updateObject().

{
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form_gui = new ilPropertyFormGUI();
$title = new ilTextInputGUI($this->lng->txt("title"), "standard_title");
$title->setRequired(true);
$title->setSize(40);
$title->setMaxLength(120);
$form_gui->addItem($title);
$desc = new ilTextAreaInputGUI($this->lng->txt("description"), "description");
$desc->setCols(37);
$desc->setRows(2);
$form_gui->addItem($desc);
if ($a_mode == "edit")
{
$online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
$form_gui->addItem($online);
$public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
$public->setInfo($this->lng->txt("book_public_log_info"));
$form_gui->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"));
$form_gui->addItem($slots);
$form_gui->setTitle($this->lng->txt("settings"));
$title->setValue($this->object->getTitle());
$desc->setValue($this->object->getDescription());
$online->setChecked(!$this->object->isOffline());
$public->setChecked($this->object->hasPublicLog());
$slots->setValue($this->object->getNumberOfSlots());
$form_gui->addCommandButton("update", $this->lng->txt("save"));
$form_gui->addCommandButton("render", $this->lng->txt("cancel"));
}
else
{
$form_gui->setTitle($this->lng->txt("book_create_title"));
$form_gui->addCommandButton("save", $this->lng->txt("save"));
$form_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
}
$form_gui->setFormAction($this->ctrl->getFormAction($this));
return $form_gui;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjBookingPoolGUI::logObject ( )

List reservations.

Definition at line 724 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::renderBookingByObject (   $a_object_id)
protected

Render list of available dates for object.

Parameters
int$a_object_id

Definition at line 334 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 352 of file class.ilObjBookingPoolGUI.php.

References ilObjectGUI\$tpl, $type, ilBookingObject\getList(), 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 372 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 775 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 867 of file class.ilObjBookingPoolGUI.php.

References $_GET, ilConsultationHourAppointments\getAppointmentIds(), logObject(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilBookingReservation\STATUS_CANCELLED, and ilCalendarCategory\TYPE_BOOK.

{
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
include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
include_once 'Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
$apps = ilConsultationHourAppointments::getAppointmentIds($obj->getUserId(), $obj->getId(), NULL, ilCalendarCategory::TYPE_BOOK);
if($apps)
{
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
$entry = new ilCalendarEntry($apps[0]);
$entry->delete();
}
ilUtil::sendSuccess($this->lng->txt('settings_saved'));
$this->logObject();
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::rsvInUseObject ( )

Definition at line 923 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 945 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 901 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::saveObject ( )

create new dataset

Reimplemented from ilObjectGUI.

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

References $_POST, $ilCtrl, ilObjectGUI\$tpl, ilChangeEvent\_isActive(), ilChangeEvent\_recordWriteEvent(), initForm(), and ilUtil\sendSuccess().

{
global $rbacadmin, $ilUser, $tpl, $ilCtrl;
$form = $this->initForm();
if($form->checkInput())
{
$_POST["new_type"] = "book";
$_POST["Fobject"]["title"] = $form->getInput("standard_title");
$_POST["Fobject"]["desc"] = $form->getInput("description");
// always call parent method first to create an object_data entry & a reference
$newObj = parent::saveObject();
$newObj->setOffline(true);
$newObj->setNumberOfSlots(4);
$newObj->update();
// always send a message
ilUtil::sendSuccess($this->lng->txt("book_pool_added"),true);
// BEGIN ChangeEvent: Record object creation
global $ilUser;
require_once('Services/Tracking/classes/class.ilChangeEvent.php');
{
ilChangeEvent::_recordWriteEvent($newObj->getId(), $ilUser->getId(), 'create');
}
// END ChangeEvent: Record object creation
$this->ctrl->setParameter($this, "ref_id", $newObj->getRefId());
$this->ctrl->redirect($this, "edit");
}
else
{
$form->setValuesByPost();
$tpl->setContent($form->getHTML());
}
}

+ Here is the call graph for this function:

ilObjBookingPoolGUI::setTabs ( )

get tabs

Reimplemented from ilObjectGUI.

Definition at line 266 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("edit",
$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 967 of file class.ilObjBookingPoolGUI.php.

References $_GET, and ilObjectGUI\$tpl.

{
global $tpl;
$this->tabs_gui->clearTargets();
$this->tabs_gui->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'log'));
$user_id = (int)$_GET['user_id'];
include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
$profile = new ilPublicUserProfileGUI($user_id);
$tpl->setContent($profile->getHTML());
}
ilObjBookingPoolGUI::updateObject ( )

update dataset

Reimplemented from ilObjectGUI.

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

References $_POST, $ilCtrl, ilObjectGUI\$tpl, and initForm().

{
global $rbacadmin, $ilUser, $tpl, $ilCtrl;
$form = $this->initForm("edit");
if($form->checkInput())
{
$_POST["Fobject"]["title"] = $form->getInput("standard_title");
$_POST["Fobject"]["desc"] = $form->getInput("description");
$this->object->setOffline(!$form->getInput('online'));
$this->object->setPublicLog($form->getInput('public'));
$this->object->setNumberOfSlots($form->getInput('slots'));
$ilCtrl->redirect($this, "render");
}
else
{
$this->tabs_gui->setTabActive('edit');
$form->setValuesByPost();
$tpl->setContent($form->getHTML());
}
}

+ Here is the call graph for this function:


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