ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilObjBookingPoolGUI.php
Go to the documentation of this file.
1 <?php
2 
28 {
29  protected \ILIAS\BookingManager\InternalDomainService $domain;
31  protected \ILIAS\BookingManager\StandardGUIRequest $book_request;
32  protected \ILIAS\BookingManager\InternalService $service;
33  protected ilTabsGUI $tabs;
36  protected int $user_id_to_book; // user who is getting the reservation
37  protected int $user_id_assigner; // user who performs the reservation.(self/another)
38  protected string $seed;
39  protected string $sseed;
40  protected int $profile_user_id;
41  protected int $book_obj_id;
42  protected string $reservation_id;
43 
44  public function __construct(
45  $a_data,
46  int $a_id,
47  bool $a_call_by_reference,
48  bool $a_prepare_output = true
49  ) {
50  global $DIC;
51 
52  $this->tpl = $DIC["tpl"];
53  $this->tabs = $DIC->tabs();
54  $this->nav_history = $DIC["ilNavigationHistory"];
55  $this->ctrl = $DIC->ctrl();
56  $this->lng = $DIC->language();
57  $this->type = "book";
58 
59  $this->book_request = $DIC->bookingManager()
60  ->internal()
61  ->gui()
62  ->standardRequest();
63  $this->domain = $DIC->bookingManager()->internal()->domain();
64 
65  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
66  $this->lng->loadLanguageModule("book");
67 
68  // not on creation
69  if (is_object($this->object)) {
71  $pool = $this->object;
72  $this->help = new ilBookingHelpAdapter($pool, $DIC["ilHelp"]);
73  $DIC["ilHelp"]->setScreenIdComponent("book");
74  }
75 
76  $this->book_obj_id = $this->book_request->getObjectId();
77  $this->seed = $this->book_request->getSeed();
78  $this->sseed = $this->book_request->getSSeed();
79  $this->reservation_id = $this->book_request->getReservationId();
80  $this->profile_user_id = $this->book_request->getUserId();
81 
82  $this->service = $DIC->bookingManager()->internal();
83 
84  $this->user_id_assigner = $this->user->getId();
85  if ($this->book_request->getBookedUser() > 0) {
86  $this->user_id_to_book = $this->book_request->getBookedUser();
87  } else {
88  $this->user_id_to_book = $this->user_id_assigner; // by default user books his own booking objects.
89  }
90 
91  if ($this->book_request->getObjectId() > 0 &&
92  ilBookingObject::lookupPoolId($this->book_request->getObjectId()) !== $this->object->getId()) {
93  throw new ilException("Booking Object ID does not match Booking Pool.");
94  }
95  $this->cron_manager = $DIC->cron()->manager();
96  }
97 
103  public function executeCommand(): void
104  {
105  $tpl = $this->tpl;
106  $ilTabs = $this->tabs;
107  $ilNavigationHistory = $this->nav_history;
108  $ilUser = $this->user;
109 
110  $next_class = $this->ctrl->getNextClass($this);
111  $cmd = $this->ctrl->getCmd();
112 
113  if (!$next_class && $cmd === 'render') {
114  if ($ilUser->getId() !== ANONYMOUS_USER_ID) {
115  if ($this->object->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES &&
116  !$this->checkPermissionBool('write')) {
117  $this->ctrl->setCmdClass('ilBookingPreferencesGUI');
118  } else {
119  $this->ctrl->setCmdClass('ilBookingObjectGUI');
120  }
121  $next_class = $this->ctrl->getNextClass($this);
122  } else {
123  $this->ctrl->redirect($this, "infoscreen");
124  }
125  }
126 
127  $ilNavigationHistory->addItem(
128  $this->ref_id,
129  "./goto.php?target=book_" . $this->ref_id,
130  "book"
131  );
132 
133  $this->prepareOutput();
134 
135  switch ($next_class) {
136  case 'ilpermissiongui':
137  $this->checkPermission('edit_permission');
138  $this->tabs_gui->setTabActive('perm_settings');
139  $perm_gui = new ilPermissionGUI($this);
140  $this->ctrl->forwardCommand($perm_gui);
141  break;
142 
143  case 'ilbookingobjectgui':
144  if (!$this->checkPermissionBool('read') && $this->checkPermissionBool('visible')) {
145  $this->ctrl->redirect($this, "infoScreen");
146  }
147  $this->checkPermission('read');
148  $this->tabs_gui->setTabActive('render');
149  $object_gui = new ilBookingObjectGUI(
150  $this,
151  $this->seed,
152  $this->sseed,
153  $this->help
154  );
155  $this->ctrl->forwardCommand($object_gui);
156  break;
157 
158  case 'ilbookingschedulegui':
159  $this->checkPermission('write');
160  $this->tabs_gui->setTabActive('schedules');
161  $schedule_gui = new ilBookingScheduleGUI($this);
162  $this->ctrl->forwardCommand($schedule_gui);
163  break;
164 
165  case 'ilpublicuserprofilegui':
166  $this->checkPermission('read');
167  $ilTabs->clearTargets();
168  $profile = new ilPublicUserProfileGUI($this->profile_user_id);
169  $profile->setBackUrl($this->ctrl->getLinkTargetByClass("ilbookingreservationsgui", ''));
170  $ret = $this->ctrl->forwardCommand($profile);
171  $tpl->setContent($ret);
172  break;
173 
174  case 'ilinfoscreengui':
175  $this->checkPermission('visible');
176  $this->infoScreen();
177  break;
178 
179  case "ilcommonactiondispatchergui":
180  $this->checkPermission('read');
182  if ($gui !== null) {
183  $this->ctrl->forwardCommand($gui);
184  }
185  break;
186 
187  case "ilobjectcopygui":
188  $this->checkPermission('copy');
189  $cp = new ilObjectCopyGUI($this);
190  $cp->setType("book");
191  $this->ctrl->forwardCommand($cp);
192  break;
193 
194  case 'ilobjectmetadatagui':
195  $this->checkPermission('write');
196  $this->tabs_gui->setTabActive('meta_data');
197  $md_gui = new ilObjectMetaDataGUI($this->object, 'bobj');
198  $this->ctrl->forwardCommand($md_gui);
199  break;
200 
201  case 'ilbookingparticipantgui':
202  $this->checkPermission('write');
203  $this->tabs_gui->setTabActive('participants');
204  $object_gui = new ilBookingParticipantGUI($this);
205  $this->ctrl->forwardCommand($object_gui);
206  break;
207 
208 
209  case "ilbookingreservationsgui":
210  $this->tabs_gui->setTabActive('log');
212  $pool = $this->object;
213  $res_gui = new ilBookingReservationsGUI($pool, $this->help);
214  $this->ctrl->forwardCommand($res_gui);
215  break;
216 
217  case 'ilbookingpreferencesgui':
218  $this->tabs_gui->setTabActive('preferences');
220  $pool = $this->object;
221  $gui = $this->service->gui()->preferences()->BookingPreferencesGUI($pool);
222  $this->ctrl->forwardCommand($gui);
223  break;
224 
225  case 'ildidactictemplategui':
226  $this->ctrl->setReturn($this, 'edit');
227  $did = new ilDidacticTemplateGUI($this);
228  $this->ctrl->forwardCommand($did);
229  break;
230 
231 
232  default:
233  if (!in_array($cmd, ["create", "save", "infoScreen"])) {
234  $this->checkPermission('read');
235  }
236  $cmd = $this->ctrl->getCmd();
237  $cmd .= 'Object';
238  $this->$cmd();
239  break;
240  }
241 
242  $this->addHeaderAction();
243  }
244 
245  protected function initCreationForms(string $new_type): array
246  {
247  $forms = parent::initCreationForms($new_type);
248  unset($forms[self::CFORM_IMPORT]);
249 
250  return $forms;
251  }
252 
253  protected function afterSave(ilObject $new_object): void
254  {
255  $new_object->setOffline(true);
256  $new_object->update();
257 
258  // always send a message
259  $this->tpl->setOnScreenMessage('success', $this->lng->txt("book_pool_added"), true);
260  $this->ctrl->setParameter($this, "ref_id", $new_object->getRefId());
261  $this->ctrl->redirect($this, "edit");
262  }
263 
264  protected function afterUpdate(): void
265  {
266  // check if template is changed
268  $this->object->getRefId()
269  );
270  $new_tpl_id = $this->getDidacticTemplateVar('dtpl');
271 
272  if ($new_tpl_id !== $current_tpl_id) {
273  // redirect to didactic template confirmation
274  $this->ctrl->setReturn($this, 'edit');
275  $this->ctrl->setCmdClass('ildidactictemplategui');
276  $this->ctrl->setCmd('confirmTemplateSwitch');
277  $dtpl_gui = new ilDidacticTemplateGUI($this, $new_tpl_id);
278  $this->ctrl->forwardCommand($dtpl_gui);
279  return;
280  }
281  parent::afterUpdate();
282  }
283 
284  public function editObject(): void
285  {
286  $this->showNoScheduleMessage();
287  if (!$this->checkPermissionBool("write")) {
288  $this->error->raiseError($this->lng->txt("msg_no_perm_write"), $this->error->MESSAGE);
289  }
290 
291  $this->tabs_gui->activateTab("settings");
292 
293  $form = $this->initEditForm();
294  $values = $this->getEditFormValues();
295  if ($values) {
296  $form->setValuesByArray($values, true);
297  }
298 
299  $this->addExternalEditFormCustom($form);
300 
301  $this->tpl->setContent($form->getHTML());
302  }
303 
304  public function showNoScheduleMessage(): void
305  {
306  $schedule_manager = $this->domain->schedules($this->object->getId());
307 
308  // if we have no schedules yet - show info
309  if ($this->object->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE &&
310  !$schedule_manager->hasSchedules()) {
311  $this->tpl->setOnScreenMessage('info', $this->lng->txt("book_schedule_warning_edit"));
312  }
313  }
314 
315 
316  protected function initEditCustomForm(ilPropertyFormGUI $form): void
317  {
318  $obj_service = $this->getObjectService();
319 
320  // Show didactic template type
321  $this->initDidacticTemplate($form);
322 
323  $type = new ilRadioGroupInputGUI($this->lng->txt("book_schedule_type"), "stype");
324  $type->setRequired(true);
325  $form->addItem($type);
326 
327  // #14478
328  if (count(ilBookingObject::getList($this->object->getId()))) {
329  $type->setDisabled(true);
330  }
331 
332  $fixed = new ilRadioOption($this->lng->txt("book_schedule_type_fixed"), ilObjBookingPool::TYPE_FIX_SCHEDULE);
333  $fixed->setInfo($this->lng->txt("book_schedule_type_fixed_info"));
334  $type->addOption($fixed);
335 
336  #23637
337  //period
338  $period = new ilNumberInputGUI($this->lng->txt("book_reservation_filter_period"), "period");
339  $period->setInfo($this->lng->txt("book_reservation_filter_period_info"));
340  $period->setSuffix($this->lng->txt("days"));
341  $period->setSize(3);
342  $period->setMinValue(0);
343  $fixed->addSubItem($period);
344 
345  // reminder
346  $rmd = new ilCheckboxInputGUI($this->lng->txt("book_reminder_setting"), "rmd");
347  $rmd->setChecked((bool) $this->object->getReminderStatus());
348  $info = $this->lng->txt("book_reminder_day_info");
349  if (!$this->cron_manager->isJobActive('book_notification')) {
350  $info .= " " . $this->lng->txt("book_notification_cron_not_active");
351  }
352  $rmd->setInfo($info);
353  $fixed->addSubItem($rmd);
354 
355  $rmd_day = new ilNumberInputGUI($this->lng->txt("book_reminder_day"), "rmd_day");
356  $rmd_day->setRequired(true);
357  $rmd_day->setSize(3);
358  $rmd_day->setSuffix($this->lng->txt("book_reminder_days"));
359  $rmd_day->setValue(max($this->object->getReminderDay(), 1));
360  $rmd_day->setMinValue(1);
361  $rmd->addSubItem($rmd_day);
362 
363  // no schedule, direct booking
364  $none = new ilRadioOption($this->lng->txt("book_schedule_type_none_direct"), ilObjBookingPool::TYPE_NO_SCHEDULE);
365  $none->setInfo($this->lng->txt("book_schedule_type_none_direct_info"));
366  $type->addOption($none);
367 
368  $limit = new ilNumberInputGUI($this->lng->txt("book_overall_limit"), "limit");
369  $limit->setSize(4);
370  $limit->setMinValue(1);
371  $limit->setSuffix($this->lng->txt("book_bookings_per_user"));
372  $none->addSubItem($limit);
373 
374  // no schedule, using preferences
375  $pref = new ilRadioOption($this->lng->txt("book_schedule_type_none_preference"), ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES);
376  $pref->setInfo($this->lng->txt("book_schedule_type_none_preference_info"));
377  $type->addOption($pref);
378 
379  $pref_options_disabled = false;
380  if ($this->object->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
381  $pref_manager = $this->domain->preferences($this->object);
382  $pref_options_disabled = $pref_manager->hasRun();
383  }
384 
385  // number of preferences
386  $pref_nr = new ilNumberInputGUI($this->lng->txt("book_nr_of_preferences"), "preference_nr");
387  $pref_nr->setSize(4);
388  $pref_nr->setMinValue(1);
389  $pref_nr->setInfo($this->lng->txt("book_nr_of_preferences_info"));
390  $pref_nr->setSuffix($this->lng->txt("book_nr_preferences"));
391  $pref_nr->setRequired(true);
392  $pref_nr->setDisabled($pref_options_disabled);
393  $pref->addSubItem($pref_nr);
394 
395  // preference deadline
396  $pref_deadline = new ilDateTimeInputGUI($this->lng->txt("book_pref_deadline"), "pref_deadline");
397  $pref_deadline->setInfo($this->lng->txt("book_pref_deadline_info"));
398  $pref_deadline->setShowTime(true);
399  $pref_deadline->setRequired(true);
400  $pref_deadline->setDisabled($pref_options_disabled);
401  $pref->addSubItem($pref_deadline);
402 
403 
404  $public = new ilCheckboxInputGUI($this->lng->txt("book_public_log"), "public");
405  $public->setInfo($this->lng->txt("book_public_log_info"));
406  $form->addItem($public);
407 
408  // messages
409  $mess = new ilCheckboxInputGUI($this->lng->txt("book_messages"), "messages");
410  $mess->setInfo($this->lng->txt("book_messages_info"));
411  $form->addItem($mess);
412 
413  $this->lng->loadLanguageModule("rep");
414  $section = new ilFormSectionHeaderGUI();
415  $section->setTitle($this->lng->txt('rep_activation_availability'));
416  $form->addItem($section);
417 
418  $online = new ilCheckboxInputGUI($this->lng->txt("online"), "online");
419  $form->addItem($online);
420 
421  // presentation
422  $pres = new ilFormSectionHeaderGUI();
423  $pres->setTitle($this->lng->txt('obj_presentation'));
424  $form->addItem($pres);
425 
426  // tile image
427  $obj_service->commonSettings()->legacyForm($form, $this->object)->addTileImage();
428 
429  // additional features
430  $feat = new ilFormSectionHeaderGUI();
431  $feat->setTitle($this->lng->txt('obj_features'));
432  $form->addItem($feat);
433  }
434 
435  protected function getEditFormCustomValues(
436  array &$a_values
437  ): void {
438  $a_values["online"] = !$this->object->isOffline();
439  $a_values["public"] = $this->object->hasPublicLog();
440  $a_values["messages"] = $this->object->usesMessages();
441  $a_values["stype"] = $this->object->getScheduleType();
442  $a_values["limit"] = $this->object->getOverallLimit();
443  $a_values["period"] = $this->object->getReservationFilterPeriod();
444  $a_values["rmd"] = $this->object->getReminderStatus();
445  $a_values["rmd_day"] = $this->object->getReminderDay();
446  $a_values["preference_nr"] = $this->object->getPreferenceNumber();
447  if ($this->object->getPreferenceDeadline() > 0) {
448  $a_values["pref_deadline"] = new ilDateTime($this->object->getPreferenceDeadline(), IL_CAL_UNIX);
449  }
450  }
451 
452  protected function updateCustom(ilPropertyFormGUI $form): void
453  {
454  $obj_service = $this->getObjectService();
455 
456  $pref_deadline = $form->getItemByPostVar("pref_deadline");
457  if ($pref_deadline !== null) {
458  $pref_deadline = $pref_deadline->getDate();
459  $pref_deadline = $pref_deadline
460  ? $pref_deadline->get(IL_CAL_UNIX)
461  : 0;
462 
463  $this->object->setOffline(!$form->getInput('online'));
464  $this->object->setReminderStatus((int) $form->getInput('rmd'));
465  $this->object->setReminderDay($form->getInput('rmd_day'));
466  $this->object->setPublicLog($form->getInput('public'));
467  $this->object->setScheduleType($form->getInput('stype'));
468  $this->object->setMessages((bool) (int) $form->getInput('messages'));
469  $this->object->setOverallLimit($form->getInput('limit') ?: null);
470  $this->object->setReservationFilterPeriod($form->getInput('period') != '' ? (int) $form->getInput('period') : null);
471  $this->object->setPreferenceDeadline($pref_deadline);
472  $this->object->setPreferenceNumber($form->getInput('preference_nr'));
473 
474  // tile image
475  $obj_service->commonSettings()->legacyForm($form, $this->object)->saveTileImage();
476 
478  $this->object->getId(),
479  $form,
481  );
482  }
483  }
484 
485  public function addExternalEditFormCustom(ilPropertyFormGUI $form): void
486  {
488  $this->object->getId(),
489  $form,
491  );
492  }
493 
499  protected function setTabs(): void
500  {
501  $ilUser = $this->user;
502 
504  $pool = $this->object;
505 
506  if (!$this->ctrl->getNextClass() && in_array($this->ctrl->getCmd(), array("create", "save"))) {
507  return;
508  }
509 
510  if ($this->checkPermissionBool('read')) {
511  if ($ilUser->getId() !== ANONYMOUS_USER_ID) {
512  if ($pool->getScheduleType() === ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES) {
513  $this->tabs_gui->addTab(
514  "preferences",
515  $this->lng->txt("book_pref_overview"),
516  $this->ctrl->getLinkTargetByClass("ilbookingpreferencesgui", "")
517  );
518  }
519 
520  if ($pool->getScheduleType() !== ilObjBookingPool::TYPE_NO_SCHEDULE_PREFERENCES ||
521  $this->checkPermissionBool('write')) {
522  $this->tabs_gui->addTab(
523  "render",
524  $this->lng->txt("book_booking_objects"),
525  $this->ctrl->getLinkTarget($this, "render")
526  );
527  }
528  }
529 
530  if ($ilUser->getId() !== ANONYMOUS_USER_ID || $this->object->hasPublicLog()) {
531  $this->tabs_gui->addTab(
532  "log",
533  $this->lng->txt("book_log"),
534  $this->ctrl->getLinkTargetByClass("ilbookingreservationsgui", "")
535  );
536  }
537 
538  $this->tabs_gui->addTab(
539  "info",
540  $this->lng->txt("info_short"),
541  $this->ctrl->getLinkTarget($this, "infoscreen")
542  );
543  }
544 
545  if ($this->checkPermissionBool('write')) {
546  $this->tabs_gui->addTab(
547  "settings",
548  $this->lng->txt("settings"),
549  $this->ctrl->getLinkTarget($this, "edit")
550  );
551 
552  if ($this->object->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
553  $this->tabs_gui->addTab(
554  "schedules",
555  $this->lng->txt("book_schedules"),
556  $this->ctrl->getLinkTargetByClass("ilbookingschedulegui", "render")
557  );
558  }
559 
560  $this->tabs_gui->addTab(
561  "participants",
562  $this->lng->txt("participants"),
563  $this->ctrl->getLinkTargetByClass("ilbookingparticipantgui", "render")
564  );
565 
566  // meta data
567  $mdgui = new ilObjectMetaDataGUI($this->object, "bobj");
568  $mdtab = $mdgui->getTab();
569  if ($mdtab) {
570  $this->tabs_gui->addTarget(
571  "meta_data",
572  $mdtab,
573  "",
574  "ilobjectmetadatagui"
575  );
576  }
577  }
578 
579 
580  if ($this->checkPermissionBool('edit_permission')) {
581  $this->tabs_gui->addTab(
582  "perm_settings",
583  $this->lng->txt("perm_settings"),
584  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
585  );
586  }
587  }
588 
589  public static function _goto(string $a_target): void
590  {
591  global $DIC;
592  $main_tpl = $DIC->ui()->mainTemplate();
593 
594  $ilAccess = $DIC->access();
595  $lng = $DIC->language();
596 
597  if ($ilAccess->checkAccess("read", "", $a_target)) {
598  ilObjectGUI::_gotoRepositoryNode($a_target, "render");
599  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
600  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
601  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
602  $main_tpl->setOnScreenMessage('failure', sprintf(
603  $lng->txt("msg_no_perm_read_item"),
605  ), true);
607  }
608  }
609 
613  public function infoScreenObject(): void
614  {
615  $this->ctrl->setCmd("showSummary");
616  $this->ctrl->setCmdClass("ilinfoscreengui");
617  $this->infoScreen();
618  }
619 
620  public function infoScreen(): string
621  {
622  $ilCtrl = $this->ctrl;
623 
624  $this->tabs_gui->setTabActive('info');
625 
626  $this->checkPermission("visible");
627 
628  $info = new ilInfoScreenGUI($this);
629 
630  $info->enablePrivateNotes();
631 
632  if ($this->checkPermissionBool("read")) {
633  $info->enableNews();
634  }
635 
636  // no news editing for files, just notifications
637  $info->enableNewsEditing(false);
638  if ($this->checkPermissionBool("write")) {
639  $news_set = new ilSetting("news");
640  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
641 
642  if ($enable_internal_rss) {
643  $info->setBlockProperty("news", "settings", true);
644  $info->setBlockProperty("news", "public_notifications_option", true);
645  }
646  }
647 
648  // forward the command
649  if ($ilCtrl->getNextClass() === "ilinfoscreengui") {
650  $ilCtrl->forwardCommand($info);
651  } else {
652  return $ilCtrl->getHTML($info);
653  }
654  return "";
655  }
656 
657 
658  public function showProfileObject(): void
659  {
660  $tpl = $this->tpl;
661  $ilCtrl = $this->ctrl;
662 
663  $this->tabs_gui->clearTargets();
664 
665  $user_id = $this->profile_user_id;
666 
667  $profile = new ilPublicUserProfileGUI($user_id);
668  $profile->setBackUrl($this->ctrl->getLinkTarget($this, 'log'));
669  $tpl->setContent($ilCtrl->getHTML($profile));
670  }
671 
672  protected function addLocatorItems(): void
673  {
674  $ilLocator = $this->locator;
675 
676  if (is_object($this->object)) {
677  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "render"), "", $this->object->getRefId());
678  }
679  }
680 
681  protected function initHeaderAction(?string $sub_type = null, ?int $sub_id = null): ?ilObjectListGUI
682  {
684  $user = $this->user;
685  $ctrl = $this->ctrl;
686  $lng = $this->lng;
687 
688  $lng->loadLanguageModule("noti");
689 
690  $lg = parent::initHeaderAction($sub_type, $sub_id);
691 
692  if ($lg && $access->checkAccess("read", "", $this->ref_id)) {
693  if ($this->object->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE &&
694  $this->object->getReminderStatus()) {
695  // notification
698  $user->getId(),
699  $this->object->getId()
700  )) {
701  $lg->addHeaderIcon(
702  "not_icon",
703  ilUtil::getImagePath("object/notification_off.svg"),
704  $lng->txt("noti_notification_deactivated")
705  );
706 
707  $ctrl->setParameter($this, "ntf", 1);
708  $caption = "noti_activate_notification";
709  } else {
710  $lg->addHeaderIcon(
711  "not_icon",
712  ilUtil::getImagePath("object/notification_on.svg"),
713  $lng->txt("noti_notification_activated")
714  );
715 
716  $ctrl->setParameter($this, "ntf", 0);
717  $caption = "noti_deactivate_notification";
718  }
719 
720  $lg->addCustomCommand(
721  $ctrl->getLinkTarget($this, "saveNotification"),
722  $caption
723  );
724 
725  $ctrl->setParameter($this, "ntf", "");
726  }
727  }
728 
729  return $lg;
730  }
731 
732  public function saveNotificationObject(): void
733  {
734  $ctrl = $this->ctrl;
735  $user = $this->user;
736 
737 
738  switch ($this->book_request->getNotification()) {
739  case 0:
740  ilNotification::setNotification(ilNotification::TYPE_BOOK, $user->getId(), $this->object->getId(), false);
741  break;
742 
743  case 1:
744  ilNotification::setNotification(ilNotification::TYPE_BOOK, $user->getId(), $this->object->getId(), true);
745  break;
746  }
747  $ctrl->redirect($this, "render");
748  }
749 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
updateCustom(ilPropertyFormGUI $form)
Class ilInfoScreenGUI.
initCreationForms(string $new_type)
getEditFormCustomValues(array &$a_values)
ilNavigationHistory $nav_history
const ANONYMOUS_USER_ID
Definition: constants.php:27
static _goto(string $a_target)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
GUI class for the workflow of copying objects.
addExternalEditFormCustom(ilPropertyFormGUI $form)
getItemByPostVar(string $a_post_var)
const ROOT_FOLDER_ID
Definition: constants.php:32
__construct($data, int $id=0, bool $call_by_reference=true, bool $prepare_output=true)
prepareOutput(bool $show_sub_objects=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInfo(string $a_info)
checkAccess(string $a_permission, string $a_cmd, int $a_ref_id, string $a_type="", ?int $a_obj_id=null, ?int $a_tree_id=null)
check access for an object (provide $a_type and $a_obj_id if available for better performance) ...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getDidacticTemplateVar(string $type)
Get didactic template setting from creation screen.
static _gotoRepositoryNode(int $ref_id, string $cmd="")
loadLanguageModule(string $a_module)
Load language module.
static updateServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
const IL_CAL_UNIX
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-...
This class represents a date/time property in a property form.
static _lookupObjId(int $ref_id)
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLanguage $lng
initEditCustomForm(ilPropertyFormGUI $form)
GUI class for public user profile presentation.
This class represents a property in a property form.
__construct(VocabulariesInterface $vocabularies)
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...
ilGlobalTemplateInterface $tpl
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
static setNotification(int $type, int $user_id, int $id, bool $status=true)
Set notification status for object and user.
ilBookingHelpAdapter $help
initDidacticTemplate(ilPropertyFormGUI $form)
Class ilObjectGUI Basic methods of all Output classes.
static initServiceSettingsForm(int $obj_id, ilPropertyFormGUI $form, array $services)
ILIAS BookingManager InternalDomainService $domain
Last visited history for repository items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
initHeaderAction(?string $sub_type=null, ?int $sub_id=null)
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilAccessHandler $access
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
static hasNotification(int $type, int $user_id, int $id)
Check notification status for object and user.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
setTabs()
set admin tabs
static lookupPoolId(int $object_id)
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
afterSave(ilObject $new_object)
addHeaderAction()
Add header action menu.
ilLocatorGUI $locator
infoScreenObject()
this one is called from the info button in the repository
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
static getList(int $a_pool_id, string $a_title=null)
Get list of booking objects.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
ILIAS BookingManager StandardGUIRequest $book_request
static _gotoRepositoryRoot(bool $raise_error=false)
Goto repository root.
ILIAS BookingManager InternalService $service