ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 @ilCtrl_Calls 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.

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

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

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

348 : void
349 {
350 $ilCtrl = $this->ctrl;
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 }
ilGlobalTemplateInterface $tpl
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...
setSubScreenId(string $a_id)
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.

References $lng, and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ create()

ilBookingScheduleGUI::create ( )

Render creation form.

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

110 : void
111 {
113 $ilCtrl = $this->ctrl;
114 $ilTabs = $this->tabs;
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.
setScreenIdComponent(string $a_comp)

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

+ Here is the call graph for this function:

◆ delete()

ilBookingScheduleGUI::delete ( )

Delete schedule.

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

373 : void
374 {
375 $ilCtrl = $this->ctrl;
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 }

References $lng.

◆ edit()

ilBookingScheduleGUI::edit ( )

Render edit form.

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

131 : void
132 {
134 $ilCtrl = $this->ctrl;
135 $ilTabs = $this->tabs;
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 }

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

+ Here is the call graph for this function:

◆ executeCommand()

ilBookingScheduleGUI::executeCommand ( )

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

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)
@inheritDoc

References $ctrl, and ilCtrl\getNextClass().

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

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 }
setAvailabilityFrom(?ilDateTime $a_date=null)
setDefinitionBySlots(array $a_def)
setDeadline(int $a_deadline)
Set deadline.
setAvailabilityTo(?ilDateTime $a_date=null)
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-...
getItemByPostVar(string $a_post_var)

References ilBookingSchedule\setAvailabilityFrom().

+ Here is the call 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.

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 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This class represents a date/time property in a property form.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
loadLanguageModule(string $a_module)
Load language module.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.

Referenced by create(), and edit().

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

83 : void
84 {
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 }
static getList(int $a_pool_id, ?string $a_title=null)
Get list of booking objects.
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...

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

+ Here is the call graph for this function:

◆ save()

ilBookingScheduleGUI::save ( )

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

250 : void
251 {
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 }
render()
Render list of booking schedules uses ilBookingSchedulesTableGUI.
formToObject(ilPropertyFormGUI $form, ilBookingSchedule $schedule)
Set form data into schedule object.

References $lng, and ILIAS\UICore\GlobalTemplate\setContent().

+ Here is the call graph for this function:

◆ update()

ilBookingScheduleGUI::update ( )

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

269 : void
270 {
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 }

References $lng, and ILIAS\UICore\GlobalTemplate\setContent().

+ 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

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

Referenced by create(), edit(), executeCommand(), and render().

◆ $help

ilHelpGUI ilBookingScheduleGUI::$help
protected

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

Referenced by create(), and edit().

◆ $lng

ilLanguage ilBookingScheduleGUI::$lng
protected

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

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

◆ $obj_data_cache

ilObjectDataCache ilBookingScheduleGUI::$obj_data_cache
protected

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

◆ $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 create(), edit(), and render().


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