19 declare(strict_types=1);
34 protected \ilObjBookingPool
$pool;
35 protected \ilBookingHelpAdapter
$help;
46 $this->gui = $gui_service;
47 $this->domain = $domain_service;
48 $this->log = $domain_service->
log();
52 $this->
ctrl = $this->gui->ctrl();
53 $this->request = $this->gui->standardRequest();
54 $this->objects_manager = $domain_service->
objects($pool->
getId());
58 public function back(): void
60 $this->log->debug(
"back");
61 $retCmd = $this->request->getReturnCmd();
62 $this->log->debug(
"returnCmd is " . $retCmd);
64 $this->
ctrl->redirectByClass(get_class($this->parent_gui), $retCmd);
68 $this->
ctrl->returnToParent($this->parent_gui);
74 $this->
help->setHelpId($a_id);
80 $tabs = $this->gui->tabs();
81 $ctrl = $this->gui->ctrl();
82 $lng = $this->domain->lng();
83 $main_tpl = $this->gui->mainTemplate();
85 $tabs->clearTargets();
86 $tabs->setBackTarget(
$lng->txt(
'book_back_to_list'), $ctrl->getLinkTarget($this->parent_gui,
'back'));
88 $table = new \ilBookingAssignParticipantsTableGUI($this->parent_gui,
'assignParticipants', $this->pool->getRefId(), $this->pool->getId(), $book_obj_id);
89 $main_tpl->setContent($table->getHTML());
116 string $post_info_cmd,
117 ?array $a_rsv_ids =
null 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();
125 $main_tpl->setOnScreenMessage(
'success',
$lng->txt(
'book_reservation_confirmed'),
true);
128 $obj = new \ilBookingObject($a_obj_id);
129 $pfile = $this->objects_manager->getBookingInfoFilename($a_obj_id);
130 $ptext = $obj->getPostText();
132 if (trim($ptext) || $pfile) {
133 if (count($a_rsv_ids)) {
137 implode(
";", $a_rsv_ids)
140 $ctrl->redirect($this->parent_gui, $post_info_cmd);
142 if ($ctrl->isAsynch()) {
143 $this->gui->send(
"<script>window.location.href = '" .
144 $ctrl->getLinkTarget($this->parent_gui, $request->
getReturnCmd()) .
"';</script>");
157 string $file_deliver_cmd
159 $this->log->debug(
"displayPostInfo");
160 $main_tpl = $this->gui->mainTemplate();
161 $ctrl = $this->gui->ctrl();
162 $lng = $this->domain->lng();
164 $request = $this->gui->standardRequest();
176 $user_id = (
int) ($reservationIdParts[1] ?? 0);
177 $from = (
int) ($reservationIdParts[2] ?? 0);
179 if ($from > time()) {
180 $to = (
int) ($reservationIdParts[3] ?? 0);
181 $tmp[
"$from-" . ($to + 1)] = 1;
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();
194 if ($from > time()) {
195 $tmp[$from .
"-" . $to + 1] = $tmp[$from .
"-" . $to + 1] ?? 0;
196 $tmp[$from .
"-" . $to + 1]++;
206 foreach ($tmp as $time => $counter) {
207 $time = explode(
"-", $time);
213 $time .=
" (" . $counter .
")";
217 $book_id = array_shift($book_ids);
230 $obj = new \ilBookingObject(
$id);
231 $pfile = $this->objects_manager->getBookingInfoFilename(
$id);
232 $ptext = $obj->getPostText();
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'));
239 $ptext = str_replace(
240 [
"[OBJECT]",
"[PERIOD]"],
241 [$obj->getTitle(), implode(
"<br />", $period)],
245 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
249 $url = $ctrl->getLinkTarget($this->parent_gui, $file_deliver_cmd);
251 $mytpl->setVariable(
"DOWNLOAD",
$lng->txt(
'download'));
252 $mytpl->setVariable(
"URL_FILE",
$url);
253 $mytpl->setVariable(
"TXT_FILE", $pfile);
256 $mytpl->setVariable(
"TXT_SUBMIT",
$lng->txt(
'ok'));
257 $mytpl->setVariable(
"URL_SUBMIT", $ctrl->getLinkTarget($this->parent_gui,
"back"));
259 $main_tpl->setContent($mytpl->get());
269 $this->log->debug(
"deliverPostFile");
276 $book_id = current($book_ids);
277 $obj = new \ilBookingReservation($book_id);
278 if ($obj->getUserId() !==
$user_id) {
282 $this->domain->objects($this->pool->getId())->deliverBookingInfo(
$id);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static array static setUseRelativeDates(bool $a_status)
set use relative dates
bookingHelp(\ilObjBookingPool $pool)
InternalDomainService $domain
displayPostInfo(int $book_obj_id, int $user_id, string $file_deliver_cmd)
Display post booking informations.
static getObjectReservationForUser(int $a_object_id, int $a_user_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static useRelativeDates()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
StandardGUIRequest $request
Author: Alexander Killing killing@leifos.de
ilBookingHelpAdapter $help
handleBookingSuccess(int $a_obj_id, string $post_info_cmd, ?array $a_rsv_ids=null)
ObjectsManager $objects_manager
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getReservationIdsFromString()
deliverPostFile(int $book_obj_id, int $user_id)
Deliver post booking file.
assignParticipants(int $book_obj_id)
__construct(InternalDomainService $domain_service, InternalGUIService $gui_service, \ilObjBookingPool $pool, object $parent_gui)
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.