ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\BookingManager\BookingProcess\ProcessUtilGUI Class Reference
+ Collaboration diagram for ILIAS\BookingManager\BookingProcess\ProcessUtilGUI:

Public Member Functions

 __construct (InternalDomainService $domain_service, InternalGUIService $gui_service, \ilObjBookingPool $pool, object $parent_gui)
 
 back ()
 
 setHelpId (string $a_id)
 
 assignParticipants (int $book_obj_id)
 
 handleBookingSuccess (int $a_obj_id, string $post_info_cmd, ?array $a_rsv_ids=null)
 
 displayPostInfo (int $book_obj_id, int $user_id, string $file_deliver_cmd)
 Display post booking informations. More...
 
 deliverPostFile (int $book_obj_id, int $user_id)
 Deliver post booking file. More...
 

Protected Attributes

ObjectsManager $objects_manager
 
StandardGUIRequest $request
 
ilCtrl $ctrl
 
ilLogger $log
 
ilObjBookingPool $pool
 
ilBookingHelpAdapter $help
 
InternalGUIService $gui
 
InternalDomainService $domain
 
object $parent_gui
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::__construct ( InternalDomainService  $domain_service,
InternalGUIService  $gui_service,
\ilObjBookingPool  $pool,
object  $parent_gui 
)

Definition at line 40 of file class.ProcessUtilGUI.php.

References ILIAS\BookingManager\BookingProcess\ProcessUtilGUI\$parent_gui, ILIAS\BookingManager\BookingProcess\ProcessUtilGUI\$pool, ILIAS\BookingManager\InternalGUIService\bookingHelp(), ILIAS\Repository\ctrl(), ilObject\getId(), ILIAS\Repository\help(), ILIAS\BookingManager\InternalDomainService\log(), and ILIAS\BookingManager\InternalDomainService\objects().

45  {
46  $this->gui = $gui_service;
47  $this->domain = $domain_service;
48  $this->log = $domain_service->log();
49  $this->help = $gui_service->bookingHelp($pool);
50  $this->parent_gui = $parent_gui;
51  $this->pool = $pool;
52  $this->ctrl = $this->gui->ctrl();
53  $this->request = $this->gui->standardRequest();
54  $this->objects_manager = $domain_service->objects($pool->getId());
55  }
+ Here is the call graph for this function:

Member Function Documentation

◆ assignParticipants()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::assignParticipants ( int  $book_obj_id)

Definition at line 78 of file class.ProcessUtilGUI.php.

References $lng.

78  : void
79  {
80  $tabs = $this->gui->tabs();
81  $ctrl = $this->gui->ctrl();
82  $lng = $this->domain->lng();
83  $main_tpl = $this->gui->mainTemplate();
84 
85  $tabs->clearTargets();
86  $tabs->setBackTarget($lng->txt('book_back_to_list'), $ctrl->getLinkTarget($this->parent_gui, 'back'));
87 
88  $table = new \ilBookingAssignParticipantsTableGUI($this->parent_gui, 'assignParticipants', $this->pool->getRefId(), $this->pool->getId(), $book_obj_id);
89  $main_tpl->setContent($table->getHTML());
90  }
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
global $lng
Definition: privfeed.php:31

◆ back()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::back ( )

Definition at line 58 of file class.ProcessUtilGUI.php.

References ILIAS\Repository\ctrl().

Referenced by ILIAS\BookingManager\BookingProcess\ProcessUtilGUI\handleBookingSuccess().

58  : void
59  {
60  $this->log->debug("back");
61  $retCmd = $this->request->getReturnCmd();
62  $this->log->debug("returnCmd is " . $retCmd);
63  if ($retCmd !== "") {
64  $this->ctrl->redirectByClass(get_class($this->parent_gui), $retCmd);
65  } else {
66  //var_dump(get_class($this->parent_gui));
67  //exit;
68  $this->ctrl->returnToParent($this->parent_gui);
69  }
70  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deliverPostFile()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::deliverPostFile ( int  $book_obj_id,
int  $user_id 
)

Deliver post booking file.

Definition at line 265 of file class.ProcessUtilGUI.php.

References $id, $user_id, and ilBookingReservation\getObjectReservationForUser().

268  : void {
269  $this->log->debug("deliverPostFile");
270  $id = $book_obj_id;
271  if (!$id) {
272  return;
273  }
274 
276  $book_id = current($book_ids);
277  $obj = new \ilBookingReservation($book_id);
278  if ($obj->getUserId() !== $user_id) {
279  return;
280  }
281 
282  $this->domain->objects($this->pool->getId())->deliverBookingInfo($id);
283  }
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ displayPostInfo()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::displayPostInfo ( int  $book_obj_id,
int  $user_id,
string  $file_deliver_cmd 
)

Display post booking informations.

Definition at line 154 of file class.ProcessUtilGUI.php.

References $id, $lng, $url, ilDatePresentation\formatPeriod(), ilBookingReservation\getObjectReservationForUser(), ILIAS\BookingManager\StandardGUIRequest\getReservationId(), ILIAS\BookingManager\StandardGUIRequest\getReservationIdsFromString(), IL_CAL_UNIX, ILIAS\Repository\int(), ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

158  : void {
159  $this->log->debug("displayPostInfo");
160  $main_tpl = $this->gui->mainTemplate();
161  $ctrl = $this->gui->ctrl();
162  $lng = $this->domain->lng();
163  $id = $book_obj_id;
164  $request = $this->gui->standardRequest();
165 
166  if (!$id) {
167  return;
168  }
169 
171 
172  $tmp = [];
173  if ($rsv_ids === [] && $request->getReservationId() !== '') {
174  $reservationIdParts = explode('_', $request->getReservationId());
175 
176  $user_id = (int) ($reservationIdParts[1] ?? 0);
177  $from = (int) ($reservationIdParts[2] ?? 0);
178 
179  if ($from > time()) {
180  $to = (int) ($reservationIdParts[3] ?? 0);
181  $tmp["$from-" . ($to + 1)] = 1;
182  }
183  $rsv_ids = [0];
184  }
185 
186  // placeholder
187 
189  foreach ($book_ids as $book_id) {
190  if (in_array($book_id, $rsv_ids) || count($rsv_ids) === 0) {
191  $obj = new \ilBookingReservation($book_id);
192  $from = $obj->getFrom();
193  $to = $obj->getTo();
194  if ($from > time()) {
195  $tmp[$from . "-" . $to + 1] = $tmp[$from . "-" . $to + 1] ?? 0;
196  $tmp[$from . "-" . $to + 1]++;
197  }
198  }
199  }
200 
203 
204  $period = array();
205  ksort($tmp);
206  foreach ($tmp as $time => $counter) {
207  $time = explode("-", $time);
209  new \ilDateTime($time[0], IL_CAL_UNIX),
210  new \ilDateTime($time[1], IL_CAL_UNIX)
211  );
212  if ($counter > 1) {
213  $time .= " (" . $counter . ")";
214  }
215  $period[] = $time;
216  }
217  $book_id = array_shift($book_ids);
218 
220 
221  /*
222  #23578 since Booking pool participants.
223  $obj = new ilBookingReservation($book_id);
224  if ($obj->getUserId() != $ilUser->getId())
225  {
226  return;
227  }
228  */
229 
230  $obj = new \ilBookingObject($id);
231  $pfile = $this->objects_manager->getBookingInfoFilename($id);
232  $ptext = $obj->getPostText();
233 
234  $mytpl = new \ilTemplate('tpl.booking_reservation_post.html', true, true, 'components/ILIAS/BookingManager/BookingProcess');
235  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
236 
237  if ($ptext) {
238  // placeholder
239  $ptext = str_replace(
240  ["[OBJECT]", "[PERIOD]"],
241  [$obj->getTitle(), implode("<br />", $period)],
242  $ptext
243  );
244 
245  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
246  }
247 
248  if ($pfile) {
249  $url = $ctrl->getLinkTarget($this->parent_gui, $file_deliver_cmd);
250 
251  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
252  $mytpl->setVariable("URL_FILE", $url);
253  $mytpl->setVariable("TXT_FILE", $pfile);
254  }
255 
256  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
257  $mytpl->setVariable("URL_SUBMIT", $ctrl->getLinkTarget($this->parent_gui, "back"));
258 
259  $main_tpl->setContent($mytpl->get());
260  }
static array static setUseRelativeDates(bool $a_status)
set use relative dates
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
$url
Definition: shib_logout.php:68
const IL_CAL_UNIX
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
+ Here is the call graph for this function:

◆ handleBookingSuccess()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::handleBookingSuccess ( int  $a_obj_id,
string  $post_info_cmd,
?array  $a_rsv_ids = null 
)

Definition at line 114 of file class.ProcessUtilGUI.php.

References $lng, ILIAS\BookingManager\BookingProcess\ProcessUtilGUI\back(), and ILIAS\BookingManager\StandardGUIRequest\getReturnCmd().

118  : void {
119  $this->log->debug("handleBookingSuccess");
120  $main_tpl = $this->gui->mainTemplate();
121  $ctrl = $this->gui->ctrl();
122  $lng = $this->domain->lng();
123  $request = $this->gui->standardRequest();
124 
125  $main_tpl->setOnScreenMessage('success', $lng->txt('book_reservation_confirmed'), true);
126 
127  // show post booking information?
128  $obj = new \ilBookingObject($a_obj_id);
129  $pfile = $this->objects_manager->getBookingInfoFilename($a_obj_id);
130  $ptext = $obj->getPostText();
131 
132  if (trim($ptext) || $pfile) {
133  if (count($a_rsv_ids)) {
135  $this->parent_gui,
136  'rsv_ids',
137  implode(";", $a_rsv_ids)
138  );
139  }
140  $ctrl->redirect($this->parent_gui, $post_info_cmd);
141  } else {
142  if ($ctrl->isAsynch()) {
143  $this->gui->send("<script>window.location.href = '" .
144  $ctrl->getLinkTarget($this->parent_gui, $request->getReturnCmd()) . "';</script>");
145  } else {
146  $this->back();
147  }
148  }
149  }
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
global $lng
Definition: privfeed.php:31
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
+ Here is the call graph for this function:

◆ setHelpId()

ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::setHelpId ( string  $a_id)

Definition at line 72 of file class.ProcessUtilGUI.php.

References ILIAS\Repository\help().

72  : void
73  {
74  $this->help->setHelpId($a_id);
75  }
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$ctrl
protected

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

◆ $domain

InternalDomainService ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$domain
protected

Definition at line 37 of file class.ProcessUtilGUI.php.

◆ $gui

InternalGUIService ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$gui
protected

Definition at line 36 of file class.ProcessUtilGUI.php.

◆ $help

ilBookingHelpAdapter ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$help
protected

Definition at line 35 of file class.ProcessUtilGUI.php.

◆ $log

ilLogger ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$log
protected

Definition at line 33 of file class.ProcessUtilGUI.php.

◆ $objects_manager

ObjectsManager ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$objects_manager
protected

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

◆ $parent_gui

object ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$parent_gui
protected

◆ $pool

ilObjBookingPool ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$pool
protected

◆ $request

StandardGUIRequest ILIAS\BookingManager\BookingProcess\ProcessUtilGUI::$request
protected

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


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