ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilAppointmentPresentationBookingPoolGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  public function collectPropertiesAndActions(): void
29  {
30  global $DIC;
31 
32  $a_app = $this->appointment;
33  $cat_info = $this->getCatInfo();
34 
35  $this->lng->loadLanguageModule("book");
36 
37  // context id is reservation id (see ilObjBookingPoolGUI->processBooking)
38  $res_id = $a_app['event']->getContextId();
39  $res = new ilBookingReservation($res_id);
40  $b_obj = new ilBookingObject($res->getObjectId());
41  $obj_id = $b_obj->getPoolId();
42  $objects_manager = $DIC->bookingManager()->internal()->domain()->objects($obj_id);
43 
44  $refs = $this->getReadableRefIds($obj_id);
45 
46  // add common section (title, description, object/calendar, location)
47  //$this->addCommonSection($a_app, $obj_id, $cat_info);
48 
49  if (count($refs) > 0) {
50  $this->addInfoSection($b_obj->getTitle());
51 
52  // object description
53  if ($b_obj->getDescription()) {
54  $this->addInfoProperty($this->lng->txt("description"), $b_obj->getDescription());
55  }
56 
57  $this->addObjectLinks($obj_id, $this->appointment);
58 
59  //object info (course, grp...)
60  //$this->addContainerInfo($obj_id);
61 
62  //link to personal bookings
63  $this->addCalendarInfo($cat_info);
64 
65  // section: booking information
66  if ($b_obj->getDescription() || $objects_manager->hasObjectInfo($b_obj->getId())) {
67  $this->addInfoSection($this->lng->txt("book_booking_information"));
68  }
69 
70  $ref_id = current($refs);
71 
72  $this->ctrl->setParameterByClass("ilObjBookingPoolGUI", "ref_id", $ref_id);
73  $this->ctrl->setParameterByClass("ilbookingobjectgui", "object_id", $res->getObjectId());
74 
75  // info file
76  if ($objects_manager->hasObjectInfo($b_obj->getId())) {
77  $this->has_files = true;
78  $link = $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI",
79  "ilObjBookingPoolGUI",
80  "ilbookingobjectgui"
81  ), "deliverInfo");
82 
83  $link = $this->ui->renderer()->render(
84  $this->ui->factory()->button()->shy($objects_manager->getObjectInfoFilename($b_obj->getId()), $link)
85  );
86 
87  $this->addInfoProperty($this->lng->txt("book_additional_info_file"), $link);
88  }
89 
90  // post file
91  $array_info = array();
92  if (($text = $b_obj->getPostText()) != "") {
94  $a_app['event']->getStart(),
95  $a_app['event']->getEnd()
96  );
97  $text = str_replace("[OBJECT]", $b_obj->getTitle(), $text);
98  $text = str_replace("[PERIOD]", $period, $text);
99  $array_info[] = $text;
100  }
101  if ($objects_manager->hasBookingInfo($b_obj->getId())) {
102  $this->has_files = true;
103 
104  $link = $this->ctrl->getLinkTargetByClass(array("ilRepositoryGUI",
105  "ilObjBookingPoolGUI",
106  "ilbookingobjectgui",
107  "ilBookingProcessWithScheduleGUI"
108  ), "deliverPostFile");
109 
110  $array_info[] = $this->ui->renderer()->render(
111  $this->ui->factory()->button()->shy($objects_manager->getBookingInfoFilename($b_obj->getId()), $link)
112  );
113  }
114  if ($array_info) {
115  $this->addInfoProperty($this->lng->txt("book_post_booking_information"), implode("<br>", $array_info));
116  }
117  }
118 
119  $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'app_id', $a_app['event']->getEntryId());
120  $this->addAction(
121  $this->lng->txt("cal_ch_cancel_booking"),
122  $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'cancelBooking')
123  );
124 
125  if (count($refs) > 0) {
126  $this->addAction($this->lng->txt("book_open"), ilLink::_getStaticLink(current($refs)));
127  }
128 
129  $this->addMetaData('book', $obj_id, "bobj", $res->getObjectId());
130  }
131 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$res
Definition: ltiservices.php:66
addObjectLinks(int $obj_id, ?array $a_appointment=null)
Add object link.
addInfoSection(string $a_txt)
Add info section.
addInfoProperty(string $a_txt, string $a_val)
Add info property.
$ref_id
Definition: ltiauth.php:65
global $DIC
Definition: shib_login.php:26
addAction(string $a_txt, string $a_link)
Add action.
addMetaData(string $a_obj_type, int $a_obj_id, ?string $a_sub_obj_type=null, ?int $a_sub_obj_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatPeriod(ilDateTime $start, ilDateTime $end, bool $a_skip_starting_day=false, ?ilObjUser $user=null)
Format a period of two dates Shows: 14.