ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 $ctrl
 
 $tpl
 
 $lng
 
 $access
 
 $tabs
 
 $help
 
 $obj_data_cache
 
 $user
 
 $ref_id
 
 $pool_id
 
 $pool_has_schedule
 
 $pool_overall_limit
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

References $DIC, ilObjBookingPool\TYPE_NO_SCHEDULE, and user().

65  {
66  global $DIC;
67 
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 =
80  ($a_parent_obj->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE);
81  $this->pool_overall_limit = $this->pool_has_schedule
82  ? null
83  : $a_parent_obj->object->getOverallLimit();
84  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilBookingObjectGUI::applyFilter ( )

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

References $table, and render().

133  {
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);
136  $table->resetOffset();
137  $table->writeFilterToSession();
138  $this->render();
139  }
List booking objects (for booking type)
render()
Render list of booking objects.
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:

◆ confirmDelete()

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

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

References $_GET, $ctrl, $ilCtrl, $lng, $tabs, $tpl, and $type.

442  {
443  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
444  return;
445  }
446 
448  $lng = $this->lng;
449  $tpl = $this->tpl;
450  $ilTabs = $this->tabs;
451 
452  $ilTabs->clearTargets();
453  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
454 
455  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
456  $conf = new ilConfirmationGUI();
457  $conf->setFormAction($ilCtrl->getFormAction($this));
458  $conf->setHeaderText($lng->txt('book_confirm_delete'));
459 
460  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
461  $type = new ilBookingObject((int) $_GET['object_id']);
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');
465 
466  $tpl->setContent($conf->getHTML());
467  }
a bookable ressource
$type
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
Confirmation screen class.

◆ create()

ilBookingObjectGUI::create ( ilPropertyFormGUI  $a_form = null)

Render creation form.

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

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

Referenced by save().

154  {
155  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
156  return;
157  }
158 
160  $tpl = $this->tpl;
161  $lng = $this->lng;
162  $ilTabs = $this->tabs;
163 
164  $ilTabs->clearTargets();
165  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
166 
167  $this->setHelpId('create');
168 
169  if (!$a_form) {
170  $a_form = $this->initForm();
171  }
172  $tpl->setContent($a_form->getHTML());
173  }
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=null)
Build property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilBookingObjectGUI::delete ( )

Delete object.

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

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

473  {
474  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
475  return;
476  }
477 
479  $lng = $this->lng;
480 
481  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
482  $obj = new ilBookingObject((int) $_POST['object_id']);
483  $obj->delete();
484 
485  ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
486  $ilCtrl->redirect($this, 'render');
487  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
global $ilCtrl
Definition: ilias.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ deliverInfo()

ilBookingObjectGUI::deliverInfo ( )

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

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

543  {
544  $id = (int) $_GET["object_id"];
545  if (!$id) {
546  return;
547  }
548 
549  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
550  $obj = new ilBookingObject($id);
551  $file = $obj->getFileFullPath();
552  if ($file) {
553  ilUtil::deliverFile($file, $obj->getFile());
554  }
555  }
a bookable ressource
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingObjectGUI::deliverPostFile ( )

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

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

646  {
648 
649  $id = (int) $_GET["object_id"];
650  if (!$id) {
651  return;
652  }
653 
654  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
656  $obj = new ilBookingReservation($book_id);
657  if ($obj->getUserId() != $ilUser->getId()) {
658  return;
659  }
660 
661  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
662  $obj = new ilBookingObject($id);
663  $file = $obj->getPostFileFullPath();
664  if ($file) {
665  ilUtil::deliverFile($file, $obj->getPostFile());
666  }
667  }
a bookable ressource
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
$ilUser
Definition: imgupload.php:18
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingObjectGUI::displayPostInfo ( )

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

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

558  {
559  $tpl = $this->tpl;
561  $lng = $this->lng;
563 
564  $id = (int) $_GET["object_id"];
565  if (!$id) {
566  return;
567  }
568 
569 
570  // placeholder
571 
572  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
574  $tmp = array();
575  $rsv_ids = explode(";", $_GET["rsv_ids"]);
576  foreach ($book_ids as $book_id) {
577  if (in_array($book_id, $rsv_ids)) {
578  $obj = new ilBookingReservation($book_id);
579  $from = $obj->getFrom();
580  $to = $obj->getTo();
581  if ($from > time()) {
582  $tmp[$from . "-" . $to]++;
583  }
584  }
585  }
586 
589 
590  $period = array();
591  ksort($tmp);
592  foreach ($tmp as $time => $counter) {
593  $time = explode("-", $time);
595  new ilDateTime($time[0], IL_CAL_UNIX),
596  new ilDateTime($time[1], IL_CAL_UNIX)
597  );
598  if ($counter > 1) {
599  $time .= " (" . $counter . ")";
600  }
601  $period[] = $time;
602  }
603  $book_id = array_shift($book_ids);
604 
606 
607 
608  $obj = new ilBookingReservation($book_id);
609  if ($obj->getUserId() != $ilUser->getId()) {
610  return;
611  }
612 
613  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
614  $obj = new ilBookingObject($id);
615  $pfile = $obj->getPostFile();
616  $ptext = $obj->getPostText();
617 
618  $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
619  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
620 
621  if ($ptext) {
622  // placeholder
623  $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
624  $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
625 
626  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
627  }
628 
629  if ($pfile) {
630  $ilCtrl->setParameter($this, "object_id", $obj->getId());
631  $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
632  $ilCtrl->setParameter($this, "object_id", "");
633 
634  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
635  $mytpl->setVariable("URL_FILE", $url);
636  $mytpl->setVariable("TXT_FILE", $pfile);
637  }
638 
639  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
640  $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
641 
642  $tpl->setContent($mytpl->get());
643  }
a bookable ressource
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
static setUseRelativeDates($a_status)
set use relative dates
$from
const IL_CAL_UNIX
static useRelativeDates()
check if relative dates are used
global $ilCtrl
Definition: ilias.php:18
$counter
$time
Definition: cron.php:21
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.
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$url
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 178 of file class.ilBookingObjectGUI.php.

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

Referenced by update().

179  {
180  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
181  return;
182  }
183 
184  $tpl = $this->tpl;
186  $ilTabs = $this->tabs;
187  $lng = $this->lng;
188 
189  $ilTabs->clearTargets();
190  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
191 
192  $this->setHelpId('edit');
193 
194  if (!$a_form) {
195  $a_form = $this->initForm('edit', (int) $_GET['object_id']);
196  }
197  $tpl->setContent($a_form->getHTML());
198  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=null)
Build property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilBookingObjectGUI::executeCommand ( )

main switch

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

References $ctrl, and $ilCtrl.

90  {
92 
93  $next_class = $ilCtrl->getNextClass($this);
94 
95  switch ($next_class) {
96  default:
97  $cmd = $ilCtrl->getCmd("render");
98  $this->$cmd();
99  break;
100  }
101  return true;
102  }
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 219 of file class.ilBookingObjectGUI.php.

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

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

220  {
221  $lng = $this->lng;
223  $ilObjDataCache = $this->obj_data_cache;
224 
225  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
226 
227  $form_gui = new ilPropertyFormGUI();
228 
229  $title = new ilTextInputGUI($lng->txt("title"), "title");
230  $title->setRequired(true);
231  $title->setSize(40);
232  $title->setMaxLength(120);
233  $form_gui->addItem($title);
234 
235  $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
236  $desc->setCols(70);
237  $desc->setRows(15);
238  $form_gui->addItem($desc);
239 
240  $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
241  $file->setALlowDeletion(true);
242  $form_gui->addItem($file);
243 
244  $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
245  $nr->setRequired(true);
246  $nr->setSize(3);
247  $nr->setMaxLength(3);
248  $form_gui->addItem($nr);
249 
250  if ($this->pool_has_schedule) {
251  $options = array();
252  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
253  foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule) {
254  $options[$schedule["booking_schedule_id"]] = $schedule["title"];
255  }
256  $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
257  $schedule->setRequired(true);
258  $schedule->setOptions($options);
259  $form_gui->addItem($schedule);
260  }
261 
263  $post->setTitle($lng->txt("book_post_booking_information"));
264  $form_gui->addItem($post);
265 
266  $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
267  $pdesc->setCols(70);
268  $pdesc->setRows(15);
269  $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
270  $form_gui->addItem($pdesc);
271 
272  $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
273  $pfile->setALlowDeletion(true);
274  $form_gui->addItem($pfile);
275 
276  // #18214 - should also work for new objects
277  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
278  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, "book", $this->pool_id, "bobj", $id);
279  $this->record_gui->setPropertyForm($form_gui);
280  $this->record_gui->parse();
281 
282  if ($a_mode == "edit") {
283  $form_gui->setTitle($lng->txt("book_edit_object"));
284 
285  $item = new ilHiddenInputGUI('object_id');
286  $item->setValue($id);
287  $form_gui->addItem($item);
288 
289  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
290  $obj = new ilBookingObject($id);
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());
297 
298  if (isset($schedule)) {
299  $schedule->setValue($obj->getScheduleId());
300  }
301 
302  $form_gui->addCommandButton("update", $lng->txt("save"));
303  } else {
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"));
307  }
308  $form_gui->setFormAction($ilCtrl->getFormAction($this));
309 
310  return $form_gui;
311  }
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.
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
This class represents a hidden form property in a property form.
This class represents a number property in a property form.
This class represents a text property in a property form.
$post
Definition: post.php:34
Create styles array
The data for the language used.
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.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 109 of file class.ilBookingObjectGUI.php.

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

Referenced by applyFilter(), and resetFilter().

110  {
111  $this->pool_gui->showNoScheduleMessage();
112 
113  $tpl = $this->tpl;
115  $lng = $this->lng;
116  $ilAccess = $this->access;
117 
118  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
119  include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
120  $bar = new ilToolbarGUI;
121  $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
122  $bar = $bar->getHTML();
123  }
124 
125  $tpl->setPermanentLink('book', $this->ref_id);
126 
127  include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
128  $table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit);
129  $tpl->setContent($bar . $table->getHTML());
130  }
global $ilCtrl
Definition: ilias.php:18
List booking objects (for booking type)
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilBookingObjectGUI::resetFilter ( )

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

References $table, and render().

142  {
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);
145  $table->resetOffset();
146  $table->resetFilter();
147  $this->render();
148  }
List booking objects (for booking type)
render()
Render list of booking objects.
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:

◆ rsvCancelUser()

ilBookingObjectGUI::rsvCancelUser ( )

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

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

517  {
520  $lng = $this->lng;
521 
522  $id = (int) $_REQUEST["object_id"];
523  if (!$id) {
524  return;
525  }
526 
527  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
529  $obj = new ilBookingReservation($id);
530  if ($obj->getUserId() != $ilUser->getId()) {
531  ilUtil::sendFailure($lng->txt('permission_denied'), true);
532  $ilCtrl->redirect($this, 'render');
533  }
534 
536  $obj->update();
537 
538  ilUtil::sendSuccess($lng->txt('settings_saved'));
539  $ilCtrl->redirect($this, 'render');
540  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id
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.
+ Here is the call graph for this function:

◆ rsvConfirmCancelUser()

ilBookingObjectGUI::rsvConfirmCancelUser ( )

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

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

490  {
492  $lng = $this->lng;
493  $tpl = $this->tpl;
494 
495  $id = (int) $_GET["object_id"];
496  if (!$id) {
497  return;
498  }
499 
500  $this->setHelpId("cancel_booking");
501 
502  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
503  $conf = new ilConfirmationGUI();
504  $conf->setFormAction($ilCtrl->getFormAction($this));
505  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
506 
507  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
508  $type = new ilBookingObject($id);
509  $conf->addItem('object_id', $id, $type->getTitle());
510  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
511  $conf->setCancel($lng->txt('cancel'), 'render');
512 
513  $tpl->setContent($conf->getHTML());
514  }
a bookable ressource
$type
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
Confirmation screen class.
+ Here is the call graph for this function:

◆ save()

ilBookingObjectGUI::save ( )

Create new object dataset.

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

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

317  {
318  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
319  return;
320  }
321 
323  $lng = $this->lng;
324 
325  $form = $this->initForm();
326  if ($form->checkInput()) {
327  $valid = true;
328  if ($this->record_gui &&
329  !$this->record_gui->importEditFormPostValues()) {
330  $valid = false;
331  }
332 
333  if ($valid) {
334  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
335  $obj = new ilBookingObject;
336  $obj->setPoolId($this->pool_id);
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"));
341 
342  if ($this->pool_has_schedule) {
343  $obj->setScheduleId($form->getInput("schedule"));
344  }
345 
346  $obj->save();
347 
348  $file = $form->getItemByPostVar("file");
349  if ($_FILES["file"]["tmp_name"]) {
350  $obj->uploadFile($_FILES["file"]);
351  } elseif ($file->getDeletionFlag()) {
352  $obj->deleteFile();
353  }
354 
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();
360  }
361 
362  $obj->update();
363 
364  if ($this->record_gui) {
365  $this->record_gui->writeEditForm(null, $obj->getId());
366  }
367 
368  ilUtil::sendSuccess($lng->txt("book_object_added"), true);
369  $ilCtrl->redirect($this, "render");
370  }
371  }
372 
373  $form->setValuesByPost();
374  $this->create($form);
375  }
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.
if(isset($_POST['submit'])) $form
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 200 of file class.ilBookingObjectGUI.php.

References $help.

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

201  {
202  $ilHelp = $this->help;
203 
204  $object_subtype = $this->pool_has_schedule
205  ? '-schedule'
206  : '-nonschedule';
207 
208  $ilHelp->setScreenIdComponent('book');
209  $ilHelp->setScreenId('object' . $object_subtype);
210  $ilHelp->setSubScreenId($a_id);
211  }
+ Here is the caller graph for this function:

◆ update()

ilBookingObjectGUI::update ( )

Update object dataset.

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

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

381  {
382  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
383  return;
384  }
385 
386  $lng = $this->lng;
388 
389  $form = $this->initForm('edit', (int) $_POST['object_id']);
390  if ($form->checkInput()) {
391  $valid = true;
392  if ($this->record_gui &&
393  !$this->record_gui->importEditFormPostValues()) {
394  $valid = false;
395  }
396 
397  if ($valid) {
398  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
399  $obj = new ilBookingObject((int) $_POST['object_id']);
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"));
404 
405  $file = $form->getItemByPostVar("file");
406  if ($_FILES["file"]["tmp_name"]) {
407  $obj->uploadFile($_FILES["file"]);
408  } elseif ($file->getDeletionFlag()) {
409  $obj->deleteFile();
410  }
411 
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();
417  }
418 
419  if ($this->pool_has_schedule) {
420  $obj->setScheduleId($form->getInput("schedule"));
421  }
422 
423  $obj->update();
424 
425  if ($this->record_gui) {
426  $this->record_gui->writeEditForm();
427  }
428 
429  ilUtil::sendSuccess($lng->txt("book_object_updated"), true);
430  $ilCtrl->redirect($this, "render");
431  }
432  }
433 
434  $form->setValuesByPost();
435  $this->edit($form);
436  }
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.
if(isset($_POST['submit'])) $form
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

◆ $access

ilBookingObjectGUI::$access
protected

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

Referenced by render().

◆ $ctrl

◆ $help

ilBookingObjectGUI::$help
protected

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

Referenced by setHelpId().

◆ $lng

ilBookingObjectGUI::$lng
protected

◆ $obj_data_cache

ilBookingObjectGUI::$obj_data_cache
protected

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

Referenced by initForm().

◆ $pool_has_schedule

ilBookingObjectGUI::$pool_has_schedule
protected

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

◆ $pool_id

ilBookingObjectGUI::$pool_id
protected

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

◆ $pool_overall_limit

ilBookingObjectGUI::$pool_overall_limit
protected

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

◆ $ref_id

ilBookingObjectGUI::$ref_id
protected

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

◆ $tabs

ilBookingObjectGUI::$tabs
protected

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

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

◆ $tpl

ilBookingObjectGUI::$tpl
protected

◆ $user

ilBookingObjectGUI::$user
protected

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

Referenced by deliverPostFile(), displayPostInfo(), and rsvCancelUser().


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