4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
68 $this->ctrl = $DIC->ctrl();
69 $this->tpl = $DIC[
"tpl"];
70 $this->lng = $DIC->language();
71 $this->access = $DIC->access();
72 $this->tabs = $DIC->tabs();
73 $this->help = $DIC[
"ilHelp"];
74 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
75 $this->
user = $DIC->user();
76 $this->ref_id = $a_parent_obj->ref_id;
77 $this->pool_id = $a_parent_obj->object->getId();
78 $this->pool_gui = $a_parent_obj;
79 $this->pool_has_schedule =
81 $this->pool_overall_limit = $this->pool_has_schedule
83 : $a_parent_obj->object->getOverallLimit();
93 $next_class =
$ilCtrl->getNextClass($this);
95 switch ($next_class) {
97 $cmd =
$ilCtrl->getCmd(
"render");
111 $this->pool_gui->showNoScheduleMessage();
118 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
119 include_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
122 $bar = $bar->getHTML();
125 $tpl->setPermanentLink(
'book', $this->ref_id);
127 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
134 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
135 $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);
137 $table->writeFilterToSession();
143 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
144 $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);
155 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
164 $ilTabs->clearTargets();
165 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
172 $tpl->setContent($a_form->getHTML());
180 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
189 $ilTabs->clearTargets();
190 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
197 $tpl->setContent($a_form->getHTML());
204 $object_subtype = $this->pool_has_schedule
208 $ilHelp->setScreenIdComponent(
'book');
209 $ilHelp->setScreenId(
'object' . $object_subtype);
210 $ilHelp->setSubScreenId($a_id);
225 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
230 $title->setRequired(
true);
232 $title->setMaxLength(120);
233 $form_gui->addItem(
$title);
238 $form_gui->addItem($desc);
241 $file->setALlowDeletion(
true);
242 $form_gui->addItem(
$file);
247 $nr->setMaxLength(3);
248 $form_gui->addItem($nr);
250 if ($this->pool_has_schedule) {
252 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
254 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
259 $form_gui->addItem($schedule);
263 $post->setTitle(
$lng->txt(
"book_post_booking_information"));
264 $form_gui->addItem(
$post);
269 $pdesc->setInfo(
$lng->txt(
"book_post_booking_text_info"));
270 $form_gui->addItem($pdesc);
274 $form_gui->addItem($pfile);
277 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
279 $this->record_gui->setPropertyForm($form_gui);
280 $this->record_gui->parse();
282 if ($a_mode ==
"edit") {
283 $form_gui->setTitle(
$lng->txt(
"book_edit_object"));
286 $item->setValue(
$id);
287 $form_gui->addItem($item);
289 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
291 $title->setValue($obj->getTitle());
292 $desc->setValue($obj->getDescription());
293 $nr->setValue($obj->getNrOfItems());
294 $pdesc->setValue($obj->getPostText());
295 $file->setValue($obj->getFile());
296 $pfile->setValue($obj->getPostFile());
298 if (isset($schedule)) {
299 $schedule->setValue($obj->getScheduleId());
302 $form_gui->addCommandButton(
"update",
$lng->txt(
"save"));
304 $form_gui->setTitle(
$lng->txt(
"book_add_object"));
305 $form_gui->addCommandButton(
"save",
$lng->txt(
"save"));
306 $form_gui->addCommandButton(
"render",
$lng->txt(
"cancel"));
308 $form_gui->setFormAction(
$ilCtrl->getFormAction($this));
318 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
326 if (
$form->checkInput()) {
328 if ($this->record_gui &&
329 !$this->record_gui->importEditFormPostValues()) {
334 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
337 $obj->setTitle(
$form->getInput(
"title"));
338 $obj->setDescription(
$form->getInput(
"desc"));
339 $obj->setNrOfItems(
$form->getInput(
"items"));
340 $obj->setPostText(
$form->getInput(
"post_text"));
342 if ($this->pool_has_schedule) {
343 $obj->setScheduleId(
$form->getInput(
"schedule"));
349 if ($_FILES[
"file"][
"tmp_name"]) {
350 $obj->uploadFile($_FILES[
"file"]);
351 } elseif (
$file->getDeletionFlag()) {
355 $pfile =
$form->getItemByPostVar(
"post_file");
356 if ($_FILES[
"post_file"][
"tmp_name"]) {
357 $obj->uploadPostFile($_FILES[
"post_file"]);
358 } elseif ($pfile->getDeletionFlag()) {
359 $obj->deletePostFile();
364 if ($this->record_gui) {
365 $this->record_gui->writeEditForm(null, $obj->getId());
369 $ilCtrl->redirect($this,
"render");
373 $form->setValuesByPost();
382 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
390 if (
$form->checkInput()) {
392 if ($this->record_gui &&
393 !$this->record_gui->importEditFormPostValues()) {
398 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
400 $obj->setTitle(
$form->getInput(
"title"));
401 $obj->setDescription(
$form->getInput(
"desc"));
402 $obj->setNrOfItems(
$form->getInput(
"items"));
403 $obj->setPostText(
$form->getInput(
"post_text"));
406 if ($_FILES[
"file"][
"tmp_name"]) {
407 $obj->uploadFile($_FILES[
"file"]);
408 } elseif (
$file->getDeletionFlag()) {
412 $pfile =
$form->getItemByPostVar(
"post_file");
413 if ($_FILES[
"post_file"][
"tmp_name"]) {
414 $obj->uploadPostFile($_FILES[
"post_file"]);
415 } elseif ($pfile->getDeletionFlag()) {
416 $obj->deletePostFile();
419 if ($this->pool_has_schedule) {
420 $obj->setScheduleId(
$form->getInput(
"schedule"));
425 if ($this->record_gui) {
426 $this->record_gui->writeEditForm();
430 $ilCtrl->redirect($this,
"render");
434 $form->setValuesByPost();
443 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
452 $ilTabs->clearTargets();
453 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
455 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
457 $conf->setFormAction(
$ilCtrl->getFormAction($this));
458 $conf->setHeaderText(
$lng->txt(
'book_confirm_delete'));
460 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
462 $conf->addItem(
'object_id', (
int) $_GET[
'object_id'],
$type->getTitle());
463 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
464 $conf->setCancel(
$lng->txt(
'cancel'),
'render');
466 $tpl->setContent($conf->getHTML());
472 public function delete()
474 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
481 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
486 $ilCtrl->redirect($this,
'render');
502 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
504 $conf->setFormAction(
$ilCtrl->getFormAction($this));
505 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
507 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
509 $conf->addItem(
'object_id',
$id,
$type->getTitle());
510 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancelUser');
511 $conf->setCancel(
$lng->txt(
'cancel'),
'render');
513 $tpl->setContent($conf->getHTML());
522 $id = (int) $_REQUEST[
"object_id"];
527 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
530 if ($obj->getUserId() !=
$ilUser->getId()) {
532 $ilCtrl->redirect($this,
'render');
539 $ilCtrl->redirect($this,
'render');
549 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
551 $file = $obj->getFileFullPath();
572 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
575 $rsv_ids = explode(
";",
$_GET[
"rsv_ids"]);
576 foreach ($book_ids as $book_id) {
577 if (in_array($book_id, $rsv_ids)) {
579 $from = $obj->getFrom();
582 $tmp[
$from .
"-" . $to]++;
603 $book_id = array_shift($book_ids);
609 if ($obj->getUserId() !=
$ilUser->getId()) {
613 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
615 $pfile = $obj->getPostFile();
616 $ptext = $obj->getPostText();
618 $mytpl =
new ilTemplate(
'tpl.booking_reservation_post.html',
true,
true,
'Modules/BookingManager');
619 $mytpl->setVariable(
"TITLE",
$lng->txt(
'book_post_booking_information'));
623 $ptext = str_replace(
"[OBJECT]", $obj->getTitle(), $ptext);
624 $ptext = str_replace(
"[PERIOD]", implode(
"<br />", $period), $ptext);
626 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
630 $ilCtrl->setParameter($this,
"object_id", $obj->getId());
631 $url =
$ilCtrl->getLinkTarget($this,
'deliverPostFile');
632 $ilCtrl->setParameter($this,
"object_id",
"");
634 $mytpl->setVariable(
"DOWNLOAD",
$lng->txt(
'download'));
635 $mytpl->setVariable(
"URL_FILE",
$url);
636 $mytpl->setVariable(
"TXT_FILE", $pfile);
639 $mytpl->setVariable(
"TXT_SUBMIT",
$lng->txt(
'ok'));
640 $mytpl->setVariable(
"URL_SUBMIT",
$ilCtrl->getLinkTargetByClass(
'ilobjbookingpoolgui',
'render'));
642 $tpl->setContent($mytpl->get());
654 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
657 if ($obj->getUserId() !=
$ilUser->getId()) {
661 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
663 $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.
if(!array_key_exists('StateId', $_REQUEST)) $id
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.
initForm($a_mode="create", $id=null)
Build property form.
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
Class ilBookingObjectGUI.
if(isset($_POST['submit'])) $form
special template class to simplify handling of ITX/PEAR
This class represents a text property in a property form.
setCols($a_cols)
Set Cols.
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.
render()
Render list of booking objects.
save()
Create new object dataset.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
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
if(empty($password)) $table
static getList($a_pool_id)
Get list of booking objects for given pool.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Confirmation screen class.
__construct($a_parent_obj)
Constructor.