4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
27 $this->access = $ilAccess;
29 $this->ref_id = $a_parent_obj->ref_id;
30 $this->pool_id = $a_parent_obj->object->getId();
31 $this->pool_has_schedule =
33 $this->pool_overall_limit = $this->pool_has_schedule
35 : $a_parent_obj->object->getOverallLimit();
45 $next_class = $ilCtrl->getNextClass($this);
50 $cmd = $ilCtrl->getCmd(
"render");
66 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id))
68 include_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
70 $bar->
addButton($lng->txt(
'book_add_object'), $ilCtrl->getLinkTarget($this,
'create'));
71 $bar = $bar->getHTML();
74 $tpl->setPermanentLink(
'book', $this->ref_id);
76 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
77 $table =
new ilBookingObjectsTableGUI($this,
'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit);
78 $tpl->setContent($bar.$table->getHTML());
83 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
84 $table =
new ilBookingObjectsTableGUI($this,
'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit, $this->repo_parent, $this->repo_parent_call);
85 $table->resetOffset();
86 $table->writeFilterToSession();
92 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
93 $table =
new ilBookingObjectsTableGUI($this,
'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit, $this->repo_parent, $this->repo_parent_call);
94 $table->resetOffset();
95 $table->resetFilter();
106 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
111 $ilTabs->clearTargets();
112 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
120 $tpl->setContent($a_form->getHTML());
130 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
134 $ilTabs->clearTargets();
135 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
143 $tpl->setContent($a_form->getHTML());
150 $object_subtype = $this->pool_has_schedule
154 $ilHelp->setScreenIdComponent(
'book');
155 $ilHelp->setScreenId(
'object'.$object_subtype);
156 $ilHelp->setSubScreenId($a_id);
169 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
174 $title->setRequired(
true);
176 $title->setMaxLength(120);
177 $form_gui->addItem(
$title);
182 $form_gui->addItem($desc);
185 $file->setALlowDeletion(
true);
186 $form_gui->addItem(
$file);
191 $nr->setMaxLength(3);
192 $form_gui->addItem($nr);
194 if($this->pool_has_schedule)
197 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
200 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
205 $form_gui->addItem($schedule);
209 $post->setTitle($lng->txt(
"book_post_booking_information"));
210 $form_gui->addItem($post);
215 $pdesc->setInfo($lng->txt(
"book_post_booking_text_info"));
216 $form_gui->addItem($pdesc);
218 $pfile =
new ilFileInputGUI($lng->txt(
"book_post_booking_file"),
"post_file");
220 $form_gui->addItem($pfile);
223 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
225 $this->record_gui->setPropertyForm($form_gui);
226 $this->record_gui->parse();
228 if ($a_mode ==
"edit")
230 $form_gui->setTitle($lng->txt(
"book_edit_object"));
233 $item->setValue($id);
234 $form_gui->addItem($item);
236 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
238 $title->setValue($obj->getTitle());
239 $desc->setValue($obj->getDescription());
240 $nr->setValue($obj->getNrOfItems());
241 $pdesc->setValue($obj->getPostText());
242 $file->setValue($obj->getFile());
243 $pfile->setValue($obj->getPostFile());
247 $schedule->setValue($obj->getScheduleId());
250 $form_gui->addCommandButton(
"update", $lng->txt(
"save"));
254 $form_gui->setTitle($lng->txt(
"book_add_object"));
255 $form_gui->addCommandButton(
"save", $lng->txt(
"save"));
256 $form_gui->addCommandButton(
"render", $lng->txt(
"cancel"));
258 $form_gui->setFormAction($ilCtrl->getFormAction($this));
270 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
275 if($form->checkInput())
278 if($this->record_gui &&
279 !$this->record_gui->importEditFormPostValues())
286 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
289 $obj->setTitle($form->getInput(
"title"));
290 $obj->setDescription($form->getInput(
"desc"));
291 $obj->setNrOfItems($form->getInput(
"items"));
292 $obj->setPostText($form->getInput(
"post_text"));
294 if($this->pool_has_schedule)
296 $obj->setScheduleId($form->getInput(
"schedule"));
301 $file = $form->getItemByPostVar(
"file");
302 if($_FILES[
"file"][
"tmp_name"])
304 $obj->uploadFile($_FILES[
"file"]);
306 else if(
$file->getDeletionFlag())
311 $pfile = $form->getItemByPostVar(
"post_file");
312 if($_FILES[
"post_file"][
"tmp_name"])
314 $obj->uploadPostFile($_FILES[
"post_file"]);
316 else if($pfile->getDeletionFlag())
318 $obj->deletePostFile();
323 if($this->record_gui)
325 $this->record_gui->writeEditForm(null, $obj->getId());
329 $ilCtrl->redirect($this,
"render");
333 $form->setValuesByPost();
344 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
349 if($form->checkInput())
352 if($this->record_gui &&
353 !$this->record_gui->importEditFormPostValues())
360 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
362 $obj->setTitle($form->getInput(
"title"));
363 $obj->setDescription($form->getInput(
"desc"));
364 $obj->setNrOfItems($form->getInput(
"items"));
365 $obj->setPostText($form->getInput(
"post_text"));
367 $file = $form->getItemByPostVar(
"file");
368 if($_FILES[
"file"][
"tmp_name"])
370 $obj->uploadFile($_FILES[
"file"]);
372 else if(
$file->getDeletionFlag())
377 $pfile = $form->getItemByPostVar(
"post_file");
378 if($_FILES[
"post_file"][
"tmp_name"])
380 $obj->uploadPostFile($_FILES[
"post_file"]);
382 else if($pfile->getDeletionFlag())
384 $obj->deletePostFile();
387 if($this->pool_has_schedule)
389 $obj->setScheduleId($form->getInput(
"schedule"));
394 if($this->record_gui)
396 $this->record_gui->writeEditForm();
400 $ilCtrl->redirect($this,
"render");
404 $form->setValuesByPost();
414 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
419 $ilTabs->clearTargets();
420 $ilTabs->setBackTarget($lng->txt(
'book_back_to_list'), $ilCtrl->getLinkTarget($this,
'render'));
422 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
424 $conf->setFormAction($ilCtrl->getFormAction($this));
425 $conf->setHeaderText($lng->txt(
'book_confirm_delete'));
427 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
429 $conf->addItem(
'object_id', (
int)$_GET[
'object_id'], $type->getTitle());
430 $conf->setConfirm($lng->txt(
'delete'),
'delete');
431 $conf->setCancel($lng->txt(
'cancel'),
'render');
433 $tpl->setContent($conf->getHTML());
443 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
447 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
452 $ilCtrl->redirect($this,
'render');
459 $id = (int)
$_GET[
"object_id"];
467 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
469 $conf->setFormAction($ilCtrl->getFormAction($this));
470 $conf->setHeaderText($lng->txt(
'book_confirm_cancel'));
472 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
474 $conf->addItem(
'object_id', $id, $type->getTitle());
475 $conf->setConfirm($lng->txt(
'book_set_cancel'),
'rsvCancelUser');
476 $conf->setCancel($lng->txt(
'cancel'),
'render');
478 $tpl->setContent($conf->getHTML());
485 $id = (int)$_REQUEST[
"object_id"];
491 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
494 if ($obj->getUserId() != $ilUser->getId())
497 $ilCtrl->redirect($this,
'render');
504 $ilCtrl->redirect($this,
'render');
509 $id = (int)
$_GET[
"object_id"];
515 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
517 $file = $obj->getFileFullPath();
528 $id = (int)
$_GET[
"object_id"];
537 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
540 $rsv_ids = explode(
";",
$_GET[
"rsv_ids"]);
541 foreach($book_ids as $book_id)
543 if(in_array($book_id, $rsv_ids))
546 $from = $obj->getFrom();
550 $tmp[$from.
"-".$to]++;
562 $time = explode(
"-", $time);
568 $time .=
" (".$counter.
")";
572 $book_id = array_shift($book_ids);
578 if ($obj->getUserId() != $ilUser->getId())
583 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
585 $pfile = $obj->getPostFile();
586 $ptext = $obj->getPostText();
588 $mytpl =
new ilTemplate(
'tpl.booking_reservation_post.html',
true,
true,
'Modules/BookingManager');
589 $mytpl->setVariable(
"TITLE", $lng->txt(
'book_post_booking_information'));
594 $ptext = str_replace(
"[OBJECT]", $obj->getTitle(), $ptext);
595 $ptext = str_replace(
"[PERIOD]", implode(
"<br />", $period), $ptext);
597 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
602 $ilCtrl->setParameter($this,
"object_id", $obj->getId());
603 $url = $ilCtrl->getLinkTarget($this,
'deliverPostFile');
604 $ilCtrl->setParameter($this,
"object_id",
"");
606 $mytpl->setVariable(
"DOWNLOAD", $lng->txt(
'download'));
607 $mytpl->setVariable(
"URL_FILE",
$url);
608 $mytpl->setVariable(
"TXT_FILE", $pfile);
611 $mytpl->setVariable(
"TXT_SUBMIT", $lng->txt(
'ok'));
612 $mytpl->setVariable(
"URL_SUBMIT", $ilCtrl->getLinkTargetByClass(
'ilobjbookingpoolgui',
'render'));
614 $tpl->setContent($mytpl->get());
621 $id = (int)
$_GET[
"object_id"];
627 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
630 if ($obj->getUserId() != $ilUser->getId())
635 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
637 $file = $obj->getPostFileFullPath();
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
update()
Update object dataset.
edit(ilPropertyFormGUI $a_form=null)
Render edit form.
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
executeCommand()
main switch
static setUseRelativeDates($a_status)
set use relative dates
confirmDelete()
Confirm delete.
static useRelativeDates()
check if relative dates are used
create(ilPropertyFormGUI $a_form=null)
Render creation form.
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
Class ilBookingObjectGUI.
if(!is_array($argv)) $options
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
List booking objects (for booking type)
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
initForm($a_mode="create", $id=NULL)
Build property form.
render()
Render list of booking objects.
save()
Create new object dataset.
This class represents a text area property in a property form.
setPoolId($a_pool_id)
Set booking pool id.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static getList($a_pool_id)
Get list of booking objects for given pool.
Confirmation screen class.
__construct($a_parent_obj)
Constructor.