ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 assignParticipants ()
 

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
 
 $user_to_deasign
 
 $object_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBookingObjectGUI::__construct (   $a_parent_obj)

Constructor.

Parameters
object$a_parent_obj

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

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

70  {
71  global $DIC;
72 
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 =
85  ($a_parent_obj->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE);
86  $this->pool_overall_limit = $this->pool_has_schedule
87  ? null
88  : $a_parent_obj->object->getOverallLimit();
89 
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"]));
93  }
global $DIC
Definition: saml.php:7
$_GET["client_id"]
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFilter()

ilBookingObjectGUI::applyFilter ( )

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

References $table, and render().

149  {
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);
152  $table->resetOffset();
153  $table->writeFilterToSession();
154  $this->render();
155  }
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:

◆ assignParticipants()

ilBookingObjectGUI::assignParticipants ( )

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

References $table.

706  {
707  $this->tabs->clearTargets();
708  $this->tabs->setBackTarget($this->lng->txt('book_back_to_list'), $this->ctrl->getLinkTarget($this, 'render'));
709 
710  include_once("./Modules/BookingManager/classes/class.ilBookingAssignParticipantsTableGUI.php");
711  $table = new ilBookingAssignParticipantsTableGUI($this, 'assignParticipants', $this->ref_id, $this->pool_id, $this->object_id);
712 
713  $this->tpl->setContent($table->getHTML());
714  }
List participant / booking pool assignment.
if(empty($password)) $table
Definition: pwgen.php:24

◆ confirmDelete()

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

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

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

458  {
459  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
460  return;
461  }
462 
464  $lng = $this->lng;
465  $tpl = $this->tpl;
466  $ilTabs = $this->tabs;
467 
468  $ilTabs->clearTargets();
469  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
470 
471  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
472  $conf = new ilConfirmationGUI();
473  $conf->setFormAction($ilCtrl->getFormAction($this));
474  $conf->setHeaderText($lng->txt('book_confirm_delete'));
475 
476  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
477  $type = new ilBookingObject($this->object_id);
478  $conf->addItem('object_id', $this->object_id, $type->getTitle());
479  $conf->setConfirm($lng->txt('delete'), 'delete');
480  $conf->setCancel($lng->txt('cancel'), 'render');
481 
482  $tpl->setContent($conf->getHTML());
483  }
a bookable ressource
$type
global $ilCtrl
Definition: ilias.php:18
Confirmation screen class.

◆ create()

ilBookingObjectGUI::create ( ilPropertyFormGUI  $a_form = null)

Render creation form.

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

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

Referenced by save().

170  {
171  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
172  return;
173  }
174 
176  $tpl = $this->tpl;
177  $lng = $this->lng;
178  $ilTabs = $this->tabs;
179 
180  $ilTabs->clearTargets();
181  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
182 
183  $this->setHelpId('create');
184 
185  if (!$a_form) {
186  $a_form = $this->initForm();
187  }
188  $tpl->setContent($a_form->getHTML());
189  }
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 488 of file class.ilBookingObjectGUI.php.

References $ctrl, $ilCtrl, and $lng.

489  {
490  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
491  return;
492  }
493 
495  $lng = $this->lng;
496 
497  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
498  $obj = new ilBookingObject($this->object_id);
499  $obj->delete();
500 
501  ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
502  $ilCtrl->redirect($this, 'render');
503  }
a bookable ressource
global $ilCtrl
Definition: ilias.php:18

◆ deliverInfo()

ilBookingObjectGUI::deliverInfo ( )

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

References $id, $object_id, and ilUtil\deliverFile().

574  {
576  if (!$id) {
577  return;
578  }
579 
580  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
581  $obj = new ilBookingObject($id);
582  $file = $obj->getFileFullPath();
583  if ($file) {
584  ilUtil::deliverFile($file, $obj->getFile());
585  }
586  }
a bookable ressource
if(!array_key_exists('StateId', $_REQUEST)) $id
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 679 of file class.ilBookingObjectGUI.php.

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

680  {
682 
684  if (!$id) {
685  return;
686  }
687 
688  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
690  $obj = new ilBookingReservation($book_id);
691  if ($obj->getUserId() != $ilUser->getId()) {
692  return;
693  }
694 
695  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
696  $obj = new ilBookingObject($id);
697  $file = $obj->getPostFileFullPath();
698  if ($file) {
699  ilUtil::deliverFile($file, $obj->getPostFile());
700  }
701  }
a bookable ressource
if(!array_key_exists('StateId', $_REQUEST)) $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.
+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingObjectGUI::displayPostInfo ( )

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

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

589  {
590  $tpl = $this->tpl;
592  $lng = $this->lng;
594 
596  if (!$id) {
597  return;
598  }
599 
600 
601  // placeholder
602 
603  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
605  $tmp = array();
606  foreach ($book_ids as $book_id) {
607  if (in_array($book_id, $this->rsv_ids)) {
608  $obj = new ilBookingReservation($book_id);
609  $from = $obj->getFrom();
610  $to = $obj->getTo();
611  if ($from > time()) {
612  $tmp[$from . "-" . $to]++;
613  }
614  }
615  }
616 
619 
620  $period = array();
621  ksort($tmp);
622  foreach ($tmp as $time => $counter) {
623  $time = explode("-", $time);
625  new ilDateTime($time[0], IL_CAL_UNIX),
626  new ilDateTime($time[1], IL_CAL_UNIX)
627  );
628  if ($counter > 1) {
629  $time .= " (" . $counter . ")";
630  }
631  $period[] = $time;
632  }
633  $book_id = array_shift($book_ids);
634 
636 
637 
638  /*
639  #23578 since Booking pool participants.
640  $obj = new ilBookingReservation($book_id);
641  if ($obj->getUserId() != $ilUser->getId())
642  {
643  return;
644  }
645  */
646 
647  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
648  $obj = new ilBookingObject($id);
649  $pfile = $obj->getPostFile();
650  $ptext = $obj->getPostText();
651 
652  $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
653  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
654 
655  if ($ptext) {
656  // placeholder
657  $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
658  $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
659 
660  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
661  }
662 
663  if ($pfile) {
664  $ilCtrl->setParameter($this, "object_id", $obj->getId());
665  $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
666  $ilCtrl->setParameter($this, "object_id", "");
667 
668  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
669  $mytpl->setVariable("URL_FILE", $url);
670  $mytpl->setVariable("TXT_FILE", $pfile);
671  }
672 
673  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
674  $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
675 
676  $tpl->setContent($mytpl->get());
677  }
a bookable ressource
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
$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
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
$url
+ Here is the call graph for this function:

◆ edit()

ilBookingObjectGUI::edit ( ilPropertyFormGUI  $a_form = null)

Render edit form.

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

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

Referenced by update().

195  {
196  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
197  return;
198  }
199 
200  $tpl = $this->tpl;
202  $ilTabs = $this->tabs;
203  $lng = $this->lng;
204 
205  $ilTabs->clearTargets();
206  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
207 
208  $this->setHelpId('edit');
209 
210  if (!$a_form) {
211  $a_form = $this->initForm('edit', $this->object_id);
212  }
213  $tpl->setContent($a_form->getHTML());
214  }
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 98 of file class.ilBookingObjectGUI.php.

References $ctrl, $form, $ilCtrl, and initForm().

99  {
101 
102  $next_class = $ilCtrl->getNextClass($this);
103 
104  switch ($next_class) {
105 
106  case "ilpropertyformgui":
107  // only case is currently adv metadata internal link in info settings, see #24497
108  $form = $this->initForm();
109  $this->ctrl->forwardCommand($form);
110  break;
111 
112  default:
113  $cmd = $ilCtrl->getCmd("render");
114  $this->$cmd();
115  break;
116  }
117  return true;
118  }
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=null)
Build property form.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

◆ initForm()

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

Build property form.

Parameters
string$a_mode
int$id
Returns
object

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

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

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

236  {
237  $lng = $this->lng;
239  $ilObjDataCache = $this->obj_data_cache;
240 
241  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
242 
243  $form_gui = new ilPropertyFormGUI();
244 
245  $title = new ilTextInputGUI($lng->txt("title"), "title");
246  $title->setRequired(true);
247  $title->setSize(40);
248  $title->setMaxLength(120);
249  $form_gui->addItem($title);
250 
251  $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
252  $desc->setCols(70);
253  $desc->setRows(15);
254  $form_gui->addItem($desc);
255 
256  $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
257  $file->setALlowDeletion(true);
258  $form_gui->addItem($file);
259 
260  $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
261  $nr->setRequired(true);
262  $nr->setSize(3);
263  $nr->setMaxLength(3);
264  $form_gui->addItem($nr);
265 
266  if ($this->pool_has_schedule) {
267  $options = array();
268  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
269  foreach (ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule) {
270  $options[$schedule["booking_schedule_id"]] = $schedule["title"];
271  }
272  $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
273  $schedule->setRequired(true);
274  $schedule->setOptions($options);
275  $form_gui->addItem($schedule);
276  }
277 
279  $post->setTitle($lng->txt("book_post_booking_information"));
280  $form_gui->addItem($post);
281 
282  $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
283  $pdesc->setCols(70);
284  $pdesc->setRows(15);
285  $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
286  $form_gui->addItem($pdesc);
287 
288  $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
289  $pfile->setALlowDeletion(true);
290  $form_gui->addItem($pfile);
291 
292  // #18214 - should also work for new objects
293  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
294  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, "book", $this->pool_id, "bobj", $id);
295  $this->record_gui->setPropertyForm($form_gui);
296  $this->record_gui->parse();
297 
298  if ($a_mode == "edit") {
299  $form_gui->setTitle($lng->txt("book_edit_object"));
300 
301  $item = new ilHiddenInputGUI('object_id');
302  $item->setValue($id);
303  $form_gui->addItem($item);
304 
305  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
306  $obj = new ilBookingObject($id);
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());
313 
314  if (isset($schedule)) {
315  $schedule->setValue($obj->getScheduleId());
316  }
317 
318  $form_gui->addCommandButton("update", $lng->txt("save"));
319  } else {
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"));
323  }
324  $form_gui->setFormAction($ilCtrl->getFormAction($this));
325 
326  return $form_gui;
327  }
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
This class represents a text area property in a property form.
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 125 of file class.ilBookingObjectGUI.php.

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

Referenced by applyFilter(), and resetFilter().

126  {
127  $this->pool_gui->showNoScheduleMessage();
128 
129  $tpl = $this->tpl;
131  $lng = $this->lng;
132  $ilAccess = $this->access;
133 
134  if ($ilAccess->checkAccess('write', '', $this->ref_id)) {
135  include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
136  $bar = new ilToolbarGUI;
137  $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
138  $bar = $bar->getHTML();
139  }
140 
141  $tpl->setPermanentLink('book', $this->ref_id);
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);
145  $tpl->setContent($bar . $table->getHTML());
146  }
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 157 of file class.ilBookingObjectGUI.php.

References $table, and render().

158  {
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);
161  $table->resetOffset();
162  $table->resetFilter();
163  $this->render();
164  }
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 538 of file class.ilBookingObjectGUI.php.

References $_POST, $ctrl, $id, $ilCtrl, $lng, $object_id, $user_to_deasign, ilBookingReservation\getObjectReservationForUser(), ilBookingParticipantGUI\PARTICIPANT_VIEW, ilUtil\sendFailure(), ilBookingReservation\STATUS_CANCELLED, and user().

539  {
541  $lng = $this->lng;
542 
543  if ($this->user_to_deasign) {
544  $user_id = $this->user_to_deasign;
545  } else {
546  $user_id = $this->user->getId();
547  }
548 
550  if (!$id || !$user_id) {
551  return;
552  }
553 
554  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
556  $obj = new ilBookingReservation($id);
557  if ($obj->getUserId() != $user_id) {
558  ilUtil::sendFailure($lng->txt('permission_denied'), true);
559  $ilCtrl->redirect($this, 'render');
560  }
561 
563  $obj->update();
564 
565  ilUtil::sendSuccess($lng->txt('settings_saved'));
567  $this->ctrl->redirectByClass('ilbookingparticipantgui', 'render');
568  } else {
569  $ilCtrl->redirect($this, 'render');
570  }
571  }
if(!array_key_exists('StateId', $_REQUEST)) $id
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ rsvConfirmCancelUser()

ilBookingObjectGUI::rsvConfirmCancelUser ( )

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

References $_GET, $ctrl, $id, $ilCtrl, $lng, $object_id, $tpl, $type, ilBookingParticipantGUI\PARTICIPANT_VIEW, and setHelpId().

506  {
508  $lng = $this->lng;
509  $tpl = $this->tpl;
510 
512  if (!$id) {
513  return;
514  }
515 
516  $this->setHelpId("cancel_booking");
517 
518  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
519  $conf = new ilConfirmationGUI();
520  $conf->setFormAction($ilCtrl->getFormAction($this));
521  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
522 
523  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
524  $type = new ilBookingObject($id);
525  $conf->addItem('object_id', $id, $type->getTitle());
526  if ($this->user_to_deasign) {
527  $conf->addHiddenItem('bkusr', $this->user_to_deasign);
528  }
529  if ($_GET['part_view'] == ilBookingParticipantGUI::PARTICIPANT_VIEW) {
530  $conf->addHiddenItem('part_view', ilBookingParticipantGUI::PARTICIPANT_VIEW);
531  }
532  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
533  $conf->setCancel($lng->txt('cancel'), 'render');
534 
535  $tpl->setContent($conf->getHTML());
536  }
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 332 of file class.ilBookingObjectGUI.php.

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

333  {
334  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
335  return;
336  }
337 
339  $lng = $this->lng;
340 
341  $form = $this->initForm();
342  if ($form->checkInput()) {
343  $valid = true;
344  if ($this->record_gui &&
345  !$this->record_gui->importEditFormPostValues()) {
346  $valid = false;
347  }
348 
349  if ($valid) {
350  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
351  $obj = new ilBookingObject;
352  $obj->setPoolId($this->pool_id);
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"));
357 
358  if ($this->pool_has_schedule) {
359  $obj->setScheduleId($form->getInput("schedule"));
360  }
361 
362  $obj->save();
363 
364  $file = $form->getItemByPostVar("file");
365  if ($_FILES["file"]["tmp_name"]) {
366  $obj->uploadFile($_FILES["file"]);
367  } elseif ($file->getDeletionFlag()) {
368  $obj->deleteFile();
369  }
370 
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();
376  }
377 
378  $obj->update();
379 
380  if ($this->record_gui) {
381  $this->record_gui->writeEditForm(null, $obj->getId());
382  }
383 
384  ilUtil::sendSuccess($lng->txt("book_object_added"), true);
385  $ilCtrl->redirect($this, "render");
386  }
387  }
388 
389  $form->setValuesByPost();
390  $this->create($form);
391  }
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.
+ Here is the call graph for this function:

◆ setHelpId()

ilBookingObjectGUI::setHelpId (   $a_id)
protected

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

References $help.

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

217  {
218  $ilHelp = $this->help;
219 
220  $object_subtype = $this->pool_has_schedule
221  ? '-schedule'
222  : '-nonschedule';
223 
224  $ilHelp->setScreenIdComponent('book');
225  $ilHelp->setScreenId('object' . $object_subtype);
226  $ilHelp->setSubScreenId($a_id);
227  }
+ Here is the caller graph for this function:

◆ update()

ilBookingObjectGUI::update ( )

Update object dataset.

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

References $ctrl, $form, $ilCtrl, $lng, $valid, edit(), and initForm().

397  {
398  if (!$this->access->checkAccess('write', '', $this->ref_id)) {
399  return;
400  }
401 
402  $lng = $this->lng;
404 
405  $form = $this->initForm('edit', $this->object_id);
406  if ($form->checkInput()) {
407  $valid = true;
408  if ($this->record_gui &&
409  !$this->record_gui->importEditFormPostValues()) {
410  $valid = false;
411  }
412 
413  if ($valid) {
414  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
415  $obj = new ilBookingObject($this->object_id);
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"));
420 
421  $file = $form->getItemByPostVar("file");
422  if ($_FILES["file"]["tmp_name"]) {
423  $obj->uploadFile($_FILES["file"]);
424  } elseif ($file->getDeletionFlag()) {
425  $obj->deleteFile();
426  }
427 
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();
433  }
434 
435  if ($this->pool_has_schedule) {
436  $obj->setScheduleId($form->getInput("schedule"));
437  }
438 
439  $obj->update();
440 
441  if ($this->record_gui) {
442  $this->record_gui->writeEditForm();
443  }
444 
445  ilUtil::sendSuccess($lng->txt("book_object_updated"), true);
446  $ilCtrl->redirect($this, "render");
447  }
448  }
449 
450  $form->setValuesByPost();
451  $this->edit($form);
452  }
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
+ 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().

◆ $object_id

ilBookingObjectGUI::$object_id
protected

◆ $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(), and displayPostInfo().

◆ $user_to_deasign

ilBookingObjectGUI::$user_to_deasign
protected

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

Referenced by rsvCancelUser().


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