56 $this->
ctrl = $DIC->ctrl();
57 $this->
lng = $DIC->language();
58 $this->main_tpl =
$DIC->ui()->mainTemplate();
60 $this->
tabs = $DIC->tabs();
61 $this->book_request =
$DIC->bookingManager()
66 $this->
lng->loadLanguageModule(
"book");
77 $this->seed = $this->book_request->getSeed();
78 $this->sseed = $this->book_request->getSSeed();
80 $this->
toolbar = $DIC->toolbar();
84 $req_return_to = $this->book_request->getReturnTo();
85 if (in_array($req_return_to, [
"ilbookingobjectservicegui",
"ilbookingreservationsgui"])) {
86 $this->return_to = $req_return_to;
94 $this->current_settings = $handler->handle()->getSettings();
98 if (is_object($this->pool)) {
100 $DIC[
"ilHelp"]->setScreenIdComponent(
"book");
117 $pool_ref_id = $this->book_request->getPoolRefId();
119 $book_ref_ids = $this->use_book_repo->getUsedBookingPools(
ilObject::_lookupObjId($this->main_host_ref_id),
false);
121 $this->pools_selected = (count($book_ref_ids) > 0);
123 if (!in_array($pool_ref_id, $book_ref_ids)) {
124 if (count($book_ref_ids) > 0) {
125 $pool_ref_id = current($book_ref_ids);
130 $this->current_pool_ref_id = $pool_ref_id;
131 if ($this->current_pool_ref_id > 0) {
148 switch ($next_class) {
149 case "ilpropertyformgui":
155 case "ilbookingobjectservicegui":
160 $this->current_pool_ref_id,
161 $this->use_book_repo,
169 case "ilbookingreservationsgui":
173 $this->
ctrl->forwardCommand($res_gui);
178 if (in_array($cmd, array(
"show",
"settings",
"saveSettings",
"selectPool"))) {
194 if (count($options) > 0) {
196 $si->setOptions($options);
197 $si->setValue($this->current_pool_ref_id);
198 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
199 $this->
toolbar->addInputItem($si,
false);
200 $this->
toolbar->addFormButton($this->
lng->txt(
"book_select_pool"),
"selectPool");
206 if ($this->return_to !==
"") {
207 $this->
ctrl->redirectByClass($this->return_to);
218 if ($this->pools_selected) {
221 $lng->txt(
"book_booking_objects"),
226 $lng->txt(
"book_log"),
230 if ($this->ref_id === $this->main_host_ref_id) {
233 $lng->txt(
"settings"),
241 protected function show(): void
244 if ($this->pools_selected) {
246 } elseif ($this->ref_id === $this->main_host_ref_id) {
250 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"book_no_pools_selected"));
259 $this->setSubTabs(
"settings");
260 $main_tpl = $this->main_tpl;
261 $form = $this->initSettingsForm();
262 $main_tpl->setContent($form->getHTML());
274 $repo->getExplorerGUI()->setSelectableTypes([
"book"]);
275 $repo->getExplorerGUI()->setTypeWhiteList(
276 [
"book",
"root",
"cat",
"grp",
"fold",
"crs"]
278 $form->addItem($repo);
279 $repo->setValue($this->current_settings->getUsedBookingObjectIds());
281 $form->addCommandButton(
"saveSettings",
$lng->txt(
"save"));
283 $form->setTitle(
$lng->txt(
"book_pool_selection"));
293 $main_tpl = $this->main_tpl;
295 $form = $this->initSettingsForm();
296 if ($form->checkInput()) {
297 $b_ids = $form->getInput(
"booking_obj_ids");
298 $b_ids = is_array($b_ids)
299 ? array_map(
static function (
$i) {
304 if (!$this->checkBookingPoolsForSchedules($b_ids)) {
305 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->txt(
"book_all_pools_need_schedules"));
306 $form->setValuesByPost();
307 $main_tpl->setContent($form->getHTML());
316 $repo = $this->use_book_repo;
320 $this->main_tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
323 $form->setValuesByPost();
324 $main_tpl->setContent($form->getHTML());
334 foreach ($ids as $pool_ref_id) {
This class is used for integration of the booking manager as a service into other repository objects,...
ilBookingHelpAdapter $help
setSubTabs(string $active)
checkBookingPoolsForSchedules(array $ids)
Check if all pools have schedules.
ilObjBookingServiceSettings $current_settings
ilObjUseBookDBRepository $use_book_repo
showPoolSelector(string $return_to)
ilGlobalTemplateInterface $main_tpl
BookingManager StandardGUIRequest $book_request
__construct(ilObjectGUI $parent_gui, int $main_host_ref_id=0)
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...
static hasExistingSchedules(int $a_pool_id)
Check if given pool has any defined schedules.
Class ilCtrl provides processing control methods.
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
getNextClass($a_gui_class=null)
@inheritDoc
redirect(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
setReturn(object $a_gui_obj, string $a_cmd=null)
@inheritDoc
saveParameter(object $a_gui_obj, $a_parameter)
@inheritDoc
getCmd(string $fallback_command=null)
@inheritDoc
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
getFormAction(object $a_gui_obj, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
forwardCommand(object $a_gui_object)
@inheritDoc
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...
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjectId(int $ref_id)
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
activateSubTab(string $a_id)
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...