ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 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, 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  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ confirmDelete()

ilBookingScheduleGUI::confirmDelete ( )

Confirm delete.

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

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

340  : void
341  {
342  $ilCtrl = $this->ctrl;
343  $lng = $this->lng;
344  $tpl = $this->tpl;
345  $ilHelp = $this->help;
346 
347  $ilHelp->setSubScreenId("delete");
348 
349 
350  $conf = new ilConfirmationGUI();
351  $conf->setFormAction($ilCtrl->getFormAction($this));
352  $conf->setHeaderText($lng->txt('book_confirm_delete'));
353 
354  $type = new ilBookingSchedule($this->schedule_id);
355  $conf->addItem('schedule_id', $this->schedule_id, $type->getTitle());
356  $conf->setConfirm($lng->txt('delete'), 'delete');
357  $conf->setCancel($lng->txt('cancel'), 'render');
358 
359  $tpl->setContent($conf->getHTML());
360  }
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 103 of file class.ilBookingScheduleGUI.php.

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

103  : void
104  {
105  $tpl = $this->tpl;
106  $ilCtrl = $this->ctrl;
107  $ilTabs = $this->tabs;
108  $lng = $this->lng;
109  $ilHelp = $this->help;
110 
111  $ilTabs->clearTargets();
112  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
113  $ilHelp->setScreenIdComponent("book");
114  $ilHelp->setScreenId("schedules");
115  $ilHelp->setSubScreenId("create");
116 
117  $form = $this->initForm();
118  $tpl->setContent($form->getHTML());
119  }
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 365 of file class.ilBookingScheduleGUI.php.

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

365  : void
366  {
367  $ilCtrl = $this->ctrl;
368  $lng = $this->lng;
369 
370  $obj = new ilBookingSchedule($this->schedule_id);
371  $obj->delete();
372 
373  $this->tpl->setOnScreenMessage('success', $lng->txt('book_schedule_deleted'), true);
374  $ilCtrl->redirect($this, 'render');
375  }
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 124 of file class.ilBookingScheduleGUI.php.

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

124  : void
125  {
126  $tpl = $this->tpl;
127  $ilCtrl = $this->ctrl;
128  $ilTabs = $this->tabs;
129  $lng = $this->lng;
130  $ilHelp = $this->help;
131 
132  $ilTabs->clearTargets();
133  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
134  $ilHelp->setScreenIdComponent("book");
135  $ilHelp->setScreenId("schedules");
136  $ilHelp->setSubScreenId("edit");
137 
138  $form = $this->initForm('edit', $this->schedule_id);
139  $tpl->setContent($form->getHTML());
140  }
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 58 of file class.ilBookingScheduleGUI.php.

References $ctrl, and ilCtrl\getNextClass().

58  : void
59  {
60  $ilCtrl = $this->ctrl;
61 
62  $next_class = $ilCtrl->getNextClass($this);
63 
64  switch ($next_class) {
65  default:
66  $cmd = $ilCtrl->getCmd("render");
67  $this->$cmd();
68  break;
69  }
70  }
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 283 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().

286  : void {
287  $ilObjDataCache = $this->obj_data_cache;
288 
289  $schedule->setTitle($form->getInput("title"));
290  $schedule->setPoolId($ilObjDataCache->lookupObjId($this->ref_id));
291 
292  $from = $form->getItemByPostVar("from");
293  if ($from !== null) {
294  $schedule->setAvailabilityFrom($from->getDate());
295  }
296 
297  $to = $form->getItemByPostVar("to");
298  if ($to !== null) {
299  $schedule->setAvailabilityTo($to->getDate());
300  }
301 
302  switch ($form->getInput("deadline_opts")) {
303  case "slot_start":
304  $schedule->setDeadline(0);
305  break;
306 
307  case "hours":
308  $schedule->setDeadline($form->getInput("deadline"));
309  break;
310 
311  case "slot_end":
312  $schedule->setDeadline(-1);
313  break;
314  }
315 
316  /*
317  if($form->getInput("type") == "flexible")
318  {
319  $schedule->setRaster($form->getInput("raster"));
320  $schedule->setMinRental($form->getInput("rent_min"));
321  $schedule->setMaxRental($form->getInput("rent_max"));
322  $schedule->setAutoBreak($form->getInput("break"));
323  }
324  else
325  {
326  $schedule->setRaster(NULL);
327  $schedule->setMinRental(NULL);
328  $schedule->setMaxRental(NULL);
329  $schedule->setAutoBreak(NULL);
330  }
331  */
332 
333  $days = $form->getInput("days");
334  $schedule->setDefinitionBySlots($days);
335  }
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 145 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().

149  $lng = $this->lng;
150  $ilCtrl = $this->ctrl;
151 
152  $lng->loadLanguageModule("dateplaner");
153 
154  $form_gui = new ilPropertyFormGUI();
155 
156  $title = new ilTextInputGUI($lng->txt("title"), "title");
157  $title->setRequired(true);
158  $title->setSize(40);
159  $title->setMaxLength(120);
160  $form_gui->addItem($title);
161 
162  $definition = new ilScheduleInputGUI($lng->txt("book_schedule_days"), "days");
163  $definition->setInfo($lng->txt("book_schedule_days_info"));
164  $definition->setRequired(true);
165  $form_gui->addItem($definition);
166 
167  $deadline_opts = new ilRadioGroupInputGUI($lng->txt("book_deadline_options"), "deadline_opts");
168  $deadline_opts->setRequired(true);
169  $form_gui->addItem($deadline_opts);
170 
171  $deadline_time = new ilRadioOption($lng->txt("book_deadline_hours"), "hours");
172  $deadline_opts->addOption($deadline_time);
173 
174  $deadline = new ilNumberInputGUI($lng->txt("book_deadline"), "deadline");
175  $deadline->setInfo($lng->txt("book_deadline_info"));
176  $deadline->setSuffix($lng->txt("book_hours"));
177  $deadline->setMinValue(1);
178  $deadline->setSize(3);
179  $deadline->setMaxLength(3);
180  $deadline_time->addSubItem($deadline);
181 
182  $deadline_start = new ilRadioOption($lng->txt("book_deadline_slot_start"), "slot_start");
183  $deadline_opts->addOption($deadline_start);
184 
185  $deadline_slot = new ilRadioOption($lng->txt("book_deadline_slot_end"), "slot_end");
186  $deadline_opts->addOption($deadline_slot);
187 
188  if ($a_mode === "edit") {
189  $schedule = new ilBookingSchedule($id);
190  }
191 
192  $av = new ilFormSectionHeaderGUI();
193  $av->setTitle($lng->txt("obj_activation_list_gui"));
194  $form_gui->addItem($av);
195 
196  // #18221
197  $lng->loadLanguageModule('rep');
198 
199  $from = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_start"), "from");
200  $from->setShowTime(true);
201  $form_gui->addItem($from);
202 
203  $to = new ilDateTimeInputGUI($lng->txt("rep_activation_limited_end"), "to");
204  $to->setShowTime(true);
205  $form_gui->addItem($to);
206 
207  if ($a_mode === "edit") {
208  $form_gui->setTitle($lng->txt("book_edit_schedule"));
209 
210  $item = new ilHiddenInputGUI('schedule_id');
211  $item->setValue($id);
212  $form_gui->addItem($item);
213 
214  $schedule = new ilBookingSchedule($id);
215  $title->setValue($schedule->getTitle());
216  $from->setDate($schedule->getAvailabilityFrom());
217  $to->setDate($schedule->getAvailabilityTo());
218 
219  if ($schedule->getDeadline() === 0) {
220  $deadline_opts->setValue("slot_start");
221  } elseif ($schedule->getDeadline() > 0) {
222  $deadline->setValue($schedule->getDeadline());
223  $deadline_opts->setValue("hours");
224  } else {
225  $deadline->setValue(0);
226  $deadline_opts->setValue("slot_end");
227  }
228 
229  $definition->setValue($schedule->getDefinitionBySlots());
230 
231  $form_gui->addCommandButton("update", $lng->txt("save"));
232  } else {
233  $form_gui->setTitle($lng->txt("book_add_schedule"));
234  $form_gui->addCommandButton("save", $lng->txt("save"));
235  $form_gui->addCommandButton("render", $lng->txt("cancel"));
236  }
237  $form_gui->setFormAction($ilCtrl->getFormAction($this));
238 
239  return $form_gui;
240  }
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 76 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().

76  : void
77  {
78  $tpl = $this->tpl;
79  $lng = $this->lng;
80  $ilCtrl = $this->ctrl;
81  $table = new ilBookingSchedulesTableGUI($this, 'render', $this->ref_id);
82 
83  $bar = "";
84  if ($this->access->canManageSettings($this->ref_id)) {
85  // if we have schedules but no objects - show info
86  if (count($table->getData())) {
87  if (!count(ilBookingObject::getList(ilObject::_lookupObjId($this->ref_id)))) {
88  $this->tpl->setOnScreenMessage('info', $lng->txt("book_type_warning"));
89  }
90  }
91 
92  $bar = new ilToolbarGUI();
93  $bar->addButton($lng->txt('book_add_schedule'), $ilCtrl->getLinkTarget($this, 'create'));
94  $bar = $bar->getHTML();
95  }
96 
97  $tpl->setContent($bar . $table->getHTML());
98  }
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 242 of file class.ilBookingScheduleGUI.php.

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

242  : void
243  {
244  $tpl = $this->tpl;
245  $lng = $this->lng;
246 
247  $form = $this->initForm();
248  if ($form->checkInput()) {
249  $obj = new ilBookingSchedule();
250  $this->formToObject($form, $obj);
251  $obj->save();
252 
253  $this->tpl->setOnScreenMessage('success', $lng->txt("book_schedule_added"));
254  $this->render();
255  } else {
256  $form->setValuesByPost();
257  $tpl->setContent($form->getHTML());
258  }
259  }
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 261 of file class.ilBookingScheduleGUI.php.

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

261  : void
262  {
263  $tpl = $this->tpl;
264  $lng = $this->lng;
265 
266  $form = $this->initForm('edit', $this->schedule_id);
267  if ($form->checkInput()) {
268  $obj = new ilBookingSchedule($this->schedule_id);
269  $this->formToObject($form, $obj);
270  $obj->update();
271 
272  $this->tpl->setOnScreenMessage('success', $lng->txt("book_schedule_updated"));
273  $this->render();
274  } else {
275  $form->setValuesByPost();
276  $tpl->setContent($form->getHTML());
277  }
278  }
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: