ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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...
 

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 18 of file class.ilBookingScheduleGUI.php.

19 {
20 $this->ref_id = $a_parent_obj->ref_id;
21 }

Member Function Documentation

◆ confirmDelete()

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

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

351 {
352 global $ilCtrl, $lng, $tpl, $ilTabs, $ilHelp;
353
354 $ilHelp->setSubScreenId("delete");
355
356
357 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
358 $conf = new ilConfirmationGUI();
359 $conf->setFormAction($ilCtrl->getFormAction($this));
360 $conf->setHeaderText($lng->txt('book_confirm_delete'));
361
362 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
363 $type = new ilBookingSchedule((int)$_GET['schedule_id']);
364 $conf->addItem('schedule_id', (int)$_GET['schedule_id'], $type->getTitle());
365 $conf->setConfirm($lng->txt('delete'), 'delete');
366 $conf->setCancel($lng->txt('cancel'), 'render');
367
368 $tpl->setContent($conf->getHTML());
369 }
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
schedule for booking ressource
Confirmation screen class.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

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

◆ create()

ilBookingScheduleGUI::create ( )

Render creation form.

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

79 {
80 global $tpl, $ilCtrl, $ilTabs, $lng, $ilHelp;
81
82 $ilTabs->clearTargets();
83 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
84 $ilHelp->setScreenIdComponent("book");
85 $ilHelp->setScreenId("schedules");
86 $ilHelp->setSubScreenId("create");
87
88 $form = $this->initForm();
89 $tpl->setContent($form->getHTML());
90 }
initForm($a_mode="create", $id=NULL)
Build property form.

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

+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

375 {
376 global $ilCtrl, $lng;
377
378 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
379 $obj = new ilBookingSchedule((int)$_POST['schedule_id']);
380 $obj->delete();
381
382 ilUtil::sendSuccess($lng->txt('book_schedule_deleted'), true);
383 $ilCtrl->redirect($this, 'render');
384 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ edit()

ilBookingScheduleGUI::edit ( )

Render edit form.

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

96 {
97 global $tpl, $ilCtrl, $ilTabs, $lng, $ilHelp;
98
99 $ilTabs->clearTargets();
100 $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
101 $ilHelp->setScreenIdComponent("book");
102 $ilHelp->setScreenId("schedules");
103 $ilHelp->setSubScreenId("edit");
104
105 $form = $this->initForm('edit', (int)$_GET['schedule_id']);
106 $tpl->setContent($form->getHTML());
107 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingScheduleGUI::executeCommand ( )

main switch

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

27 {
28 global $tpl, $ilTabs, $ilCtrl;
29
30 $next_class = $ilCtrl->getNextClass($this);
31
32 switch($next_class)
33 {
34 default:
35 $cmd = $ilCtrl->getCmd("render");
36 $this->$cmd();
37 break;
38 }
39 return true;
40 }
$cmd
Definition: sahs_server.php:35

References $cmd, $ilCtrl, and $tpl.

◆ formToObject()

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

Convert incoming form data to schedule object.

Parameters
object$form
object$schedule

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

320 {
321 global $ilObjDataCache;
322
323 $schedule->setTitle($form->getInput("title"));
324 $schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
325 $schedule->setDeadline($form->getInput("deadline"));
326
327 /*
328 if($form->getInput("type") == "flexible")
329 {
330 $schedule->setRaster($form->getInput("raster"));
331 $schedule->setMinRental($form->getInput("rent_min"));
332 $schedule->setMaxRental($form->getInput("rent_max"));
333 $schedule->setAutoBreak($form->getInput("break"));
334 }
335 else
336 {
337 $schedule->setRaster(NULL);
338 $schedule->setMinRental(NULL);
339 $schedule->setMaxRental(NULL);
340 $schedule->setAutoBreak(NULL);
341 }
342 */
343
344 $schedule->setDefinitionBySlots(ilScheduleInputGUI::getPostData("days"));
345 }
static getPostData($a_post_var, $a_remove_invalid=true)

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

116 {
117 global $lng, $ilCtrl;
118
119 $lng->loadLanguageModule("dateplaner");
120
121 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
122
123 $form_gui = new ilPropertyFormGUI();
124
125 $title = new ilTextInputGUI($lng->txt("title"), "title");
126 $title->setRequired(true);
127 $title->setSize(40);
128 $title->setMaxLength(120);
129 $form_gui->addItem($title);
130
131 /*
132 $type = new ilRadioGroupInputGUI($lng->txt("book_schedule_type"), "type");
133 $type->setRequired(true);
134 $form_gui->addItem($type);
135 $fix = new ilRadioOption($lng->txt("book_schedule_type_fix"), "fix");
136 $fix->setInfo($lng->txt("book_schedule_type_fix_info"));
137 $type->addOption($fix);
138 $flex = new ilRadioOption($lng->txt("book_schedule_type_flexible"), "flexible");
139 $flex->setInfo($lng->txt("book_schedule_type_flexible_info"));
140 $type->addOption($flex);
141
142 $raster = new ilNumberInputGUI($lng->txt("book_schedule_raster"), "raster");
143 $raster->setRequired(true);
144 $raster->setInfo($lng->txt("book_schedule_raster_info"));
145 $raster->setMinValue(1);
146 $raster->setSize(3);
147 $raster->setMaxLength(3);
148 $raster->setSuffix($lng->txt("book_minutes"));
149 $flex->addSubItem($raster);
150
151 $rent_min = new ilNumberInputGUI($lng->txt("book_schedule_rent_min"), "rent_min");
152 $rent_min->setInfo($lng->txt("book_schedule_rent_info"));
153 $rent_min->setMinValue(1);
154 $rent_min->setSize(3);
155 $rent_min->setMaxLength(3);
156 $flex->addSubItem($rent_min);
157
158 $rent_max = new ilNumberInputGUI($lng->txt("book_schedule_rent_max"), "rent_max");
159 $rent_max->setInfo($lng->txt("book_schedule_rent_info"));
160 $rent_max->setMinValue(1);
161 $rent_max->setSize(3);
162 $rent_max->setMaxLength(3);
163 $flex->addSubItem($rent_max);
164
165 $break = new ilNumberInputGUI($lng->txt("book_schedule_break"), "break");
166 $break->setInfo($lng->txt("book_schedule_break_info"));
167 $break->setMinValue(1);
168 $break->setSize(3);
169 $break->setMaxLength(3);
170 $flex->addSubItem($break);
171 */
172
173 include_once "Modules/BookingManager/classes/class.ilScheduleInputGUI.php";
174 $definition = new ilScheduleInputGUI($lng->txt("book_schedule_days"), "days");
175 $definition->setInfo($lng->txt("book_schedule_days_info"));
176 $definition->setRequired(true);
177 $form_gui->addItem($definition);
178
179 $deadline = new ilNumberInputGUI($lng->txt("book_deadline"), "deadline");
180 $deadline->setInfo($lng->txt("book_deadline_info"));
181 $deadline->setSuffix($lng->txt("book_hours"));
182 $deadline->setMinValue(0);
183 $deadline->setSize(3);
184 $deadline->setMaxLength(3);
185 $form_gui->addItem($deadline);
186
187 if ($a_mode == "edit")
188 {
189 $form_gui->setTitle($lng->txt("book_edit_schedule"));
190
191 $item = new ilHiddenInputGUI('schedule_id');
192 $item->setValue($id);
193 $form_gui->addItem($item);
194
195 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
196 $schedule = new ilBookingSchedule($id);
197 $title->setValue($schedule->getTitle());
198 $deadline->setValue($schedule->getDeadline());
199
200 /*
201 if($schedule->getRaster())
202 {
203 $type->setValue("flexible");
204 $raster->setValue($schedule->getRaster());
205 $rent_min->setValue($schedule->getMinRental());
206 $rent_max->setValue($schedule->getMaxRental());
207 $break->setValue($schedule->getAutoBreak());
208 }
209 else
210 {
211 $type->setValue("fix");
212 }
213 */
214
215 $definition->setValue($schedule->getDefinitionBySlots());
216
217 $form_gui->addCommandButton("update", $lng->txt("save"));
218 }
219 else
220 {
221 $form_gui->setTitle($lng->txt("book_add_schedule"));
222 $form_gui->addCommandButton("save", $lng->txt("save"));
223 $form_gui->addCommandButton("render", $lng->txt("cancel"));
224 }
225 $form_gui->setFormAction($ilCtrl->getFormAction($this));
226
227 return $form_gui;
228 }
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 text property in a property form.
This class represents a text property in a property form.

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

48 {
49 global $tpl, $lng, $ilCtrl, $ilAccess;
50
51 include_once 'Modules/BookingManager/classes/class.ilBookingSchedulesTableGUI.php';
52 $table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
53
54 if ($ilAccess->checkAccess('write', '', $this->ref_id))
55 {
56 // if we have schedules but no objects - show info
57 if(sizeof($table->getData()))
58 {
59 include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
60 if(!sizeof(ilBookingObject::getList(ilObject::_lookupObjId($this->ref_id))))
61 {
62 ilUtil::sendInfo($lng->txt("book_type_warning"));
63 }
64 }
65
66 include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
67 $bar = new ilToolbarGUI;
68 $bar->addButton($lng->txt('book_add_schedule'), $ilCtrl->getLinkTarget($this, 'create'));
69 $bar = $bar->getHTML();
70 }
71
72 $tpl->setContent($bar.$table->getHTML());
73 }
static getList($a_pool_id)
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.

References $ilCtrl, $lng, $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 233 of file class.ilBookingScheduleGUI.php.

234 {
235 global $tpl, $lng;
236
237 $form = $this->initForm();
238 if($form->checkInput())
239 {
240 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
241 $obj = new ilBookingSchedule;
242 $this->formToObject($form, $obj);
243 $obj->save();
244
245 ilUtil::sendSuccess($lng->txt("book_schedule_added"));
246 $this->render();
247 }
248 else
249 {
250 $form->setValuesByPost();
251 $this->setDefinitionFromPost($form);
252 $tpl->setContent($form->getHTML());
253 }
254 }
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(), ilUtil\sendSuccess(), 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 287 of file class.ilBookingScheduleGUI.php.

288 {
289 $days = $form->getInput("days");
290 if($days)
291 {
292 $days_group = $form->getItemByPostVar("days");
293 foreach($days_group->getOptions() as $option)
294 {
295 $days_fields[$option->getValue()] = $option;
296 }
297
298 foreach($days as $day)
299 {
300 $slot = $form->getInput($day."_slot");
301 $subs = $days_fields[$day]->getSubItems();
302 if($slot[0])
303 {
304 $subs[0]->setValue($slot[0]);
305 }
306 if($slot[1])
307 {
308 $subs[1]->setValue($slot[1]);
309 }
310 }
311 }
312 }
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 259 of file class.ilBookingScheduleGUI.php.

260 {
261 global $tpl, $lng;
262
263 $form = $this->initForm('edit', (int)$_POST['schedule_id']);
264 if($form->checkInput())
265 {
266 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
267 $obj = new ilBookingSchedule((int)$_POST['schedule_id']);
268 $this->formToObject($form, $obj);
269 $obj->update();
270
271 ilUtil::sendSuccess($lng->txt("book_schedule_updated"));
272 $this->render();
273 }
274 else
275 {
276 $form->setValuesByPost();
277 $this->setDefinitionFromPost($form);
278 $tpl->setContent($form->getHTML());
279 }
280 }

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

+ Here is the call graph for this function:

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