ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
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 27 of file class.ilBookBulkCreationGUI.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

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

Member Function Documentation

◆ cancelCreation()

ilBookBulkCreationGUI::cancelCreation ( )
protected

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

207  : void
208  {
209  $ctrl = $this->gui->ctrl();
210  $ctrl->returnToParent($this);
211  }

◆ createObjects()

ilBookBulkCreationGUI::createObjects ( )
protected

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

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

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

◆ executeCommand()

ilBookBulkCreationGUI::executeCommand ( )

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

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

◆ getCreationForm()

ilBookBulkCreationGUI::getCreationForm ( )
protected

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

References $lng, and ilObjBookingPool\TYPE_FIX_SCHEDULE.

Referenced by showConfirmationScreen(), and showCreationForm().

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

◆ modifyToolbar()

ilBookBulkCreationGUI::modifyToolbar ( ilToolbarGUI  $toolbar)

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

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

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

◆ renderConfirmation()

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

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

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

Referenced by showConfirmationScreen().

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

◆ showConfirmationScreen()

ilBookBulkCreationGUI::showConfirmationScreen ( )
protected

Definition at line 129 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.

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

◆ showCreationForm()

ilBookBulkCreationGUI::showCreationForm ( )
protected

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

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

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

Field Documentation

◆ $domain

InternalDomainService ilBookBulkCreationGUI::$domain
protected

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

Referenced by __construct().

◆ $gui

InternalGUIService ilBookBulkCreationGUI::$gui
protected

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

Referenced by __construct().

◆ $objects_manager

ILIAS BookingManager Objects ObjectsManager ilBookBulkCreationGUI::$objects_manager
protected

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

◆ $pool

ilObjBookingPool ilBookBulkCreationGUI::$pool
protected

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

Referenced by __construct().


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