19declare(strict_types=1);
35 protected \ilObjBookingPool
$pool;
36 protected \ilBookingHelpAdapter
$help;
47 $this->gui = $gui_service;
48 $this->domain = $domain_service;
49 $this->log = $domain_service->
log();
53 $this->
ctrl = $this->gui->ctrl();
54 $this->request = $this->gui->standardRequest();
59 public function back(): void
61 $this->log->debug(
"back");
62 $retCmd = $this->request->getReturnCmd();
63 $this->log->debug(
"returnCmd is " . $retCmd);
65 $class = get_class($this->parent_gui);
66 if ($retCmd ===
'week' && $class === ilBookingProcessWithScheduleGUI::class) {
67 if ($this->request->getOriginCmd() ===
'book') {
68 $this->domain->objectSelection($this->pool->getId())->setSelectedObjects([$this->request->getObjectId()]);
70 $this->
ctrl->setParameterByClass($class,
'seed', $this->request->getSeed());
71 $this->
ctrl->redirectByClass($class, $retCmd);
76 $this->
ctrl->redirectByClass(get_class($this->parent_gui), $retCmd);
80 $this->
ctrl->returnToParent($this->parent_gui);
86 $this->
help->setHelpId($a_id);
92 $tabs = $this->gui->tabs();
93 $ctrl = $this->gui->ctrl();
94 $lng = $this->domain->lng();
95 $main_tpl = $this->gui->mainTemplate();
97 $tabs->clearTargets();
100 $table = new \ilBookingAssignParticipantsTableGUI($this->parent_gui,
'assignParticipants', $this->pool->getRefId(), $this->pool->getId(), $book_obj_id);
101 $main_tpl->setContent($table->getHTML());
128 string $post_info_cmd,
129 ?array $a_rsv_ids =
null
131 $this->log->debug(
"handleBookingSuccess");
132 $main_tpl = $this->gui->mainTemplate();
133 $ctrl = $this->gui->ctrl();
134 $lng = $this->domain->lng();
135 $request = $this->gui->standardRequest();
137 $main_tpl->setOnScreenMessage(
'success',
$lng->txt(
'book_reservation_confirmed'),
true);
140 $obj = new \ilBookingObject($a_obj_id);
141 $pfile = $this->objects_manager->getBookingInfoFilename($a_obj_id);
142 $ptext = $obj->getPostText();
144 if (trim($ptext) || $pfile) {
145 if (count($a_rsv_ids)) {
149 implode(
";", $a_rsv_ids)
155 $this->gui->send(
"<script>window.location.href = '" .
169 string $file_deliver_cmd
171 $this->log->debug(
"displayPostInfo");
172 $main_tpl = $this->gui->mainTemplate();
173 $ctrl = $this->gui->ctrl();
174 $lng = $this->domain->lng();
176 $request = $this->gui->standardRequest();
189 $from = (
int) ($reservationIdParts[2] ?? 0);
191 if ($from > time()) {
192 $to = (
int) ($reservationIdParts[3] ?? 0);
193 $tmp[
"$from-" . ($to + 1)] = 1;
201 foreach ($book_ids as $book_id) {
202 if (in_array($book_id, $rsv_ids) || count($rsv_ids) === 0) {
203 $obj = new \ilBookingReservation($book_id);
204 $from = $obj->getFrom();
206 if ($from > time()) {
207 $tmp[$from .
"-" . $to + 1] = $tmp[$from .
"-" . $to + 1] ?? 0;
208 $tmp[$from .
"-" . $to + 1]++;
218 foreach ($tmp as $time =>
$counter) {
219 $time = explode(
"-", $time);
229 $book_id = array_shift($book_ids);
242 $obj = new \ilBookingObject(
$id);
243 $pfile = $this->objects_manager->getBookingInfoFilename(
$id);
244 $ptext = $obj->getPostText();
246 $mytpl = new \ilTemplate(
'tpl.booking_reservation_post.html',
true,
true,
'components/ILIAS/BookingManager/BookingProcess');
247 $mytpl->setVariable(
"TITLE",
$lng->txt(
'book_post_booking_information'));
251 $ptext = str_replace(
252 [
"[OBJECT]",
"[PERIOD]"],
253 [$obj->getTitle(), implode(
"<br />", $period)],
257 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
261 $url = $ctrl->getLinkTarget($this->parent_gui, $file_deliver_cmd);
263 $mytpl->setVariable(
"DOWNLOAD",
$lng->txt(
'download'));
264 $mytpl->setVariable(
"URL_FILE",
$url);
265 $mytpl->setVariable(
"TXT_FILE", $pfile);
268 $mytpl->setVariable(
"TXT_SUBMIT",
$lng->txt(
'ok'));
269 $mytpl->setVariable(
"URL_SUBMIT", $ctrl->getLinkTarget($this->parent_gui,
"back"));
271 $main_tpl->setContent($mytpl->get());
281 $this->log->debug(
"deliverPostFile");
288 $book_id = current($book_ids);
289 $obj = new \ilBookingReservation($book_id);
290 if ($obj->getUserId() !==
$user_id) {
294 $this->domain->objects($this->pool->getId())->deliverBookingInfo(
$id);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(InternalDomainService $domain_service, InternalGUIService $gui_service, \ilObjBookingPool $pool, object $parent_gui)
assignParticipants(int $book_obj_id)
ObjectsManager $objects_manager
StandardGUIRequest $request
displayPostInfo(int $book_obj_id, int $user_id, string $file_deliver_cmd)
Display post booking informations.
InternalDomainService $domain
ilBookingHelpAdapter $help
deliverPostFile(int $book_obj_id, int $user_id)
Deliver post booking file.
handleBookingSuccess(int $a_obj_id, string $post_info_cmd, ?array $a_rsv_ids=null)
Author: Alexander Killing killing@leifos.de
bookingHelp(\ilObjBookingPool $pool)
getReservationIdsFromString()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
redirect(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
static useRelativeDates()
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.
@classDescription Date and time handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...