ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBookingScheduleGUI Class Reference

Class ilBookingScheduleGUI. More...

+ Collaboration diagram for ilBookingScheduleGUI:

Public Member Functions

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

Protected Member Functions

 setDefinitionFromPost (ilPropertyFormGUI $form)
 Reload definition values from post data.
 formToObject ($form, $schedule)
 Convert incoming form data to schedule object.

Detailed Description

Constructor & Destructor Documentation

ilBookingScheduleGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

Definition at line 18 of file class.ilBookingScheduleGUI.php.

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

Member Function Documentation

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

Definition at line 344 of file class.ilBookingScheduleGUI.php.

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

{
global $ilCtrl, $lng, $tpl, $ilTabs;
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.ilBookingSchedule.php';
$type = new ilBookingSchedule((int)$_GET['schedule_id']);
$conf->addItem('schedule_id', (int)$_GET['schedule_id'], $type->getTitle());
$conf->setConfirm($lng->txt('delete'), 'delete');
$conf->setCancel($lng->txt('cancel'), 'render');
$tpl->setContent($conf->getHTML());
}
ilBookingScheduleGUI::create ( )

Render creation form.

Definition at line 78 of file class.ilBookingScheduleGUI.php.

References $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();
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilBookingScheduleGUI::delete ( )

Delete schedule.

Definition at line 365 of file class.ilBookingScheduleGUI.php.

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

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

+ Here is the call graph for this function:

ilBookingScheduleGUI::edit ( )

Render edit form.

Definition at line 92 of file class.ilBookingScheduleGUI.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['schedule_id']);
$tpl->setContent($form->getHTML());
}

+ Here is the call graph for this function:

ilBookingScheduleGUI::executeCommand ( )

main switch

Definition at line 26 of file class.ilBookingScheduleGUI.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;
}
ilBookingScheduleGUI::formToObject (   $form,
  $schedule 
)
protected

Convert incoming form data to schedule object.

Parameters
object$form
object$schedule

Definition at line 313 of file class.ilBookingScheduleGUI.php.

References ilScheduleInputGUI\getPostData().

Referenced by save(), and update().

{
global $ilObjDataCache;
$schedule->setTitle($form->getInput("title"));
$schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
$schedule->setDeadline($form->getInput("deadline"));
/*
if($form->getInput("type") == "flexible")
{
$schedule->setRaster($form->getInput("raster"));
$schedule->setMinRental($form->getInput("rent_min"));
$schedule->setMaxRental($form->getInput("rent_max"));
$schedule->setAutoBreak($form->getInput("break"));
}
else
{
$schedule->setRaster(NULL);
$schedule->setMinRental(NULL);
$schedule->setMaxRental(NULL);
$schedule->setAutoBreak(NULL);
}
*/
$schedule->setDefinitionBySlots(ilScheduleInputGUI::getPostData("days"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingScheduleGUI::initForm (   $a_mode = "create",
  $id = NULL 
)

Build property form.

Parameters
string$a_mode
int$id
Returns
object

Definition at line 109 of file class.ilBookingScheduleGUI.php.

References $ilCtrl, $lng, $title, and ilFormPropertyGUI\setInfo().

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

{
global $lng, $ilCtrl;
$lng->loadLanguageModule("dateplaner");
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);
/*
$type = new ilRadioGroupInputGUI($lng->txt("book_schedule_type"), "type");
$type->setRequired(true);
$form_gui->addItem($type);
$fix = new ilRadioOption($lng->txt("book_schedule_type_fix"), "fix");
$fix->setInfo($lng->txt("book_schedule_type_fix_info"));
$type->addOption($fix);
$flex = new ilRadioOption($lng->txt("book_schedule_type_flexible"), "flexible");
$flex->setInfo($lng->txt("book_schedule_type_flexible_info"));
$type->addOption($flex);
$raster = new ilNumberInputGUI($lng->txt("book_schedule_raster"), "raster");
$raster->setRequired(true);
$raster->setInfo($lng->txt("book_schedule_raster_info"));
$raster->setMinValue(1);
$raster->setSize(3);
$raster->setMaxLength(3);
$raster->setSuffix($lng->txt("book_minutes"));
$flex->addSubItem($raster);
$rent_min = new ilNumberInputGUI($lng->txt("book_schedule_rent_min"), "rent_min");
$rent_min->setInfo($lng->txt("book_schedule_rent_info"));
$rent_min->setMinValue(1);
$rent_min->setSize(3);
$rent_min->setMaxLength(3);
$flex->addSubItem($rent_min);
$rent_max = new ilNumberInputGUI($lng->txt("book_schedule_rent_max"), "rent_max");
$rent_max->setInfo($lng->txt("book_schedule_rent_info"));
$rent_max->setMinValue(1);
$rent_max->setSize(3);
$rent_max->setMaxLength(3);
$flex->addSubItem($rent_max);
$break = new ilNumberInputGUI($lng->txt("book_schedule_break"), "break");
$break->setInfo($lng->txt("book_schedule_break_info"));
$break->setMinValue(1);
$break->setSize(3);
$break->setMaxLength(3);
$flex->addSubItem($break);
*/
include_once "Modules/BookingManager/classes/class.ilScheduleInputGUI.php";
$definition = new ilScheduleInputGUI($lng->txt("book_schedule_days"), "days");
$definition->setInfo($lng->txt("book_schedule_days_info"));
$definition->setRequired(true);
$form_gui->addItem($definition);
$deadline = new ilNumberInputGUI($lng->txt("book_deadline"), "deadline");
$deadline->setInfo($lng->txt("book_deadline_info"));
$deadline->setSuffix($lng->txt("book_hours"));
$deadline->setMinValue(0);
$deadline->setSize(3);
$deadline->setMaxLength(3);
$form_gui->addItem($deadline);
if ($a_mode == "edit")
{
$form_gui->setTitle($lng->txt("book_edit_schedule"));
$item = new ilHiddenInputGUI('schedule_id');
$item->setValue($id);
$form_gui->addItem($item);
include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
$schedule = new ilBookingSchedule($id);
$title->setValue($schedule->getTitle());
$deadline->setValue($schedule->getDeadline());
/*
if($schedule->getRaster())
{
$type->setValue("flexible");
$raster->setValue($schedule->getRaster());
$rent_min->setValue($schedule->getMinRental());
$rent_max->setValue($schedule->getMaxRental());
$break->setValue($schedule->getAutoBreak());
}
else
{
$type->setValue("fix");
}
*/
$definition->setValue($schedule->getDefinitionBySlots());
$form_gui->addCommandButton("update", $lng->txt("save"));
}
else
{
$form_gui->setTitle($lng->txt("book_add_schedule"));
$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:

ilBookingScheduleGUI::render ( )

Render list of booking schedules.

uses ilBookingSchedulesTableGUI

Definition at line 47 of file class.ilBookingScheduleGUI.php.

References $ilCtrl, $lng, $tpl, ilObject\_lookupObjId(), ilToolbarGUI\addButton(), ilBookingObject\getList(), and ilUtil\sendInfo().

Referenced by save(), and update().

{
global $tpl, $lng, $ilCtrl, $ilAccess;
include_once 'Modules/BookingManager/classes/class.ilBookingSchedulesTableGUI.php';
$table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
if ($ilAccess->checkAccess('write', '', $this->ref_id))
{
// if we have schedules but no objects - show info
if(sizeof($table->getData()))
{
include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
if(!sizeof(ilBookingObject::getList(ilObject::_lookupObjId($this->ref_id))))
{
ilUtil::sendInfo($lng->txt("book_type_warning"));
}
}
include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
$bar = new ilToolbarGUI;
$bar->addButton($lng->txt('book_add_schedule'), $ilCtrl->getLinkTarget($this, 'create'));
$bar = $bar->getHTML();
}
$tpl->setContent($bar.$table->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingScheduleGUI::save ( )

Create new dataset.

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

References $lng, $tpl, formToObject(), initForm(), render(), ilUtil\sendSuccess(), and setDefinitionFromPost().

{
global $tpl, $lng;
$form = $this->initForm();
if($form->checkInput())
{
include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
$obj = new ilBookingSchedule;
$this->formToObject($form, $obj);
$obj->save();
ilUtil::sendSuccess($lng->txt("book_schedule_added"));
$this->render();
}
else
{
$form->setValuesByPost();
$this->setDefinitionFromPost($form);
$tpl->setContent($form->getHTML());
}
}

+ Here is the call graph for this function:

ilBookingScheduleGUI::setDefinitionFromPost ( ilPropertyFormGUI  $form)
protected

Reload definition values from post data.

Parameters
ilPropertyFormGUI$form

Definition at line 281 of file class.ilBookingScheduleGUI.php.

References ilPropertyFormGUI\getInput(), and ilPropertyFormGUI\getItemByPostVar().

Referenced by save(), and update().

{
$days = $form->getInput("days");
if($days)
{
$days_group = $form->getItemByPostVar("days");
foreach($days_group->getOptions() as $option)
{
$days_fields[$option->getValue()] = $option;
}
foreach($days as $day)
{
$slot = $form->getInput($day."_slot");
$subs = $days_fields[$day]->getSubItems();
if($slot[0])
{
$subs[0]->setValue($slot[0]);
}
if($slot[1])
{
$subs[1]->setValue($slot[1]);
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingScheduleGUI::update ( )

Update dataset.

Definition at line 253 of file class.ilBookingScheduleGUI.php.

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

{
global $tpl, $lng;
$form = $this->initForm('edit', (int)$_POST['schedule_id']);
if($form->checkInput())
{
include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
$obj = new ilBookingSchedule((int)$_POST['schedule_id']);
$this->formToObject($form, $obj);
$obj->update();
ilUtil::sendSuccess($lng->txt("book_schedule_updated"));
$this->render();
}
else
{
$form->setValuesByPost();
$this->setDefinitionFromPost($form);
$tpl->setContent($form->getHTML());
}
}

+ Here is the call graph for this function:


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