ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 262 of file class.ProcessUtilGUI.php.

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

265  : void {
266  $this->log->debug("deliverPostFile");
267  $id = $book_obj_id;
268  if (!$id) {
269  return;
270  }
271 
273  $book_id = current($book_ids);
274  $obj = new \ilBookingReservation($book_id);
275  if ($obj->getUserId() !== $user_id) {
276  return;
277  }
278 
279  $this->domain->objects($this->pool->getId())->deliverBookingInfo($id);
280  }
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, $user_id, 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 = array();
173  if (count($rsv_ids) === 0 && $request->getReservationId() !== "") {
174  [$obj_id, $user_id, $from, $to] = explode("_", $request->getReservationId());
175  if ($from > time()) {
176  $tmp[$from . "-" . $to + 1] = $tmp[$from . "-" . $to + 1] ?? 0;
177  $tmp[$from . "-" . $to + 1]++;
178  }
179  $user_id = (int) $user_id;
180  $rsv_ids = [0];
181  }
182 
183  // placeholder
184 
186  foreach ($book_ids as $book_id) {
187  if (in_array($book_id, $rsv_ids) || count($rsv_ids) === 0) {
188  $obj = new \ilBookingReservation($book_id);
189  $from = $obj->getFrom();
190  $to = $obj->getTo();
191  if ($from > time()) {
192  $tmp[$from . "-" . $to + 1] = $tmp[$from . "-" . $to + 1] ?? 0;
193  $tmp[$from . "-" . $to + 1]++;
194  }
195  }
196  }
197 
200 
201  $period = array();
202  ksort($tmp);
203  foreach ($tmp as $time => $counter) {
204  $time = explode("-", $time);
206  new \ilDateTime($time[0], IL_CAL_UNIX),
207  new \ilDateTime($time[1], IL_CAL_UNIX)
208  );
209  if ($counter > 1) {
210  $time .= " (" . $counter . ")";
211  }
212  $period[] = $time;
213  }
214  $book_id = array_shift($book_ids);
215 
217 
218  /*
219  #23578 since Booking pool participants.
220  $obj = new ilBookingReservation($book_id);
221  if ($obj->getUserId() != $ilUser->getId())
222  {
223  return;
224  }
225  */
226 
227  $obj = new \ilBookingObject($id);
228  $pfile = $this->objects_manager->getBookingInfoFilename($id);
229  $ptext = $obj->getPostText();
230 
231  $mytpl = new \ilTemplate('tpl.booking_reservation_post.html', true, true, 'components/ILIAS/BookingManager/BookingProcess');
232  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
233 
234  if ($ptext) {
235  // placeholder
236  $ptext = str_replace(
237  ["[OBJECT]", "[PERIOD]"],
238  [$obj->getTitle(), implode("<br />", $period)],
239  $ptext
240  );
241 
242  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
243  }
244 
245  if ($pfile) {
246  $url = $ctrl->getLinkTarget($this->parent_gui, $file_deliver_cmd);
247 
248  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
249  $mytpl->setVariable("URL_FILE", $url);
250  $mytpl->setVariable("TXT_FILE", $pfile);
251  }
252 
253  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
254  $mytpl->setVariable("URL_SUBMIT", $ctrl->getLinkTarget($this->parent_gui, "back"));
255 
256  $main_tpl->setContent($mytpl->get());
257  }
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:66
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: