4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
25 $this->ref_id = $a_parent_obj->ref_id;
26 $this->pool_id = $a_parent_obj->object->getId();
27 $this->pool_has_schedule =
29 $this->pool_overall_limit = $this->pool_has_schedule
31 : $a_parent_obj->object->getOverallLimit();
41 $next_class = $ilCtrl->getNextClass($this);
46 $cmd = $ilCtrl->getCmd(
"render");
62 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id))
64 include_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
66 $bar->
addButton($lng->txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
67 $bar = $bar->getHTML();
70 $tpl->setPermanentLink(
'book', $this->ref_id);
72 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
73 $table =
new ilBookingObjectsTableGUI($this,
'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit);
74 $tpl->setContent($bar.$table->getHTML());
84 $ilTabs->clearTargets();
85 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
88 $tpl->setContent($form->getHTML());
98 $ilTabs->clearTargets();
99 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
102 $tpl->setContent($form->getHTML());
115 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
122 $title->setMaxLength(120);
123 $form_gui->addItem($title);
128 $form_gui->addItem($desc);
131 $file->setALlowDeletion(
true);
132 $form_gui->addItem(
$file);
137 $nr->setMaxLength(3);
138 $form_gui->addItem($nr);
140 if($this->pool_has_schedule)
143 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
146 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
151 $form_gui->addItem($schedule);
155 $post->setTitle($lng->txt(
"book_post_booking_information"));
156 $form_gui->addItem($post);
161 $pdesc->setInfo($lng->txt(
"book_post_booking_text_info"));
162 $form_gui->addItem($pdesc);
164 $pfile =
new ilFileInputGUI($lng->txt(
"book_post_booking_file"),
"post_file");
166 $form_gui->addItem($pfile);
168 if ($a_mode ==
"edit")
170 $form_gui->setTitle($lng->txt(
"book_edit_object"));
173 $item->setValue($id);
174 $form_gui->addItem($item);
176 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
178 $title->setValue($obj->getTitle());
179 $desc->setValue($obj->getDescription());
180 $nr->setValue($obj->getNrOfItems());
181 $pdesc->setValue($obj->getPostText());
182 $file->setValue($obj->getFile());
183 $pfile->setValue($obj->getPostFile());
187 $schedule->setValue($obj->getScheduleId());
190 $form_gui->addCommandButton(
"update", $lng->txt(
"save"));
194 $form_gui->setTitle($lng->txt(
"book_add_object"));
195 $form_gui->addCommandButton(
"save", $lng->txt(
"save"));
196 $form_gui->addCommandButton(
"render", $lng->txt(
"cancel"));
198 $form_gui->setFormAction($ilCtrl->getFormAction($this));
211 if($form->checkInput())
213 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
216 $obj->setTitle($form->getInput(
"title"));
217 $obj->setDescription($form->getInput(
"desc"));
218 $obj->setNrOfItems($form->getInput(
"items"));
219 $obj->setPostText($form->getInput(
"post_text"));
221 if($this->pool_has_schedule)
223 $obj->setScheduleId($form->getInput(
"schedule"));
228 $file = $form->getItemByPostVar(
"file");
229 if($_FILES[
"file"][
"tmp_name"])
231 $obj->uploadFile($_FILES[
"file"]);
233 else if(
$file->getDeletionFlag())
238 $pfile = $form->getItemByPostVar(
"post_file");
239 if($_FILES[
"post_file"][
"tmp_name"])
241 $obj->uploadPostFile($_FILES[
"post_file"]);
243 else if($pfile->getDeletionFlag())
245 $obj->deletePostFile();
255 $ilTabs->clearTargets();
256 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
258 $form->setValuesByPost();
259 $tpl->setContent($form->getHTML());
271 if($form->checkInput())
273 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
275 $obj->setTitle($form->getInput(
"title"));
276 $obj->setDescription($form->getInput(
"desc"));
277 $obj->setNrOfItems($form->getInput(
"items"));
278 $obj->setPostText($form->getInput(
"post_text"));
280 $file = $form->getItemByPostVar(
"file");
281 if($_FILES[
"file"][
"tmp_name"])
283 $obj->uploadFile($_FILES[
"file"]);
285 else if(
$file->getDeletionFlag())
290 $pfile = $form->getItemByPostVar(
"post_file");
291 if($_FILES[
"post_file"][
"tmp_name"])
293 $obj->uploadPostFile($_FILES[
"post_file"]);
295 else if($pfile->getDeletionFlag())
297 $obj->deletePostFile();
300 if($this->pool_has_schedule)
302 $obj->setScheduleId($form->getInput(
"schedule"));
312 $form->setValuesByPost();
313 $tpl->setContent($form->getHTML());
324 $ilTabs->clearTargets();
325 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
327 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
329 $conf->setFormAction($ilCtrl->getFormAction($this));
330 $conf->setHeaderText($lng->txt(
'book_confirm_delete'));
332 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
334 $conf->addItem(
'object_id', (
int)$_GET[
'object_id'], $type->getTitle());
335 $conf->setConfirm($lng->txt(
'delete'),
'delete');
336 $conf->setCancel($lng->txt(
'cancel'),
'render');
338 $tpl->setContent($conf->getHTML());
348 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
353 $ilCtrl->redirect($this,
'render');
360 $id = (int)
$_GET[
"object_id"];
366 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
368 $conf->setFormAction($ilCtrl->getFormAction($this));
369 $conf->setHeaderText($lng->txt(
'book_confirm_cancel'));
371 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
373 $conf->addItem(
'object_id', $id, $type->getTitle());
374 $conf->setConfirm($lng->txt(
'book_set_cancel'),
'rsvCancelUser');
375 $conf->setCancel($lng->txt(
'cancel'),
'render');
377 $tpl->setContent($conf->getHTML());
390 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
393 if ($obj->getUserId() != $ilUser->getId())
396 $ilCtrl->redirect($this,
'render');
403 $ilCtrl->redirect($this,
'render');
408 $id = (int)
$_GET[
"object_id"];
414 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
416 $file = $obj->getFileFullPath();
427 $id = (int)
$_GET[
"object_id"];
436 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
439 $rsv_ids = explode(
";",
$_GET[
"rsv_ids"]);
440 foreach($book_ids as $book_id)
442 if(in_array($book_id, $rsv_ids))
445 $from = $obj->getFrom();
449 $tmp[$from.
"-".$to]++;
459 foreach($tmp as $time => $counter)
461 $time = explode(
"-", $time);
467 $time .=
" (".$counter.
")";
471 $book_id = array_shift($book_ids);
477 if ($obj->getUserId() != $ilUser->getId())
482 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
484 $pfile = $obj->getPostFile();
485 $ptext = $obj->getPostText();
487 $mytpl =
new ilTemplate(
'tpl.booking_reservation_post.html',
true,
true,
'Modules/BookingManager');
488 $mytpl->setVariable(
"TITLE", $lng->txt(
'book_post_booking_information'));
493 $ptext = str_replace(
"[OBJECT]", $obj->getTitle(), $ptext);
494 $ptext = str_replace(
"[PERIOD]", implode(
"<br />", $period), $ptext);
496 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
501 $ilCtrl->setParameter($this,
"object_id", $obj->getId());
502 $url = $ilCtrl->getLinkTarget($this,
'deliverPostFile');
503 $ilCtrl->setParameter($this,
"object_id",
"");
505 $mytpl->setVariable(
"DOWNLOAD", $lng->txt(
'download'));
506 $mytpl->setVariable(
"URL_FILE", $url);
507 $mytpl->setVariable(
"TXT_FILE", $pfile);
510 $mytpl->setVariable(
"TXT_SUBMIT", $lng->txt(
'ok'));
511 $mytpl->setVariable(
"URL_SUBMIT", $ilCtrl->getLinkTargetByClass(
'ilobjbookingpoolgui',
'render'));
513 $tpl->setContent($mytpl->get());
520 $id = (int)
$_GET[
"object_id"];
526 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
529 if ($obj->getUserId() != $ilUser->getId())
534 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
536 $file = $obj->getPostFileFullPath();