ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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

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.

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

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  }
$_GET["client_id"]
schedule for booking ressource
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
Confirmation screen class.

◆ create()

ilBookingScheduleGUI::create ( )

Render creation form.

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

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

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  }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=NULL)
Build property form.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

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

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
schedule for booking ressource
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ edit()

ilBookingScheduleGUI::edit ( )

Render edit form.

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

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

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  }
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=NULL)
Build property form.
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ executeCommand()

ilBookingScheduleGUI::executeCommand ( )

main switch

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

References $cmd, $ilCtrl, and $tpl.

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
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18

◆ 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.

References ilScheduleInputGUI\getPostData().

Referenced by save(), and update().

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)
+ 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.

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

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

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 property form user interface.
schedule for booking ressource
This class represents a text property in a property form.
global $ilCtrl
Definition: ilias.php:18
setInfo($a_info)
Set Information Text.
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 text property in a property form.
global $lng
Definition: privfeed.php:40
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ 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.

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

Referenced by save(), and update().

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  }
addButton($a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
List booking schedules (for booking pool)
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupObjId($a_id)
static getList($a_pool_id)
Get list of booking objects for given type.
global $lng
Definition: privfeed.php:40
+ 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.

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
schedule for booking ressource
global $tpl
Definition: ilias.php:8
initForm($a_mode="create", $id=NULL)
Build property form.
formToObject($form, $schedule)
Convert incoming form data to schedule object.
global $lng
Definition: privfeed.php:40
render()
Render list of booking schedules.
setDefinitionFromPost(ilPropertyFormGUI $form)
Reload definition values from post data.
+ 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.

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

Referenced by save(), and update().

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  }
getItemByPostVar($a_post_var)
Get Item by POST variable.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ 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.

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
schedule for booking ressource
global $tpl
Definition: ilias.php:8
initForm($a_mode="create", $id=NULL)
Build property form.
formToObject($form, $schedule)
Convert incoming form data to schedule object.
global $lng
Definition: privfeed.php:40
render()
Render list of booking schedules.
setDefinitionFromPost(ilPropertyFormGUI $form)
Reload definition values from post data.
+ Here is the call graph for this function:

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