ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBookingObject Class Reference

a bookable ressource More...

+ Collaboration diagram for ilBookingObject:

Public Member Functions

 __construct ($a_id=null)
 Constructor. More...
 
 getId ()
 Get id. More...
 
 setTitle ($a_title)
 Set object title. More...
 
 getTitle ()
 Get object title. More...
 
 setDescription ($a_value)
 Set object description. More...
 
 getDescription ()
 Get object description. More...
 
 setPoolId ($a_pool_id)
 Set booking pool id. More...
 
 getPoolId ()
 Get booking pool id. More...
 
 setScheduleId ($a_schedule_id)
 Set booking schedule id. More...
 
 getScheduleId ()
 Get booking schedule id. More...
 
 setNrOfItems ($a_value)
 Set number of items. More...
 
 getNrOfItems ()
 Get number of items. More...
 
 setFile ($a_value)
 Set info file. More...
 
 getFile ()
 Get info file. More...
 
 getFileFullPath ()
 Get path to info file. More...
 
 uploadFile (array $a_upload)
 Upload new info file. More...
 
 deleteFile ()
 remove existing info file More...
 
 setPostText ($a_value)
 Set post text. More...
 
 getPostText ()
 Get post text. More...
 
 setPostFile ($a_value)
 Set post file. More...
 
 getPostFile ()
 Get post file. More...
 
 getPostFileFullPath ()
 Get path to post file. More...
 
 uploadPostFile (array $a_upload)
 Upload new post file. More...
 
 deletePostFile ()
 remove existing post file More...
 
 deleteFiles ()
 remove existing files More...
 
 save ()
 Create new entry in db. More...
 
 update ()
 Update entry in db. More...
 
 delete ()
 Delete single entry. More...
 
 doClone ($a_pool_id, $a_schedule_map=null)
 

Static Public Member Functions

static initStorage ($a_id, $a_subdir=null)
 Init file system storage. More...
 
static getList ($a_pool_id, $a_title=null)
 Get list of booking objects for given type. More...
 
static getNumberOfObjectsForPool ($a_pool_id)
 Get number of booking objects for given booking pool id. More...
 
static getObjectsForPool (int $a_pool_id)
 Get all booking pool object ids from an specific booking pool. More...
 
static getNrOfItemsForObjects (array $a_obj_ids)
 Get nr of available items. More...
 
static lookupPoolId ($object_id)
 Lookup pool id. More...
 
static lookupTitle ($object_id)
 Lookup pool id. More...
 

Protected Member Functions

 read ()
 Get dataset from db. More...
 
 getDBFields ()
 Parse properties for sql statements. More...
 

Protected Attributes

 $db
 
 $id
 
 $pool_id
 
 $title
 
 $description
 
 $nr_of_items
 
 $schedule_id
 
 $info_file
 
 $post_text
 
 $post_file
 

Detailed Description

a bookable ressource

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.ilBookingObject.php.

Constructor & Destructor Documentation

◆ __construct()

ilBookingObject::__construct (   $a_id = null)

Constructor.

if id is given will read dataset from db

Parameters
int$a_id

Definition at line 36 of file class.ilBookingObject.php.

References $DIC, and read().

37  {
38  global $DIC;
39 
40  $this->db = $DIC->database();
41  $this->id = (int) $a_id;
42  $this->read();
43  }
global $DIC
Definition: goto.php:24
read()
Get dataset from db.
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilBookingObject::delete ( )

Delete single entry.

Returns
bool

Definition at line 500 of file class.ilBookingObject.php.

References $db, $ilDB, and deleteFiles().

501  {
502  $ilDB = $this->db;
503 
504  if ($this->id) {
505  $this->deleteFiles();
506 
507  return $ilDB->manipulate('DELETE FROM booking_object' .
508  ' WHERE booking_object_id = ' . $ilDB->quote($this->id, 'integer'));
509  }
510  }
global $ilDB
deleteFiles()
remove existing files
+ Here is the call graph for this function:

◆ deleteFile()

ilBookingObject::deleteFile ( )

remove existing info file

Definition at line 201 of file class.ilBookingObject.php.

References getFileFullPath(), and setFile().

Referenced by uploadFile().

202  {
203  if ($this->id) {
204  $path = $this->getFileFullPath();
205  if ($path) {
206  @unlink($path);
207  $this->setFile(null);
208  }
209  }
210  }
getFileFullPath()
Get path to info file.
setFile($a_value)
Set info file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteFiles()

ilBookingObject::deleteFiles ( )

remove existing files

Definition at line 302 of file class.ilBookingObject.php.

References setFile(), and setPostFile().

Referenced by delete().

303  {
304  if ($this->id) {
305  $storage = new ilFSStorageBooking($this->id);
306  $storage->delete();
307 
308  $this->setFile(null);
309  $this->setPostFile(null);
310  }
311  }
setFile($a_value)
Set info file.
setPostFile($a_value)
Set post file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deletePostFile()

ilBookingObject::deletePostFile ( )

remove existing post file

Definition at line 288 of file class.ilBookingObject.php.

References getPostFileFullPath(), and setPostFile().

Referenced by uploadPostFile().

289  {
290  if ($this->id) {
291  $path = $this->getPostFileFullPath();
292  if ($path) {
293  @unlink($path);
294  $this->setPostFile(null);
295  }
296  }
297  }
getPostFileFullPath()
Get path to post file.
setPostFile($a_value)
Set post file.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doClone()

ilBookingObject::doClone (   $a_pool_id,
  $a_schedule_map = null 
)

Definition at line 535 of file class.ilBookingObject.php.

References $schedule_id, $source, getDescription(), getFile(), getId(), getNrOfItems(), getPostFile(), getPostText(), getScheduleId(), getTitle(), initStorage(), and ilUtil\rCopy().

536  {
537  $new_obj = new self();
538  $new_obj->setPoolId($a_pool_id);
539  $new_obj->setTitle($this->getTitle());
540  $new_obj->setDescription($this->getDescription());
541  $new_obj->setNrOfItems($this->getNrOfItems());
542  $new_obj->setFile($this->getFile());
543  $new_obj->setPostText($this->getPostText());
544  $new_obj->setPostFile($this->getPostFile());
545 
546  if ($a_schedule_map) {
547  $schedule_id = $this->getScheduleId();
548  if ($schedule_id) {
549  $new_obj->setScheduleId($a_schedule_map[$schedule_id]);
550  }
551  }
552 
553  $new_obj->save();
554 
555  // files
556  $source = $this->initStorage($this->getId());
557  $target = $new_obj->initStorage($new_obj->getId());
558  ilUtil::rCopy($source, $target);
559  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
getPostFile()
Get post file.
getFile()
Get info file.
getTitle()
Get object title.
getScheduleId()
Get booking schedule id.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
getNrOfItems()
Get number of items.
getPostText()
Get post text.
getDescription()
Get object description.
$source
Definition: metadata.php:76
+ Here is the call graph for this function:

◆ getDBFields()

ilBookingObject::getDBFields ( )
protected

Parse properties for sql statements.

Returns
array

Definition at line 365 of file class.ilBookingObject.php.

References getDescription(), getFile(), getNrOfItems(), getPostFile(), getPostText(), getScheduleId(), and getTitle().

Referenced by save(), and update().

366  {
367  $fields = array(
368  'title' => array('text', $this->getTitle()),
369  'description' => array('text', $this->getDescription()),
370  'schedule_id' => array('text', $this->getScheduleId()),
371  'nr_items' => array('text', $this->getNrOfItems()),
372  'info_file' => array('text', $this->getFile()),
373  'post_text' => array('text', $this->getPostText()),
374  'post_file' => array('text', $this->getPostFile())
375  );
376 
377  return $fields;
378  }
getPostFile()
Get post file.
getFile()
Get info file.
getTitle()
Get object title.
getScheduleId()
Get booking schedule id.
getNrOfItems()
Get number of items.
getPostText()
Get post text.
getDescription()
Get object description.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilBookingObject::getDescription ( )

Get object description.

Returns
string

Definition at line 85 of file class.ilBookingObject.php.

References $description.

Referenced by doClone(), and getDBFields().

86  {
87  return $this->description;
88  }
+ Here is the caller graph for this function:

◆ getFile()

ilBookingObject::getFile ( )

Get info file.

Returns
string

Definition at line 157 of file class.ilBookingObject.php.

References $info_file.

Referenced by doClone(), and getDBFields().

158  {
159  return $this->info_file;
160  }
+ Here is the caller graph for this function:

◆ getFileFullPath()

ilBookingObject::getFileFullPath ( )

Get path to info file.

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

References $info_file, and initStorage().

Referenced by deleteFile().

166  {
167  if ($this->id && $this->info_file) {
168  $path = $this->initStorage($this->id, "file");
169  return $path . $this->info_file;
170  }
171  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilBookingObject::getId ( )

Get id.

Returns
int

Definition at line 49 of file class.ilBookingObject.php.

References $id.

Referenced by doClone().

50  {
51  return $this->id;
52  }
+ Here is the caller graph for this function:

◆ getList()

static ilBookingObject::getList (   $a_pool_id,
  $a_title = null 
)
static

Get list of booking objects for given type.

Parameters
int$a_pool_id
string$a_title
Returns
array

Definition at line 428 of file class.ilBookingObject.php.

References $DIC, $ilDB, and $res.

Referenced by ilBookingPreferencesManager\calculateBookings(), ilObjBookingPool\cloneObject(), ilBookingAssignObjectsTableGUI\getItems(), ilBookingObjectsTableGUI\getItems(), ilObjBookingPoolGUI\initEditCustomForm(), ilBookingParticipantsTableGUI\initFilter(), ilBookingReservationsTableGUI\initFilter(), ilBookingPreferencesGUI\initPreferenceForm(), ilBookingPreferencesGUI\listPreferenceOptions(), ilBookingPreferencesManager\readBookings(), ilBookingScheduleGUI\render(), and ilBookingReservationsGUI\rsvConfirmCancel().

429  {
430  global $DIC;
431 
432  $ilDB = $DIC->database();
433 
434  $sql = 'SELECT *' .
435  ' FROM booking_object' .
436  ' WHERE pool_id = ' . $ilDB->quote($a_pool_id, 'integer');
437 
438  if ($a_title) {
439  $sql .= ' AND (' . $ilDB->like('title', 'text', '%' . $a_title . '%') .
440  ' OR ' . $ilDB->like('description', 'text', '%' . $a_title . '%') . ')';
441  }
442 
443  $sql .= ' ORDER BY title';
444 
445  $set = $ilDB->query($sql);
446  $res = array();
447  while ($row = $ilDB->fetchAssoc($set)) {
448  $res[] = $row;
449  }
450  return $res;
451  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getNrOfItems()

ilBookingObject::getNrOfItems ( )

Get number of items.

Returns
int

Definition at line 139 of file class.ilBookingObject.php.

References $nr_of_items.

Referenced by doClone(), and getDBFields().

140  {
141  return $this->nr_of_items;
142  }
+ Here is the caller graph for this function:

◆ getNrOfItemsForObjects()

static ilBookingObject::getNrOfItemsForObjects ( array  $a_obj_ids)
static

Get nr of available items.

Parameters
array$a_obj_ids
Returns
array

Definition at line 517 of file class.ilBookingObject.php.

References $DIC, and $ilDB.

Referenced by ilBookingProcessGUI\confirmedBooking(), ilBookingReservation\getAvailableObject(), ilBookingReservation\getNumAvailablesNoSchedule(), and ilBookingReservation\isObjectAvailableInPeriod().

518  {
519  global $DIC;
520 
521  $ilDB = $DIC->database();
522 
523  $map = array();
524 
525  $set = $ilDB->query("SELECT booking_object_id,nr_items" .
526  " FROM booking_object" .
527  " WHERE " . $ilDB->in("booking_object_id", $a_obj_ids, "", "integer"));
528  while ($row = $ilDB->fetchAssoc($set)) {
529  $map[$row["booking_object_id"]] = $row["nr_items"];
530  }
531 
532  return $map;
533  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getNumberOfObjectsForPool()

static ilBookingObject::getNumberOfObjectsForPool (   $a_pool_id)
static

Get number of booking objects for given booking pool id.

Parameters
int$a_pool_id
Returns
int

Definition at line 458 of file class.ilBookingObject.php.

References $DIC, and $ilDB.

Referenced by ilBookingParticipantsTableGUI\fillRow().

459  {
460  global $DIC;
461 
462  $ilDB = $DIC->database();
463 
464  $sql = 'SELECT count(*) as count' .
465  ' FROM booking_object' .
466  ' WHERE pool_id = ' . $ilDB->quote($a_pool_id, 'integer');
467  $set = $ilDB->query($sql);
468  $rec = $ilDB->fetchAssoc($set);
469 
470  return $rec["count"];
471  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getObjectsForPool()

static ilBookingObject::getObjectsForPool ( int  $a_pool_id)
static

Get all booking pool object ids from an specific booking pool.

Parameters
int$a_pool_id
Returns
array

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

References $DIC, and $ilDB.

Referenced by ilBookingReservation\isBookingPoolLimitReachedByUser().

478  : array
479  {
480  global $DIC;
481  $ilDB = $DIC->database();
482 
483  $set = $ilDB->query("SELECT booking_object_id" .
484  " FROM booking_object" .
485  " WHERE pool_id = " . $ilDB->quote($a_pool_id, 'integer'));
486 
487  $objects = array();
488  while ($row = $ilDB->fetchAssoc($set)) {
489  $objects[] = $row['booking_object_id'];
490  }
491 
492  return $objects;
493  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getPoolId()

ilBookingObject::getPoolId ( )

Get booking pool id.

Returns
int

Definition at line 103 of file class.ilBookingObject.php.

References $pool_id.

Referenced by save().

104  {
105  return $this->pool_id;
106  }
+ Here is the caller graph for this function:

◆ getPostFile()

ilBookingObject::getPostFile ( )

Get post file.

Returns
string

Definition at line 243 of file class.ilBookingObject.php.

References $post_file.

Referenced by doClone(), and getDBFields().

244  {
245  return $this->post_file;
246  }
+ Here is the caller graph for this function:

◆ getPostFileFullPath()

ilBookingObject::getPostFileFullPath ( )

Get path to post file.

Definition at line 251 of file class.ilBookingObject.php.

References $post_file, and initStorage().

Referenced by deletePostFile().

252  {
253  if ($this->id && $this->post_file) {
254  $path = $this->initStorage($this->id, "post");
255  return $path . $this->post_file;
256  }
257  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPostText()

ilBookingObject::getPostText ( )

Get post text.

Returns
string

Definition at line 225 of file class.ilBookingObject.php.

References $post_text.

Referenced by doClone(), and getDBFields().

226  {
227  return $this->post_text;
228  }
+ Here is the caller graph for this function:

◆ getScheduleId()

ilBookingObject::getScheduleId ( )

Get booking schedule id.

Returns
int

Definition at line 121 of file class.ilBookingObject.php.

References $schedule_id.

Referenced by doClone(), and getDBFields().

122  {
123  return $this->schedule_id;
124  }
+ Here is the caller graph for this function:

◆ getTitle()

ilBookingObject::getTitle ( )

Get object title.

Returns
string

Definition at line 67 of file class.ilBookingObject.php.

References $title.

Referenced by doClone(), getDBFields(), ilBookingReservationsGUI\rsvConfirmCancel(), ilBookingReservationsGUI\rsvConfirmCancelAggregationForm(), and ilBookingReservationsGUI\rsvConfirmDelete().

68  {
69  return $this->title;
70  }
+ Here is the caller graph for this function:

◆ initStorage()

static ilBookingObject::initStorage (   $a_id,
  $a_subdir = null 
)
static

Init file system storage.

Parameters
type$a_id
type$a_subdir
Returns
string

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

Referenced by doClone(), getFileFullPath(), getPostFileFullPath(), uploadFile(), and uploadPostFile().

321  {
322  $storage = new ilFSStorageBooking($a_id);
323  $storage->create();
324 
325  $path = $storage->getAbsolutePath() . "/";
326 
327  if ($a_subdir) {
328  $path .= $a_subdir . "/";
329 
330  if (!is_dir($path)) {
331  mkdir($path);
332  }
333  }
334 
335  return $path;
336  }
+ Here is the caller graph for this function:

◆ lookupPoolId()

static ilBookingObject::lookupPoolId (   $object_id)
static

Lookup pool id.

Parameters
int$object_id
Returns
int

Definition at line 567 of file class.ilBookingObject.php.

References $db, and $DIC.

Referenced by ilBookingReservationsGUI\__construct(), ilObjBookingPoolGUI\__construct(), and ilBookingReservation\getMembersWithoutReservation().

568  {
569  global $DIC;
570 
571  $db = $DIC->database();
572  $set = $db->queryF(
573  "SELECT pool_id FROM booking_object " .
574  " WHERE booking_object_id = %s ",
575  array("integer"),
576  array($object_id)
577  );
578  $rec = $db->fetchAssoc($set);
579  return (int) $rec["pool_id"];
580  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilBookingObject::lookupTitle (   $object_id)
static

Lookup pool id.

Parameters
int$object_id
Returns
int

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

References $db, and $DIC.

Referenced by ilBookingPreferencesGUI\savePreferences().

589  {
590  global $DIC;
591 
592  $db = $DIC->database();
593  $set = $db->queryF(
594  "SELECT title FROM booking_object " .
595  " WHERE booking_object_id = %s ",
596  array("integer"),
597  array($object_id)
598  );
599  $rec = $db->fetchAssoc($set);
600  return $rec["title"];
601  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ read()

ilBookingObject::read ( )
protected

Get dataset from db.

Definition at line 341 of file class.ilBookingObject.php.

References $db, $ilDB, setDescription(), setFile(), setNrOfItems(), setPoolId(), setPostFile(), setPostText(), setScheduleId(), and setTitle().

Referenced by __construct().

342  {
343  $ilDB = $this->db;
344 
345  if ($this->id) {
346  $set = $ilDB->query('SELECT *' .
347  ' FROM booking_object' .
348  ' WHERE booking_object_id = ' . $ilDB->quote($this->id, 'integer'));
349  $row = $ilDB->fetchAssoc($set);
350  $this->setTitle($row['title']);
351  $this->setDescription($row['description']);
352  $this->setPoolId($row['pool_id']);
353  $this->setScheduleId($row['schedule_id']);
354  $this->setNrOfItems($row['nr_items']);
355  $this->setFile($row['info_file']);
356  $this->setPostText($row['post_text']);
357  $this->setPostFile($row['post_file']);
358  }
359  }
setPostText($a_value)
Set post text.
setScheduleId($a_schedule_id)
Set booking schedule id.
setFile($a_value)
Set info file.
setDescription($a_value)
Set object description.
setTitle($a_title)
Set object title.
setNrOfItems($a_value)
Set number of items.
global $ilDB
setPostFile($a_value)
Set post file.
setPoolId($a_pool_id)
Set booking pool id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilBookingObject::save ( )

Create new entry in db.

Returns
bool

Definition at line 384 of file class.ilBookingObject.php.

References $db, $ilDB, getDBFields(), and getPoolId().

385  {
386  $ilDB = $this->db;
387 
388  if ($this->id) {
389  return false;
390  }
391 
392  $this->id = $ilDB->nextId('booking_object');
393 
394  $fields = $this->getDBFields();
395  $fields['booking_object_id'] = array('integer', $this->id);
396  $fields['pool_id'] = array('integer', $this->getPoolId());
397 
398  return $ilDB->insert('booking_object', $fields);
399  }
getDBFields()
Parse properties for sql statements.
getPoolId()
Get booking pool id.
global $ilDB
+ Here is the call graph for this function:

◆ setDescription()

ilBookingObject::setDescription (   $a_value)

Set object description.

Parameters
string$a_value

Definition at line 76 of file class.ilBookingObject.php.

Referenced by read().

77  {
78  $this->description = $a_value;
79  }
+ Here is the caller graph for this function:

◆ setFile()

ilBookingObject::setFile (   $a_value)

Set info file.

Parameters
string$a_value

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

Referenced by deleteFile(), deleteFiles(), read(), and uploadFile().

149  {
150  $this->info_file = $a_value;
151  }
+ Here is the caller graph for this function:

◆ setNrOfItems()

ilBookingObject::setNrOfItems (   $a_value)

Set number of items.

Parameters
int$a_value

Definition at line 130 of file class.ilBookingObject.php.

Referenced by read().

131  {
132  $this->nr_of_items = (int) $a_value;
133  }
+ Here is the caller graph for this function:

◆ setPoolId()

ilBookingObject::setPoolId (   $a_pool_id)

Set booking pool id.

Parameters
int$a_pool_id

Definition at line 94 of file class.ilBookingObject.php.

Referenced by read(), and ilBookingObjectGUI\save().

95  {
96  $this->pool_id = (int) $a_pool_id;
97  }
+ Here is the caller graph for this function:

◆ setPostFile()

ilBookingObject::setPostFile (   $a_value)

Set post file.

Parameters
string$a_value

Definition at line 234 of file class.ilBookingObject.php.

Referenced by deleteFiles(), deletePostFile(), read(), and uploadPostFile().

235  {
236  $this->post_file = $a_value;
237  }
+ Here is the caller graph for this function:

◆ setPostText()

ilBookingObject::setPostText (   $a_value)

Set post text.

Parameters
string$a_value

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

Referenced by read().

217  {
218  $this->post_text = $a_value;
219  }
+ Here is the caller graph for this function:

◆ setScheduleId()

ilBookingObject::setScheduleId (   $a_schedule_id)

Set booking schedule id.

Parameters
int$a_schedule_id

Definition at line 112 of file class.ilBookingObject.php.

Referenced by read().

113  {
114  $this->schedule_id = (int) $a_schedule_id;
115  }
+ Here is the caller graph for this function:

◆ setTitle()

ilBookingObject::setTitle (   $a_title)

Set object title.

Parameters
string$a_title

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

Referenced by read().

59  {
60  $this->title = $a_title;
61  }
+ Here is the caller graph for this function:

◆ update()

ilBookingObject::update ( )

Update entry in db.

Returns
bool

Definition at line 405 of file class.ilBookingObject.php.

References $db, $ilDB, and getDBFields().

406  {
407  $ilDB = $this->db;
408 
409  if (!$this->id) {
410  return false;
411  }
412 
413  $fields = $this->getDBFields();
414 
415  return $ilDB->update(
416  'booking_object',
417  $fields,
418  array('booking_object_id' => array('integer', $this->id))
419  );
420  }
getDBFields()
Parse properties for sql statements.
global $ilDB
+ Here is the call graph for this function:

◆ uploadFile()

ilBookingObject::uploadFile ( array  $a_upload)

Upload new info file.

Parameters
array$a_upload
Returns
bool

Definition at line 179 of file class.ilBookingObject.php.

References deleteFile(), initStorage(), ilUtil\moveUploadedFile(), and setFile().

180  {
181  if (!$this->id) {
182  return false;
183  }
184 
185  $this->deleteFile();
186 
187  $path = $this->initStorage($this->id, "file");
188  $original = $a_upload["name"];
189  if (ilUtil::moveUploadedFile($a_upload["tmp_name"], $original, $path . $original)) {
190  chmod($path . $original, 0770);
191 
192  $this->setFile($original);
193  return true;
194  }
195  return false;
196  }
deleteFile()
remove existing info file
setFile($a_value)
Set info file.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
+ Here is the call graph for this function:

◆ uploadPostFile()

ilBookingObject::uploadPostFile ( array  $a_upload)

Upload new post file.

Parameters
array$a_upload
Returns
bool

Definition at line 265 of file class.ilBookingObject.php.

References deletePostFile(), initStorage(), ilUtil\moveUploadedFile(), and setPostFile().

266  {
267  if (!$this->id) {
268  return false;
269  }
270 
271  $this->deletePostFile();
272 
273  $path = $this->initStorage($this->id, "post");
274  $original = $a_upload["name"];
275 
276  if (ilUtil::moveUploadedFile($a_upload["tmp_name"], $original, $path . $original)) {
277  chmod($path . $original, 0770);
278 
279  $this->setPostFile($original);
280  return true;
281  }
282  return false;
283  }
deletePostFile()
remove existing post file
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
setPostFile($a_value)
Set post file.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilBookingObject::$db
protected

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

Referenced by delete(), lookupPoolId(), lookupTitle(), read(), save(), and update().

◆ $description

ilBookingObject::$description
protected

Definition at line 22 of file class.ilBookingObject.php.

Referenced by getDescription().

◆ $id

ilBookingObject::$id
protected

Definition at line 19 of file class.ilBookingObject.php.

Referenced by getId().

◆ $info_file

ilBookingObject::$info_file
protected

Definition at line 25 of file class.ilBookingObject.php.

Referenced by getFile(), and getFileFullPath().

◆ $nr_of_items

ilBookingObject::$nr_of_items
protected

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

Referenced by getNrOfItems().

◆ $pool_id

ilBookingObject::$pool_id
protected

Definition at line 20 of file class.ilBookingObject.php.

Referenced by getPoolId().

◆ $post_file

ilBookingObject::$post_file
protected

Definition at line 27 of file class.ilBookingObject.php.

Referenced by getPostFile(), and getPostFileFullPath().

◆ $post_text

ilBookingObject::$post_text
protected

Definition at line 26 of file class.ilBookingObject.php.

Referenced by getPostText().

◆ $schedule_id

ilBookingObject::$schedule_id
protected

Definition at line 24 of file class.ilBookingObject.php.

Referenced by doClone(), and getScheduleId().

◆ $title

ilBookingObject::$title
protected

Definition at line 21 of file class.ilBookingObject.php.

Referenced by getTitle().


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