4 require_once
"./Services/Object/classes/class.ilObjectGUI.php";
73 $this->ctrl = $DIC->ctrl();
74 $this->tpl = $DIC[
"tpl"];
75 $this->lng = $DIC->language();
76 $this->access = $DIC->access();
77 $this->tabs = $DIC->tabs();
78 $this->help = $DIC[
"ilHelp"];
79 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
80 $this->
user = $DIC->user();
81 $this->ref_id = $a_parent_obj->ref_id;
82 $this->pool_id = $a_parent_obj->object->getId();
83 $this->pool_gui = $a_parent_obj;
84 $this->pool_has_schedule =
86 $this->pool_overall_limit = $this->pool_has_schedule
88 : $a_parent_obj->object->getOverallLimit();
90 $this->object_id = (int) $_REQUEST[
'object_id'];
91 $this->user_to_deasign = (int) $_REQUEST[
'bkusr'];
92 $this->rsv_ids = array_map(
'intval', explode(
";",
$_GET[
"rsv_ids"]));
102 $next_class =
$ilCtrl->getNextClass($this);
104 switch ($next_class) {
106 case "ilpropertyformgui":
109 $this->ctrl->forwardCommand(
$form);
113 $cmd =
$ilCtrl->getCmd(
"render");
127 $this->pool_gui->showNoScheduleMessage();
134 if ($ilAccess->checkAccess(
'write',
'', $this->ref_id)) {
135 include_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
138 $bar = $bar->getHTML();
141 $tpl->setPermanentLink(
'book', $this->ref_id);
143 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
150 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
151 $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);
153 $table->writeFilterToSession();
159 include_once
'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
160 $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);
171 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
180 $ilTabs->clearTargets();
181 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
188 $tpl->setContent($a_form->getHTML());
196 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
205 $ilTabs->clearTargets();
206 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
211 $a_form = $this->
initForm(
'edit', $this->object_id);
213 $tpl->setContent($a_form->getHTML());
220 $object_subtype = $this->pool_has_schedule
224 $ilHelp->setScreenIdComponent(
'book');
225 $ilHelp->setScreenId(
'object' . $object_subtype);
226 $ilHelp->setSubScreenId($a_id);
241 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
246 $title->setRequired(
true);
248 $title->setMaxLength(120);
249 $form_gui->addItem(
$title);
254 $form_gui->addItem($desc);
258 $form_gui->addItem($file);
263 $nr->setMaxLength(3);
264 $form_gui->addItem($nr);
266 if ($this->pool_has_schedule) {
268 include_once
'Modules/BookingManager/classes/class.ilBookingSchedule.php';
270 $options[$schedule[
"booking_schedule_id"]] = $schedule[
"title"];
275 $form_gui->addItem($schedule);
279 $post->setTitle(
$lng->txt(
"book_post_booking_information"));
280 $form_gui->addItem(
$post);
285 $pdesc->setInfo(
$lng->txt(
"book_post_booking_text_info"));
286 $form_gui->addItem($pdesc);
290 $form_gui->addItem($pfile);
293 include_once(
'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
295 $this->record_gui->setPropertyForm($form_gui);
296 $this->record_gui->parse();
298 if ($a_mode ==
"edit") {
299 $form_gui->setTitle(
$lng->txt(
"book_edit_object"));
302 $item->setValue(
$id);
303 $form_gui->addItem($item);
305 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
307 $title->setValue($obj->getTitle());
308 $desc->setValue($obj->getDescription());
309 $nr->setValue($obj->getNrOfItems());
310 $pdesc->setValue($obj->getPostText());
311 $file->setValue($obj->getFile());
312 $pfile->setValue($obj->getPostFile());
314 if (isset($schedule)) {
315 $schedule->setValue($obj->getScheduleId());
318 $form_gui->addCommandButton(
"update",
$lng->txt(
"save"));
320 $form_gui->setTitle(
$lng->txt(
"book_add_object"));
321 $form_gui->addCommandButton(
"save",
$lng->txt(
"save"));
322 $form_gui->addCommandButton(
"render",
$lng->txt(
"cancel"));
324 $form_gui->setFormAction(
$ilCtrl->getFormAction($this));
334 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
342 if (
$form->checkInput()) {
344 if ($this->record_gui &&
345 !$this->record_gui->importEditFormPostValues()) {
350 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
353 $obj->setTitle(
$form->getInput(
"title"));
354 $obj->setDescription(
$form->getInput(
"desc"));
355 $obj->setNrOfItems(
$form->getInput(
"items"));
356 $obj->setPostText(
$form->getInput(
"post_text"));
358 if ($this->pool_has_schedule) {
359 $obj->setScheduleId(
$form->getInput(
"schedule"));
364 $file =
$form->getItemByPostVar(
"file");
365 if ($_FILES[
"file"][
"tmp_name"]) {
366 $obj->uploadFile($_FILES[
"file"]);
367 } elseif ($file->getDeletionFlag()) {
371 $pfile =
$form->getItemByPostVar(
"post_file");
372 if ($_FILES[
"post_file"][
"tmp_name"]) {
373 $obj->uploadPostFile($_FILES[
"post_file"]);
374 } elseif ($pfile->getDeletionFlag()) {
375 $obj->deletePostFile();
380 if ($this->record_gui) {
381 $this->record_gui->writeEditForm(null, $obj->getId());
384 ilUtil::sendSuccess(
$lng->txt(
"book_object_added"),
true);
385 $ilCtrl->redirect($this,
"render");
389 $form->setValuesByPost();
398 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
406 if (
$form->checkInput()) {
408 if ($this->record_gui &&
409 !$this->record_gui->importEditFormPostValues()) {
414 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
416 $obj->setTitle(
$form->getInput(
"title"));
417 $obj->setDescription(
$form->getInput(
"desc"));
418 $obj->setNrOfItems(
$form->getInput(
"items"));
419 $obj->setPostText(
$form->getInput(
"post_text"));
421 $file =
$form->getItemByPostVar(
"file");
422 if ($_FILES[
"file"][
"tmp_name"]) {
423 $obj->uploadFile($_FILES[
"file"]);
424 } elseif ($file->getDeletionFlag()) {
428 $pfile =
$form->getItemByPostVar(
"post_file");
429 if ($_FILES[
"post_file"][
"tmp_name"]) {
430 $obj->uploadPostFile($_FILES[
"post_file"]);
431 } elseif ($pfile->getDeletionFlag()) {
432 $obj->deletePostFile();
435 if ($this->pool_has_schedule) {
436 $obj->setScheduleId(
$form->getInput(
"schedule"));
441 if ($this->record_gui) {
442 $this->record_gui->writeEditForm();
445 ilUtil::sendSuccess(
$lng->txt(
"book_object_updated"),
true);
446 $ilCtrl->redirect($this,
"render");
450 $form->setValuesByPost();
459 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
468 $ilTabs->clearTargets();
469 $ilTabs->setBackTarget(
$lng->txt(
'book_back_to_list'),
$ilCtrl->getLinkTarget($this,
'render'));
471 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
473 $conf->setFormAction(
$ilCtrl->getFormAction($this));
474 $conf->setHeaderText(
$lng->txt(
'book_confirm_delete'));
476 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
478 $conf->addItem(
'object_id', $this->object_id,
$type->getTitle());
479 $conf->setConfirm(
$lng->txt(
'delete'),
'delete');
480 $conf->setCancel(
$lng->txt(
'cancel'),
'render');
482 $tpl->setContent($conf->getHTML());
488 public function delete()
490 if (!$this->access->checkAccess(
'write',
'', $this->ref_id)) {
497 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
501 ilUtil::sendSuccess(
$lng->txt(
'book_object_deleted'),
true);
502 $ilCtrl->redirect($this,
'render');
518 include_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
520 $conf->setFormAction(
$ilCtrl->getFormAction($this));
521 $conf->setHeaderText(
$lng->txt(
'book_confirm_cancel'));
523 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
525 $conf->addItem(
'object_id',
$id,
$type->getTitle());
526 if ($this->user_to_deasign) {
527 $conf->addHiddenItem(
'bkusr', $this->user_to_deasign);
532 $conf->setConfirm(
$lng->txt(
'book_set_cancel'),
'rsvCancelUser');
533 $conf->setCancel(
$lng->txt(
'cancel'),
'render');
535 $tpl->setContent($conf->getHTML());
543 if ($this->user_to_deasign) {
546 $user_id = $this->
user->getId();
550 if (!
$id || !$user_id) {
554 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
557 if ($obj->getUserId() != $user_id) {
559 $ilCtrl->redirect($this,
'render');
565 ilUtil::sendSuccess(
$lng->txt(
'settings_saved'));
567 $this->ctrl->redirectByClass(
'ilbookingparticipantgui',
'render');
569 $ilCtrl->redirect($this,
'render');
580 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
582 $file = $obj->getFileFullPath();
603 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
606 foreach ($book_ids as $book_id) {
607 if (in_array($book_id, $this->rsv_ids)) {
609 $from = $obj->getFrom();
611 if (
$from > time()) {
612 $tmp[
$from .
"-" . $to]++;
622 foreach ($tmp as
$time => $counter) {
629 $time .=
" (" . $counter .
")";
633 $book_id = array_shift($book_ids);
647 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
649 $pfile = $obj->getPostFile();
650 $ptext = $obj->getPostText();
652 $mytpl =
new ilTemplate(
'tpl.booking_reservation_post.html',
true,
true,
'Modules/BookingManager');
653 $mytpl->setVariable(
"TITLE",
$lng->txt(
'book_post_booking_information'));
657 $ptext = str_replace(
"[OBJECT]", $obj->getTitle(), $ptext);
658 $ptext = str_replace(
"[PERIOD]", implode(
"<br />", $period), $ptext);
660 $mytpl->setVariable(
"POST_TEXT", nl2br($ptext));
664 $ilCtrl->setParameter($this,
"object_id", $obj->getId());
665 $url =
$ilCtrl->getLinkTarget($this,
'deliverPostFile');
666 $ilCtrl->setParameter($this,
"object_id",
"");
668 $mytpl->setVariable(
"DOWNLOAD",
$lng->txt(
'download'));
669 $mytpl->setVariable(
"URL_FILE",
$url);
670 $mytpl->setVariable(
"TXT_FILE", $pfile);
673 $mytpl->setVariable(
"TXT_SUBMIT",
$lng->txt(
'ok'));
674 $mytpl->setVariable(
"URL_SUBMIT",
$ilCtrl->getLinkTargetByClass(
'ilobjbookingpoolgui',
'render'));
676 $tpl->setContent($mytpl->get());
688 include_once
'Modules/BookingManager/classes/class.ilBookingReservation.php';
691 if ($obj->getUserId() !=
$ilUser->getId()) {
695 include_once
'Modules/BookingManager/classes/class.ilBookingObject.php';
697 $file = $obj->getPostFileFullPath();
707 $this->tabs->clearTargets();
708 $this->tabs->setBackTarget($this->lng->txt(
'book_back_to_list'), $this->ctrl->getLinkTarget($this,
'render'));
710 include_once(
"./Modules/BookingManager/classes/class.ilBookingAssignParticipantsTableGUI.php");
713 $this->tpl->setContent(
$table->getHTML());
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.
List participant / booking pool assignment.
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)
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.
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.
Confirmation screen class.
__construct($a_parent_obj)
Constructor.