ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 Render creation form. More...
 
 edit ()
 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  $this->ref_id = $a_parent_obj->ref_id;
26  $this->pool_id = $a_parent_obj->object->getId();
27  $this->pool_has_schedule =
28  ($a_parent_obj->object->getScheduleType() != ilObjBookingPool::TYPE_NO_SCHEDULE);
29  $this->pool_overall_limit = $this->pool_has_schedule
30  ? null
31  : $a_parent_obj->object->getOverallLimit();
32  }

Member Function Documentation

◆ applyFilter()

ilBookingObjectGUI::applyFilter ( )

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

References render().

78  {
79  include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
80  $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);
81  $table->resetOffset();
82  $table->writeFilterToSession();
83  $this->render();
84  }
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 373 of file class.ilBookingObjectGUI.php.

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

374  {
375  global $ilCtrl, $lng, $tpl, $ilTabs;
376 
377  $ilTabs->clearTargets();
378  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
379 
380  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
381  $conf = new ilConfirmationGUI();
382  $conf->setFormAction($ilCtrl->getFormAction($this));
383  $conf->setHeaderText($lng->txt('book_confirm_delete'));
384 
385  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
386  $type = new ilBookingObject((int)$_GET['object_id']);
387  $conf->addItem('object_id', (int)$_GET['object_id'], $type->getTitle());
388  $conf->setConfirm($lng->txt('delete'), 'delete');
389  $conf->setCancel($lng->txt('cancel'), 'render');
390 
391  $tpl->setContent($conf->getHTML());
392  }
a bookable ressource
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
Confirmation screen class.

◆ create()

ilBookingObjectGUI::create ( )

Render creation form.

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

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

99  {
100  global $ilCtrl, $tpl, $lng, $ilTabs;
101 
102  $ilTabs->clearTargets();
103  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
104 
105  $this->setHelpId('create');
106 
107  $form = $this->initForm();
108  $tpl->setContent($form->getHTML());
109  }
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:40
+ Here is the call graph for this function:

◆ delete()

ilBookingObjectGUI::delete ( )

Delete object.

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

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

398  {
399  global $ilCtrl, $lng;
400 
401  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
402  $obj = new ilBookingObject((int)$_POST['object_id']);
403  $obj->delete();
404 
405  ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
406  $ilCtrl->redirect($this, 'render');
407  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ deliverInfo()

ilBookingObjectGUI::deliverInfo ( )

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

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

462  {
463  $id = (int)$_GET["object_id"];
464  if(!$id)
465  {
466  return;
467  }
468 
469  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
470  $obj = new ilBookingObject($id);
471  $file = $obj->getFileFullPath();
472  if($file)
473  {
474  ilUtil::deliverFile($file, $obj->getFile());
475  }
476  }
a bookable ressource
print $file
$_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.
+ Here is the call graph for this function:

◆ deliverPostFile()

ilBookingObjectGUI::deliverPostFile ( )

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

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

572  {
573  global $ilUser;
574 
575  $id = (int)$_GET["object_id"];
576  if(!$id)
577  {
578  return;
579  }
580 
581  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
582  $book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
583  $obj = new ilBookingReservation($book_id);
584  if ($obj->getUserId() != $ilUser->getId())
585  {
586  return;
587  }
588 
589  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
590  $obj = new ilBookingObject($id);
591  $file = $obj->getPostFileFullPath();
592  if($file)
593  {
594  ilUtil::deliverFile($file, $obj->getPostFile());
595  }
596  }
a bookable ressource
print $file
$_GET["client_id"]
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ displayPostInfo()

ilBookingObjectGUI::displayPostInfo ( )

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

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

479  {
480  global $tpl, $ilUser, $lng, $ilCtrl;
481 
482  $id = (int)$_GET["object_id"];
483  if(!$id)
484  {
485  return;
486  }
487 
488 
489  // placeholder
490 
491  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
492  $book_ids = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId(), true);
493  $tmp = array();
494  $rsv_ids = explode(";", $_GET["rsv_ids"]);
495  foreach($book_ids as $book_id)
496  {
497  if(in_array($book_id, $rsv_ids))
498  {
499  $obj = new ilBookingReservation($book_id);
500  $from = $obj->getFrom();
501  $to = $obj->getTo();
502  if($from > time())
503  {
504  $tmp[$from."-".$to]++;
505  }
506  }
507  }
508 
511 
512  $period = array();
513  ksort($tmp);
514  foreach($tmp as $time => $counter)
515  {
516  $time = explode("-", $time);
518  new ilDateTime($time[0], IL_CAL_UNIX),
519  new ilDateTime($time[1], IL_CAL_UNIX));
520  if($counter > 1)
521  {
522  $time .= " (".$counter.")";
523  }
524  $period[] = $time;
525  }
526  $book_id = array_shift($book_ids);
527 
529 
530 
531  $obj = new ilBookingReservation($book_id);
532  if ($obj->getUserId() != $ilUser->getId())
533  {
534  return;
535  }
536 
537  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
538  $obj = new ilBookingObject($id);
539  $pfile = $obj->getPostFile();
540  $ptext = $obj->getPostText();
541 
542  $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
543  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
544 
545  if($ptext)
546  {
547  // placeholder
548  $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
549  $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
550 
551  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
552  }
553 
554  if($pfile)
555  {
556  $ilCtrl->setParameter($this, "object_id", $obj->getId());
557  $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
558  $ilCtrl->setParameter($this, "object_id", "");
559 
560  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
561  $mytpl->setVariable("URL_FILE", $url);
562  $mytpl->setVariable("TXT_FILE", $pfile);
563  }
564 
565  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
566  $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
567 
568  $tpl->setContent($mytpl->get());
569  }
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
static getObjectReservationForUser($a_object_id, $a_user_id, $a_multi=false)
special template class to simplify handling of ITX/PEAR
Date and time handling
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

◆ edit()

ilBookingObjectGUI::edit ( )

Render edit form.

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

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

115  {
116  global $tpl, $ilCtrl, $ilTabs, $lng;
117 
118  $ilTabs->clearTargets();
119  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
120 
121  $this->setHelpId('edit');
122 
123  $form = $this->initForm('edit', (int)$_GET['object_id']);
124  $tpl->setContent($form->getHTML());
125  }
$_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:40
+ Here is the call graph for this function:

◆ executeCommand()

ilBookingObjectGUI::executeCommand ( )

main switch

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

References $cmd, and $ilCtrl.

38  {
39  global $ilCtrl;
40 
41  $next_class = $ilCtrl->getNextClass($this);
42 
43  switch($next_class)
44  {
45  default:
46  $cmd = $ilCtrl->getCmd("render");
47  $this->$cmd();
48  break;
49  }
50  return true;
51  }
$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 146 of file class.ilBookingObjectGUI.php.

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

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

147  {
148  global $lng, $ilCtrl, $ilObjDataCache;
149 
150  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
151 
152  $form_gui = new ilPropertyFormGUI();
153 
154  $title = new ilTextInputGUI($lng->txt("title"), "title");
155  $title->setRequired(true);
156  $title->setSize(40);
157  $title->setMaxLength(120);
158  $form_gui->addItem($title);
159 
160  $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
161  $desc->setCols(70);
162  $desc->setRows(15);
163  $form_gui->addItem($desc);
164 
165  $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
166  $file->setALlowDeletion(true);
167  $form_gui->addItem($file);
168 
169  $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
170  $nr->setRequired(true);
171  $nr->setSize(3);
172  $nr->setMaxLength(3);
173  $form_gui->addItem($nr);
174 
175  if($this->pool_has_schedule)
176  {
177  $options = array();
178  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
179  foreach(ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule)
180  {
181  $options[$schedule["booking_schedule_id"]] = $schedule["title"];
182  }
183  $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
184  $schedule->setRequired(true);
185  $schedule->setOptions($options);
186  $form_gui->addItem($schedule);
187  }
188 
189  $post = new ilFormSectionHeaderGUI();
190  $post->setTitle($lng->txt("book_post_booking_information"));
191  $form_gui->addItem($post);
192 
193  $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
194  $pdesc->setCols(70);
195  $pdesc->setRows(15);
196  $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
197  $form_gui->addItem($pdesc);
198 
199  $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
200  $pfile->setALlowDeletion(true);
201  $form_gui->addItem($pfile);
202 
203  if ($a_mode == "edit")
204  {
205  $form_gui->setTitle($lng->txt("book_edit_object"));
206 
207  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordGUI.php');
208  $this->record_gui = new ilAdvancedMDRecordGUI(ilAdvancedMDRecordGUI::MODE_EDITOR, "book", $this->pool_id, "bobj", $id);
209  $this->record_gui->setPropertyForm($form_gui);
210  $this->record_gui->parse();
211 
212  $item = new ilHiddenInputGUI('object_id');
213  $item->setValue($id);
214  $form_gui->addItem($item);
215 
216  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
217  $obj = new ilBookingObject($id);
218  $title->setValue($obj->getTitle());
219  $desc->setValue($obj->getDescription());
220  $nr->setValue($obj->getNrOfItems());
221  $pdesc->setValue($obj->getPostText());
222  $file->setValue($obj->getFile());
223  $pfile->setValue($obj->getPostFile());
224 
225  if(isset($schedule))
226  {
227  $schedule->setValue($obj->getScheduleId());
228  }
229 
230  $form_gui->addCommandButton("update", $lng->txt("save"));
231  }
232  else
233  {
234  $form_gui->setTitle($lng->txt("book_add_object"));
235  $form_gui->addCommandButton("save", $lng->txt("save"));
236  $form_gui->addCommandButton("render", $lng->txt("cancel"));
237  }
238  $form_gui->setFormAction($ilCtrl->getFormAction($this));
239 
240  return $form_gui;
241  }
a bookable ressource
print $file
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.
global $lng
Definition: privfeed.php:40
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 58 of file class.ilBookingObjectGUI.php.

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

Referenced by applyFilter(), resetFilter(), save(), and update().

59  {
60  global $tpl, $ilCtrl, $lng, $ilAccess;
61 
62  if ($ilAccess->checkAccess('write', '', $this->ref_id))
63  {
64  include_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
65  $bar = new ilToolbarGUI;
66  $bar->addButton($lng->txt('book_add_object'), $ilCtrl->getLinkTarget($this, 'create'));
67  $bar = $bar->getHTML();
68  }
69 
70  $tpl->setPermanentLink('book', $this->ref_id);
71 
72  include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
73  $table = new ilBookingObjectsTableGUI($this, 'render', $this->ref_id, $this->pool_id, $this->pool_has_schedule, $this->pool_overall_limit);
74  $tpl->setContent($bar.$table->getHTML());
75  }
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:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetFilter()

ilBookingObjectGUI::resetFilter ( )

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

References render().

87  {
88  include_once 'Modules/BookingManager/classes/class.ilBookingObjectsTableGUI.php';
89  $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);
90  $table->resetOffset();
91  $table->resetFilter();
92  $this->render();
93  }
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 435 of file class.ilBookingObjectGUI.php.

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

436  {
437  global $ilCtrl, $ilUser, $lng;
438 
439  $id = (int)$_REQUEST["object_id"];
440  if(!$id)
441  {
442  return;
443  }
444 
445  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
446  $id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
447  $obj = new ilBookingReservation($id);
448  if ($obj->getUserId() != $ilUser->getId())
449  {
450  ilUtil::sendFailure($lng->txt('permission_denied'), true);
451  $ilCtrl->redirect($this, 'render');
452  }
453 
455  $obj->update();
456 
457  ilUtil::sendSuccess($lng->txt('settings_saved'));
458  $ilCtrl->redirect($this, 'render');
459  }
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)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ rsvConfirmCancelUser()

ilBookingObjectGUI::rsvConfirmCancelUser ( )

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

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

410  {
411  global $ilCtrl, $lng, $tpl;
412 
413  $id = (int)$_GET["object_id"];
414  if(!$id)
415  {
416  return;
417  }
418 
419  $this->setHelpId("cancel_booking");
420 
421  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
422  $conf = new ilConfirmationGUI();
423  $conf->setFormAction($ilCtrl->getFormAction($this));
424  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
425 
426  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
427  $type = new ilBookingObject($id);
428  $conf->addItem('object_id', $id, $type->getTitle());
429  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
430  $conf->setCancel($lng->txt('cancel'), 'render');
431 
432  $tpl->setContent($conf->getHTML());
433  }
a bookable ressource
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
Confirmation screen class.
+ Here is the call graph for this function:

◆ save()

ilBookingObjectGUI::save ( )

Create new object dataset.

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

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

247  {
248  global $ilCtrl, $tpl, $lng, $ilTabs;
249 
250  $form = $this->initForm();
251  if($form->checkInput())
252  {
253  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
254  $obj = new ilBookingObject;
255  $obj->setPoolId($this->pool_id);
256  $obj->setTitle($form->getInput("title"));
257  $obj->setDescription($form->getInput("desc"));
258  $obj->setNrOfItems($form->getInput("items"));
259  $obj->setPostText($form->getInput("post_text"));
260 
261  if($this->pool_has_schedule)
262  {
263  $obj->setScheduleId($form->getInput("schedule"));
264  }
265 
266  $obj->save();
267 
268  $file = $form->getItemByPostVar("file");
269  if($_FILES["file"]["tmp_name"])
270  {
271  $obj->uploadFile($_FILES["file"]);
272  }
273  else if($file->getDeletionFlag())
274  {
275  $obj->deleteFile();
276  }
277 
278  $pfile = $form->getItemByPostVar("post_file");
279  if($_FILES["post_file"]["tmp_name"])
280  {
281  $obj->uploadPostFile($_FILES["post_file"]);
282  }
283  else if($pfile->getDeletionFlag())
284  {
285  $obj->deletePostFile();
286  }
287 
288  $obj->update();
289 
290  ilUtil::sendSuccess($lng->txt("book_object_added"));
291  $this->render();
292  }
293  else
294  {
295  $ilTabs->clearTargets();
296  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
297 
298  $form->setValuesByPost();
299  $tpl->setContent($form->getHTML());
300  }
301  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
print $file
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
initForm($a_mode="create", $id=NULL)
Build property form.
render()
Render list of booking objects.
global $lng
Definition: privfeed.php:40
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 127 of file class.ilBookingObjectGUI.php.

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

128  {
129  global $ilHelp;
130 
131  $object_subtype = $this->pool_has_schedule
132  ? '-schedule'
133  : '-nonschedule';
134 
135  $ilHelp->setScreenIdComponent('book');
136  $ilHelp->setScreenId('object'.$object_subtype);
137  $ilHelp->setSubScreenId($a_id);
138  }
+ Here is the caller graph for this function:

◆ update()

ilBookingObjectGUI::update ( )

Update object dataset.

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

References $_POST, $file, $lng, $tpl, $valid, initForm(), render(), and ilUtil\sendSuccess().

307  {
308  global $tpl, $lng;
309 
310  $form = $this->initForm('edit', (int)$_POST['object_id']);
311  if($form->checkInput())
312  {
313  $valid = true;
314  if($this->record_gui &&
315  !$this->record_gui->importEditFormPostValues())
316  {
317  $valid = false;
318  }
319 
320  if($valid)
321  {
322  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
323  $obj = new ilBookingObject((int)$_POST['object_id']);
324  $obj->setTitle($form->getInput("title"));
325  $obj->setDescription($form->getInput("desc"));
326  $obj->setNrOfItems($form->getInput("items"));
327  $obj->setPostText($form->getInput("post_text"));
328 
329  $file = $form->getItemByPostVar("file");
330  if($_FILES["file"]["tmp_name"])
331  {
332  $obj->uploadFile($_FILES["file"]);
333  }
334  else if($file->getDeletionFlag())
335  {
336  $obj->deleteFile();
337  }
338 
339  $pfile = $form->getItemByPostVar("post_file");
340  if($_FILES["post_file"]["tmp_name"])
341  {
342  $obj->uploadPostFile($_FILES["post_file"]);
343  }
344  else if($pfile->getDeletionFlag())
345  {
346  $obj->deletePostFile();
347  }
348 
349  if($this->pool_has_schedule)
350  {
351  $obj->setScheduleId($form->getInput("schedule"));
352  }
353 
354  $obj->update();
355 
356  if($this->record_gui)
357  {
358  $this->record_gui->writeEditForm();
359  }
360 
361  ilUtil::sendSuccess($lng->txt("book_object_updated"));
362  $this->render();
363  }
364  }
365 
366  $form->setValuesByPost();
367  $tpl->setContent($form->getHTML());
368  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
print $file
$_POST['username']
Definition: cron.php:12
$valid
global $tpl
Definition: ilias.php:8
initForm($a_mode="create", $id=NULL)
Build property form.
render()
Render list of booking objects.
global $lng
Definition: privfeed.php:40
+ 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: