ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilBookingObjectGUI Class Reference

Class ilBookingObjectGUI. More...

+ Collaboration diagram for ilBookingObjectGUI:

Public Member Functions

 __construct ($a_parent_obj)
 Constructor. More...
 
 executeCommand ()
 main switch More...
 
 render ()
 Render list of booking objects. More...
 
 applyFilter ()
 
 resetFilter ()
 
 create (ilPropertyFormGUI $a_form=null)
 Render creation form. More...
 
 edit (ilPropertyFormGUI $a_form=null)
 Render edit form. More...
 
 initForm ($a_mode="create", $id=NULL)
 Build property form. More...
 
 save ()
 Create new object dataset. More...
 
 update ()
 Update object dataset. More...
 
 confirmDelete ()
 Confirm delete. More...
 
 delete ()
 Delete object. More...
 
 rsvConfirmCancelUser ()
 
 rsvCancelUser ()
 
 deliverInfo ()
 
 displayPostInfo ()
 
 deliverPostFile ()
 

Protected Member Functions

 setHelpId ($a_id)
 

Protected Attributes

 $ref_id
 
 $pool_id
 
 $pool_has_schedule
 
 $pool_overall_limit
 

Detailed Description

Class ilBookingObjectGUI.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 12 of file class.ilBookingObjectGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

Definition at line 23 of file class.ilBookingObjectGUI.php.

References ilObjBookingPool\TYPE_NO_SCHEDULE.

24  {
25  global $ilAccess;
26 
27  $this->access = $ilAccess;
28 
29  $this->ref_id = $a_parent_obj->ref_id;
30  $this->pool_id = $a_parent_obj->object->getId();
31  $this->pool_has_schedule =
32  ($a_parent_obj->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE);
33  $this->pool_overall_limit = $this->pool_has_schedule
34  ? null
35  : $a_parent_obj->object->getOverallLimit();
36  }

Member Function Documentation

◆ applyFilter()

ilBookingObjectGUI::applyFilter ( )

Definition at line 81 of file class.ilBookingObjectGUI.php.

References render().

82  {
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();
87  $this->render();
88  }
List booking objects (for booking type)
render()
Render list of booking objects.
+ Here is the call graph for this function:

◆ confirmDelete()

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

Definition at line 411 of file class.ilBookingObjectGUI.php.

References $_GET, $ilCtrl, $lng, and $tpl.

412  {
413  global $ilCtrl, $lng, $tpl, $ilTabs;
414  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
415  return;
416  }
417 
418 
419  $ilTabs->clearTargets();
420  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
421 
422  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
423  $conf = new ilConfirmationGUI();
424  $conf->setFormAction($ilCtrl->getFormAction($this));
425  $conf->setHeaderText($lng->txt('book_confirm_delete'));
426 
427  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
428  $type = new ilBookingObject((int)$_GET['object_id']);
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');
432 
433  $tpl->setContent($conf->getHTML());
434  }
a bookable ressource
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
Confirmation screen class.

◆ create()

ilBookingObjectGUI::create ( ilPropertyFormGUI  $a_form = null)

Render creation form.

Definition at line 102 of file class.ilBookingObjectGUI.php.

References $ilCtrl, $lng, $tpl, initForm(), and setHelpId().

Referenced by save().

103  {
104  global $ilCtrl, $tpl, $lng, $ilTabs;
105 
106  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
107  return;
108  }
109 
110 
111  $ilTabs->clearTargets();
112  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
113 
114  $this->setHelpId('create');
115 
116  if(!$a_form)
117  {
118  $a_form = $this->initForm();
119  }
120  $tpl->setContent($a_form->getHTML());
121  }
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=NULL)
Build property form.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilBookingObjectGUI::delete ( )

Delete object.

Definition at line 439 of file class.ilBookingObjectGUI.php.

References $_POST, $ilCtrl, $lng, and ilUtil\sendSuccess().

440  {
441  global $ilCtrl, $lng;
442 
443  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
444  return;
445  }
446 
447  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
448  $obj = new ilBookingObject((int)$_POST['object_id']);
449  $obj->delete();
450 
451  ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
452  $ilCtrl->redirect($this, 'render');
453  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
$_POST["username"]
+ Here is the call graph for this function:

◆ deliverInfo()

ilBookingObjectGUI::deliverInfo ( )

Definition at line 507 of file class.ilBookingObjectGUI.php.

References $_GET, $file, and ilUtil\deliverFile().

508  {
509  $id = (int)$_GET["object_id"];
510  if(!$id)
511  {
512  return;
513  }
514 
515  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
516  $obj = new ilBookingObject($id);
517  $file = $obj->getFileFullPath();
518  if($file)
519  {
520  ilUtil::deliverFile($file, $obj->getFile());
521  }
522  }
a bookable ressource
$_GET["client_id"]
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingObjectGUI::deliverPostFile ( )

Definition at line 617 of file class.ilBookingObjectGUI.php.

References $_GET, $file, $ilUser, ilUtil\deliverFile(), and ilBookingReservation\getObjectReservationForUser().

618  {
619  global $ilUser;
620 
621  $id = (int)$_GET["object_id"];
622  if(!$id)
623  {
624  return;
625  }
626 
627  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
628  $book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
629  $obj = new ilBookingReservation($book_id);
630  if ($obj->getUserId() != $ilUser->getId())
631  {
632  return;
633  }
634 
635  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
636  $obj = new ilBookingObject($id);
637  $file = $obj->getPostFileFullPath();
638  if($file)
639  {
640  ilUtil::deliverFile($file, $obj->getPostFile());
641  }
642  }
a bookable ressource
$_GET["client_id"]
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
$ilUser
Definition: imgupload.php:18
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingObjectGUI::displayPostInfo ( )

Definition at line 524 of file class.ilBookingObjectGUI.php.

References $_GET, $counter, $ilCtrl, $ilUser, $lng, $tpl, $url, array, ilDatePresentation\formatPeriod(), ilBookingReservation\getObjectReservationForUser(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), time, and ilDatePresentation\useRelativeDates().

525  {
526  global $tpl, $ilUser, $lng, $ilCtrl;
527 
528  $id = (int)$_GET["object_id"];
529  if(!$id)
530  {
531  return;
532  }
533 
534 
535  // placeholder
536 
537  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
538  $book_ids = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId(), true);
539  $tmp = array();
540  $rsv_ids = explode(";", $_GET["rsv_ids"]);
541  foreach($book_ids as $book_id)
542  {
543  if(in_array($book_id, $rsv_ids))
544  {
545  $obj = new ilBookingReservation($book_id);
546  $from = $obj->getFrom();
547  $to = $obj->getTo();
548  if($from > time())
549  {
550  $tmp[$from."-".$to]++;
551  }
552  }
553  }
554 
557 
558  $period = array();
559  ksort($tmp);
560  foreach($tmp as $time => $counter)
561  {
562  $time = explode("-", $time);
564  new ilDateTime($time[0], IL_CAL_UNIX),
565  new ilDateTime($time[1], IL_CAL_UNIX));
566  if($counter > 1)
567  {
568  $time .= " (".$counter.")";
569  }
570  $period[] = $time;
571  }
572  $book_id = array_shift($book_ids);
573 
575 
576 
577  $obj = new ilBookingReservation($book_id);
578  if ($obj->getUserId() != $ilUser->getId())
579  {
580  return;
581  }
582 
583  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
584  $obj = new ilBookingObject($id);
585  $pfile = $obj->getPostFile();
586  $ptext = $obj->getPostText();
587 
588  $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
589  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
590 
591  if($ptext)
592  {
593  // placeholder
594  $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
595  $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
596 
597  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
598  }
599 
600  if($pfile)
601  {
602  $ilCtrl->setParameter($this, "object_id", $obj->getId());
603  $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
604  $ilCtrl->setParameter($this, "object_id", "");
605 
606  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
607  $mytpl->setVariable("URL_FILE", $url);
608  $mytpl->setVariable("TXT_FILE", $pfile);
609  }
610 
611  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
612  $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
613 
614  $tpl->setContent($mytpl->get());
615  }
a bookable ressource
$_GET["client_id"]
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static setUseRelativeDates($a_status)
set use relative dates
$url
Definition: shib_logout.php:72
const IL_CAL_UNIX
static useRelativeDates()
check if relative dates are used
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
$counter
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
special template class to simplify handling of ITX/PEAR
Date and time handling
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ edit()

ilBookingObjectGUI::edit ( ilPropertyFormGUI  $a_form = null)

Render edit form.

Definition at line 126 of file class.ilBookingObjectGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, initForm(), and setHelpId().

Referenced by update().

127  {
128  global $tpl, $ilCtrl, $ilTabs, $lng;
129 
130  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
131  return;
132  }
133 
134  $ilTabs->clearTargets();
135  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
136 
137  $this->setHelpId('edit');
138 
139  if(!$a_form)
140  {
141  $a_form = $this->initForm('edit', (int)$_GET['object_id']);
142  }
143  $tpl->setContent($a_form->getHTML());
144  }
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=NULL)
Build property form.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilBookingObjectGUI::executeCommand ( )

main switch

Definition at line 41 of file class.ilBookingObjectGUI.php.

References $cmd, and $ilCtrl.

42  {
43  global $ilCtrl;
44 
45  $next_class = $ilCtrl->getNextClass($this);
46 
47  switch($next_class)
48  {
49  default:
50  $cmd = $ilCtrl->getCmd("render");
51  $this->$cmd();
52  break;
53  }
54  return true;
55  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18

◆ initForm()

ilBookingObjectGUI::initForm (   $a_mode = "create",
  $id = NULL 
)

Build property form.

Parameters
string$a_mode
int$id
Returns
object

Definition at line 165 of file class.ilBookingObjectGUI.php.

References $file, $ilCtrl, $lng, $options, $title, array, ilBookingSchedule\getList(), ilAdvancedMDRecordGUI\MODE_EDITOR, ilFileInputGUI\setALlowDeletion(), ilTextAreaInputGUI\setCols(), and ilFormPropertyGUI\setRequired().

Referenced by create(), edit(), save(), and update().

166  {
167  global $lng, $ilCtrl, $ilObjDataCache;
168 
169  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
170 
171  $form_gui = new ilPropertyFormGUI();
172 
173  $title = new ilTextInputGUI($lng->txt("title"), "title");
174  $title->setRequired(true);
175  $title->setSize(40);
176  $title->setMaxLength(120);
177  $form_gui->addItem($title);
178 
179  $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
180  $desc->setCols(70);
181  $desc->setRows(15);
182  $form_gui->addItem($desc);
183 
184  $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
185  $file->setALlowDeletion(true);
186  $form_gui->addItem($file);
187 
188  $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
189  $nr->setRequired(true);
190  $nr->setSize(3);
191  $nr->setMaxLength(3);
192  $form_gui->addItem($nr);
193 
194  if($this->pool_has_schedule)
195  {
196  $options = array();
197  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
198  foreach(ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule)
199  {
200  $options[$schedule["booking_schedule_id"]] = $schedule["title"];
201  }
202  $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
203  $schedule->setRequired(true);
204  $schedule->setOptions($options);
205  $form_gui->addItem($schedule);
206  }
207 
208  $post = new ilFormSectionHeaderGUI();
209  $post->setTitle($lng->txt("book_post_booking_information"));
210  $form_gui->addItem($post);
211 
212  $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
213  $pdesc->setCols(70);
214  $pdesc->setRows(15);
215  $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
216  $form_gui->addItem($pdesc);
217 
218  $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
219  $pfile->setALlowDeletion(true);
220  $form_gui->addItem($pfile);
221 
222  // #18214 - should also work for new objects
223  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
224  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, "book", $this->pool_id, "bobj", $id);
225  $this->record_gui->setPropertyForm($form_gui);
226  $this->record_gui->parse();
227 
228  if ($a_mode == "edit")
229  {
230  $form_gui->setTitle($lng->txt("book_edit_object"));
231 
232  $item = new ilHiddenInputGUI('object_id');
233  $item->setValue($id);
234  $form_gui->addItem($item);
235 
236  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
237  $obj = new ilBookingObject($id);
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());
244 
245  if(isset($schedule))
246  {
247  $schedule->setValue($obj->getScheduleId());
248  }
249 
250  $form_gui->addCommandButton("update", $lng->txt("save"));
251  }
252  else
253  {
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"));
257  }
258  $form_gui->setFormAction($ilCtrl->getFormAction($this));
259 
260  return $form_gui;
261  }
a bookable ressource
This class represents a selection list property in a property form.
This class represents a property form user interface.
setALlowDeletion($a_val)
Set allow deletion.
This class represents a section header in a property form.
This class represents a file property in a property form.
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
if(!is_array($argv)) $options
This class represents a number property in a property form.
This class represents a text property in a property form.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
This class represents a text area property in a property form.
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.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilBookingObjectGUI::render ( )

Render list of booking objects.

uses ilBookingObjectsTableGUI

Definition at line 62 of file class.ilBookingObjectGUI.php.

References $ilCtrl, $lng, $tpl, and ilToolbarGUI\addButton().

Referenced by applyFilter(), and resetFilter().

63  {
64  global $tpl, $ilCtrl, $lng, $ilAccess;
65 
66  if ($ilAccess->checkAccess('write', '', $this->ref_id))
67  {
68  include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
69  $bar = new ilToolbarGUI;
70  $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
71  $bar = $bar->getHTML();
72  }
73 
74  $tpl->setPermanentLink('book', $this->ref_id);
75 
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());
79  }
addButton($a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
List booking objects (for booking type)
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilBookingObjectGUI::resetFilter ( )

Definition at line 90 of file class.ilBookingObjectGUI.php.

References render().

91  {
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();
96  $this->render();
97  }
List booking objects (for booking type)
render()
Render list of booking objects.
+ Here is the call graph for this function:

◆ rsvCancelUser()

ilBookingObjectGUI::rsvCancelUser ( )

Definition at line 481 of file class.ilBookingObjectGUI.php.

References $ilCtrl, $ilUser, $lng, ilBookingReservation\getObjectReservationForUser(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilBookingReservation\STATUS_CANCELLED.

482  {
483  global $ilCtrl, $ilUser, $lng;
484 
485  $id = (int)$_REQUEST["object_id"];
486  if(!$id)
487  {
488  return;
489  }
490 
491  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
492  $id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
493  $obj = new ilBookingReservation($id);
494  if ($obj->getUserId() != $ilUser->getId())
495  {
496  ilUtil::sendFailure($lng->txt('permission_denied'), true);
497  $ilCtrl->redirect($this, 'render');
498  }
499 
501  $obj->update();
502 
503  ilUtil::sendSuccess($lng->txt('settings_saved'));
504  $ilCtrl->redirect($this, 'render');
505  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ rsvConfirmCancelUser()

ilBookingObjectGUI::rsvConfirmCancelUser ( )

Definition at line 455 of file class.ilBookingObjectGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, and setHelpId().

456  {
457  global $ilCtrl, $lng, $tpl;
458 
459  $id = (int)$_GET["object_id"];
460  if(!$id)
461  {
462  return;
463  }
464 
465  $this->setHelpId("cancel_booking");
466 
467  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
468  $conf = new ilConfirmationGUI();
469  $conf->setFormAction($ilCtrl->getFormAction($this));
470  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
471 
472  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
473  $type = new ilBookingObject($id);
474  $conf->addItem('object_id', $id, $type->getTitle());
475  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
476  $conf->setCancel($lng->txt('cancel'), 'render');
477 
478  $tpl->setContent($conf->getHTML());
479  }
a bookable ressource
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17
Confirmation screen class.
+ Here is the call graph for this function:

◆ save()

ilBookingObjectGUI::save ( )

Create new object dataset.

Definition at line 266 of file class.ilBookingObjectGUI.php.

References $file, $ilCtrl, $lng, $valid, create(), initForm(), ilUtil\sendSuccess(), and ilBookingObject\setPoolId().

267  {
268  global $ilCtrl, $lng;
269 
270  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
271  return;
272  }
273 
274  $form = $this->initForm();
275  if($form->checkInput())
276  {
277  $valid = true;
278  if($this->record_gui &&
279  !$this->record_gui->importEditFormPostValues())
280  {
281  $valid = false;
282  }
283 
284  if($valid)
285  {
286  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
287  $obj = new ilBookingObject;
288  $obj->setPoolId($this->pool_id);
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"));
293 
294  if($this->pool_has_schedule)
295  {
296  $obj->setScheduleId($form->getInput("schedule"));
297  }
298 
299  $obj->save();
300 
301  $file = $form->getItemByPostVar("file");
302  if($_FILES["file"]["tmp_name"])
303  {
304  $obj->uploadFile($_FILES["file"]);
305  }
306  else if($file->getDeletionFlag())
307  {
308  $obj->deleteFile();
309  }
310 
311  $pfile = $form->getItemByPostVar("post_file");
312  if($_FILES["post_file"]["tmp_name"])
313  {
314  $obj->uploadPostFile($_FILES["post_file"]);
315  }
316  else if($pfile->getDeletionFlag())
317  {
318  $obj->deletePostFile();
319  }
320 
321  $obj->update();
322 
323  if($this->record_gui)
324  {
325  $this->record_gui->writeEditForm(null, $obj->getId());
326  }
327 
328  ilUtil::sendSuccess($lng->txt("book_object_added"), true);
329  $ilCtrl->redirect($this, "render");
330  }
331  }
332 
333  $form->setValuesByPost();
334  $this->create($form);
335  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
$valid
global $ilCtrl
Definition: ilias.php:18
create(ilPropertyFormGUI $a_form=null)
Render creation form.
initForm($a_mode="create", $id=NULL)
Build property form.
global $lng
Definition: privfeed.php:17
setPoolId($a_pool_id)
Set booking pool id.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ setHelpId()

ilBookingObjectGUI::setHelpId (   $a_id)
protected

Definition at line 146 of file class.ilBookingObjectGUI.php.

Referenced by create(), edit(), and rsvConfirmCancelUser().

147  {
148  global $ilHelp;
149 
150  $object_subtype = $this->pool_has_schedule
151  ? '-schedule'
152  : '-nonschedule';
153 
154  $ilHelp->setScreenIdComponent('book');
155  $ilHelp->setScreenId('object'.$object_subtype);
156  $ilHelp->setSubScreenId($a_id);
157  }
+ Here is the caller graph for this function:

◆ update()

ilBookingObjectGUI::update ( )

Update object dataset.

Definition at line 340 of file class.ilBookingObjectGUI.php.

References $_POST, $file, $ilCtrl, $lng, $valid, edit(), initForm(), and ilUtil\sendSuccess().

341  {
342  global $lng, $ilCtrl;
343 
344  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
345  return;
346  }
347 
348  $form = $this->initForm('edit', (int)$_POST['object_id']);
349  if($form->checkInput())
350  {
351  $valid = true;
352  if($this->record_gui &&
353  !$this->record_gui->importEditFormPostValues())
354  {
355  $valid = false;
356  }
357 
358  if($valid)
359  {
360  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
361  $obj = new ilBookingObject((int)$_POST['object_id']);
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"));
366 
367  $file = $form->getItemByPostVar("file");
368  if($_FILES["file"]["tmp_name"])
369  {
370  $obj->uploadFile($_FILES["file"]);
371  }
372  else if($file->getDeletionFlag())
373  {
374  $obj->deleteFile();
375  }
376 
377  $pfile = $form->getItemByPostVar("post_file");
378  if($_FILES["post_file"]["tmp_name"])
379  {
380  $obj->uploadPostFile($_FILES["post_file"]);
381  }
382  else if($pfile->getDeletionFlag())
383  {
384  $obj->deletePostFile();
385  }
386 
387  if($this->pool_has_schedule)
388  {
389  $obj->setScheduleId($form->getInput("schedule"));
390  }
391 
392  $obj->update();
393 
394  if($this->record_gui)
395  {
396  $this->record_gui->writeEditForm();
397  }
398 
399  ilUtil::sendSuccess($lng->txt("book_object_updated"), true);
400  $ilCtrl->redirect($this, "render");
401  }
402  }
403 
404  $form->setValuesByPost();
405  $this->edit($form);
406  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
edit(ilPropertyFormGUI $a_form=null)
Render edit form.
$valid
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=NULL)
Build property form.
global $lng
Definition: privfeed.php:17
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
$_POST["username"]
+ Here is the call graph for this function:

Field Documentation

◆ $pool_has_schedule

ilBookingObjectGUI::$pool_has_schedule
protected

Definition at line 16 of file class.ilBookingObjectGUI.php.

◆ $pool_id

ilBookingObjectGUI::$pool_id
protected

Definition at line 15 of file class.ilBookingObjectGUI.php.

◆ $pool_overall_limit

ilBookingObjectGUI::$pool_overall_limit
protected

Definition at line 17 of file class.ilBookingObjectGUI.php.

◆ $ref_id

ilBookingObjectGUI::$ref_id
protected

Definition at line 14 of file class.ilBookingObjectGUI.php.


The documentation for this class was generated from the following file: