ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBookingObjectGUI Class Reference

Class ilBookingObjectGUI. More...

+ Collaboration diagram for ilBookingObjectGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor.
 executeCommand ()
 main switch
 render ()
 Render list of booking objects.
 create ()
 Render creation form.
 edit ()
 Render edit form.
 initForm ($a_mode="create", $id=NULL)
 Build property form.
 save ()
 Create new object dataset.
 update ()
 Update object dataset.
 confirmDelete ()
 Confirm delete.
 delete ()
 Delete object.

Detailed Description

Constructor & Destructor Documentation

ilBookingObjectGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

Definition at line 21 of file class.ilBookingObjectGUI.php.

{
$this->ref_id = $a_parent_obj->ref_id;
}

Member Function Documentation

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

Definition at line 233 of file class.ilBookingObjectGUI.php.

References $_GET, $_REQUEST, $ilCtrl, $lng, and $tpl.

{
global $ilCtrl, $lng, $tpl, $ilTabs;
$ilCtrl->setParameter($this, 'type_id', (int)$_REQUEST['type_id']);
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
$conf = new ilConfirmationGUI();
$conf->setFormAction($ilCtrl->getFormAction($this));
$conf->setHeaderText($lng->txt('book_confirm_delete'));
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$type = new ilBookingObject((int)$_GET['object_id']);
$conf->addItem('object_id', (int)$_GET['object_id'], $type->getTitle());
$conf->setConfirm($lng->txt('delete'), 'delete');
$conf->setCancel($lng->txt('cancel'), 'render');
$tpl->setContent($conf->getHTML());
}
ilBookingObjectGUI::create ( )

Render creation form.

Definition at line 75 of file class.ilBookingObjectGUI.php.

References $_REQUEST, $ilCtrl, $lng, $tpl, and initForm().

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$ilCtrl->setParameter($this, 'type_id', (int)$_REQUEST['type_id']);
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
$form = $this->initForm();
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilBookingObjectGUI::delete ( )

Delete object.

Definition at line 259 of file class.ilBookingObjectGUI.php.

References $_POST, $_REQUEST, $ilCtrl, $lng, and ilUtil\sendSuccess().

{
global $ilCtrl, $lng;
$ilCtrl->setParameter($this, 'type_id', (int)$_REQUEST['type_id']);
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject((int)$_POST['object_id']);
$obj->delete();
ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
$ilCtrl->redirect($this, 'render');
}

+ Here is the call graph for this function:

ilBookingObjectGUI::edit ( )

Render edit form.

Definition at line 91 of file class.ilBookingObjectGUI.php.

References $_GET, $_REQUEST, $ilCtrl, $lng, $tpl, and initForm().

{
global $tpl, $ilCtrl, $ilTabs, $lng;
$ilCtrl->setParameter($this, 'type_id', (int)$_REQUEST['type_id']);
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
$form = $this->initForm('edit', (int)$_GET['object_id']);
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilBookingObjectGUI::executeCommand ( )

main switch

Definition at line 29 of file class.ilBookingObjectGUI.php.

References $cmd, $ilCtrl, and $tpl.

{
global $tpl, $ilTabs, $ilCtrl;
$next_class = $ilCtrl->getNextClass($this);
switch($next_class)
{
default:
$cmd = $ilCtrl->getCmd("render");
$this->$cmd();
break;
}
return true;
}
ilBookingObjectGUI::initForm (   $a_mode = "create",
  $id = NULL 
)

Build property form.

Parameters
string$a_mode
int$id
Returns
object

Definition at line 110 of file class.ilBookingObjectGUI.php.

References $_REQUEST, $ilCtrl, $lng, $title, ilBookingSchedule\getList(), and ilFormPropertyGUI\setRequired().

Referenced by create(), edit(), save(), and update().

{
global $lng, $ilCtrl, $ilObjDataCache;
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$form_gui = new ilPropertyFormGUI();
$title = new ilTextInputGUI($lng->txt("title"), "title");
$title->setRequired(true);
$title->setSize(40);
$title->setMaxLength(120);
$form_gui->addItem($title);
include_once 'Modules/BookingManager/classes/class.ilBookingType.php';
$type = new ilBookingType((int)$_REQUEST['type_id']);
if(!$type->getScheduleId())
{
$options = array();
include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
foreach(ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule)
{
$options[$schedule["booking_schedule_id"]] = $schedule["title"];
}
$schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
$schedule->setRequired(true);
$schedule->setOptions($options);
$form_gui->addItem($schedule);
}
if ($a_mode == "edit")
{
$form_gui->setTitle($lng->txt("book_edit_object").": ".$type->getTitle());
$item = new ilHiddenInputGUI('object_id');
$item->setValue($id);
$form_gui->addItem($item);
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$type = new ilBookingObject($id);
$title->setValue($type->getTitle());
if(isset($schedule))
{
$schedule->setValue($type->getScheduleId());
}
$form_gui->addCommandButton("update", $lng->txt("save"));
}
else
{
$form_gui->setTitle($lng->txt("book_add_object").": ".$type->getTitle());
$form_gui->addCommandButton("save", $lng->txt("save"));
$form_gui->addCommandButton("render", $lng->txt("cancel"));
}
$form_gui->setFormAction($ilCtrl->getFormAction($this));
return $form_gui;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingObjectGUI::render ( )

Render list of booking objects.

uses ilBookingObjectsTableGUI

Definition at line 50 of file class.ilBookingObjectGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, and ilToolbarGUI\addButton().

Referenced by save(), and update().

{
global $tpl, $ilCtrl, $ilTabs, $lng, $ilAccess;
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTargetByClass('ilBookingTypeGUI', 'render'));
$ilCtrl->setParameter($this, 'type_id', (int)$_GET['type_id']);
if ($ilAccess->checkAccess('write', '', $this->ref_id))
{
include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
$bar = new ilToolbarGUI;
$bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
$bar = $bar->getHTML();
}
include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
$table = new ilBookingObjectsTableGUI($this, 'listItems', $this->ref_id, (int)$_GET['type_id']);
$tpl->setContent($bar.$table->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingObjectGUI::save ( )

Create new object dataset.

Definition at line 174 of file class.ilBookingObjectGUI.php.

References $_REQUEST, $ilCtrl, $lng, $tpl, initForm(), render(), ilUtil\sendSuccess(), and ilBookingObject\setTitle().

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$form = $this->initForm();
if($form->checkInput())
{
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject;
$obj->setTitle($form->getInput("title"));
$obj->setTypeId((int)$_REQUEST["type_id"]);
$obj->setScheduleId($form->getInput("schedule"));
$obj->save();
ilUtil::sendSuccess($lng->txt("book_object_added"));
$this->render();
}
else
{
$ilCtrl->setParameter($this, 'type_id', (int)$_REQUEST['type_id']);
$ilTabs->clearTargets();
$ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
$form->setValuesByPost();
$tpl->setContent($form->getHTML());
}
}

+ Here is the call graph for this function:

ilBookingObjectGUI::update ( )

Update object dataset.

Definition at line 206 of file class.ilBookingObjectGUI.php.

References $_POST, $_REQUEST, $lng, $tpl, initForm(), render(), and ilUtil\sendSuccess().

{
global $tpl, $ilObjDataCache, $lng;
$form = $this->initForm('edit', (int)$_POST['object_id']);
if($form->checkInput())
{
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject((int)$_POST['object_id']);
$obj->setTitle($form->getInput("title"));
$obj->setTypeId((int)$_REQUEST['type_id']);
$obj->setScheduleId($form->getInput("schedule"));
$obj->update();
ilUtil::sendSuccess($lng->txt("book_object_updated"));
$this->render();
}
else
{
$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: