ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilBookBulkCreationGUI Class Reference
+ Collaboration diagram for ilBookBulkCreationGUI:

Public Member Functions

 __construct (InternalDomainService $domain, InternalGUIService $gui, ilObjBookingPool $pool)
 
 executeCommand ()
 
 modifyToolbar (ilToolbarGUI $toolbar)
 

Protected Member Functions

 showCreationForm ()
 
 getCreationForm ()
 
 showConfirmationScreen ()
 
 renderConfirmation (string $data, int $schedule_id=0)
 
 createObjects ()
 
 cancelCreation ()
 

Protected Attributes

ILIAS BookingManager Objects ObjectsManager $objects_manager
 
ilObjBookingPool $pool
 
InternalDomainService $domain
 
InternalGUIService $gui
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilBookBulkCreationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookBulkCreationGUI::__construct ( InternalDomainService  $domain,
InternalGUIService  $gui,
ilObjBookingPool  $pool 
)

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

References $domain, $gui, $lng, $pool, ilObject\getId(), and ILIAS\BookingManager\InternalDomainService\objects().

35  {
36  $this->pool = $pool;
37  $this->domain = $domain;
38  $this->gui = $gui;
39  $lng = $domain->lng();
40  $lng->loadLanguageModule("book");
41  $this->objects_manager = $domain
42  ->objects($pool->getId());
43  }
global $lng
Definition: privfeed.php:32
+ Here is the call graph for this function:

Member Function Documentation

◆ cancelCreation()

ilBookBulkCreationGUI::cancelCreation ( )
protected

Definition at line 204 of file class.ilBookBulkCreationGUI.php.

204  : void
205  {
206  $ctrl = $this->gui->ctrl();
207  $ctrl->returnToParent($this);
208  }

◆ createObjects()

ilBookBulkCreationGUI::createObjects ( )
protected

Definition at line 187 of file class.ilBookBulkCreationGUI.php.

References $data, $lng, and ilObjBookingPool\TYPE_FIX_SCHEDULE.

187  : void
188  {
189  $main_tpl = $this->gui->mainTemplate();
190  $ctrl = $this->gui->ctrl();
191  $lng = $this->domain->lng();
192  $request = $this->gui->standardRequest();
193 
194  $data = $request->getBulkCreationData();
195  $schedule_id = 0;
196  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
197  $schedule_id = $request->getScheduleId();
198  }
199  $arr = $this->objects_manager->createObjectsFromBulkInputString($data, $schedule_id);
200  $main_tpl->setOnScreenMessage("success", $lng->txt("msg_obj_modified"), true);
201  $ctrl->returnToParent($this);
202  }
global $lng
Definition: privfeed.php:32

◆ executeCommand()

ilBookBulkCreationGUI::executeCommand ( )

Definition at line 45 of file class.ilBookBulkCreationGUI.php.

45  : void
46  {
47  $ctrl = $this->gui->ctrl();
48 
49  $next_class = $ctrl->getNextClass($this);
50  $cmd = $ctrl->getCmd("showCreationForm");
51 
52  switch ($next_class) {
53  default:
54  if (in_array($cmd, [
55  "showCreationForm",
56  "showConfirmationScreen",
57  "cancelCreation",
58  "createObjects"
59  ])) {
60  $this->$cmd();
61  }
62  }
63  }

◆ getCreationForm()

ilBookBulkCreationGUI::getCreationForm ( )
protected

Definition at line 94 of file class.ilBookBulkCreationGUI.php.

References $lng, and ilObjBookingPool\TYPE_FIX_SCHEDULE.

Referenced by showConfirmationScreen(), and showCreationForm().

94  : \ILIAS\Repository\Form\FormAdapterGUI
95  {
96  $lng = $this->domain->lng();
97  $schedule_manager = $this->domain->schedules($this->pool->getId());
98  $schedules = $schedule_manager->getScheduleList();
99  $form = $this
100  ->gui
101  ->form(self::class, "showConfirmationScreen")
102  ->asyncModal()
103  ->section("creation", $lng->txt("book_bulk_data"))
104  ->textarea(
105  "data",
106  $lng->txt("book_title_description_nr"),
107  $lng->txt("book_title_description_nr_info"),
108  )
109  ->required();
110 
111  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
112  $form->select(
113  "schedule_id",
114  $lng->txt("book_schedule"),
115  $schedules,
116  "",
117  (string) array_key_first($schedules)
118  )
119  ->required();
120  }
121 
122 
123  return $form;
124  }
global $lng
Definition: privfeed.php:32
+ Here is the caller graph for this function:

◆ modifyToolbar()

ilBookBulkCreationGUI::modifyToolbar ( ilToolbarGUI  $toolbar)

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

References $c, $components, $lng, and ilToolbarGUI\addComponent().

65  : void
66  {
67  $lng = $this->domain->lng();
68  $ctrl = $this->gui->ctrl();
69  $components = $this
70  ->gui
71  ->modal($lng->txt("book_bulk_creation"))
72  ->getAsyncTriggerButtonComponents(
73  $lng->txt("book_bulk_creation"),
74  $ctrl->getLinkTarget($this, "showCreationForm", "", true),
75  false
76  );
77  foreach ($components as $type => $c) {
78  if ($type === "signal") {
79  continue;
80  }
81  $toolbar->addComponent($c);
82  }
83  }
addComponent(\ILIAS\UI\Component\Component $a_comp)
$c
Definition: deliver.php:9
$components
global $lng
Definition: privfeed.php:32
+ Here is the call graph for this function:

◆ renderConfirmation()

ilBookBulkCreationGUI::renderConfirmation ( string  $data,
int  $schedule_id = 0 
)
protected

Definition at line 148 of file class.ilBookBulkCreationGUI.php.

References Vendor\Package\$f, $id, $lng, $r, ILIAS\Repository\event(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by showConfirmationScreen().

148  : string
149  {
150  $lng = $this->domain->lng();
151  $ctrl = $this->gui->ctrl();
152 
153  $f = $this->gui->ui()->factory();
154  $r = $this->gui->ui()->renderer();
155  $button1 = $f->button()->standard(
156  $lng->txt("book_create_objects"),
157  "#"
158  )->withAdditionalOnLoadCode(static function (string $id) {
159  return <<<EOT
160  globalThis.book_bulk_button = document.getElementById("$id");
161  book_bulk_button.addEventListener("click", (event) => {
162  book_bulk_button.closest(".c-modal").querySelector(".modal-body").querySelector("form").submit();
163  });
164 EOT;
165  });
166  $button2 = $f->button()->standard(
167  $lng->txt("cancel"),
168  $ctrl->getLinkTarget($this, "cancelCreation")
169  );
170 
171  $mbox = $f->messageBox()->confirmation(
172  $lng->txt("book_bulk_confirmation")
173  )->withButtons([$button1]);
174 
175  $ctrl->setParameter($this, "schedule_id", $schedule_id);
176  $table = new ilBookingBulkCreationTableGUI(
177  $this,
178  "renderConfirmation",
179  $data,
180  $this->pool->getId()
181  );
182 
183  return $r->render($mbox) .
184  $table->getHTML();
185  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
global $lng
Definition: privfeed.php:32
$r
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showConfirmationScreen()

ilBookBulkCreationGUI::showConfirmationScreen ( )
protected

Definition at line 126 of file class.ilBookBulkCreationGUI.php.

References $lng, ILIAS\Repository\form(), getCreationForm(), ILIAS\Repository\int(), ILIAS\UI\examples\MainControls\Slate\Legacy\legacy(), renderConfirmation(), and ilObjBookingPool\TYPE_FIX_SCHEDULE.

126  : void
127  {
128  $form = $this->getCreationForm();
129  $lng = $this->domain->lng();
130  if (!$form->isValid()) {
131  $this->gui->modal($lng->txt("book_bulk_creation"))
132  ->form($form)
133  ->send();
134  }
135 
136  $schedule_id = 0;
137  if ($this->pool->getScheduleType() === ilObjBookingPool::TYPE_FIX_SCHEDULE) {
138  $schedule_id = (int) $form->getData("schedule_id");
139  }
140  $this->gui->modal($lng->txt("book_bulk_creation"))
141  ->legacy($this->renderConfirmation(
142  $form->getData("data"),
143  $schedule_id
144  ))
145  ->send();
146  }
renderConfirmation(string $data, int $schedule_id=0)
legacy()
expected output: > ILIAS shows the rendered Component.
Definition: legacy.php:13
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:32
+ Here is the call graph for this function:

◆ showCreationForm()

ilBookBulkCreationGUI::showCreationForm ( )
protected

Definition at line 85 of file class.ilBookBulkCreationGUI.php.

References $lng, ILIAS\Repository\form(), getCreationForm(), and send().

85  : void
86  {
87  $lng = $this->domain->lng();
88  $this->gui
89  ->modal($lng->txt("book_bulk_creation"))
90  ->form($this->getCreationForm())
91  ->send();
92  }
form( $class_path, string $cmd, string $submit_caption="")
global $lng
Definition: privfeed.php:32
catch(ilCmiXapiException $e) send($response)
Definition: xapitoken.php:97
+ Here is the call graph for this function:

Field Documentation

◆ $domain

InternalDomainService ilBookBulkCreationGUI::$domain
protected

Definition at line 28 of file class.ilBookBulkCreationGUI.php.

Referenced by __construct().

◆ $gui

InternalGUIService ilBookBulkCreationGUI::$gui
protected

Definition at line 29 of file class.ilBookBulkCreationGUI.php.

Referenced by __construct().

◆ $objects_manager

ILIAS BookingManager Objects ObjectsManager ilBookBulkCreationGUI::$objects_manager
protected

Definition at line 26 of file class.ilBookBulkCreationGUI.php.

◆ $pool

ilObjBookingPool ilBookBulkCreationGUI::$pool
protected

Definition at line 27 of file class.ilBookBulkCreationGUI.php.

Referenced by __construct().


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