ILIAS  Release_4_4_x_branch Revision 61816
 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.
 rsvConfirmCancelUser ()
 rsvCancelUser ()
 deliverInfo ()
 displayPostInfo ()
 deliverPostFile ()

Protected Attributes

 $ref_id
 $pool_id
 $pool_has_schedule

Detailed Description

Class ilBookingObjectGUI.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilBookingObjectGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

References ilObjBookingPool\TYPE_NO_SCHEDULE.

{
$this->ref_id = $a_parent_obj->ref_id;
$this->pool_id = $a_parent_obj->object->getId();
$this->pool_has_schedule =
($a_parent_obj->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE);
}

Member Function Documentation

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

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

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

{
global $ilCtrl, $lng, $tpl, $ilTabs;
$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 77 of file class.ilBookingObjectGUI.php.

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

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$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 340 of file class.ilBookingObjectGUI.php.

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

{
global $ilCtrl, $lng;
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::deliverInfo ( )

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

References $_GET, $file, and ilUtil\deliverFile().

{
$id = (int)$_GET["object_id"];
if(!$id)
{
return;
}
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject($id);
$file = $obj->getFileFullPath();
if($file)
{
ilUtil::deliverFile($file, $obj->getFile());
}
}

+ Here is the call graph for this function:

ilBookingObjectGUI::deliverPostFile ( )

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

References $_GET, $file, $ilUser, ilUtil\deliverFile(), and ilBookingReservation\getObjectReservationForUser().

{
global $ilUser;
$id = (int)$_GET["object_id"];
if(!$id)
{
return;
}
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
$obj = new ilBookingReservation($book_id);
if ($obj->getUserId() != $ilUser->getId())
{
return;
}
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject($id);
$file = $obj->getPostFileFullPath();
if($file)
{
ilUtil::deliverFile($file, $obj->getPostFile());
}
}

+ Here is the call graph for this function:

ilBookingObjectGUI::displayPostInfo ( )

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

References $_GET, $ilCtrl, $ilUser, $lng, $tpl, and ilBookingReservation\getObjectReservationForUser().

{
global $tpl, $ilUser, $lng, $ilCtrl;
$id = (int)$_GET["object_id"];
if(!$id)
{
return;
}
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
$obj = new ilBookingReservation($book_id);
if ($obj->getUserId() != $ilUser->getId())
{
return;
}
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject($id);
$pfile = $obj->getPostFile();
$ptext = $obj->getPostText();
$mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
$mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
if($ptext)
{
$mytpl->setVariable("POST_TEXT", nl2br($ptext));
}
if($pfile)
{
$ilCtrl->setParameter($this, "object_id", $obj->getId());
$url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
$ilCtrl->setParameter($this, "object_id", "");
$mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
$mytpl->setVariable("URL_FILE", $url);
$mytpl->setVariable("TXT_FILE", $pfile);
}
$mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
$mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
$tpl->setContent($mytpl->get());
}

+ Here is the call graph for this function:

ilBookingObjectGUI::edit ( )

Render edit form.

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

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

{
global $tpl, $ilCtrl, $ilTabs, $lng;
$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 33 of file class.ilBookingObjectGUI.php.

References $cmd, and $ilCtrl.

{
global $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 108 of file class.ilBookingObjectGUI.php.

References $file, $ilCtrl, $lng, $options, ilBookingSchedule\getList(), ilFileInputGUI\setALlowDeletion(), ilTextAreaInputGUI\setCols(), 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);
$desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
$desc->setCols(70);
$desc->setRows(15);
$form_gui->addItem($desc);
$file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
$file->setALlowDeletion(true);
$form_gui->addItem($file);
$nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
$nr->setRequired(true);
$nr->setSize(3);
$nr->setMaxLength(3);
$form_gui->addItem($nr);
if($this->pool_has_schedule)
{
$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);
}
$post = new ilFormSectionHeaderGUI();
$post->setTitle($lng->txt("book_post_booking_information"));
$form_gui->addItem($post);
$pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
$pdesc->setCols(70);
$pdesc->setRows(15);
$form_gui->addItem($pdesc);
$pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
$pfile->setALlowDeletion(true);
$form_gui->addItem($pfile);
if ($a_mode == "edit")
{
$form_gui->setTitle($lng->txt("book_edit_object"));
$item = new ilHiddenInputGUI('object_id');
$item->setValue($id);
$form_gui->addItem($item);
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject($id);
$title->setValue($obj->getTitle());
$desc->setValue($obj->getDescription());
$nr->setValue($obj->getNrOfItems());
$pdesc->setValue($obj->getPostText());
$file->setValue($obj->getFile());
$pfile->setValue($obj->getPostFile());
if(isset($schedule))
{
$schedule->setValue($obj->getScheduleId());
}
$form_gui->addCommandButton("update", $lng->txt("save"));
}
else
{
$form_gui->setTitle($lng->txt("book_add_object"));
$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 54 of file class.ilBookingObjectGUI.php.

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

Referenced by save(), and update().

{
global $tpl, $ilCtrl, $lng, $ilAccess;
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('Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
$plink = new ilPermanentLinkGUI('book', $this->ref_id);
include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
$table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule);
$tpl->setContent($bar.$table->getHTML().$plink->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingObjectGUI::rsvCancelUser ( )

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

References $_REQUEST, $ilCtrl, $ilUser, $lng, ilBookingReservation\getObjectReservationForUser(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilBookingReservation\STATUS_CANCELLED.

{
global $ilCtrl, $ilUser, $lng;
$id = (int)$_REQUEST["object_id"];
if(!$id)
{
return;
}
include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
$obj = new ilBookingReservation($id);
if ($obj->getUserId() != $ilUser->getId())
{
ilUtil::sendFailure($lng->txt('permission_denied'), true);
$ilCtrl->redirect($this, 'render');
}
$obj->update();
ilUtil::sendSuccess($lng->txt('settings_saved'));
$ilCtrl->redirect($this, 'render');
}

+ Here is the call graph for this function:

ilBookingObjectGUI::rsvConfirmCancelUser ( )

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

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

{
global $ilCtrl, $lng, $tpl;
$id = (int)$_GET["object_id"];
if(!$id)
{
return;
}
// #12310
include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
$conf = new ilConfirmationGUI();
$conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancelUser'));
$conf->setHeaderText($lng->txt('book_confirm_cancel'));
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$type = new ilBookingObject($id);
$conf->addItem('object_id', $id, $type->getTitle());
$conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
$conf->setCancel($lng->txt('cancel'), 'render');
$tpl->setContent($conf->getHTML());
}
ilBookingObjectGUI::save ( )

Create new object dataset.

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

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

{
global $ilCtrl, $tpl, $lng, $ilTabs;
$form = $this->initForm();
if($form->checkInput())
{
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
$obj = new ilBookingObject;
$obj->setPoolId($this->pool_id);
$obj->setTitle($form->getInput("title"));
$obj->setDescription($form->getInput("desc"));
$obj->setNrOfItems($form->getInput("items"));
$obj->setPostText($form->getInput("post_text"));
if($this->pool_has_schedule)
{
$obj->setScheduleId($form->getInput("schedule"));
}
$obj->save();
$file = $form->getItemByPostVar("file");
if($_FILES["file"]["tmp_name"])
{
$obj->uploadFile($_FILES["file"]);
}
else if($file->getDeletionFlag())
{
$obj->deleteFile();
}
$pfile = $form->getItemByPostVar("post_file");
if($_FILES["post_file"]["tmp_name"])
{
$obj->uploadPostFile($_FILES["post_file"]);
}
else if($pfile->getDeletionFlag())
{
$obj->deletePostFile();
}
$obj->update();
ilUtil::sendSuccess($lng->txt("book_object_added"));
$this->render();
}
else
{
$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 262 of file class.ilBookingObjectGUI.php.

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

{
global $tpl, $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->setDescription($form->getInput("desc"));
$obj->setNrOfItems($form->getInput("items"));
$obj->setPostText($form->getInput("post_text"));
$file = $form->getItemByPostVar("file");
if($_FILES["file"]["tmp_name"])
{
$obj->uploadFile($_FILES["file"]);
}
else if($file->getDeletionFlag())
{
$obj->deleteFile();
}
$pfile = $form->getItemByPostVar("post_file");
if($_FILES["post_file"]["tmp_name"])
{
$obj->uploadPostFile($_FILES["post_file"]);
}
else if($pfile->getDeletionFlag())
{
$obj->deletePostFile();
}
if($this->pool_has_schedule)
{
$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:

Field Documentation

ilBookingObjectGUI::$pool_has_schedule
protected

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

ilBookingObjectGUI::$pool_id
protected

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

ilBookingObjectGUI::$ref_id
protected

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


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