ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBookingScheduleGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilBookingScheduleGUI:

Public Member Functions

 __construct (ilObjBookingPoolGUI $a_parent_obj)
 
 executeCommand ()
 
 render ()
 Render list of booking schedules uses ilBookingSchedulesTableGUI. More...
 
 create ()
 Render creation form. More...
 
 edit ()
 Render edit form. More...
 
 initForm (string $a_mode="create", ?int $id=null)
 Build property form. More...
 
 save ()
 
 update ()
 
 confirmDelete ()
 Confirm delete. More...
 
 delete ()
 Delete schedule. More...
 

Protected Member Functions

 formToObject (ilPropertyFormGUI $form, ilBookingSchedule $schedule)
 Set form data into schedule object. More...
 

Protected Attributes

ILIAS BookingManager StandardGUIRequest $book_request
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ilCtrl $ctrl
 
ilLanguage $lng
 
ilAccessHandler $access
 
ilHelpGUI $help
 
ilObjectDataCache $obj_data_cache
 
int $schedule_id
 
int $ref_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilBookingScheduleGUI

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om ilBookingScheduleGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilBookingScheduleGUI::__construct ( ilObjBookingPoolGUI  $a_parent_obj)

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

References $DIC, ilObject\_lookupObjId(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilObjectGUI\getRefId(), ILIAS\Repository\help(), ILIAS\Repository\lng(), ilBookingSchedule\lookupPoolId(), and ILIAS\Repository\tabs().

40  {
41  global $DIC;
42 
43  $this->tpl = $DIC->ui()->mainTemplate();
44  $this->tabs = $DIC->tabs();
45  $this->ctrl = $DIC->ctrl();
46  $this->lng = $DIC->language();
47  $this->access = $DIC->access();
48  $this->help = $DIC["ilHelp"];
49  $this->obj_data_cache = $DIC["ilObjDataCache"];
50  $this->ref_id = $a_parent_obj->getRefId();
51  $this->book_request = $DIC->bookingManager()
52  ->internal()
53  ->gui()
54  ->standardRequest();
55  $this->schedule_id = $this->book_request->getScheduleId();
56 
57  if ($this->schedule_id > 0 && ilBookingSchedule::lookupPoolId($this->schedule_id) !== ilObject::_lookupObjId($this->ref_id)) {
58  throw new ilPermissionException("Schedule pool id does not match pool id.");
59  }
60 
61  }
static lookupPoolId(int $schedule_id)
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDelete()

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

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

References $ctrl, $help, $lng, $tpl, $type, ilGlobalTemplateInterface\setContent(), ilHelpGUI\setSubScreenId(), and ilLanguage\txt().

347  : void
348  {
349  $ilCtrl = $this->ctrl;
350  $lng = $this->lng;
351  $tpl = $this->tpl;
352  $ilHelp = $this->help;
353 
354  $ilHelp->setSubScreenId("delete");
355 
356 
357  $conf = new ilConfirmationGUI();
358  $conf->setFormAction($ilCtrl->getFormAction($this));
359  $conf->setHeaderText($lng->txt('book_confirm_delete'));
360 
361  $type = new ilBookingSchedule($this->schedule_id);
362  $conf->addItem('schedule_id', $this->schedule_id, $type->getTitle());
363  $conf->setConfirm($lng->txt('delete'), 'delete');
364  $conf->setCancel($lng->txt('cancel'), 'render');
365 
366  $tpl->setContent($conf->getHTML());
367  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
setSubScreenId(string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ create()

ilBookingScheduleGUI::create ( )

Render creation form.

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

References $ctrl, $help, $lng, $tabs, $tpl, initForm(), ilGlobalTemplateInterface\setContent(), ilHelpGUI\setScreenIdComponent(), and ilLanguage\txt().

110  : void
111  {
112  $tpl = $this->tpl;
113  $ilCtrl = $this->ctrl;
114  $ilTabs = $this->tabs;
115  $lng = $this->lng;
116  $ilHelp = $this->help;
117 
118  $ilTabs->clearTargets();
119  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
120  $ilHelp->setScreenIdComponent("book");
121  $ilHelp->setScreenId("schedules");
122  $ilHelp->setSubScreenId("create");
123 
124  $form = $this->initForm();
125  $tpl->setContent($form->getHTML());
126  }
initForm(string $a_mode="create", ?int $id=null)
Build property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
setScreenIdComponent(string $a_comp)
+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

References $ctrl, $lng, and ilLanguage\txt().

372  : void
373  {
374  $ilCtrl = $this->ctrl;
375  $lng = $this->lng;
376 
377  $obj = new ilBookingSchedule($this->schedule_id);
378  $obj->delete();
379 
380  $this->tpl->setOnScreenMessage('success', $lng->txt('book_schedule_deleted'), true);
381  $ilCtrl->redirect($this, 'render');
382  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ edit()

ilBookingScheduleGUI::edit ( )

Render edit form.

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

References $ctrl, $help, $lng, $tabs, $tpl, initForm(), ilGlobalTemplateInterface\setContent(), ilHelpGUI\setScreenIdComponent(), and ilLanguage\txt().

131  : void
132  {
133  $tpl = $this->tpl;
134  $ilCtrl = $this->ctrl;
135  $ilTabs = $this->tabs;
136  $lng = $this->lng;
137  $ilHelp = $this->help;
138 
139  $ilTabs->clearTargets();
140  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
141  $ilHelp->setScreenIdComponent("book");
142  $ilHelp->setScreenId("schedules");
143  $ilHelp->setSubScreenId("edit");
144 
145  $form = $this->initForm('edit', $this->schedule_id);
146  $tpl->setContent($form->getHTML());
147  }
initForm(string $a_mode="create", ?int $id=null)
Build property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
setScreenIdComponent(string $a_comp)
+ Here is the call graph for this function:

◆ executeCommand()

ilBookingScheduleGUI::executeCommand ( )

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

References $ctrl, and ilCtrl\getNextClass().

63  : void
64  {
65  $ilCtrl = $this->ctrl;
66 
67  $next_class = $ilCtrl->getNextClass($this);
68 
69  switch ($next_class) {
70  default:
71  $cmd = $ilCtrl->getCmd("render");
72  $this->$cmd();
73  break;
74  }
75  }
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ formToObject()

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

Set form data into schedule object.

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

References $obj_data_cache, ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), ilBookingSchedule\setAvailabilityFrom(), ilBookingSchedule\setAvailabilityTo(), ilBookingSchedule\setDeadline(), ilBookingSchedule\setDefinitionBySlots(), ilBookingSchedule\setPoolId(), and ilBookingSchedule\setTitle().

Referenced by save(), and update().

293  : void {
294  $ilObjDataCache = $this->obj_data_cache;
295 
296  $schedule->setTitle($form->getInput("title"));
297  $schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
298 
299  $from = $form->getItemByPostVar("from");
300  if ($from !== null) {
301  $schedule->setAvailabilityFrom($from->getDate());
302  }
303 
304  $to = $form->getItemByPostVar("to");
305  if ($to !== null) {
306  $schedule->setAvailabilityTo($to->getDate());
307  }
308 
309  switch ($form->getInput("deadline_opts")) {
310  case "slot_start":
311  $schedule->setDeadline(0);
312  break;
313 
314  case "hours":
315  $schedule->setDeadline($form->getInput("deadline"));
316  break;
317 
318  case "slot_end":
319  $schedule->setDeadline(-1);
320  break;
321  }
322 
323  /*
324  if($form->getInput("type") == "flexible")
325  {
326  $schedule->setRaster($form->getInput("raster"));
327  $schedule->setMinRental($form->getInput("rent_min"));
328  $schedule->setMaxRental($form->getInput("rent_max"));
329  $schedule->setAutoBreak($form->getInput("break"));
330  }
331  else
332  {
333  $schedule->setRaster(NULL);
334  $schedule->setMinRental(NULL);
335  $schedule->setMaxRental(NULL);
336  $schedule->setAutoBreak(NULL);
337  }
338  */
339 
340  $days = $form->getInput("days");
341  $schedule->setDefinitionBySlots($days);
342  }
setDeadline(int $a_deadline)
Set deadline.
getItemByPostVar(string $a_post_var)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
setDefinitionBySlots(array $a_def)
setAvailabilityTo(?ilDateTime $a_date=null)
setAvailabilityFrom(?ilDateTime $a_date=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initForm()

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

Build property form.

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

References $ctrl, $id, $lng, ilLanguage\loadLanguageModule(), ilFormPropertyGUI\setInfo(), ilFormPropertyGUI\setRequired(), ilDateTimeInputGUI\setShowTime(), and ilLanguage\txt().

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

156  $lng = $this->lng;
157  $ilCtrl = $this->ctrl;
158 
159  $lng->loadLanguageModule("dateplaner");
160 
161  $form_gui = new ilPropertyFormGUI();
162 
163  $title = new ilTextInputGUI($lng->txt("title"), "title");
164  $title->setRequired(true);
165  $title->setSize(40);
166  $title->setMaxLength(120);
167  $form_gui->addItem($title);
168 
169  $definition = new ilScheduleInputGUI($lng->txt("book_schedule_days"), "days");
170  $definition->setInfo($lng->txt("book_schedule_days_info"));
171  $definition->setRequired(true);
172  $form_gui->addItem($definition);
173 
174  $deadline_opts = new ilRadioGroupInputGUI($lng->txt("book_deadline_options"), "deadline_opts");
175  $deadline_opts->setRequired(true);
176  $form_gui->addItem($deadline_opts);
177 
178  $deadline_time = new ilRadioOption($lng->txt("book_deadline_hours"), "hours");
179  $deadline_opts->addOption($deadline_time);
180 
181  $deadline = new ilNumberInputGUI($lng->txt("book_deadline"), "deadline");
182  $deadline->setInfo($lng->txt("book_deadline_info"));
183  $deadline->setSuffix($lng->txt("book_hours"));
184  $deadline->setMinValue(1);
185  $deadline->setSize(3);
186  $deadline->setMaxLength(3);
187  $deadline_time->addSubItem($deadline);
188 
189  $deadline_start = new ilRadioOption($lng->txt("book_deadline_slot_start"), "slot_start");
190  $deadline_opts->addOption($deadline_start);
191 
192  $deadline_slot = new ilRadioOption($lng->txt("book_deadline_slot_end"), "slot_end");
193  $deadline_opts->addOption($deadline_slot);
194 
195  if ($a_mode === "edit") {
196  $schedule = new ilBookingSchedule($id);
197  }
198 
199  $av = new ilFormSectionHeaderGUI();
200  $av->setTitle($lng->txt("obj_activation_list_gui"));
201  $form_gui->addItem($av);
202 
203  // #18221
204  $lng->loadLanguageModule('rep');
205 
206  $from = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_start"), "from");
207  $from->setShowTime(true);
208  $form_gui->addItem($from);
209 
210  $to = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_end"), "to");
211  $to->setShowTime(true);
212  $form_gui->addItem($to);
213 
214  if ($a_mode === "edit") {
215  $form_gui->setTitle($lng->txt("book_edit_schedule"));
216 
217  $item = new ilHiddenInputGUI('schedule_id');
218  $item->setValue($id);
219  $form_gui->addItem($item);
220 
221  $schedule = new ilBookingSchedule($id);
222  $title->setValue($schedule->getTitle());
223  $from->setDate($schedule->getAvailabilityFrom());
224  $to->setDate($schedule->getAvailabilityTo());
225 
226  if ($schedule->getDeadline() === 0) {
227  $deadline_opts->setValue("slot_start");
228  } elseif ($schedule->getDeadline() > 0) {
229  $deadline->setValue($schedule->getDeadline());
230  $deadline_opts->setValue("hours");
231  } else {
232  $deadline->setValue(0);
233  $deadline_opts->setValue("slot_end");
234  }
235 
236  $definition->setValue($schedule->getDefinitionBySlots());
237 
238  $form_gui->addCommandButton("update", $lng->txt("save"));
239  } else {
240  $form_gui->setTitle($lng->txt("book_add_schedule"));
241  $form_gui->addCommandButton("save", $lng->txt("save"));
242  $form_gui->addCommandButton("render", $lng->txt("cancel"));
243  }
244  $form_gui->setFormAction($ilCtrl->getFormAction($this));
245 
246  return $form_gui;
247  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setShowTime(bool $a_showtime)
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
This class represents a number property in a property form.
setRequired(bool $a_required)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ 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 81 of file class.ilBookingScheduleGUI.php.

References $access, Vendor\Package\$bar, $ctrl, $lng, $tpl, ilObject\_lookupObjId(), ilBookingObject\getList(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

Referenced by save(), and update().

81  : void
82  {
83  $tpl = $this->tpl;
84  $lng = $this->lng;
85  $ilCtrl = $this->ctrl;
86  $ilAccess = $this->access;
87 
88  $table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
89 
90  $bar = "";
91  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
92  // if we have schedules but no objects - show info
93  if (count($table->getData())) {
94  if (!count(ilBookingObject::getList(ilObject::_lookupObjId($this->ref_id)))) {
95  $this->tpl->setOnScreenMessage('info', $lng->txt("book_type_warning"));
96  }
97  }
98 
99  $bar = new ilToolbarGUI();
100  $bar->addButton($lng->txt('book_add_schedule'), $ilCtrl->getLinkTarget($this, 'create'));
101  $bar = $bar->getHTML();
102  }
103 
104  $tpl->setContent($bar . $table->getHTML());
105  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilBookingScheduleGUI::save ( )

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

References $lng, $tpl, formToObject(), initForm(), render(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

249  : void
250  {
251  $tpl = $this->tpl;
252  $lng = $this->lng;
253 
254  $form = $this->initForm();
255  if ($form->checkInput()) {
256  $obj = new ilBookingSchedule();
257  $this->formToObject($form, $obj);
258  $obj->save();
259 
260  $this->tpl->setOnScreenMessage('success', $lng->txt("book_schedule_added"));
261  $this->render();
262  } else {
263  $form->setValuesByPost();
264  $tpl->setContent($form->getHTML());
265  }
266  }
initForm(string $a_mode="create", ?int $id=null)
Build property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
formToObject(ilPropertyFormGUI $form, ilBookingSchedule $schedule)
Set form data into schedule object.
render()
Render list of booking schedules uses ilBookingSchedulesTableGUI.
+ Here is the call graph for this function:

◆ update()

ilBookingScheduleGUI::update ( )

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

References $lng, $tpl, formToObject(), initForm(), render(), ilGlobalTemplateInterface\setContent(), and ilLanguage\txt().

268  : void
269  {
270  $tpl = $this->tpl;
271  $lng = $this->lng;
272 
273  $form = $this->initForm('edit', $this->schedule_id);
274  if ($form->checkInput()) {
275  $obj = new ilBookingSchedule($this->schedule_id);
276  $this->formToObject($form, $obj);
277  $obj->update();
278 
279  $this->tpl->setOnScreenMessage('success', $lng->txt("book_schedule_updated"));
280  $this->render();
281  } else {
282  $form->setValuesByPost();
283  $tpl->setContent($form->getHTML());
284  }
285  }
initForm(string $a_mode="create", ?int $id=null)
Build property form.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilGlobalTemplateInterface $tpl
setContent(string $a_html)
Sets content for standard template.
formToObject(ilPropertyFormGUI $form, ilBookingSchedule $schedule)
Set form data into schedule object.
render()
Render list of booking schedules uses ilBookingSchedulesTableGUI.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilBookingScheduleGUI::$access
protected

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

Referenced by render().

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingScheduleGUI::$book_request
protected

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

◆ $ctrl

ilCtrl ilBookingScheduleGUI::$ctrl
protected

◆ $help

ilHelpGUI ilBookingScheduleGUI::$help
protected

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

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

◆ $lng

ilLanguage ilBookingScheduleGUI::$lng
protected

◆ $obj_data_cache

ilObjectDataCache ilBookingScheduleGUI::$obj_data_cache
protected

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

Referenced by formToObject().

◆ $ref_id

int ilBookingScheduleGUI::$ref_id
protected

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

◆ $schedule_id

int ilBookingScheduleGUI::$schedule_id
protected

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

◆ $tabs

ilTabsGUI ilBookingScheduleGUI::$tabs
protected

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

Referenced by create(), and edit().

◆ $tpl

ilGlobalTemplateInterface ilBookingScheduleGUI::$tpl
protected

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

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


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