ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
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 Access AccessManager $access
 
ILIAS BookingManager StandardGUIRequest $book_request
 
ilGlobalTemplateInterface $tpl
 
ilTabsGUI $tabs
 
ilCtrl $ctrl
 
ilLanguage $lng
 
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(), 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->bookingManager()->internal()->domain()->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) {
58  $this->access->validateScheduleId(
59  $this->schedule_id,
60  ilObject::_lookupObjId($this->ref_id)
61  );
62  }
63  }
static _lookupObjId(int $ref_id)
global $DIC
Definition: shib_login.php:26
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDelete()

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

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

References $ctrl, $help, $lng, $tpl, ILIAS\UICore\GlobalTemplate\setContent(), ilHelpGUI\setSubScreenId(), and ilLanguage\txt().

348  : void
349  {
350  $ilCtrl = $this->ctrl;
351  $lng = $this->lng;
352  $tpl = $this->tpl;
353  $ilHelp = $this->help;
354 
355  $ilHelp->setSubScreenId("delete");
356 
357 
358  $conf = new ilConfirmationGUI();
359  $conf->setFormAction($ilCtrl->getFormAction($this));
360  $conf->setHeaderText($lng->txt('book_confirm_delete'));
361 
362  $type = new ilBookingSchedule($this->schedule_id);
363  $conf->addItem('schedule_id', $this->schedule_id, $type->getTitle());
364  $conf->setConfirm($lng->txt('delete'), 'delete');
365  $conf->setCancel($lng->txt('cancel'), 'render');
366 
367  $tpl->setContent($conf->getHTML());
368  }
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...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
setSubScreenId(string $a_id)
+ 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(), ILIAS\UICore\GlobalTemplate\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...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
setScreenIdComponent(string $a_comp)
+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

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

373  : void
374  {
375  $ilCtrl = $this->ctrl;
376  $lng = $this->lng;
377 
378  $obj = new ilBookingSchedule($this->schedule_id);
379  $obj->delete();
380 
381  $this->tpl->setOnScreenMessage('success', $lng->txt('book_schedule_deleted'), true);
382  $ilCtrl->redirect($this, 'render');
383  }
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(), ILIAS\UICore\GlobalTemplate\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...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
setScreenIdComponent(string $a_comp)
+ Here is the call graph for this function:

◆ executeCommand()

ilBookingScheduleGUI::executeCommand ( )

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

References $ctrl, and ilCtrl\getNextClass().

65  : void
66  {
67  $ilCtrl = $this->ctrl;
68 
69  $next_class = $ilCtrl->getNextClass($this);
70 
71  switch ($next_class) {
72  default:
73  $cmd = $ilCtrl->getCmd("render");
74  $this->$cmd();
75  break;
76  }
77  }
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 291 of file class.ilBookingScheduleGUI.php.

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

Referenced by save(), and update().

294  : void {
295  $ilObjDataCache = $this->obj_data_cache;
296 
297  $schedule->setTitle($form->getInput("title"));
298  $schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
299 
300  $from = $form->getItemByPostVar("from");
301  if ($from !== null) {
302  $schedule->setAvailabilityFrom($from->getDate());
303  }
304 
305  $to = $form->getItemByPostVar("to");
306  if ($to !== null) {
307  $schedule->setAvailabilityTo($to->getDate());
308  }
309 
310  switch ($form->getInput("deadline_opts")) {
311  case "slot_start":
312  $schedule->setDeadline(0);
313  break;
314 
315  case "hours":
316  $schedule->setDeadline($form->getInput("deadline"));
317  break;
318 
319  case "slot_end":
320  $schedule->setDeadline(-1);
321  break;
322  }
323 
324  /*
325  if($form->getInput("type") == "flexible")
326  {
327  $schedule->setRaster($form->getInput("raster"));
328  $schedule->setMinRental($form->getInput("rent_min"));
329  $schedule->setMaxRental($form->getInput("rent_max"));
330  $schedule->setAutoBreak($form->getInput("break"));
331  }
332  else
333  {
334  $schedule->setRaster(NULL);
335  $schedule->setMinRental(NULL);
336  $schedule->setMaxRental(NULL);
337  $schedule->setAutoBreak(NULL);
338  }
339  */
340 
341  $days = $form->getInput("days");
342  $schedule->setDefinitionBySlots($days);
343  }
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-...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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->setRequired(true);
188  $deadline_time->addSubItem($deadline);
189 
190  $deadline_start = new ilRadioOption($lng->txt("book_deadline_slot_start"), "slot_start");
191  $deadline_opts->addOption($deadline_start);
192 
193  $deadline_slot = new ilRadioOption($lng->txt("book_deadline_slot_end"), "slot_end");
194  $deadline_opts->addOption($deadline_slot);
195 
196  if ($a_mode === "edit") {
197  $schedule = new ilBookingSchedule($id);
198  }
199 
200  $av = new ilFormSectionHeaderGUI();
201  $av->setTitle($lng->txt("obj_activation_list_gui"));
202  $form_gui->addItem($av);
203 
204  // #18221
205  $lng->loadLanguageModule('rep');
206 
207  $from = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_start"), "from");
208  $from->setShowTime(true);
209  $form_gui->addItem($from);
210 
211  $to = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_end"), "to");
212  $to->setShowTime(true);
213  $form_gui->addItem($to);
214 
215  if ($a_mode === "edit") {
216  $form_gui->setTitle($lng->txt("book_edit_schedule"));
217 
218  $item = new ilHiddenInputGUI('schedule_id');
219  $item->setValue($id);
220  $form_gui->addItem($item);
221 
222  $schedule = new ilBookingSchedule($id);
223  $title->setValue($schedule->getTitle());
224  $from->setDate($schedule->getAvailabilityFrom());
225  $to->setDate($schedule->getAvailabilityTo());
226 
227  if ($schedule->getDeadline() === 0) {
228  $deadline_opts->setValue("slot_start");
229  } elseif ($schedule->getDeadline() > 0) {
230  $deadline->setValue($schedule->getDeadline());
231  $deadline_opts->setValue("hours");
232  } else {
233  $deadline->setValue(0);
234  $deadline_opts->setValue("slot_end");
235  }
236 
237  $definition->setValue($schedule->getDefinitionBySlots());
238 
239  $form_gui->addCommandButton("update", $lng->txt("save"));
240  } else {
241  $form_gui->setTitle($lng->txt("book_add_schedule"));
242  $form_gui->addCommandButton("save", $lng->txt("save"));
243  $form_gui->addCommandButton("render", $lng->txt("cancel"));
244  }
245  $form_gui->setFormAction($ilCtrl->getFormAction($this));
246 
247  return $form_gui;
248  }
This class represents an option in a radio group.
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...
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 class represents a date/time property in a property form.
This class represents a hidden form property in a property form.
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 83 of file class.ilBookingScheduleGUI.php.

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

Referenced by save(), and update().

83  : void
84  {
85  $tpl = $this->tpl;
86  $lng = $this->lng;
87  $ilCtrl = $this->ctrl;
88  $table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
89 
90  $bar = "";
91  if ($this->access->canManageSettings($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...
setContent(string $a_html)
Sets content for standard template.
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
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 250 of file class.ilBookingScheduleGUI.php.

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

250  : void
251  {
252  $tpl = $this->tpl;
253  $lng = $this->lng;
254 
255  $form = $this->initForm();
256  if ($form->checkInput()) {
257  $obj = new ilBookingSchedule();
258  $this->formToObject($form, $obj);
259  $obj->save();
260 
261  $this->tpl->setOnScreenMessage('success', $lng->txt("book_schedule_added"));
262  $this->render();
263  } else {
264  $form->setValuesByPost();
265  $tpl->setContent($form->getHTML());
266  }
267  }
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...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
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 269 of file class.ilBookingScheduleGUI.php.

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

269  : void
270  {
271  $tpl = $this->tpl;
272  $lng = $this->lng;
273 
274  $form = $this->initForm('edit', $this->schedule_id);
275  if ($form->checkInput()) {
276  $obj = new ilBookingSchedule($this->schedule_id);
277  $this->formToObject($form, $obj);
278  $obj->update();
279 
280  $this->tpl->setOnScreenMessage('success', $lng->txt("book_schedule_updated"));
281  $this->render();
282  } else {
283  $form->setValuesByPost();
284  $tpl->setContent($form->getHTML());
285  }
286  }
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...
setContent(string $a_html)
Sets content for standard template.
ilGlobalTemplateInterface $tpl
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

ILIAS BookingManager Access AccessManager ilBookingScheduleGUI::$access
protected

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

◆ $book_request

ILIAS BookingManager StandardGUIRequest ilBookingScheduleGUI::$book_request
protected

Definition at line 28 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 30 of file class.ilBookingScheduleGUI.php.

Referenced by create(), and edit().

◆ $tpl

ilGlobalTemplateInterface ilBookingScheduleGUI::$tpl
protected

Definition at line 29 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: