ILIAS  release_7 Revision v7.30-3-g800a261c036
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: goto.php:24
help()
Definition: help.php:2

References $DIC, and help().

+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDelete()

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

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

410 {
411 $ilCtrl = $this->ctrl;
414 $ilTabs = $this->tabs;
415 $ilHelp = $this->help;
416
417 $ilHelp->setSubScreenId("delete");
418
419
420 $conf = new ilConfirmationGUI();
421 $conf->setFormAction($ilCtrl->getFormAction($this));
422 $conf->setHeaderText($lng->txt('book_confirm_delete'));
423
424 $type = new ilBookingSchedule($this->schedule_id);
425 $conf->addItem('schedule_id', $this->schedule_id, $type->getTitle());
426 $conf->setConfirm($lng->txt('delete'), 'delete');
427 $conf->setCancel($lng->txt('cancel'), 'render');
428
429 $tpl->setContent($conf->getHTML());
430 }
schedule for booking ressource
Confirmation screen class.
$type

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

◆ create()

ilBookingScheduleGUI::create ( )

Render creation form.

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

127 {
129 $ilCtrl = $this->ctrl;
130 $ilTabs = $this->tabs;
132 $ilHelp = $this->help;
133
134 $ilTabs->clearTargets();
135 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
136 $ilHelp->setScreenIdComponent("book");
137 $ilHelp->setScreenId("schedules");
138 $ilHelp->setSubScreenId("create");
139
140 $form = $this->initForm();
141 $tpl->setContent($form->getHTML());
142 }
initForm($a_mode="create", $id=null)
Build property form.

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

+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

436 {
437 $ilCtrl = $this->ctrl;
439
440 $obj = new ilBookingSchedule($this->schedule_id);
441 $obj->delete();
442
443 ilUtil::sendSuccess($lng->txt('book_schedule_deleted'), true);
444 $ilCtrl->redirect($this, 'render');
445 }

References $ctrl, and $lng.

◆ edit()

ilBookingScheduleGUI::edit ( )

Render edit form.

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

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

References $ctrl, $help, $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;
80 $ilCtrl = $this->ctrl;
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, $tabs, and $tpl.

◆ formToObject()

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

Convert incoming form data to schedule object.

Parameters
object$form
object$schedule

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

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

References $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 171 of file class.ilBookingScheduleGUI.php.

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

References $ctrl, and $lng.

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 {
102 $ilCtrl = $this->ctrl;
103 $ilAccess = $this->access;
104
105 $table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
106
107 if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
108 // if we have schedules but no objects - show info
109 if (sizeof($table->getData())) {
110 if (!sizeof(ilBookingObject::getList(ilObject::_lookupObjId($this->ref_id)))) {
111 ilUtil::sendInfo($lng->txt("book_type_warning"));
112 }
113 }
114
115 $bar = new ilToolbarGUI;
116 $bar->addButton($lng->txt('book_add_schedule'), $ilCtrl->getLinkTarget($this, 'create'));
117 $bar = $bar->getHTML();
118 }
119
120 $tpl->setContent($bar . $table->getHTML());
121 }
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)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $access, Vendor\Package\$bar, $ctrl, $lng, $tpl, ilObject\_lookupObjId(), 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 284 of file class.ilBookingScheduleGUI.php.

285 {
288
289 $form = $this->initForm();
290 if ($form->checkInput()) {
291 $obj = new ilBookingSchedule;
292 $this->formToObject($form, $obj);
293 $obj->save();
294
295 ilUtil::sendSuccess($lng->txt("book_schedule_added"));
296 $this->render();
297 } else {
298 $form->setValuesByPost();
299 $this->setDefinitionFromPost($form);
300 $tpl->setContent($form->getHTML());
301 }
302 }
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 $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 332 of file class.ilBookingScheduleGUI.php.

333 {
334 $days = $form->getInput("days");
335 if ($days) {
336 $days_group = $form->getItemByPostVar("days");
337 foreach ($days_group->getOptions() as $option) {
338 $days_fields[$option->getValue()] = $option;
339 }
340
341 foreach ($days as $day) {
342 $slot = $form->getInput($day . "_slot");
343 $subs = $days_fields[$day]->getSubItems();
344 if ($slot[0]) {
345 $subs[0]->setValue($slot[0]);
346 }
347 if ($slot[1]) {
348 $subs[1]->setValue($slot[1]);
349 }
350 }
351 }
352 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
getItemByPostVar($a_post_var)
Get Item by POST variable.

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

Referenced by save(), and update().

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

◆ update()

ilBookingScheduleGUI::update ( )

Update dataset.

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

308 {
311
312 $form = $this->initForm('edit', $this->schedule_id);
313 if ($form->checkInput()) {
314 $obj = new ilBookingSchedule($this->schedule_id);
315 $this->formToObject($form, $obj);
316 $obj->update();
317
318 ilUtil::sendSuccess($lng->txt("book_schedule_updated"));
319 $this->render();
320 } else {
321 $form->setValuesByPost();
322 $this->setDefinitionFromPost($form);
323 $tpl->setContent($form->getHTML());
324 }
325 }

References $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: