ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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...
 
 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 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

◆ confirmDelete()

ilBookingObjectGUI::confirmDelete ( )

Confirm delete.

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

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

321  {
322  global $ilCtrl, $lng, $tpl, $ilTabs;
323 
324  $ilTabs->clearTargets();
325  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
326 
327  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
328  $conf = new ilConfirmationGUI();
329  $conf->setFormAction($ilCtrl->getFormAction($this));
330  $conf->setHeaderText($lng->txt('book_confirm_delete'));
331 
332  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
333  $type = new ilBookingObject((int)$_GET['object_id']);
334  $conf->addItem('object_id', (int)$_GET['object_id'], $type->getTitle());
335  $conf->setConfirm($lng->txt('delete'), 'delete');
336  $conf->setCancel($lng->txt('cancel'), 'render');
337 
338  $tpl->setContent($conf->getHTML());
339  }
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 80 of file class.ilBookingObjectGUI.php.

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

81  {
82  global $ilCtrl, $tpl, $lng, $ilTabs;
83 
84  $ilTabs->clearTargets();
85  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
86 
87  $form = $this->initForm();
88  $tpl->setContent($form->getHTML());
89  }
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 344 of file class.ilBookingObjectGUI.php.

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

345  {
346  global $ilCtrl, $lng;
347 
348  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
349  $obj = new ilBookingObject((int)$_POST['object_id']);
350  $obj->delete();
351 
352  ilUtil::sendSuccess($lng->txt('book_object_deleted'), true);
353  $ilCtrl->redirect($this, 'render');
354  }
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 406 of file class.ilBookingObjectGUI.php.

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

407  {
408  $id = (int)$_GET["object_id"];
409  if(!$id)
410  {
411  return;
412  }
413 
414  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
415  $obj = new ilBookingObject($id);
416  $file = $obj->getFileFullPath();
417  if($file)
418  {
419  ilUtil::deliverFile($file, $obj->getFile());
420  }
421  }
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 516 of file class.ilBookingObjectGUI.php.

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

517  {
518  global $ilUser;
519 
520  $id = (int)$_GET["object_id"];
521  if(!$id)
522  {
523  return;
524  }
525 
526  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
527  $book_id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
528  $obj = new ilBookingReservation($book_id);
529  if ($obj->getUserId() != $ilUser->getId())
530  {
531  return;
532  }
533 
534  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
535  $obj = new ilBookingObject($id);
536  $file = $obj->getPostFileFullPath();
537  if($file)
538  {
539  ilUtil::deliverFile($file, $obj->getPostFile());
540  }
541  }
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 423 of file class.ilBookingObjectGUI.php.

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

424  {
425  global $tpl, $ilUser, $lng, $ilCtrl;
426 
427  $id = (int)$_GET["object_id"];
428  if(!$id)
429  {
430  return;
431  }
432 
433 
434  // placeholder
435 
436  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
437  $book_ids = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId(), true);
438  $tmp = array();
439  $rsv_ids = explode(";", $_GET["rsv_ids"]);
440  foreach($book_ids as $book_id)
441  {
442  if(in_array($book_id, $rsv_ids))
443  {
444  $obj = new ilBookingReservation($book_id);
445  $from = $obj->getFrom();
446  $to = $obj->getTo();
447  if($from > time())
448  {
449  $tmp[$from."-".$to]++;
450  }
451  }
452  }
453 
456 
457  $period = array();
458  ksort($tmp);
459  foreach($tmp as $time => $counter)
460  {
461  $time = explode("-", $time);
463  new ilDateTime($time[0], IL_CAL_UNIX),
464  new ilDateTime($time[1], IL_CAL_UNIX));
465  if($counter > 1)
466  {
467  $time .= " (".$counter.")";
468  }
469  $period[] = $time;
470  }
471  $book_id = array_shift($book_ids);
472 
474 
475 
476  $obj = new ilBookingReservation($book_id);
477  if ($obj->getUserId() != $ilUser->getId())
478  {
479  return;
480  }
481 
482  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
483  $obj = new ilBookingObject($id);
484  $pfile = $obj->getPostFile();
485  $ptext = $obj->getPostText();
486 
487  $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
488  $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
489 
490  if($ptext)
491  {
492  // placeholder
493  $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
494  $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
495 
496  $mytpl->setVariable("POST_TEXT", nl2br($ptext));
497  }
498 
499  if($pfile)
500  {
501  $ilCtrl->setParameter($this, "object_id", $obj->getId());
502  $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
503  $ilCtrl->setParameter($this, "object_id", "");
504 
505  $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
506  $mytpl->setVariable("URL_FILE", $url);
507  $mytpl->setVariable("TXT_FILE", $pfile);
508  }
509 
510  $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
511  $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
512 
513  $tpl->setContent($mytpl->get());
514  }
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
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 94 of file class.ilBookingObjectGUI.php.

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

95  {
96  global $tpl, $ilCtrl, $ilTabs, $lng;
97 
98  $ilTabs->clearTargets();
99  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
100 
101  $form = $this->initForm('edit', (int)$_GET['object_id']);
102  $tpl->setContent($form->getHTML());
103  }
$_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 111 of file class.ilBookingObjectGUI.php.

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

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

112  {
113  global $lng, $ilCtrl, $ilObjDataCache;
114 
115  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
116 
117  $form_gui = new ilPropertyFormGUI();
118 
119  $title = new ilTextInputGUI($lng->txt("title"), "title");
120  $title->setRequired(true);
121  $title->setSize(40);
122  $title->setMaxLength(120);
123  $form_gui->addItem($title);
124 
125  $desc = new ilTextAreaInputGUI($lng->txt("description"), "desc");
126  $desc->setCols(70);
127  $desc->setRows(15);
128  $form_gui->addItem($desc);
129 
130  $file = new ilFileInputGUI($lng->txt("book_additional_info_file"), "file");
131  $file->setALlowDeletion(true);
132  $form_gui->addItem($file);
133 
134  $nr = new ilNumberInputGUI($lng->txt("booking_nr_of_items"), "items");
135  $nr->setRequired(true);
136  $nr->setSize(3);
137  $nr->setMaxLength(3);
138  $form_gui->addItem($nr);
139 
140  if($this->pool_has_schedule)
141  {
142  $options = array();
143  include_once 'Modules/BookingManager/classes/class.ilBookingSchedule.php';
144  foreach(ilBookingSchedule::getList($ilObjDataCache->lookupObjId($this->ref_id)) as $schedule)
145  {
146  $options[$schedule["booking_schedule_id"]] = $schedule["title"];
147  }
148  $schedule = new ilSelectInputGUI($lng->txt("book_schedule"), "schedule");
149  $schedule->setRequired(true);
150  $schedule->setOptions($options);
151  $form_gui->addItem($schedule);
152  }
153 
154  $post = new ilFormSectionHeaderGUI();
155  $post->setTitle($lng->txt("book_post_booking_information"));
156  $form_gui->addItem($post);
157 
158  $pdesc = new ilTextAreaInputGUI($lng->txt("book_post_booking_text"), "post_text");
159  $pdesc->setCols(70);
160  $pdesc->setRows(15);
161  $pdesc->setInfo($lng->txt("book_post_booking_text_info"));
162  $form_gui->addItem($pdesc);
163 
164  $pfile = new ilFileInputGUI($lng->txt("book_post_booking_file"), "post_file");
165  $pfile->setALlowDeletion(true);
166  $form_gui->addItem($pfile);
167 
168  if ($a_mode == "edit")
169  {
170  $form_gui->setTitle($lng->txt("book_edit_object"));
171 
172  $item = new ilHiddenInputGUI('object_id');
173  $item->setValue($id);
174  $form_gui->addItem($item);
175 
176  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
177  $obj = new ilBookingObject($id);
178  $title->setValue($obj->getTitle());
179  $desc->setValue($obj->getDescription());
180  $nr->setValue($obj->getNrOfItems());
181  $pdesc->setValue($obj->getPostText());
182  $file->setValue($obj->getFile());
183  $pfile->setValue($obj->getPostFile());
184 
185  if(isset($schedule))
186  {
187  $schedule->setValue($obj->getScheduleId());
188  }
189 
190  $form_gui->addCommandButton("update", $lng->txt("save"));
191  }
192  else
193  {
194  $form_gui->setTitle($lng->txt("book_add_object"));
195  $form_gui->addCommandButton("save", $lng->txt("save"));
196  $form_gui->addCommandButton("render", $lng->txt("cancel"));
197  }
198  $form_gui->setFormAction($ilCtrl->getFormAction($this));
199 
200  return $form_gui;
201  }
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 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:

◆ rsvCancelUser()

ilBookingObjectGUI::rsvCancelUser ( )

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

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

381  {
382  global $ilCtrl, $ilUser, $lng;
383 
384  $id = (int)$_REQUEST["object_id"];
385  if(!$id)
386  {
387  return;
388  }
389 
390  include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
391  $id = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId());
392  $obj = new ilBookingReservation($id);
393  if ($obj->getUserId() != $ilUser->getId())
394  {
395  ilUtil::sendFailure($lng->txt('permission_denied'), true);
396  $ilCtrl->redirect($this, 'render');
397  }
398 
400  $obj->update();
401 
402  ilUtil::sendSuccess($lng->txt('settings_saved'));
403  $ilCtrl->redirect($this, 'render');
404  }
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 356 of file class.ilBookingObjectGUI.php.

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

357  {
358  global $ilCtrl, $lng, $tpl;
359 
360  $id = (int)$_GET["object_id"];
361  if(!$id)
362  {
363  return;
364  }
365 
366  include_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
367  $conf = new ilConfirmationGUI();
368  $conf->setFormAction($ilCtrl->getFormAction($this));
369  $conf->setHeaderText($lng->txt('book_confirm_cancel'));
370 
371  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
372  $type = new ilBookingObject($id);
373  $conf->addItem('object_id', $id, $type->getTitle());
374  $conf->setConfirm($lng->txt('book_set_cancel'), 'rsvCancelUser');
375  $conf->setCancel($lng->txt('cancel'), 'render');
376 
377  $tpl->setContent($conf->getHTML());
378  }
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.

◆ save()

ilBookingObjectGUI::save ( )

Create new object dataset.

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

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

207  {
208  global $ilCtrl, $tpl, $lng, $ilTabs;
209 
210  $form = $this->initForm();
211  if($form->checkInput())
212  {
213  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
214  $obj = new ilBookingObject;
215  $obj->setPoolId($this->pool_id);
216  $obj->setTitle($form->getInput("title"));
217  $obj->setDescription($form->getInput("desc"));
218  $obj->setNrOfItems($form->getInput("items"));
219  $obj->setPostText($form->getInput("post_text"));
220 
221  if($this->pool_has_schedule)
222  {
223  $obj->setScheduleId($form->getInput("schedule"));
224  }
225 
226  $obj->save();
227 
228  $file = $form->getItemByPostVar("file");
229  if($_FILES["file"]["tmp_name"])
230  {
231  $obj->uploadFile($_FILES["file"]);
232  }
233  else if($file->getDeletionFlag())
234  {
235  $obj->deleteFile();
236  }
237 
238  $pfile = $form->getItemByPostVar("post_file");
239  if($_FILES["post_file"]["tmp_name"])
240  {
241  $obj->uploadPostFile($_FILES["post_file"]);
242  }
243  else if($pfile->getDeletionFlag())
244  {
245  $obj->deletePostFile();
246  }
247 
248  $obj->update();
249 
250  ilUtil::sendSuccess($lng->txt("book_object_added"));
251  $this->render();
252  }
253  else
254  {
255  $ilTabs->clearTargets();
256  $ilTabs->setBackTarget($lng->txt('book_back_to_list'), $ilCtrl->getLinkTarget($this, 'render'));
257 
258  $form->setValuesByPost();
259  $tpl->setContent($form->getHTML());
260  }
261  }
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:

◆ update()

ilBookingObjectGUI::update ( )

Update object dataset.

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

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

267  {
268  global $tpl, $lng;
269 
270  $form = $this->initForm('edit', (int)$_POST['object_id']);
271  if($form->checkInput())
272  {
273  include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
274  $obj = new ilBookingObject((int)$_POST['object_id']);
275  $obj->setTitle($form->getInput("title"));
276  $obj->setDescription($form->getInput("desc"));
277  $obj->setNrOfItems($form->getInput("items"));
278  $obj->setPostText($form->getInput("post_text"));
279 
280  $file = $form->getItemByPostVar("file");
281  if($_FILES["file"]["tmp_name"])
282  {
283  $obj->uploadFile($_FILES["file"]);
284  }
285  else if($file->getDeletionFlag())
286  {
287  $obj->deleteFile();
288  }
289 
290  $pfile = $form->getItemByPostVar("post_file");
291  if($_FILES["post_file"]["tmp_name"])
292  {
293  $obj->uploadPostFile($_FILES["post_file"]);
294  }
295  else if($pfile->getDeletionFlag())
296  {
297  $obj->deletePostFile();
298  }
299 
300  if($this->pool_has_schedule)
301  {
302  $obj->setScheduleId($form->getInput("schedule"));
303  }
304 
305  $obj->update();
306 
307  ilUtil::sendSuccess($lng->txt("book_object_updated"));
308  $this->render();
309  }
310  else
311  {
312  $form->setValuesByPost();
313  $tpl->setContent($form->getHTML());
314  }
315  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
a bookable ressource
print $file
$_POST['username']
Definition: cron.php:12
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: