ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjBookingPoolGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObjectGUI.php";
5
19{
23 protected $tabs;
24
28 protected $nav_history;
29
33 protected $help;
34
38 protected $user_id_to_book; // user who is getting the reservation
39
43 protected $user_id_assigner; // user who performs the reservation.(self/another)
44
49 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
50 {
51 global $DIC;
52
53 $this->tpl = $DIC["tpl"];
54 $this->tabs = $DIC->tabs();
55 $this->nav_history = $DIC["ilNavigationHistory"];
56 $this->help = $DIC["ilHelp"];
57 $this->ctrl = $DIC->ctrl();
58 $this->lng = $DIC->language();
59 $this->type = "book";
60 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
61 $this->lng->loadLanguageModule("book");
62
63 $this->user_profile_id = (int) $_GET["user_id"];
64 $this->book_obj_id = (int) $_REQUEST['object_id'];
65 $this->seed = ilUtil::stripSlashes($_GET['seed']);
66 $this->sseed = ilUtil::stripSlashes($_GET['sseed']);
67 $this->reservation_id = ilUtil::stripSlashes($_GET["reservation_id"]);
68 $this->profile_user_id = (int) $_GET['user_id'];
69
70 $this->user_id_assigner = $this->user->getId();
71 if ($_GET['bkusr']) {
72 $this->user_id_to_book = (int) $_GET['bkusr'];
73 } else {
74 $this->user_id_to_book = $this->user_id_assigner; // by default user books his own booking objects.
75 }
76
77 if ((int) $_REQUEST['object_id'] > 0 && ilBookingObject::lookupPoolId((int) $_REQUEST['object_id']) != $this->object->getId()) {
78 throw new ilException("Booking Object ID does not match Booking Pool.");
79 }
80 }
81
87 public function executeCommand()
88 {
90 $ilTabs = $this->tabs;
91 $ilNavigationHistory = $this->nav_history;
93
94 $next_class = $this->ctrl->getNextClass($this);
95 $cmd = $this->ctrl->getCmd();
96
97 if (!$next_class && $cmd == 'render') {
98 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
99 $this->ctrl->setCmdClass('ilBookingObjectGUI');
100 $next_class = $this->ctrl->getNextClass($this);
101 } else {
102 $this->ctrl->redirect($this, "infoscreen");
103 }
104 }
105
106 if (substr($cmd, 0, 4) == 'book') {
107 $next_class = '';
108 }
109
110 $ilNavigationHistory->addItem(
111 $this->ref_id,
112 "./goto.php?target=book_" . $this->ref_id,
113 "book"
114 );
115
116 $this->prepareOutput();
117
118 switch ($next_class) {
119 case 'ilpermissiongui':
120 $this->checkPermission('edit_permission');
121 $this->tabs_gui->setTabActive('perm_settings');
122 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
123 $perm_gui = new ilPermissionGUI($this);
124 $ret = &$this->ctrl->forwardCommand($perm_gui);
125 break;
126
127 case 'ilbookingobjectgui':
128 if (!$this->checkPermissionBool('read') && $this->checkPermissionBool('visible')) {
129 $this->ctrl->redirect($this, "infoScreen");
130 }
131 $this->checkPermission('read');
132 $this->tabs_gui->setTabActive('render');
133 include_once("Modules/BookingManager/classes/class.ilBookingObjectGUI.php");
134 $object_gui = new ilBookingObjectGUI($this);
135 $ret = &$this->ctrl->forwardCommand($object_gui);
136 break;
137
138 case 'ilbookingschedulegui':
139 $this->checkPermission('write');
140 $this->tabs_gui->setTabActive('schedules');
141 include_once("Modules/BookingManager/classes/class.ilBookingScheduleGUI.php");
142 $schedule_gui = new ilBookingScheduleGUI($this);
143 $ret = &$this->ctrl->forwardCommand($schedule_gui);
144 break;
145
146 case 'ilpublicuserprofilegui':
147 $this->checkPermission('read');
148 $ilTabs->clearTargets();
149 include_once("Services/User/classes/class.ilPublicUserProfileGUI.php");
150 $profile = new ilPublicUserProfileGUI($this->user_profile_id);
151 $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
152 $ret = $this->ctrl->forwardCommand($profile);
153 $tpl->setContent($ret);
154 break;
155
156 case 'ilinfoscreengui':
157 $this->checkPermission('visible');
158 $this->infoScreen();
159 break;
160
161 case "ilcommonactiondispatchergui":
162 $this->checkPermission('read');
163 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
165 $this->ctrl->forwardCommand($gui);
166 break;
167
168 case "ilobjectcopygui":
169 $this->checkPermission('copy');
170 include_once "./Services/Object/classes/class.ilObjectCopyGUI.php";
171 $cp = new ilObjectCopyGUI($this);
172 $cp->setType("book");
173 $this->ctrl->forwardCommand($cp);
174 break;
175
176 case 'ilobjectmetadatagui':
177 $this->checkPermission('write');
178 $this->tabs_gui->setTabActive('meta_data');
179 include_once 'Services/Object/classes/class.ilObjectMetaDataGUI.php';
180 $md_gui = new ilObjectMetaDataGUI($this->object, 'bobj');
181 $this->ctrl->forwardCommand($md_gui);
182 break;
183
184 case 'ilbookingparticipantgui':
185 $this->checkPermission('write');
186 $this->tabs_gui->setTabActive('participants');
187 include_once("Modules/BookingManager/classes/class.ilBookingParticipantGUI.php");
188 $object_gui = new ilBookingParticipantGUI($this);
189 $this->ctrl->forwardCommand($object_gui);
190 break;
191
192 default:
193 if (!in_array($cmd, ["create", "save", "infoScreen"])) {
194 $this->checkPermission('read');
195 }
196 $cmd = $this->ctrl->getCmd();
197 $cmd .= 'Object';
198 $this->$cmd();
199 break;
200 }
201
202 $this->addHeaderAction();
203 return true;
204 }
205
206 protected function initCreationForms($a_new_type)
207 {
208 $forms = parent::initCreationForms($a_new_type);
209 unset($forms[self::CFORM_IMPORT]);
210
211 return $forms;
212 }
213
214 protected function afterSave(ilObject $a_new_object)
215 {
216 $a_new_object->setOffline(true);
217 $a_new_object->update();
218
219 // always send a message
220 ilUtil::sendSuccess($this->lng->txt("book_pool_added"), true);
221 $this->ctrl->setParameter($this, "ref_id", $a_new_object->getRefId());
222 $this->ctrl->redirect($this, "edit");
223 }
224
225 public function editObject()
226 {
227 $this->showNoScheduleMessage();
228 return parent::editObject();
229 }
230
237 public function showNoScheduleMessage()
238 {
239 // if we have no schedules yet - show info
240 include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
241 if ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE &&
242 !sizeof(ilBookingSchedule::getList($this->object->getId()))) {
243 ilUtil::sendInfo($this->lng->txt("book_schedule_warning_edit"));
244 }
245 }
246
247
248 protected function initEditCustomForm(ilPropertyFormGUI $a_form)
249 {
250 $obj_service = $this->getObjectService();
251
252 $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
253 $a_form->addItem($online);
254
255 $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype");
256 $type->setRequired(true);
257 $a_form->addItem($type);
258
259 // #14478
260 include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
261 if (sizeof(ilBookingObject::getList($this->object->getId()))) {
262 $type->setDisabled(true);
263 }
264
265 $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE);
266 $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info"));
267 $type->addOption($fixed);
268
269 #23637
270 //period
271 $period = new ilNumberInputGUI($this->lng->txt("book_reservation_filter_period"), "period");
272 $period->setInfo($this->lng->txt("book_reservation_filter_period_info"));
273 $period->setSuffix($this->lng->txt("days"));
274 $period->setSize(3);
275 $period->setMinValue(0);
276 $fixed->addSubItem($period);
277
278 // reminder
279 $rmd = new ilCheckboxInputGUI($this->lng->txt("book_reminder_setting"), "rmd");
280 $rmd->setChecked($this->object->getReminderStatus());
281 $fixed->addSubItem($rmd);
282
283 $rmd_day = new ilNumberInputGUI($this->lng->txt("book_reminder_day"), "rmd_day");
284 $rmd_day->setRequired(true);
285 $rmd_day->setInfo($this->lng->txt("book_reminder_day_info"));
286 $rmd_day->setSize(3);
287 $rmd_day->setSuffix($this->lng->txt("book_reminder_days"));
288 $rmd_day->setValue(max($this->object->getReminderDay(), 1));
289 $rmd_day->setMinValue(1);
290 $rmd->addSubItem($rmd_day);
291
292 $none = new ilRadioOption($this->lng->txt("book_schedule_type_none"), ilObjBookingPool::TYPE_NO_SCHEDULE);
293 $none->setInfo($this->lng->txt("book_schedule_type_none_info"));
294 $type->addOption($none);
295
296 $limit = new ilNumberInputGUI($this->lng->txt("book_overall_limit"), "limit");
297 $limit->setSize(4);
298 $limit->setMinValue(1);
299 $limit->setInfo($this->lng->txt("book_overall_limit_info"));
300 $none->addSubItem($limit);
301
302 $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
303 $public->setInfo($this->lng->txt("book_public_log_info"));
304 $a_form->addItem($public);
305
306 // presentation
307 $pres = new ilFormSectionHeaderGUI();
308 $pres->setTitle($this->lng->txt('obj_presentation'));
309 $a_form->addItem($pres);
310
311 // tile image
312 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->addTileImage();
313
314 // additional features
315 $feat = new ilFormSectionHeaderGUI();
316 $feat->setTitle($this->lng->txt('obj_features'));
317 $a_form->addItem($feat);
318 }
319
320 protected function getEditFormCustomValues(array &$a_values)
321 {
322 $a_values["online"] = !$this->object->isOffline();
323 $a_values["public"] = $this->object->hasPublicLog();
324 $a_values["stype"] = $this->object->getScheduleType();
325 $a_values["limit"] = $this->object->getOverallLimit();
326 $a_values["period"] = $this->object->getReservationFilterPeriod();
327 $a_values["rmd"] = $this->object->getReminderStatus();
328 $a_values["rmd_day"] = $this->object->getReminderDay();
329 }
330
331 protected function updateCustom(ilPropertyFormGUI $a_form)
332 {
333 $obj_service = $this->getObjectService();
334
335 $this->object->setOffline(!$a_form->getInput('online'));
336 $this->object->setReminderStatus($a_form->getInput('rmd'));
337 $this->object->setReminderDay($a_form->getInput('rmd_day'));
338 $this->object->setPublicLog($a_form->getInput('public'));
339 $this->object->setScheduleType($a_form->getInput('stype'));
340 $this->object->setOverallLimit($a_form->getInput('limit') ? $a_form->getInput('limit') : null);
341 $this->object->setReservationFilterPeriod(strlen($a_form->getInput('period')) ? (int) $a_form->getInput('period') : null);
342
343 // tile image
344 $obj_service->commonSettings()->legacyForm($a_form, $this->object)->saveTileImage();
345
346 include_once './Services/Container/classes/class.ilContainer.php';
347 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
349 $this->object->getId(),
350 $a_form,
352 );
353 }
354
356 {
357 include_once './Services/Container/classes/class.ilContainer.php';
358 include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
360 $this->object->getId(),
361 $a_form,
363 );
364 }
365
369 public function setTabs()
370 {
371 $ilHelp = $this->help;
373
374 if (in_array($this->ctrl->getCmd(), array("create", "save")) && !$this->ctrl->getNextClass()) {
375 return;
376 }
377
378 $ilHelp->setScreenIdComponent("book");
379
380 if ($this->checkPermissionBool('read')) {
381 if ($ilUser->getId() != ANONYMOUS_USER_ID) {
382 $this->tabs_gui->addTab(
383 "render",
384 $this->lng->txt("book_booking_types"),
385 $this->ctrl->getLinkTarget($this, "render")
386 );
387 }
388
389 $this->tabs_gui->addTab(
390 "info",
391 $this->lng->txt("info_short"),
392 $this->ctrl->getLinkTarget($this, "infoscreen")
393 );
394
395 if ($ilUser->getId() != ANONYMOUS_USER_ID || $this->object->hasPublicLog()) {
396 $this->tabs_gui->addTab(
397 "log",
398 $this->lng->txt("book_log"),
399 $this->ctrl->getLinkTarget($this, "log")
400 );
401 }
402 }
403
404 if ($this->checkPermissionBool('write')) {
405 if ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
406 $this->tabs_gui->addTab(
407 "schedules",
408 $this->lng->txt("book_schedules"),
409 $this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render")
410 );
411 }
412
413 $this->tabs_gui->addTab(
414 "settings",
415 $this->lng->txt("settings"),
416 $this->ctrl->getLinkTarget($this, "edit")
417 );
418
419 // meta data
420 include_once "Services/Object/classes/class.ilObjectMetaDataGUI.php";
421 $mdgui = new ilObjectMetaDataGUI($this->object, "bobj");
422 $mdtab = $mdgui->getTab();
423 if ($mdtab) {
424 $this->tabs_gui->addTarget(
425 "meta_data",
426 $mdtab,
427 "",
428 "ilobjectmetadatagui"
429 );
430 }
431 }
432
433 if ($this->checkPermissionBool('write')) {
434 $this->tabs_gui->addTab(
435 "participants",
436 $this->lng->txt("participants"),
437 $this->ctrl->getLinkTargetByClass("ilbookingparticipantgui", "render")
438 );
439 }
440
441 if ($this->checkPermissionBool('edit_permission')) {
442 $this->tabs_gui->addTab(
443 "perm_settings",
444 $this->lng->txt("perm_settings"),
445 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
446 );
447 }
448 }
449
450 protected function setHelpId($a_id)
451 {
452 $ilHelp = $this->help;
453
454 $object_subtype = ($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE)
455 ? '-schedule'
456 : '-nonschedule';
457
458 $ilHelp->setScreenIdComponent('book');
459 $ilHelp->setScreenId('object' . $object_subtype);
460 $ilHelp->setSubScreenId($a_id);
461 }
462
466 public function bookObject()
467 {
469
470 $this->tabs_gui->clearTargets();
471 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
472
473 $this->setHelpId("book");
474
475 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
476 $obj = new ilBookingObject((int) $_GET['object_id']);
477
478 $this->lng->loadLanguageModule("dateplaner");
479 $this->ctrl->setParameter($this, 'object_id', $obj->getId());
480
481 if ($this->user_id_to_book != $this->user_id_assigner) {
482 $this->ctrl->setParameter($this, 'bkusr', $this->user_id_to_book);
483 }
484
485 if ($this->object->getScheduleType() == ilObjBookingPool::TYPE_FIX_SCHEDULE) {
486 include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
487 $schedule = new ilBookingSchedule($obj->getScheduleId());
488
489 $tpl->setContent($this->renderSlots($schedule, array($obj->getId()), $obj->getTitle()));
490 } else {
491 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
492 $cgui = new ilConfirmationGUI();
493 $cgui->setHeaderText($this->lng->txt("book_confirm_booking_no_schedule"));
494
495 $cgui->setFormAction($this->ctrl->getFormAction($this));
496 $cgui->setCancel($this->lng->txt("cancel"), "render");
497 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedBooking");
498
499 $cgui->addItem("object_id", $obj->getId(), $obj->getTitle());
500
502 $cgui->addHiddenItem("part_view", ilBookingParticipantGUI::PARTICIPANT_VIEW);
503 }
504
505 $tpl->setContent($cgui->getHTML());
506 }
507 }
508
509 protected function renderSlots(ilBookingSchedule $schedule, array $object_ids, $title)
510 {
512
513 // fix
514 if (!$schedule->getRaster()) {
515 $mytpl = new ilTemplate('tpl.booking_reservation_fix.html', true, true, 'Modules/BookingManager');
516
517 $mytpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this));
518 $mytpl->setVariable('TXT_TITLE', $this->lng->txt('book_reservation_title'));
519 $mytpl->setVariable('TXT_INFO', $this->lng->txt('book_reservation_fix_info'));
520 $mytpl->setVariable('TXT_OBJECT', $title);
521 $mytpl->setVariable('TXT_CMD_BOOK', $this->lng->txt('book_confirm_booking'));
522 $mytpl->setVariable('TXT_CMD_CANCEL', $this->lng->txt('cancel'));
523
524 include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
525
526 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
527
528 $morning_aggr = $user_settings->getDayStart();
529 $evening_aggr = $user_settings->getDayEnd();
530 $hours = array();
531 for ($i = $morning_aggr;$i <= $evening_aggr;$i++) {
532 switch ($user_settings->getTimeFormat()) {
534 if ($morning_aggr > 0 && $i == $morning_aggr) {
535 $hours[$i] = sprintf('%02d:00', 0) . "-";
536 }
537 $hours[$i] .= sprintf('%02d:00', $i);
538 if ($evening_aggr < 23 && $i == $evening_aggr) {
539 $hours[$i] .= "-" . sprintf('%02d:00', 23);
540 }
541 break;
542
544 if ($morning_aggr > 0 && $i == $morning_aggr) {
545 $hours[$i] = date('h a', mktime(0, 0, 0, 1, 1, 2000)) . "-";
546 }
547 $hours[$i] .= date('h a', mktime($i, 0, 0, 1, 1, 2000));
548 if ($evening_aggr < 23 && $i == $evening_aggr) {
549 $hours[$i] .= "-" . date('h a', mktime(23, 0, 0, 1, 1, 2000));
550 }
551 break;
552 }
553 }
554
555 if ($this->seed != "") {
556 $find_first_open = false;
557 $seed = new ilDate($this->seed, IL_CAL_DATE);
558 } else {
559 $find_first_open = true;
560 $seed = ($this->sseed != "")
561 ? new ilDate($this->sseed, IL_CAL_DATE)
562 : new ilDate(time(), IL_CAL_UNIX);
563 }
564
565 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
566 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
567 $week_start = $user_settings->getWeekStart();
568
569 if (!$find_first_open) {
570 $dates = array();
571 $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
572 } else {
573 $dates = array();
574
575 //loop for 1 week
576 $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
577
578 // find first open slot
579 if (!$has_open_slot) {
580 // 1 year is limit for search
581 $limit = clone($seed);
582 $limit->increment(ilDate::YEAR, 1);
583 $limit = $limit->get(IL_CAL_UNIX);
584
585 while (!$has_open_slot && $seed->get(IL_CAL_UNIX) < $limit) {
586 $seed->increment(ilDate::WEEK, 1);
587
588 $dates = array();
589 $has_open_slot = $this->buildDatesBySchedule($week_start, $hours, $schedule, $object_ids, $seed, $dates);
590 }
591 }
592 }
593
594 include_once 'Services/Calendar/classes/class.ilCalendarHeaderNavigationGUI.php';
595 $navigation = new ilCalendarHeaderNavigationGUI($this, $seed, ilDateTime::WEEK, 'book');
596 $mytpl->setVariable('NAVIGATION', $navigation->getHTML());
597
598 foreach (ilCalendarUtil::_buildWeekDayList($seed, $week_start)->get() as $date) {
599 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
600
601 $mytpl->setCurrentBlock('weekdays');
602 $mytpl->setVariable('TXT_WEEKDAY', ilCalendarUtil:: _numericDayToString($date_info['wday']));
603 $mytpl->setVariable('TXT_DATE', $date_info['mday'] . ' ' . ilCalendarUtil:: _numericMonthToString($date_info['mon']));
604 $mytpl->parseCurrentBlock();
605 }
606
607 include_once 'Services/Calendar/classes/class.ilCalendarAppointmentColors.php';
608 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
609 $color = array();
611 for ($loop = 0; $loop < 7; $loop++) {
612 $col = $all[$loop];
614 $color[$loop + 1] = 'border-bottom: 1px solid ' . $col . '; background-color: ' . $col . '; color: ' . $fnt;
615 }
616
617 $counter = 0;
618 foreach ($dates as $hour => $days) {
619 $caption = $days;
620 $caption = array_shift($caption);
621
622 for ($loop = 1; $loop < 8; $loop++) {
623 if (!isset($days[$loop])) {
624 $mytpl->setCurrentBlock('dates');
625 $mytpl->setVariable('DUMMY', '&nbsp;');
626 $mytpl->parseCurrentBlock();
627 } else {
628 if (isset($days[$loop]['captions'])) {
629 foreach ($days[$loop]['captions'] as $slot_id => $slot_caption) {
630 $mytpl->setCurrentBlock('choice');
631 $mytpl->setVariable('TXT_DATE', $slot_caption);
632 $mytpl->setVariable('VALUE_DATE', $slot_id);
633 $mytpl->setVariable('DATE_COLOR', $color[$loop]);
634 $mytpl->setVariable(
635 'TXT_AVAILABLE',
636 sprintf(
637 $this->lng->txt('book_reservation_available'),
638 $days[$loop]['available'][$slot_id]
639 )
640 );
641 $mytpl->parseCurrentBlock();
642 }
643
644 $mytpl->setCurrentBlock('dates');
645 $mytpl->setVariable('DUMMY', '');
646 $mytpl->parseCurrentBlock();
647 } elseif (isset($days[$loop]['in_slot'])) {
648 $mytpl->setCurrentBlock('dates');
649 $mytpl->setVariable('DATE_COLOR', $color[$loop]);
650 $mytpl->parseCurrentBlock();
651 } else {
652 $mytpl->setCurrentBlock('dates');
653 $mytpl->setVariable('DUMMY', '&nbsp;');
654 $mytpl->parseCurrentBlock();
655 }
656 }
657 }
658
659 $mytpl->setCurrentBlock('slots');
660 $mytpl->setVariable('TXT_HOUR', $caption);
661 if ($counter % 2) {
662 $mytpl->setVariable('CSS_ROW', 'tblrow1');
663 } else {
664 $mytpl->setVariable('CSS_ROW', 'tblrow2');
665 }
666 $mytpl->parseCurrentBlock();
667
668 $counter++;
669 }
670 }
671 // flexible
672 else {
673 // :TODO: inactive for now
674 }
675
676 return $mytpl->get();
677 }
678
679 protected function buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
680 {
682
683 include_once 'Services/Calendar/classes/class.ilCalendarUserSettings.php';
684 $user_settings = ilCalendarUserSettings::_getInstanceByUserId($ilUser->getId());
685
686 $map = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
687 $definition = $schedule->getDefinition();
688
689 $av_from = ($schedule->getAvailabilityFrom() && !$schedule->getAvailabilityFrom()->isNull())
690 ? $schedule->getAvailabilityFrom()->get(IL_CAL_DATE)
691 : null;
692 $av_to = ($schedule->getAvailabilityTo() && !$schedule->getAvailabilityTo()->isNull())
693 ? $schedule->getAvailabilityTo()->get(IL_CAL_DATE)
694 : null;
695
696 $has_open_slot = false;
697 foreach (ilCalendarUtil::_buildWeekDayList($seed, $week_start)->get() as $date) {
698 $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC');
699
700 #24045 and #24936
701 if ($av_from || $av_to) {
702 $today = $date->get(IL_CAL_DATE);
703
704 if ($av_from && $av_from > $today) {
705 continue;
706 }
707
708 if ($av_to && $av_to < $today) {
709 continue;
710 }
711 }
712
713 $slots = array();
714 if (isset($definition[$map[$date_info['isoday'] - 1]])) {
715 $slots = array();
716 foreach ($definition[$map[$date_info['isoday'] - 1]] as $slot) {
717 $slot = explode('-', $slot);
718 $slots[] = array('from' => str_replace(':', '', $slot[0]),
719 'to' => str_replace(':', '', $slot[1]));
720 }
721 }
722
723 $last = array_pop(array_keys($hours));
724 $slot_captions = array();
725 foreach ($hours as $hour => $period) {
726 $dates[$hour][0] = $period;
727
728 $period = explode("-", $period);
729
730 // #13738
731 if ($user_settings->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12) {
732 $period[0] = date("H", strtotime($period[0]));
733 if (sizeof($period) == 2) {
734 $period[1] = date("H", strtotime($period[1]));
735 }
736 }
737
738 if (sizeof($period) == 1) {
739 $period_from = (int) substr($period[0], 0, 2) . "00";
740 $period_to = (int) substr($period[0], 0, 2) . "59";
741 } else {
742 $period_from = (int) substr($period[0], 0, 2) . "00";
743 $period_to = (int) substr($period[1], 0, 2) . "59";
744 }
745
746 $column = $date_info['isoday'];
747 if (!$week_start) {
748 if ($column < 7) {
749 $column++;
750 } else {
751 $column = 1;
752 }
753 }
754
755 if (sizeof($slots)) {
756 $in = false;
757 foreach ($slots as $slot) {
758 $slot_from = mktime(substr($slot['from'], 0, 2), substr($slot['from'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
759 $slot_to = mktime(substr($slot['to'], 0, 2), substr($slot['to'], 2, 2), 0, $date_info["mon"], $date_info["mday"], $date_info["year"]);
760
761 // always single object, we can sum up
762 $nr_available = (array) ilBookingReservation::getAvailableObject($object_ids, $slot_from, $slot_to - 1, false, true);
763
764 // any objects available?
765 if (!array_sum($nr_available)) {
766 continue;
767 }
768
769 // check deadline
770 if ($schedule->getDeadline() >= 0) {
771 // 0-n hours before slots begins
772 if ($slot_from < (time() + $schedule->getDeadline() * 60 * 60)) {
773 continue;
774 }
775 } else {
776 // running slots can be booked, only ended slots are invalid
777 if ($slot_to < time()) {
778 continue;
779 }
780 }
781
782 // is slot active in current hour?
783 if ((int) $slot['from'] < $period_to && (int) $slot['to'] > $period_from) {
785 $from = array_pop(explode(' ', $from));
787 $to = array_pop(explode(' ', $to));
788
789 // show caption (first hour) of slot
790 $id = $slot_from . '_' . $slot_to;
791 if (!in_array($id, $slot_captions)) {
792 $dates[$hour][$column]['captions'][$id] = $from . '-' . $to;
793 $dates[$hour][$column]['available'][$id] = array_sum($nr_available);
794 $slot_captions[] = $id;
795 }
796
797 $in = true;
798 }
799 }
800 // (any) active slot
801 if ($in) {
802 $has_open_slot = true;
803 $dates[$hour][$column]['in_slot'] = $in;
804 }
805 }
806 }
807 }
808
809 return $has_open_slot;
810 }
811
815 public function confirmedBookingObject()
816 {
818
819 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
820 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
821
822 $success = false;
823 $rsv_ids = array();
824
825 if ($this->object->getScheduleType() == ilObjBookingPool::TYPE_NO_SCHEDULE) {
826 if ($this->book_obj_id > 0) {
827 $object_id = $this->book_obj_id;
828 if ($object_id) {
830 !ilBookingReservation::getObjectReservationForUser($object_id, $this->user_id_to_book)) { // #18304
831 $rsv_ids[] = $this->processBooking($object_id);
832 $success = $object_id;
833 } else {
834 // #11852
835 ilUtil::sendFailure($this->lng->txt('book_reservation_failed_overbooked'), true);
836 $this->ctrl->redirect($this, 'render');
837 }
838 }
839 }
840 } else {
841 if (!isset($_POST['date'])) {
842 ilUtil::sendFailure($this->lng->txt('select_one'));
843 return $this->bookObject();
844 }
845
846 // single object reservation(s)
847 if ($this->book_obj_id > 0) {
848 $confirm = array();
849
850 $object_id = $this->book_obj_id;
851 if ($object_id) {
852 $group_id = null;
853 $nr = ilBookingObject::getNrOfItemsForObjects(array($object_id));
854 // needed for recurrence
856 foreach ($_POST['date'] as $date) {
857 $fromto = explode('_', $date);
858 $fromto[1]--;
859
860 $counter = ilBookingReservation::getAvailableObject(array($object_id), $fromto[0], $fromto[1], false, true);
861 $counter = $counter[$object_id];
862 if ($counter) {
863 // needed for recurrence
864 $confirm[$object_id . "_" . $fromto[0] . "_" . ($fromto[1] + 1)] = $counter;
865 }
866 }
867 }
868
869 if (sizeof($confirm)) {
870 return $this->confirmBookingNumbers($confirm, $group_id);
871 }
872 }
873 }
874
875 if ($success) {
876 $this->saveParticipant();
877 $this->handleBookingSuccess($success, $rsv_ids);
878 } else {
879 ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
880 $this->ctrl->redirect($this, 'book');
881 }
882 }
883
884 protected function handleBookingSuccess($a_obj_id, array $a_rsv_ids = null)
885 {
886 ilUtil::sendSuccess($this->lng->txt('book_reservation_confirmed'), true);
887
888 // show post booking information?
889 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
890 $obj = new ilBookingObject($a_obj_id);
891 $pfile = $obj->getPostFile();
892 $ptext = $obj->getPostText();
893 if (trim($ptext) || $pfile) {
894 if (sizeof($a_rsv_ids)) {
895 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'rsv_ids', implode(";", $a_rsv_ids));
896 }
897 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $obj->getId());
898 $this->ctrl->redirectByClass('ilbookingobjectgui', 'displayPostInfo');
899 } else {
901 $this->ctrl->redirectByClass('ilbookingparticipantgui', 'render');
902 } else {
903 $this->ctrl->redirect($this, 'render');
904 }
905 }
906 }
907
908 protected function initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload = false)
909 {
910 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
911 $form = new ilPropertyFormGUI();
912 $form->setFormAction($this->ctrl->getFormAction($this, "confirmedBooking"));
913 $form->setTitle($this->lng->txt("book_confirm_booking_schedule_number_of_objects"));
914 $form->setDescription($this->lng->txt("book_confirm_booking_schedule_number_of_objects_info"));
915
916 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
917 $section = false;
918 $min_date = null;
919 foreach ($a_objects_counter as $id => $counter) {
920 $id = explode("_", $id);
921 $book_id = $id[0] . "_" . $id[1] . "_" . $id[2] . "_" . $counter;
922
923 $obj = new ilBookingObject($id[0]);
924
925 if (!$section) {
927 $section->setTitle($obj->getTitle());
928 $form->addItem($section);
929
930 $section = true;
931 }
932
933 $period = /* $this->lng->txt("book_period").": ". */
935 new ilDateTime($id[1], IL_CAL_UNIX),
936 new ilDateTime($id[2], IL_CAL_UNIX)
937 );
938
939 $nr_field = new ilNumberInputGUI($period, "conf_nr__" . $book_id);
940 $nr_field->setValue(1);
941 $nr_field->setSize(3);
942 $nr_field->setMaxValue($counter);
943 $nr_field->setMinValue($counter ? 1 : 0);
944 $nr_field->setRequired(true);
945 $form->addItem($nr_field);
946
947 if (!$min_date || $id[1] < $min_date) {
948 $min_date = $id[1];
949 }
950 }
951
952 // recurrence
953 $this->lng->loadLanguageModule("dateplaner");
954 $rec_mode = new ilSelectInputGUI($this->lng->txt("cal_recurrences"), "recm");
955 $rec_mode->setRequired(true);
956 $rec_mode->setOptions(array(
957 "-1" => $this->lng->txt("cal_no_recurrence"),
958 1 => $this->lng->txt("cal_weekly"),
959 2 => $this->lng->txt("r_14"),
960 4 => $this->lng->txt("r_4_weeks")
961 ));
962 $form->addItem($rec_mode);
963
964 $rec_end = new ilDateTimeInputGUI($this->lng->txt("cal_repeat_until"), "rece");
965 $rec_end->setRequired(true);
966 $rec_mode->addSubItem($rec_end);
967
968 if (!$a_reload) {
969 // show date only if active recurrence
970 $rec_mode->setHideSubForm(true, '>= 1');
971
972 if ($min_date) {
973 $rec_end->setDate(new ilDateTime($min_date, IL_CAL_UNIX));
974 }
975 } else {
976 // recurrence may not be changed on reload
977 $rec_mode->setDisabled(true);
978 $rec_end->setDisabled(true);
979 }
980
981 if ($a_group_id) {
982 $grp = new ilHiddenInputGUI("grp_id");
983 $grp->setValue($a_group_id);
984 $form->addItem($grp);
985 }
986
987 if ($this->user_id_assigner != $this->user_id_to_book) {
988 $usr = new ilHiddenInputGUI("bkusr");
989 $usr->setValue($this->user_id_to_book);
990 $form->addItem($usr);
991 }
992
993 $form->addCommandButton("confirmedBookingNumbers", $this->lng->txt("confirm"));
994 $form->addCommandButton("render", $this->lng->txt("cancel"));
995
996 return $form;
997 }
998
999 public function confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form = null)
1000 {
1001 $tpl = $this->tpl;
1002
1003 $this->tabs_gui->clearTargets();
1004 $this->tabs_gui->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
1005
1006 if (!$a_form) {
1007 $a_form = $this->initBookingNumbersForm($a_objects_counter, $a_group_id);
1008 }
1009
1010 $tpl->setContent($a_form->getHTML());
1011 }
1012
1013 protected function addDaysDate($a_date, $a_days)
1014 {
1015 $date = date_parse($a_date);
1016 $stamp = mktime(0, 0, 1, $date["month"], $date["day"] + $a_days, $date["year"]);
1017 return date("Y-m-d", $stamp);
1018 }
1019
1020 protected function addDaysStamp($a_stamp, $a_days)
1021 {
1022 $date = getDate($a_stamp);
1023 return mktime(
1024 $date["hours"],
1025 $date["minutes"],
1026 $date["seconds"],
1027 $date["mon"],
1028 $date["mday"] + $a_days,
1029 $date["year"]
1030 );
1031 }
1032
1034 {
1035 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1036 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1037
1038 //get the user who will get the booking.
1039 if ($_POST['bkusr']) {
1040 $this->user_id_to_book = (int) $_POST['bkusr'];
1041 }
1042
1043 // convert post data to initial form config
1044 $counter = array();
1045 $current_first = $obj_id = null;
1046 foreach (array_keys($_POST) as $id) {
1047 if (substr($id, 0, 9) == "conf_nr__") {
1048 $id = explode("_", substr($id, 9));
1049 $counter[$id[0] . "_" . $id[1] . "_" . $id[2]] = (int) $id[3];
1050 if (!$current_first) {
1051 $current_first = date("Y-m-d", $id[1]);
1052 }
1053 }
1054 }
1055
1056 // recurrence
1057
1058 // checkInput() has not been called yet, so we have to improvise
1059 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
1061
1062 if ((int) $_POST["recm"] > 0 && $end && $current_first) {
1063 ksort($counter);
1064 $end = $end->get(IL_CAL_DATE);
1065 $cycle = (int) $_POST["recm"] * 7;
1066 $cut = 0;
1067 $org = $counter;
1068 while ($cut < 1000 && $this->addDaysDate($current_first, $cycle) <= $end) {
1069 $cut++;
1070 $current_first = null;
1071 foreach ($org as $item_id => $max) {
1072 $parts = explode("_", $item_id);
1073 $obj_id = $parts[0];
1074
1075 $from = $this->addDaysStamp($parts[1], $cycle * $cut);
1076 $to = $this->addDaysStamp($parts[2], $cycle * $cut);
1077
1078 $new_item_id = $obj_id . "_" . $from . "_" . $to;
1079
1080 // form reload because of validation errors
1081 if (!isset($counter[$new_item_id]) && date("Y-m-d", $to) <= $end) {
1082 // get max available for added dates
1083 $new_max = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to - 1, false, true);
1084 $new_max = (int) $new_max[$obj_id];
1085
1086 $counter[$new_item_id] = $new_max;
1087
1088 if (!$current_first) {
1089 $current_first = date("Y-m-d", $from);
1090 }
1091
1092 // clone input
1093 $_POST["conf_nr__" . $new_item_id . "_" . $new_max] = $_POST["conf_nr__" . $item_id . "_" . $max];
1094 }
1095 }
1096 }
1097 }
1098
1099 $group_id = $_POST["grp_id"];
1100
1101 $form = $this->initBookingNumbersForm($counter, $group_id, true);
1102 if ($form->checkInput()) {
1103 $success = false;
1104 $rsv_ids = array();
1105 foreach ($counter as $id => $all_nr) {
1106 $book_nr = $form->getInput("conf_nr__" . $id . "_" . $all_nr);
1107 $parts = explode("_", $id);
1108 $obj_id = $parts[0];
1109 $from = $parts[1];
1110 $to = $parts[2] - 1;
1111
1112 // get currently available slots
1113 $counter = ilBookingReservation::getAvailableObject(array($obj_id), $from, $to, false, true);
1114 $counter = $counter[$obj_id];
1115 if ($counter) {
1116 // we can only book what is left
1117 $book_nr = min($book_nr, $counter);
1118 for ($loop = 0; $loop < $book_nr; $loop++) {
1119 $rsv_ids[] = $this->processBooking($obj_id, $from, $to, $group_id);
1120 $success = $obj_id;
1121 }
1122 }
1123 }
1124 if ($success) {
1125 $this->saveParticipant();
1126 $this->handleBookingSuccess($success, $rsv_ids);
1127 } else {
1128 ilUtil::sendFailure($this->lng->txt('book_reservation_failed'), true);
1129 $this->ctrl->redirect($this, 'render');
1130 }
1131 } else {
1132 // ilDateTimeInputGUI does NOT add hidden values on disabled!
1133
1134 $rece_array = explode(".", $_POST['rece']);
1135
1136 $rece_day = str_pad($rece_array[0], 2, "0", STR_PAD_LEFT);
1137 $rece_month = str_pad($rece_array[1], 2, "0", STR_PAD_LEFT);
1138 $rece_year = $rece_array[2];
1139
1140 // ilDateTimeInputGUI will choke on POST array format
1141 $_POST["rece"] = null;
1142
1143 $form->setValuesByPost();
1144
1145 $rece_date = new ilDate($rece_year . "-" . $rece_month . "-" . $rece_day, IL_CAL_DATE);
1146
1147 $form->getItemByPostVar("rece")->setDate($rece_date);
1148 $form->getItemByPostVar("recm")->setHideSubForm($_POST["recm"] < 1);
1149
1150 $hidden_date = new ilHiddenInputGUI("rece");
1151 $hidden_date->setValue($rece_date);
1152 $form->addItem($hidden_date);
1153
1154 return $this->confirmBookingNumbers($counter, $group_id, $form);
1155 }
1156 }
1157
1167 public function processBooking($a_object_id, $a_from = null, $a_to = null, $a_group_id = null)
1168 {
1169 // #11995
1170 $this->checkPermission('read');
1171
1172 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1173 $reservation = new ilBookingReservation();
1174 $reservation->setObjectId($a_object_id);
1175 $reservation->setUserId($this->user_id_to_book);
1176 $reservation->setAssignerId($this->user_id_assigner);
1177 $reservation->setFrom($a_from);
1178 $reservation->setTo($a_to);
1179 $reservation->setGroupId($a_group_id);
1180 $reservation->save();
1181
1182 if ($a_from) {
1183 $this->lng->loadLanguageModule('dateplaner');
1184 include_once 'Services/Calendar/classes/class.ilCalendarUtil.php';
1185 include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
1186 $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_BOOK, $this->user_id_to_book, $this->lng->txt('cal_ch_personal_book'), true);
1187
1188 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1189 $object = new ilBookingObject($a_object_id);
1190
1191 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1192 $entry = new ilCalendarEntry;
1193 $entry->setStart(new ilDateTime($a_from, IL_CAL_UNIX));
1194 $entry->setEnd(new ilDateTime($a_to, IL_CAL_UNIX));
1195 $entry->setTitle($this->lng->txt('book_cal_entry') . ' ' . $object->getTitle());
1196 $entry->setContextId($reservation->getId());
1197 $entry->save();
1198
1199 include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1200 $assignment = new ilCalendarCategoryAssignments($entry->getEntryId());
1201 $assignment->addAssignment($def_cat->getCategoryId());
1202 }
1203
1204 return $reservation->getId();
1205 }
1206
1210 public function logObject()
1211 {
1212 $tpl = $this->tpl;
1213
1214 $this->tabs_gui->setTabActive('log');
1215
1216 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1217
1218 $filter = null;
1219 if ($this->book_obj_id > 0) {
1220 $filter["object"] = $this->book_obj_id;
1221 }
1222
1223 // coming from participants tab to cancel reservations.
1224 if ($_GET['user_id']) {
1225 $filter["user_id"] = (int) $_GET['user_id'];
1226 }
1227
1228 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1230 $this,
1231 'log',
1232 $this->ref_id,
1233 $this->object->getId(),
1234 $show_all,
1235 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1236 $filter
1237 );
1238 $tpl->setContent($table->getHTML());
1239 }
1240
1241 public function logDetailsObject()
1242 {
1243 $tpl = $this->tpl;
1244
1245 $this->tabs_gui->clearTargets();
1246 $this->tabs_gui->setBackTarget(
1247 $this->lng->txt("back"),
1248 $this->ctrl->getLinkTarget($this, "log")
1249 );
1250
1251 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1252
1253 $filter = null;
1254 if ($this->book_obj_id > 0) {
1255 $filter["object"] = $this->book_obj_id;
1256 }
1257
1258 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1260 $this,
1261 'log',
1262 $this->ref_id,
1263 $this->object->getId(),
1264 $show_all,
1265 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE),
1266 $filter,
1267 $this->reservation_id
1268 );
1269 $tpl->setContent($table->getHTML());
1270 }
1271
1275 public function changeStatusObject()
1276 {
1277 $this->tabs_gui->setTabActive('log');
1278
1279 if (!$_POST['reservation_id']) {
1280 ilUtil::sendFailure($this->lng->txt('select_one'));
1281 return $this->logObject();
1282 }
1283
1284 if ($this->checkPermissionBool('write')) {
1285 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1286 ilBookingReservation::changeStatus($_POST['reservation_id'], (int) $_POST['tstatus']);
1287 }
1288
1289 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1290 return $this->ctrl->redirect($this, 'log');
1291 }
1292
1296 public function applyLogFilterObject()
1297 {
1298 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1299
1300 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1302 $this,
1303 'log',
1304 $this->ref_id,
1305 $this->object->getId(),
1306 $show_all,
1307 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1308 );
1309 $table->resetOffset();
1310 $table->writeFilterToSession();
1311 $this->logObject();
1312 }
1313
1317 public function resetLogFilterObject()
1318 {
1319 $show_all = ($this->checkPermissionBool('write') || $this->object->hasPublicLog());
1320
1321 include_once 'Modules/BookingManager/classes/class.ilBookingReservationsTableGUI.php';
1323 $this,
1324 'log',
1325 $this->ref_id,
1326 $this->object->getId(),
1327 $show_all,
1328 ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE)
1329 );
1330 $table->resetOffset();
1331 $table->resetFilter();
1332 $this->logObject();
1333 }
1334
1335 public static function _goto($a_target)
1336 {
1337 global $DIC;
1338
1339 $ilAccess = $DIC->access();
1340 $lng = $DIC->language();
1341
1342 if ($ilAccess->checkAccess("read", "", $a_target)) {
1343 ilObjectGUI::_gotoRepositoryNode($a_target, "render");
1344 } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1345 ilUtil::sendFailure(sprintf(
1346 $lng->txt("msg_no_perm_read_item"),
1348 ), true);
1350 }
1351 }
1352
1358 public function infoScreenObject()
1359 {
1360 $this->ctrl->setCmd("showSummary");
1361 $this->ctrl->setCmdClass("ilinfoscreengui");
1362 $this->infoScreen();
1363 }
1364
1365 public function infoScreen()
1366 {
1368
1369 $this->tabs_gui->setTabActive('info');
1370
1371 $this->checkPermission("visible");
1372
1373 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1374 $info = new ilInfoScreenGUI($this);
1375
1376 $info->enablePrivateNotes();
1377
1378 if ($this->checkPermissionBool("read")) {
1379 $info->enableNews();
1380 }
1381
1382 // no news editing for files, just notifications
1383 $info->enableNewsEditing(false);
1384 if ($this->checkPermissionBool("write")) {
1385 $news_set = new ilSetting("news");
1386 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1387
1388 if ($enable_internal_rss) {
1389 $info->setBlockProperty("news", "settings", true);
1390 $info->setBlockProperty("news", "public_notifications_option", true);
1391 }
1392 }
1393
1394 // forward the command
1395 if ($ilCtrl->getNextClass() == "ilinfoscreengui") {
1396 $ilCtrl->forwardCommand($info);
1397 } else {
1398 return $ilCtrl->getHTML($info);
1399 }
1400 }
1401
1402 protected function getLogReservationIds()
1403 {
1404 if ($_POST["mrsv"]) {
1405 return $_POST["mrsv"];
1406 } elseif ($this->reservation_id > 0) {
1407 return array($this->reservation_id);
1408 }
1409 }
1410
1411 public function rsvConfirmCancelObject()
1412 {
1414 $lng = $this->lng;
1415 $tpl = $this->tpl;
1417
1418 $ids = $this->getLogReservationIds();
1419 if (!is_array($ids) || !sizeof($ids)) {
1420 $this->ctrl->redirect($this, 'log');
1421 }
1422
1423 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1424 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1425
1426 $max = array();
1427 foreach ($ids as $idx => $id) {
1428 if (!is_numeric($id)) {
1429 list($obj_id, $user_id, $from, $to) = explode("_", $id);
1430
1431 $valid_ids = array();
1432 foreach (ilBookingObject::getList($this->object->getId()) as $item) {
1433 $valid_ids[$item["booking_object_id"]] = $item["title"];
1434 }
1435
1436 if (($this->checkPermissionBool("write") || $user_id == $ilUser->getId()) &&
1437 $from > time() &&
1438 in_array($obj_id, array_keys($valid_ids))) {
1439 $rsv_ids = ilBookingReservation::getCancelDetails($obj_id, $user_id, $from, $to);
1440 if (!sizeof($rsv_ids)) {
1441 unset($ids[$idx]);
1442 }
1443 if (sizeof($rsv_ids) > 1) {
1444 $max[$id] = sizeof($rsv_ids);
1445 $ids[$idx] = $rsv_ids;
1446 } else {
1447 // only 1 in group? treat as normal reservation
1448 $ids[$idx] = array_shift($rsv_ids);
1449 }
1450 } else {
1451 unset($ids[$idx]);
1452 }
1453 }
1454 }
1455
1456 if (!is_array($ids) || !sizeof($ids)) {
1457 $this->ctrl->redirect($this, 'log');
1458 }
1459
1460 // show form instead
1461 if (sizeof($max) && max($max) > 1) {
1462 return $this->rsvConfirmCancelAggregationObject($ids);
1463 }
1464
1465 $this->tabs_gui->clearTargets();
1466 $this->tabs_gui->setBackTarget(
1467 $lng->txt("back"),
1468 $ilCtrl->getLinkTarget($this, "log")
1469 );
1470
1471 $this->setHelpId("cancel_booking");
1472
1473 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1474 $conf = new ilConfirmationGUI();
1475 $conf->setFormAction($ilCtrl->getFormAction($this, 'rsvCancel'));
1476 $conf->setHeaderText($lng->txt('book_confirm_cancel'));
1477 $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancel');
1478 $conf->setCancel($lng->txt('cancel'), 'log');
1479
1480 foreach ($ids as $id) {
1481 $rsv = new ilBookingReservation($id);
1482 $obj = new ilBookingObject($rsv->getObjectId());
1483
1484 $details = $obj->getTitle();
1485 if ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
1486 $details .= ", " . ilDatePresentation::formatPeriod(
1487 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1488 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
1489 );
1490 }
1491
1492 $conf->addItem('rsv_id[]', $id, $details);
1493 }
1494
1495 $tpl->setContent($conf->getHTML());
1496 }
1497
1498 public function rsvConfirmCancelAggregationForm($a_ids)
1499 {
1500 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
1501 $form = new ilPropertyFormGUI();
1502 $form->setFormAction($this->ctrl->getFormAction($this, "rsvCancel"));
1503 $form->setTitle($this->lng->txt("book_confirm_cancel_aggregation"));
1504
1505 include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
1506 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1507
1509
1510 foreach ($a_ids as $idx => $ids) {
1511 if (is_array($ids)) {
1512 $first = $ids;
1513 $first = array_shift($first);
1514 } else {
1515 $first = $ids;
1516 }
1517
1518 $rsv = new ilBookingReservation($first);
1519 $obj = new ilBookingObject($rsv->getObjectId());
1520
1521 $caption = $obj->getTitle() . ", " . ilDatePresentation::formatPeriod(
1522 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1523 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
1524 );
1525
1526 // #17869
1527 if (is_array($ids)) {
1528 $caption .= " (" . sizeof($ids) . ")";
1529 }
1530
1531 $item = new ilNumberInputGUI($caption, "rsv_id_" . $idx);
1532 $item->setRequired(true);
1533 $item->setMinValue(0);
1534 $item->setSize(4);
1535 $form->addItem($item);
1536
1537 if (is_array($ids)) {
1538 $item->setMaxValue(sizeof($ids));
1539
1540 foreach ($ids as $id) {
1541 $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "][]");
1542 $hidden->setValue($id);
1543 $form->addItem($hidden);
1544 }
1545 } else {
1546 $item->setMaxValue(1);
1547
1548 $hidden = new ilHiddenInputGUI("rsv_aggr[" . $idx . "]");
1549 $hidden->setValue($ids);
1550 $form->addItem($hidden);
1551 }
1552
1553 if ($_POST["rsv_id_" . $idx]) {
1554 $item->setValue((int) $_POST["rsv_id_" . $idx]);
1555 }
1556 }
1557
1558 $form->addCommandButton("rsvCancel", $this->lng->txt("confirm"));
1559 $form->addCommandButton("log", $this->lng->txt("cancel"));
1560
1561 return $form;
1562 }
1563
1564 public function rsvConfirmCancelAggregationObject(array $a_ids = null)
1565 {
1566 $tpl = $this->tpl;
1568 $lng = $this->lng;
1569
1570 $this->tabs_gui->clearTargets();
1571 $this->tabs_gui->setBackTarget(
1572 $lng->txt("back"),
1573 $ilCtrl->getLinkTarget($this, "log")
1574 );
1575
1576 $this->setHelpId("cancel_booking");
1577
1578 // #13511
1579 ilUtil::sendQuestion($lng->txt("book_confirm_cancel"));
1580
1581 $form = $this->rsvConfirmCancelAggregationForm($a_ids);
1582
1583 $tpl->setContent($form->getHTML());
1584 }
1585
1586 public function rsvCancelObject()
1587 {
1589 $tpl = $this->tpl;
1590 $lng = $this->lng;
1592
1593 $ids = $_POST["rsv_id"];
1594
1595 // parse aggregation form
1596 if ($_POST["rsv_aggr"]) {
1597 $form = $this->rsvConfirmCancelAggregationForm($_POST["rsv_aggr"]);
1598 if (!$form->checkInput()) {
1599 $this->tabs_gui->clearTargets();
1600 $this->tabs_gui->setBackTarget(
1601 $lng->txt("back"),
1602 $ilCtrl->getLinkTarget($this, "log")
1603 );
1604
1605 return $tpl->setContent($form->getHTML());
1606 }
1607
1608 $ids = array();
1609 foreach ($_POST["rsv_aggr"] as $idx => $aggr_ids) {
1610 $max = (int) $_POST["rsv_id_" . $idx];
1611 if ($max) {
1612 if (!is_array($aggr_ids)) {
1613 $ids[] = $aggr_ids;
1614 } else {
1615 $aggr_ids = array_slice($aggr_ids, 0, $max);
1616 $ids = array_merge($ids, $aggr_ids);
1617 }
1618 }
1619 }
1620 }
1621
1622 if ($ids) {
1623 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1624 foreach ($ids as $id) {
1625 $obj = new ilBookingReservation($id);
1626
1627 if (!$this->checkPermissionBool("write") && $obj->getUserId() != $ilUser->getId()) {
1628 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1629 $this->ctrl->redirect($this, 'log');
1630 }
1631
1633 $obj->update();
1634
1635 if ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
1636 // remove user calendar entry (#11086)
1637 $cal_entry_id = $obj->getCalendarEntry();
1638 if ($cal_entry_id) {
1639 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1640 $entry = new ilCalendarEntry($cal_entry_id);
1641 $entry->delete();
1642 }
1643 }
1644 }
1645 }
1646
1647 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1648 $this->logObject();
1649 }
1650
1651 public function rsvConfirmDeleteObject()
1652 {
1653 global $DIC;
1654 if (!$this->checkPermissionBool("write")) {
1655 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1656 $this->ctrl->redirect($this, 'log');
1657 }
1658
1659 $this->tabs_gui->clearTargets();
1660 $this->tabs_gui->setBackTarget(
1661 $this->lng->txt("back"),
1662 $this->ctrl->getLinkTarget($this, "log")
1663 );
1664
1665 include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
1666 $conf = new ilConfirmationGUI();
1667 $conf->setFormAction($this->ctrl->getFormAction($this, 'rsvDelete'));
1668 $conf->setHeaderText($this->lng->txt('book_confirm_delete'));
1669 $conf->setConfirm($this->lng->txt('book_set_delete'), 'rsvDelete');
1670 $conf->setCancel($this->lng->txt('cancel'), 'log');
1671
1672 list($obj_id, $user_id, $from, $to) = explode("_", $DIC->http()->request()->getQueryParams()['reservation_id']);
1674 $rsv = new ilBookingReservation($ids[0]);
1675 $obj = new ilBookingObject($rsv->getObjectId());
1676
1677 $details = sprintf($this->lng->txt('X_reservations_of'), count($ids)) . ' ' . $obj->getTitle();
1678 if ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
1679 $details .= ", " . ilDatePresentation::formatPeriod(
1680 new ilDateTime($rsv->getFrom(), IL_CAL_UNIX),
1681 new ilDateTime($rsv->getTo() + 1, IL_CAL_UNIX)
1682 );
1683 }
1684
1685 $conf->addItem('rsv_ids', implode(',', $ids), $details);
1686 $this->tpl->setContent($conf->getHTML());
1687 }
1688
1689 public function rsvDeleteObject()
1690 {
1691 global $DIC;
1692 $get = $DIC->http()->request()->getParsedBody()['rsv_ids'];
1693 if ($get) {
1694 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1695 foreach (explode(',', $get) as $id) {
1697 $obj = new ilBookingObject($res->getObjectId());
1698 if ($obj->getPoolId() != $this->object->getId() || !$this->checkPermissionBool("write")) {
1699 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1700 $this->ctrl->redirect($this, 'log');
1701 }
1702 if ($this->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE) {
1703 $cal_entry_id = $res->getCalendarEntry();
1704 if ($cal_entry_id) {
1705 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1706 $entry = new ilCalendarEntry($cal_entry_id);
1707 $entry->delete();
1708 }
1709 }
1710 $res->delete();
1711 }
1712 }
1713
1714 ilUtil::sendSuccess($this->lng->txt('reservation_deleted'));
1715 $this->logObject();
1716 }
1717
1718 public function rsvInUseObject()
1719 {
1720 $this->checkPermission("write");
1721
1722 $ids = $this->getLogReservationIds();
1723 if ($ids) {
1724 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1725 foreach ($ids as $id) {
1726 $obj = new ilBookingReservation($id);
1727 $obj->setStatus(ilBookingReservation::STATUS_IN_USE);
1728 $obj->update();
1729 }
1730 }
1731
1732 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1733 $this->logObject();
1734 }
1735
1736 public function rsvNotInUseObject()
1737 {
1738 $this->checkPermission("write");
1739
1740 $ids = $this->getLogReservationIds();
1741 if ($ids) {
1742 include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
1743 foreach ($ids as $id) {
1744 $obj = new ilBookingReservation($id);
1745 $obj->setStatus(null);
1746 $obj->update();
1747 }
1748 }
1749
1750 ilUtil::sendSuccess($this->lng->txt('settings_saved'));
1751 $this->logObject();
1752 }
1753
1754 public function showProfileObject()
1755 {
1756 $tpl = $this->tpl;
1758
1759 $this->tabs_gui->clearTargets();
1760
1761 $user_id = $this->profile_user_id;
1762
1763 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1764 $profile = new ilPublicUserProfileGUI($user_id);
1765 $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
1766 $tpl->setContent($ilCtrl->getHTML($profile));
1767 }
1768
1769 public function addLocatorItems()
1770 {
1771 $ilLocator = $this->locator;
1772
1773 if (is_object($this->object)) {
1774 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "render"), "", $this->object->getRefId());
1775 }
1776 }
1777
1781 protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
1782 {
1786 $lng = $this->lng;
1787
1788 $lng->loadLanguageModule("noti");
1789
1790 $lg = parent::initHeaderAction($a_sub_type, $a_sub_id);
1791
1792 if ($lg && $access->checkAccess("read", "", $this->ref_id)) {
1793 // notification
1794 if (true) {
1795 if (!ilNotification::hasNotification(ilNotification::TYPE_BOOK, $user->getId(), $this->object->getId())) {
1796 $lg->addHeaderIcon(
1797 "not_icon",
1798 ilUtil::getImagePath("notification_off.svg"),
1799 $lng->txt("noti_notification_deactivated")
1800 );
1801
1802 $ctrl->setParameter($this, "ntf", 1);
1803 $caption = "noti_activate_notification";
1804 } else {
1805 $lg->addHeaderIcon(
1806 "not_icon",
1807 ilUtil::getImagePath("notification_on.svg"),
1808 $lng->txt("noti_notification_activated")
1809 );
1810
1811 $ctrl->setParameter($this, "ntf", 0);
1812 $caption = "noti_deactivate_notification";
1813 }
1814
1815 $lg->addCustomCommand(
1816 $ctrl->getLinkTarget($this, "saveNotification"),
1817 $caption
1818 );
1819
1820 $ctrl->setParameter($this, "ntf", "");
1821 }
1822 }
1823
1824 return $lg;
1825 }
1826
1830 public function saveNotificationObject()
1831 {
1834
1835
1836 switch ($_GET["ntf"]) {
1837 case 0:
1838 ilNotification::setNotification(ilNotification::TYPE_BOOK, $user->getId(), $this->object->getId(), false);
1839 break;
1840
1841 case 1:
1842 ilNotification::setNotification(ilNotification::TYPE_BOOK, $user->getId(), $this->object->getId(), true);
1843 break;
1844 }
1845 $ctrl->redirect($this, "render");
1846 }
1847 /*
1848 * save booking participant.
1849 */
1850 protected function saveParticipant()
1851 {
1852 include_once("./Modules/BookingManager/classes/class.ilBookingParticipant.php");
1853 $participant = new ilBookingParticipant($this->user_id_to_book, $this->object->getId());
1854 }
1855
1860 {
1861 if ($_POST["mass"]) {
1862 $participants = $_POST["mass"];
1863 } else {
1864 $this->ctrl->redirectByClass('ilbookingobjectgui', 'render');
1865 }
1866
1867 $this->tabs->clearTargets();
1868 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $this->book_obj_id);
1869 $this->tabs->setBackTarget($this->lng->txt("back"), $this->ctrl->getLinkTargetByClass('ilbookingobjectgui', 'assignparticipants'));
1870 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', '');
1871
1872 $conf = new ilConfirmationGUI();
1873 $conf->setFormAction($this->ctrl->getFormAction($this));
1874
1875 //add user list as items.
1876 foreach ($participants as $id) {
1878 $conf->addItem("participants[]", $id, $name);
1879 }
1880
1881 $available = ilBookingReservation::numAvailableFromObjectNoSchedule($this->book_obj_id);
1882 if (sizeof($participants) > $available) {
1883 $obj = new ilBookingObject($this->book_obj_id);
1884 $conf->setHeaderText(
1885 sprintf(
1886 $this->lng->txt('book_limit_objects_available'),
1887 sizeof($participants),
1888 $obj->getTitle(),
1889 $available
1890 )
1891 );
1892 } else {
1893 $conf->setHeaderText($this->lng->txt('book_confirm_booking_no_schedule'));
1894 $conf->addHiddenItem("object_id", $this->book_obj_id);
1895 $conf->setConfirm($this->lng->txt("assign"), "saveMultipleBookings");
1896 }
1897
1898 $conf->setCancel($this->lng->txt("cancel"), 'redirectToList');
1899 $this->tpl->setContent($conf->getHTML());
1900 }
1901
1902 public function redirectToListObject()
1903 {
1904 $this->ctrl->setParameterByClass('ilbookingobjectgui', 'object_id', $this->book_obj_id);
1905 $this->ctrl->redirectByClass('ilbookingobjectgui', 'assignParticipants');
1906 }
1907
1913 {
1914 if ($_POST["participants"] && $_POST['object_id']) {
1915 $participants = $_POST["participants"];
1916 $this->book_obj_id = $_POST['object_id'];
1917 } else {
1918 $this->ctrl->redirectByClass('ilbookingobjectgui', 'render');
1919 }
1920 $rsv_ids = array();
1921 foreach ($participants as $id) {
1922 $this->user_id_to_book = $id;
1923 $rsv_ids[] = $this->processBooking($this->book_obj_id);
1924 }
1925
1926 if (sizeof($rsv_ids)) {
1927 ilUtil::sendSuccess("booking_multiple_succesfully");
1928 $this->ctrl->redirectByClass('ilbookingobjectgui', 'render');
1929 } else {
1930 ilUtil::sendFailure($this->lng->txt('book_reservation_failed_overbooked'), true);
1931 $this->ctrl->redirect($this, 'render');
1932 }
1933 }
1934}
user()
Definition: user.php:4
$success
Definition: Utf8Test.php:86
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
$section
Definition: Utf8Test.php:83
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_FKT_GETDATE
const IL_CAL_DATE
const IL_CAL_UNIX
Class ilBookingObjectGUI.
a bookable ressource
static lookupPoolId($object_id)
Lookup pool id.
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
static getList($a_pool_id, $a_title=null)
Get list of booking objects for given type.
Class ilBookingParticipantGUI.
Class ilBookingParticipant.
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static changeStatus(array $a_ids, $a_status)
List all reservations.
static getAvailableObject(array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
Check if any of given objects are bookable.
static getCancelDetails($a_obj_id, $a_user_id, $a_from, $a_to)
Get reservation ids from aggregated id for cancellation.
static getNewGroupId()
Get next group id.
static numAvailableFromObjectNoSchedule($a_obj_id)
static isObjectAvailableNoSchedule($a_obj_id)
Class ilBookingScheduleGUI.
schedule for booking ressource
getRaster()
Get booking raster.
static getList($a_pool_id)
Get list of booking objects for given pool.
static _getColorsByType($a_type)
get selectable colors
Model for a calendar entry.
setStart($a_start)
@access public
static _getInstanceByUserId($a_user_id)
get singleton instance
static parseIncomingDate($a_value, $a_add_time=null)
Try to parse incoming value to date object.
static _numericDayToString($a_day, $a_long=true)
get
static _buildWeekDayList($a_day, $a_weekstart)
build week day list
static calculateFontColor($a_html_color_code)
Calculate best font color from html hex color code.
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
This class represents a checkbox property in a property form.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Confirmation screen class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
This class represents a date/time property in a property form.
@classDescription Date and time handling
Class for single dates.
Base class for ILIAS Exception handling.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
Class ilInfoScreenGUI.
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
This class represents a number property in a property form.
Class ilObjBookingPoolGUI.
confirmBookingNumbers(array $a_objects_counter, $a_group_id, ilPropertyFormGUI $a_form=null)
buildDatesBySchedule($week_start, array $hours, $schedule, array $object_ids, $seed, array &$dates)
applyLogFilterObject()
Apply filter from reservations table gui.
addExternalEditFormCustom(ilPropertyFormGUI $a_form)
bookObject()
First step in booking process.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
afterSave(ilObject $a_new_object)
Post (successful) object creation hook.
changeStatusObject()
Change status of given reservations.
saveNotificationObject()
Save notification.
getEditFormCustomValues(array &$a_values)
Add values to custom edit fields.
processBooking($a_object_id, $a_from=null, $a_to=null, $a_group_id=null)
Book object for date.
saveMultipleBookingsObject()
Save multiple users reservations for one booking pool object.
initHeaderAction($a_sub_type=null, $a_sub_id=null)
Add header action menu.ilObjectListGUI
initCreationForms($a_new_type)
Init creation froms.
initEditCustomForm(ilPropertyFormGUI $a_form)
Add custom fields to update form.
rsvConfirmCancelAggregationObject(array $a_ids=null)
renderSlots(ilBookingSchedule $schedule, array $object_ids, $title)
handleBookingSuccess($a_obj_id, array $a_rsv_ids=null)
infoScreenObject()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually,...
confirmedBookingObject()
Book object - either of type or specific - for given dates.
initBookingNumbersForm(array $a_objects_counter, $a_group_id, $a_reload=false)
updateCustom(ilPropertyFormGUI $a_form)
Insert custom update form values into object.
resetLogFilterObject()
Reset filter in reservations table gui.
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
bookMultipleParticipantsObject()
Create reservations for a bunch of booking pool participants.
showNoScheduleMessage()
Show no schedule message.
static _lookupFullname($a_user_id)
Lookup Full Name.
GUI class for the workflow of copying objects.
Class ilObjectGUI Basic methods of all Output classes.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
prepareOutput($a_show_subobjects=true)
prepare output
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
addHeaderAction()
Add header action menu.
getObjectService()
Get object service.
Class ilObjectMetaDataGUI.
static initServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Init service settings form.
static updateServiceSettingsForm($a_obj_id, ilPropertyFormGUI $form, $services)
Update service settings.
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
update()
update object in db
static _lookupTitle($a_id)
lookup object title
getRefId()
get reference id @access public
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
addItem($a_item)
Add Item (Property, SectionHeader).
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
GUI class for public user profile presentation.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$i
Definition: disco.tpl.php:19
$lg
Definition: example_018.php:62
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$ret
Definition: parser.php:6
$type
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$from
$ilUser
Definition: imgupload.php:18