4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
24 $this->ref_id = $a_parent_obj->ref_id;
25 $this->pool_id = $a_parent_obj->object->getId();
26 $this->pool_has_schedule =
37 $next_class = $ilCtrl->getNextClass($this);
42 $cmd = $ilCtrl->getCmd(
"render");
58 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id))
60 include_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
62 $bar->
addButton($lng->txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
63 $bar = $bar->getHTML();
66 include_once(
'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php');
69 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
71 $tpl->setContent($bar.$table->getHTML().$plink->getHTML());
81 $ilTabs->clearTargets();
82 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
85 $tpl->setContent($form->getHTML());
95 $ilTabs->clearTargets();
96 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
99 $tpl->setContent($form->getHTML());
112 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
119 $title->setMaxLength(120);
120 $form_gui->addItem($title);
125 $form_gui->addItem($desc);
128 $file->setALlowDeletion(
true);
129 $form_gui->addItem(
$file);
134 $nr->setMaxLength(3);
135 $form_gui->addItem($nr);
137 if($this->pool_has_schedule)
140 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
143 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
148 $form_gui->addItem($schedule);
152 $post->setTitle($lng->txt(
"book_post_booking_information"));
153 $form_gui->addItem($post);
158 $form_gui->addItem($pdesc);
160 $pfile =
new ilFileInputGUI($lng->txt(
"book_post_booking_file"),
"post_file");
162 $form_gui->addItem($pfile);
164 if ($a_mode ==
"edit")
166 $form_gui->setTitle($lng->txt(
"book_edit_object"));
169 $item->setValue($id);
170 $form_gui->addItem($item);
172 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
174 $title->setValue($obj->getTitle());
175 $desc->setValue($obj->getDescription());
176 $nr->setValue($obj->getNrOfItems());
177 $pdesc->setValue($obj->getPostText());
178 $file->setValue($obj->getFile());
179 $pfile->setValue($obj->getPostFile());
183 $schedule->setValue($obj->getScheduleId());
186 $form_gui->addCommandButton(
"update", $lng->txt(
"save"));
190 $form_gui->setTitle($lng->txt(
"book_add_object"));
191 $form_gui->addCommandButton(
"save", $lng->txt(
"save"));
192 $form_gui->addCommandButton(
"render", $lng->txt(
"cancel"));
194 $form_gui->setFormAction($ilCtrl->getFormAction($this));
207 if($form->checkInput())
209 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
212 $obj->setTitle($form->getInput(
"title"));
213 $obj->setDescription($form->getInput(
"desc"));
214 $obj->setNrOfItems($form->getInput(
"items"));
215 $obj->setPostText($form->getInput(
"post_text"));
217 if($this->pool_has_schedule)
219 $obj->setScheduleId($form->getInput(
"schedule"));
224 $file = $form->getItemByPostVar(
"file");
225 if($_FILES[
"file"][
"tmp_name"])
227 $obj->uploadFile($_FILES[
"file"]);
229 else if(
$file->getDeletionFlag())
234 $pfile = $form->getItemByPostVar(
"post_file");
235 if($_FILES[
"post_file"][
"tmp_name"])
237 $obj->uploadPostFile($_FILES[
"post_file"]);
239 else if($pfile->getDeletionFlag())
241 $obj->deletePostFile();
251 $ilTabs->clearTargets();
252 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
254 $form->setValuesByPost();
255 $tpl->setContent($form->getHTML());
267 if($form->checkInput())
269 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
271 $obj->setTitle($form->getInput(
"title"));
272 $obj->setDescription($form->getInput(
"desc"));
273 $obj->setNrOfItems($form->getInput(
"items"));
274 $obj->setPostText($form->getInput(
"post_text"));
276 $file = $form->getItemByPostVar(
"file");
277 if($_FILES[
"file"][
"tmp_name"])
279 $obj->uploadFile($_FILES[
"file"]);
281 else if(
$file->getDeletionFlag())
286 $pfile = $form->getItemByPostVar(
"post_file");
287 if($_FILES[
"post_file"][
"tmp_name"])
289 $obj->uploadPostFile($_FILES[
"post_file"]);
291 else if($pfile->getDeletionFlag())
293 $obj->deletePostFile();
296 if($this->pool_has_schedule)
298 $obj->setScheduleId($form->getInput(
"schedule"));
308 $form->setValuesByPost();
309 $tpl->setContent($form->getHTML());
320 $ilTabs->clearTargets();
321 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
323 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
325 $conf->setFormAction($ilCtrl->getFormAction($this));
326 $conf->setHeaderText($lng->txt(
'book_confirm_delete'));
328 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
330 $conf->addItem(
'object_id', (
int)$_GET[
'object_id'], $type->getTitle());
331 $conf->setConfirm($lng->txt(
'delete'),
'delete');
332 $conf->setCancel($lng->txt(
'cancel'),
'render');
334 $tpl->setContent($conf->getHTML());
344 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
349 $ilCtrl->redirect($this,
'render');
356 $id = (int)
$_GET[
"object_id"];
363 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
365 $conf->setFormAction($ilCtrl->getFormAction($this,
'rsvCancelUser'));
366 $conf->setHeaderText($lng->txt(
'book_confirm_cancel'));
368 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
370 $conf->addItem(
'object_id', $id, $type->getTitle());
371 $conf->setConfirm($lng->txt(
'book_set_cancel'),
'rsvCancelUser');
372 $conf->setCancel($lng->txt(
'cancel'),
'render');
374 $tpl->setContent($conf->getHTML());
387 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
390 if ($obj->getUserId() != $ilUser->getId())
393 $ilCtrl->redirect($this,
'render');
400 $ilCtrl->redirect($this,
'render');
405 $id = (int)
$_GET[
"object_id"];
411 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
413 $file = $obj->getFileFullPath();
424 $id = (int)
$_GET[
"object_id"];
430 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
433 if ($obj->getUserId() != $ilUser->getId())
438 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
440 $pfile = $obj->getPostFile();
441 $ptext = $obj->getPostText();
443 $mytpl =
new ilTemplate(
'tpl.booking_reservation_post.html',
true,
true,
'Modules/BookingManager');
444 $mytpl->setVariable(
"TITLE", $lng->txt(
'book_post_booking_information'));
448 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
453 $ilCtrl->setParameter($this,
"object_id", $obj->getId());
454 $url = $ilCtrl->getLinkTarget($this,
'deliverPostFile');
455 $ilCtrl->setParameter($this,
"object_id",
"");
457 $mytpl->setVariable(
"DOWNLOAD", $lng->txt(
'download'));
458 $mytpl->setVariable(
"URL_FILE", $url);
459 $mytpl->setVariable(
"TXT_FILE", $pfile);
462 $mytpl->setVariable(
"TXT_SUBMIT", $lng->txt(
'ok'));
463 $mytpl->setVariable(
"URL_SUBMIT", $ilCtrl->getLinkTargetByClass(
'ilobjbookingpoolgui',
'render'));
465 $tpl->setContent($mytpl->get());
472 $id = (int)
$_GET[
"object_id"];
478 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
481 if ($obj->getUserId() != $ilUser->getId())
486 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
488 $file = $obj->getPostFileFullPath();