ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBookingScheduleGUI Class Reference

Class ilBookingScheduleGUI. More...

+ Collaboration diagram for ilBookingScheduleGUI:

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

 $tpl
 
 $tabs
 
 $ctrl
 
 $lng
 
 $access
 
 $help
 
 $obj_data_cache
 
 $schedule_id
 

Detailed Description

Class ilBookingScheduleGUI.

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

@ilCtrl_Calls ilBookingScheduleGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilBookingScheduleGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

59 {
60 global $DIC;
61
62 $this->tpl = $DIC["tpl"];
63 $this->tabs = $DIC->tabs();
64 $this->ctrl = $DIC->ctrl();
65 $this->lng = $DIC->language();
66 $this->access = $DIC->access();
67 $this->help = $DIC["ilHelp"];
68 $this->obj_data_cache = $DIC["ilObjDataCache"];
69 $this->ref_id = $a_parent_obj->ref_id;
70 $this->schedule_id = (int) $_REQUEST['schedule_id'];
71 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ confirmDelete()

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

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

420 {
424 $ilTabs = $this->tabs;
425 $ilHelp = $this->help;
426
427 $ilHelp->setSubScreenId("delete");
428
429
430 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
431 $conf = new ilConfirmationGUI();
432 $conf->setFormAction($ilCtrl->getFormAction($this));
433 $conf->setHeaderText($lng->txt('book_confirm_delete'));
434
435 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
436 $type = new ilBookingSchedule($this->schedule_id);
437 $conf->addItem('schedule_id', $this->schedule_id, $type->getTitle());
438 $conf->setConfirm($lng->txt('delete'), 'delete');
439 $conf->setCancel($lng->txt('cancel'), 'render');
440
441 $tpl->setContent($conf->getHTML());
442 }
schedule for booking ressource
Confirmation screen class.
global $ilCtrl
Definition: ilias.php:18
$type

References $ctrl, $help, $ilCtrl, $lng, $tabs, $tpl, and $type.

◆ create()

ilBookingScheduleGUI::create ( )

Render creation form.

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

130 {
133 $ilTabs = $this->tabs;
135 $ilHelp = $this->help;
136
137 $ilTabs->clearTargets();
138 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
139 $ilHelp->setScreenIdComponent("book");
140 $ilHelp->setScreenId("schedules");
141 $ilHelp->setSubScreenId("create");
142
143 $form = $this->initForm();
144 $tpl->setContent($form->getHTML());
145 }
initForm($a_mode="create", $id=null)
Build property form.
if(isset($_POST['submit'])) $form

References $ctrl, $form, $help, $ilCtrl, $lng, $tabs, $tpl, and initForm().

+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

448 {
451
452 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
453 $obj = new ilBookingSchedule($this->schedule_id);
454 $obj->delete();
455
456 ilUtil::sendSuccess($lng->txt('book_schedule_deleted'), true);
457 $ilCtrl->redirect($this, 'render');
458 }

References $ctrl, $ilCtrl, and $lng.

◆ edit()

ilBookingScheduleGUI::edit ( )

Render edit form.

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

151 {
154 $ilTabs = $this->tabs;
156 $ilHelp = $this->help;
157
158 $ilTabs->clearTargets();
159 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
160 $ilHelp->setScreenIdComponent("book");
161 $ilHelp->setScreenId("schedules");
162 $ilHelp->setSubScreenId("edit");
163
164 $form = $this->initForm('edit', $this->schedule_id);
165 $tpl->setContent($form->getHTML());
166 }

References $ctrl, $form, $help, $ilCtrl, $lng, $tabs, $tpl, and initForm().

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingScheduleGUI::executeCommand ( )

main switch

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

77 {
79 $ilTabs = $this->tabs;
81
82 $next_class = $ilCtrl->getNextClass($this);
83
84 switch ($next_class) {
85 default:
86 $cmd = $ilCtrl->getCmd("render");
87 $this->$cmd();
88 break;
89 }
90 return true;
91 }

References $ctrl, $ilCtrl, $tabs, and $tpl.

◆ formToObject()

ilBookingScheduleGUI::formToObject (   $form,
  $schedule 
)
protected

Convert incoming form data to schedule object.

Parameters
object$form
object$schedule

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

370 {
371 $ilObjDataCache = $this->obj_data_cache;
372
373 $schedule->setTitle($form->getInput("title"));
374 $schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
375
376 $from = $form->getItemByPostVar("from");
377 $schedule->setAvailabilityFrom($from->getDate());
378
379 $to = $form->getItemByPostVar("to");
380 $schedule->setAvailabilityTo($to->getDate());
381
382 switch ($form->getInput("deadline_opts")) {
383 case "slot_start":
384 $schedule->setDeadline(0);
385 break;
386
387 case "hours":
388 $schedule->setDeadline($form->getInput("deadline"));
389 break;
390
391 case "slot_end":
392 $schedule->setDeadline(-1);
393 break;
394 }
395
396 /*
397 if($form->getInput("type") == "flexible")
398 {
399 $schedule->setRaster($form->getInput("raster"));
400 $schedule->setMinRental($form->getInput("rent_min"));
401 $schedule->setMaxRental($form->getInput("rent_max"));
402 $schedule->setAutoBreak($form->getInput("break"));
403 }
404 else
405 {
406 $schedule->setRaster(NULL);
407 $schedule->setMinRental(NULL);
408 $schedule->setMaxRental(NULL);
409 $schedule->setAutoBreak(NULL);
410 }
411 */
412
413 $schedule->setDefinitionBySlots(ilScheduleInputGUI::getPostData("days"));
414 }
static getPostData($a_post_var, $a_remove_invalid=true)
$from

References $form, $from, $obj_data_cache, and ilScheduleInputGUI\getPostData().

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

Build property form.

Parameters
string$a_mode
int$id
Returns
object

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

175 {
178
179 $lng->loadLanguageModule("dateplaner");
180
181 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
182
183 $form_gui = new ilPropertyFormGUI();
184
185 $title = new ilTextInputGUI($lng->txt("title"), "title");
186 $title->setRequired(true);
187 $title->setSize(40);
188 $title->setMaxLength(120);
189 $form_gui->addItem($title);
190
191 include_once "Modules/BookingManager/classes/class.ilScheduleInputGUI.php";
192 $definition = new ilScheduleInputGUI($lng->txt("book_schedule_days"), "days");
193 $definition->setInfo($lng->txt("book_schedule_days_info"));
194 $definition->setRequired(true);
195 $form_gui->addItem($definition);
196
197 $deadline_opts = new ilRadioGroupInputGUI($lng->txt("book_deadline_options"), "deadline_opts");
198 $deadline_opts->setRequired(true);
199 $form_gui->addItem($deadline_opts);
200
201 $deadline_time = new ilRadioOption($lng->txt("book_deadline_hours"), "hours");
202 $deadline_opts->addOption($deadline_time);
203
204 $deadline = new ilNumberInputGUI($lng->txt("book_deadline"), "deadline");
205 $deadline->setInfo($lng->txt("book_deadline_info"));
206 $deadline->setSuffix($lng->txt("book_hours"));
207 $deadline->setMinValue(1);
208 $deadline->setSize(3);
209 $deadline->setMaxLength(3);
210 $deadline_time->addSubItem($deadline);
211
212 $deadline_start = new ilRadioOption($lng->txt("book_deadline_slot_start"), "slot_start");
213 $deadline_opts->addOption($deadline_start);
214
215 $deadline_slot = new ilRadioOption($lng->txt("book_deadline_slot_end"), "slot_end");
216 $deadline_opts->addOption($deadline_slot);
217
218 if ($a_mode == "edit") {
219 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
220 $schedule = new ilBookingSchedule($id);
221 }
222
223 $av = new ilFormSectionHeaderGUI();
224 $av->setTitle($lng->txt("obj_activation_list_gui"));
225 $form_gui->addItem($av);
226
227 // #18221
228 $lng->loadLanguageModule('rep');
229
230 $from = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_start"), "from");
231 $from->setShowTime(true);
232 $form_gui->addItem($from);
233
234 $to = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_end"), "to");
235 $to->setShowTime(true);
236 $form_gui->addItem($to);
237
238 if ($a_mode == "edit") {
239 $form_gui->setTitle($lng->txt("book_edit_schedule"));
240
241 $item = new ilHiddenInputGUI('schedule_id');
242 $item->setValue($id);
243 $form_gui->addItem($item);
244
245 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
246 $schedule = new ilBookingSchedule($id);
247 $title->setValue($schedule->getTitle());
248 $from->setDate($schedule->getAvailabilityFrom());
249 $to->setDate($schedule->getAvailabilityTo());
250
251 if ($schedule->getDeadline() == 0) {
252 $deadline_opts->setValue("slot_start");
253 } elseif ($schedule->getDeadline() > 0) {
254 $deadline->setValue($schedule->getDeadline());
255 $deadline_opts->setValue("hours");
256 } else {
257 $deadline->setValue(0);
258 $deadline_opts->setValue("slot_end");
259 }
260
261 /*
262 if($schedule->getRaster())
263 {
264 $type->setValue("flexible");
265 $raster->setValue($schedule->getRaster());
266 $rent_min->setValue($schedule->getMinRental());
267 $rent_max->setValue($schedule->getMaxRental());
268 $break->setValue($schedule->getAutoBreak());
269 }
270 else
271 {
272 $type->setValue("fix");
273 }
274 */
275
276 $definition->setValue($schedule->getDefinitionBySlots());
277
278 $form_gui->addCommandButton("update", $lng->txt("save"));
279 } else {
280 $form_gui->setTitle($lng->txt("book_add_schedule"));
281 $form_gui->addCommandButton("save", $lng->txt("save"));
282 $form_gui->addCommandButton("render", $lng->txt("cancel"));
283 }
284 $form_gui->setFormAction($ilCtrl->getFormAction($this));
285
286 return $form_gui;
287 }
This class represents a date/time property in a property form.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a text property in a property form.
This class represents a text property in a property form.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $ctrl, $from, $id, $ilCtrl, $lng, and $title.

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

+ Here is the caller graph for this function:

◆ render()

ilBookingScheduleGUI::render ( )

Render list of booking schedules.

uses ilBookingSchedulesTableGUI

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

99 {
103 $ilAccess = $this->access;
104
105 include_once 'Modules/BookingManager/classes/class.ilBookingSchedulesTableGUI.php';
106 $table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
107
108 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
109 // if we have schedules but no objects - show info
110 if (sizeof($table->getData())) {
111 include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
112 if (!sizeof(ilBookingObject::getList(ilObject::_lookupObjId($this->ref_id)))) {
113 ilUtil::sendInfo($lng->txt("book_type_warning"));
114 }
115 }
116
117 include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
118 $bar = new ilToolbarGUI;
119 $bar->addButton($lng->txt('book_add_schedule'), $ilCtrl->getLinkTarget($this, 'create'));
120 $bar = $bar->getHTML();
121 }
122
123 $tpl->setContent($bar . $table->getHTML());
124 }
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
List booking schedules (for booking pool)
static _lookupObjId($a_id)
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(empty($password)) $table
Definition: pwgen.php:24

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

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilBookingScheduleGUI::save ( )

Create new dataset.

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

293 {
296
297 $form = $this->initForm();
298 if ($form->checkInput()) {
299 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
300 $obj = new ilBookingSchedule;
301 $this->formToObject($form, $obj);
302 $obj->save();
303
304 ilUtil::sendSuccess($lng->txt("book_schedule_added"));
305 $this->render();
306 } else {
307 $form->setValuesByPost();
309 $tpl->setContent($form->getHTML());
310 }
311 }
formToObject($form, $schedule)
Convert incoming form data to schedule object.
render()
Render list of booking schedules.
setDefinitionFromPost(ilPropertyFormGUI $form)
Reload definition values from post data.

References $form, $lng, $tpl, formToObject(), initForm(), render(), and setDefinitionFromPost().

+ Here is the call graph for this function:

◆ setDefinitionFromPost()

ilBookingScheduleGUI::setDefinitionFromPost ( ilPropertyFormGUI  $form)
protected

Reload definition values from post data.

Parameters
ilPropertyFormGUI$form

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

343 {
344 $days = $form->getInput("days");
345 if ($days) {
346 $days_group = $form->getItemByPostVar("days");
347 foreach ($days_group->getOptions() as $option) {
348 $days_fields[$option->getValue()] = $option;
349 }
350
351 foreach ($days as $day) {
352 $slot = $form->getInput($day . "_slot");
353 $subs = $days_fields[$day]->getSubItems();
354 if ($slot[0]) {
355 $subs[0]->setValue($slot[0]);
356 }
357 if ($slot[1]) {
358 $subs[1]->setValue($slot[1]);
359 }
360 }
361 }
362 }

References $form.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ update()

ilBookingScheduleGUI::update ( )

Update dataset.

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

317 {
320
321 $form = $this->initForm('edit', $this->schedule_id);
322 if ($form->checkInput()) {
323 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
324 $obj = new ilBookingSchedule($this->schedule_id);
325 $this->formToObject($form, $obj);
326 $obj->update();
327
328 ilUtil::sendSuccess($lng->txt("book_schedule_updated"));
329 $this->render();
330 } else {
331 $form->setValuesByPost();
333 $tpl->setContent($form->getHTML());
334 }
335 }

References $form, $lng, $tpl, formToObject(), initForm(), render(), and setDefinitionFromPost().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilBookingScheduleGUI::$access
protected

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

Referenced by render().

◆ $ctrl

ilBookingScheduleGUI::$ctrl
protected

◆ $help

ilBookingScheduleGUI::$help
protected

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

Referenced by confirmDelete(), create(), and edit().

◆ $lng

ilBookingScheduleGUI::$lng
protected

◆ $obj_data_cache

ilBookingScheduleGUI::$obj_data_cache
protected

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

Referenced by formToObject().

◆ $schedule_id

ilBookingScheduleGUI::$schedule_id
protected

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

◆ $tabs

ilBookingScheduleGUI::$tabs
protected

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

Referenced by confirmDelete(), create(), edit(), and executeCommand().

◆ $tpl

ilBookingScheduleGUI::$tpl
protected

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