ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBookingReservation Class Reference

a booking reservation More...

+ Collaboration diagram for ilBookingReservation:

Public Member Functions

 __construct ($a_id=NULL)
 Constructor. More...
 
 getId ()
 Get id. More...
 
 setObjectId ($a_object_id)
 Set object id. More...
 
 getObjectId ()
 Get object id. More...
 
 setUserId ($a_user_id)
 Set booking user id. More...
 
 getUserId ()
 Get booking user id. More...
 
 setFrom ($a_from)
 Set booking from date. More...
 
 getFrom ()
 Get booking from date. More...
 
 setTo ($a_to)
 Set booking to date. More...
 
 getTo ()
 Get booking to date. More...
 
 setStatus ($a_status)
 Set booking status. More...
 
 getStatus ()
 Get booking status. More...
 
 setGroupId ($a_group_id)
 Set group id. More...
 
 getGroupId ()
 Get group id. More...
 
 save ()
 Create new entry in db. More...
 
 update ()
 Update entry in db. More...
 
 delete ()
 Delete single entry. More...
 
 getCalendarEntry ()
 

Static Public Member Functions

static isValidStatus ($a_status)
 Check if given status is valid. More...
 
static getNewGroupId ()
 Get next group id. More...
 
static getAvailableObject (array $a_ids, $a_from, $a_to, $a_return_single=true, $a_return_counter=false)
 Check if any of given objects are bookable. More...
 
static isObjectAvailableNoSchedule ($a_obj_id)
 
static getCurrentOrUpcomingReservation ($a_object_id)
 Get details about object reservation. More...
 
static getObjectReservationForUser ($a_object_id, $a_user_id)
 
static getList ($a_object_ids, $a_limit=10, $a_offset=0, array $filter)
 List all reservations. More...
 
static getGroupedList ($a_object_ids, $a_limit=10, $a_offset=0, array $filter=null, $a_group_id=null)
 List all reservations. More...
 
static changeStatus (array $a_ids, $a_status)
 Batch update reservation status. More...
 

Data Fields

const STATUS_IN_USE = 2
 
const STATUS_CANCELLED = 5
 

Protected Member Functions

 read ()
 Get dataset from db. More...
 

Protected Attributes

 $id
 
 $object_id
 
 $user_id
 
 $from
 
 $to
 
 $status
 
 $group_id
 

Detailed Description

a booking reservation

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

Constructor & Destructor Documentation

◆ __construct()

ilBookingReservation::__construct (   $a_id = NULL)

Constructor.

if id is given will read dataset from db

Parameters
int$a_id

Definition at line 32 of file class.ilBookingReservation.php.

References read().

33  {
34  $this->id = (int)$a_id;
35  $this->read();
36  }
+ Here is the call graph for this function:

Member Function Documentation

◆ changeStatus()

static ilBookingReservation::changeStatus ( array  $a_ids,
  $a_status 
)
static

Batch update reservation status.

Parameters
array$a_ids
int$a_status
Returns
bool

Definition at line 598 of file class.ilBookingReservation.php.

Referenced by ilObjBookingPoolGUI\changeStatusObject().

599  {
600  global $ilDB;
601 
602  if(self::isValidStatus($a_status))
603  {
604  return $ilDB->manipulate('UPDATE booking_reservation'.
605  ' SET status = '.$ilDB->quote($a_status, 'integer').
606  ' WHERE '.$ilDB->in('booking_reservation_id', $a_ids, '', 'integer'));
607 
608  }
609  }
+ Here is the caller graph for this function:

◆ delete()

ilBookingReservation::delete ( )

Delete single entry.

Returns
bool

Definition at line 261 of file class.ilBookingReservation.php.

262  {
263  global $ilDB;
264 
265  if($this->id)
266  {
267  return $ilDB->manipulate('DELETE FROM booking_reservation'.
268  ' WHERE booking_reservation_id = '.$ilDB->quote($this->id, 'integer'));
269  }
270  }

◆ getAvailableObject()

static ilBookingReservation::getAvailableObject ( array  $a_ids,
  $a_from,
  $a_to,
  $a_return_single = true,
  $a_return_counter = false 
)
static

Check if any of given objects are bookable.

Parameters
array$a_ids
int$a_from
int$a_to
int$a_return_single
Returns
int

Definition at line 291 of file class.ilBookingReservation.php.

References $from, $id, $row, $to, and ilBookingObject\getNrOfItemsForObjects().

Referenced by ilObjBookingPoolGUI\buildDatesBySchedule(), ilObjBookingPoolGUI\confirmedBookingNumbersObject(), and ilObjBookingPoolGUI\confirmedBookingObject().

292  {
293  global $ilDB;
294 
295  $nr_map = ilBookingObject::getNrOfItemsForObjects($a_ids);
296 
297  $from = $ilDB->quote($a_from, 'integer');
298  $to = $ilDB->quote($a_to, 'integer');
299 
300  $set = $ilDB->query('SELECT count(*) cnt, object_id'.
301  ' FROM booking_reservation'.
302  ' WHERE '.$ilDB->in('object_id', $a_ids, '', 'integer').
303  ' AND (status IS NULL OR status <> '.$ilDB->quote(self::STATUS_CANCELLED, 'integer').')'.
304  ' AND ((date_from <= '.$from.' AND date_to >= '.$from.')'.
305  ' OR (date_from <= '.$to.' AND date_to >= '.$to.')'.
306  ' OR (date_from >= '.$from.' AND date_to <= '.$to.'))'.
307  ' GROUP BY object_id');
308  $blocked = $counter = array();
309  while($row = $ilDB->fetchAssoc($set))
310  {
311  if($row['cnt'] >= $nr_map[$row['object_id']])
312  {
313  $blocked[] = $row['object_id'];
314  }
315  else if($a_return_counter)
316  {
317  $counter[$row['object_id']] = (int)$nr_map[$row['object_id']]-(int)$row['cnt'];
318  }
319  }
320  $available = array_diff($a_ids, $blocked);
321  if(sizeof($available))
322  {
323  if($a_return_counter)
324  {
325  foreach($a_ids as $id)
326  {
327  if(!isset($counter[$id]))
328  {
329  $counter[$id] = (int)$nr_map[$id];
330  }
331  }
332  return $counter;
333  }
334  else if($a_return_single)
335  {
336  return array_shift($available);
337  }
338  else
339  {
340  return $available;
341  }
342  }
343  }
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCalendarEntry()

ilBookingReservation::getCalendarEntry ( )

Definition at line 611 of file class.ilBookingReservation.php.

References $row, getId(), and ilCalendarCategory\TYPE_BOOK.

612  {
613  global $ilDB;
614 
615  include_once 'Services/Calendar/classes/class.ilCalendarCategory.php';
616 
617  $set = $ilDB->query("SELECT ce.cal_id FROM cal_entries ce".
618  " JOIN cal_cat_assignments cca ON ce.cal_id = cca.cal_id".
619  " JOIN cal_categories cc ON cca.cat_id = cc.cat_id".
620  " JOIN booking_reservation br ON ce.context_id = br.booking_reservation_id".
621  " WHERE cc.obj_id = ".$ilDB->quote($this->getUserId(),'integer').
622  " AND br.user_id = ".$ilDB->quote($this->getUserId(),'integer').
623  " AND cc.type = ".$ilDB->quote(ilCalendarCategory::TYPE_BOOK,'integer').
624  " AND ce.context_id = ".$ilDB->quote($this->getId(), 'integer'));
625  $row = $ilDB->fetchAssoc($set);
626  return $row["cal_id"];
627  }
+ Here is the call graph for this function:

◆ getCurrentOrUpcomingReservation()

static ilBookingReservation::getCurrentOrUpcomingReservation (   $a_object_id)
static

Get details about object reservation.

Parameters
int$a_object_id
Returns
array

Definition at line 368 of file class.ilBookingReservation.php.

References $row.

369  {
370  global $ilDB;
371 
372  $now = $ilDB->quote(time(), 'integer');
373 
374  $ilDB->setLimit(1);
375  $set = $ilDB->query('SELECT user_id, status, date_from, date_to'.
376  ' FROM booking_reservation'.
377  ' WHERE ((date_from <= '.$now.' AND date_to >= '.$now.')'.
378  ' OR date_from > '.$now.')'.
379  ' AND (status <> '.$ilDB->quote(self::STATUS_CANCELLED, 'integer').
380  ' OR STATUS IS NULL) AND object_id = '.$ilDB->quote($a_object_id, 'integer').
381  ' ORDER BY date_from');
382  $row = $ilDB->fetchAssoc($set);
383  return $row;
384  }

◆ getFrom()

ilBookingReservation::getFrom ( )

Get booking from date.

Returns
int

Definition at line 96 of file class.ilBookingReservation.php.

References $from.

Referenced by save().

+ Here is the caller graph for this function:

◆ getGroupedList()

static ilBookingReservation::getGroupedList (   $a_object_ids,
  $a_limit = 10,
  $a_offset = 0,
array  $filter = null,
  $a_group_id = null 
)
static

List all reservations.

Parameters
array$a_object_ids
int$a_limit
int$a_offset
array$filter
array$a_group_id
Returns
array

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

References $group_id, $res, and $row.

Referenced by ilBookingReservationsTableGUI\getItems().

473  {
474  global $ilDB;
475 
476  $sql = 'SELECT r.*,o.title'.
477  ' FROM booking_reservation r'.
478  ' JOIN booking_object o ON (o.booking_object_id = r.object_id)';
479 
480  $where = array($ilDB->in('r.object_id', $a_object_ids, '', 'integer'));
481  if($filter['status'])
482  {
483  if($filter['status'] > 0)
484  {
485  $where[] = 'status = '.$ilDB->quote($filter['status'], 'integer');
486  }
487  else
488  {
489  $where[] = '(status != '.$ilDB->quote(-$filter['status'], 'integer').
490  ' OR status IS NULL)';
491  }
492  }
493  if($filter['from'])
494  {
495  $where[] = 'date_from >= '.$ilDB->quote($filter['from'], 'integer');
496  }
497  if($filter['to'])
498  {
499  $where[] = 'date_to <= '.$ilDB->quote($filter['to'], 'integer');
500  }
501  if($a_group_id)
502  {
503  $where[] = 'group_id = '.$ilDB->quote(substr($a_group_id, 1), 'integer');
504  }
505  if(sizeof($where))
506  {
507  $sql .= ' WHERE '.implode(' AND ', $where);
508  }
509 
510  $sql .= ' ORDER BY date_from DESC, booking_reservation_id DESC';
511 
512  $set = $ilDB->query($sql);
513  $res = $grps = array();
514  $counter = 0;
515  while($row = $ilDB->fetchAssoc($set))
516  {
517  if($row["group_id"] && !$a_group_id)
518  {
519  if(!isset($grps[$row["group_id"]]))
520  {
521  $grps[$row["group_id"]] = 1;
522  $counter++;
523  }
524  else
525  {
526  $grps[$row["group_id"]]++;
527  }
528  }
529  else
530  {
531  $counter++;
532  }
533 
534  if($a_group_id || ($counter > $a_offset && sizeof($res) < $a_limit))
535  {
536  if($row["group_id"] && !$a_group_id)
537  {
538  $group_id = "g".$row["group_id"];
539  $res[$group_id]["group_id"] = $group_id;
540  $res[$group_id]["details"][] = $row;
541  }
542  else
543  {
544  unset($row["group_id"]);
545  $res[] = $row;
546  }
547  }
548  }
549 
550  foreach($res as $idx => $item)
551  {
552  if(isset($item["details"]))
553  {
554  $res[$idx]["date_from"] = null;
555  $res[$idx]["date_to"] = null;
556 
557  foreach($item["details"] as $detail)
558  {
559  // same for each item
560  $res[$idx]["user_id"] = $detail["user_id"];
561  $res[$idx]["object_id"] = $detail["object_id"];
562  $res[$idx]["title"] = $detail["title"];
563  $res[$idx]["booking_reservation_id"] = $detail["booking_reservation_id"];
564 
565  // min/max period
566  if(!$res[$idx]["date_from"] || $detail["date_from"] < $res[$idx]["date_from"])
567  {
568  $res[$idx]["date_from"] = $detail["date_from"];
569  }
570  if(!$res[$idx]["date_to"] || $detail["date_to"] > $res[$idx]["date_to"])
571  {
572  $res[$idx]["date_to"] = $detail["date_to"];
573  }
574  }
575 
576  if(sizeof($item["details"]) > 1)
577  {
578  $res[$idx]["booking_reservation_id"] = $idx;
579  $res[$idx]["title"] .= " (".sizeof($item["details"]).")";
580  }
581  else
582  {
583  $res[$idx]["status"] = $detail["status"];
584  unset($res[$idx]["group_id"]);
585  }
586  }
587  }
588 
589  return array('data'=>$res, 'counter'=>$counter);
590  }
+ Here is the caller graph for this function:

◆ getGroupId()

ilBookingReservation::getGroupId ( )

Get group id.

Returns
int

Definition at line 171 of file class.ilBookingReservation.php.

References $group_id.

Referenced by save().

172  {
173  return $this->group_id;
174  }
+ Here is the caller graph for this function:

◆ getId()

ilBookingReservation::getId ( )

Get id.

Returns
int

Definition at line 42 of file class.ilBookingReservation.php.

References $id.

Referenced by getCalendarEntry().

43  {
44  return $this->id;
45  }
+ Here is the caller graph for this function:

◆ getList()

static ilBookingReservation::getList (   $a_object_ids,
  $a_limit = 10,
  $a_offset = 0,
array  $filter 
)
static

List all reservations.

Parameters
array$a_object_ids
int$a_limit
int$a_offset
array$a_offset
Returns
array

Definition at line 407 of file class.ilBookingReservation.php.

References $res, and $row.

Referenced by ilBookingObjectsTableGUI\fillRow().

408  {
409  global $ilDB;
410 
411  $sql = 'SELECT r.*,o.title'.
412  ' FROM booking_reservation r'.
413  ' JOIN booking_object o ON (o.booking_object_id = r.object_id)';
414 
415  $count_sql = 'SELECT COUNT(*) AS counter'.
416  ' FROM booking_reservation r'.
417  ' JOIN booking_object o ON (o.booking_object_id = r.object_id)';
418 
419  $where = array($ilDB->in('r.object_id', $a_object_ids, '', 'integer'));
420  if($filter['status'])
421  {
422  if($filter['status'] > 0)
423  {
424  $where[] = 'status = '.$ilDB->quote($filter['status'], 'integer');
425  }
426  else
427  {
428  $where[] = '(status != '.$ilDB->quote(-$filter['status'], 'integer').
429  ' OR status IS NULL)';
430  }
431  }
432  if($filter['from'])
433  {
434  $where[] = 'date_from >= '.$ilDB->quote($filter['from'], 'integer');
435  }
436  if($filter['to'])
437  {
438  $where[] = 'date_to <= '.$ilDB->quote($filter['to'], 'integer');
439  }
440  if(sizeof($where))
441  {
442  $sql .= ' WHERE '.implode(' AND ', $where);
443  $count_sql .= ' WHERE '.implode(' AND ', $where);
444  }
445 
446  $set = $ilDB->query($count_sql);
447  $row = $ilDB->fetchAssoc($set);
448  $counter = $row['counter'];
449 
450  $sql .= ' ORDER BY date_from DESC, booking_reservation_id DESC';
451 
452  $ilDB->setLimit($a_limit, $a_offset);
453  $set = $ilDB->query($sql);
454  $res = array();
455  while($row = $ilDB->fetchAssoc($set))
456  {
457  $res[] = $row;
458  }
459 
460  return array('data'=>$res, 'counter'=>$counter);
461  }
+ Here is the caller graph for this function:

◆ getNewGroupId()

static ilBookingReservation::getNewGroupId ( )
static

Get next group id.

Returns
int

Definition at line 276 of file class.ilBookingReservation.php.

Referenced by ilObjBookingPoolGUI\confirmedBookingObject().

277  {
278  global $ilDB;
279 
280  return $ilDB->nextId('booking_reservation_group');
281  }
+ Here is the caller graph for this function:

◆ getObjectId()

ilBookingReservation::getObjectId ( )

Get object id.

Returns
int

Definition at line 60 of file class.ilBookingReservation.php.

References $object_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ getObjectReservationForUser()

static ilBookingReservation::getObjectReservationForUser (   $a_object_id,
  $a_user_id 
)
static

Definition at line 386 of file class.ilBookingReservation.php.

References $row.

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

387  {
388  global $ilDB;
389 
390  $set = $ilDB->query('SELECT booking_reservation_id FROM booking_reservation'.
391  ' WHERE user_id = '.$ilDB->quote($a_user_id, 'integer').
392  ' AND object_id = '.$ilDB->quote($a_object_id, 'integer').
393  ' AND (status <> '.$ilDB->quote(self::STATUS_CANCELLED, 'integer').
394  ' OR STATUS IS NULL)');
395  $row = $ilDB->fetchAssoc($set);
396  return $row['booking_reservation_id'];
397  }
+ Here is the caller graph for this function:

◆ getStatus()

ilBookingReservation::getStatus ( )

Get booking status.

Returns
int

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

References $status.

Referenced by save().

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

◆ getTo()

ilBookingReservation::getTo ( )

Get booking to date.

Returns
int

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

References $to.

Referenced by save().

115  {
116  return $this->to;
117  }
+ Here is the caller graph for this function:

◆ getUserId()

ilBookingReservation::getUserId ( )

Get booking user id.

Returns
int

Definition at line 78 of file class.ilBookingReservation.php.

References $user_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ isObjectAvailableNoSchedule()

static ilBookingReservation::isObjectAvailableNoSchedule (   $a_obj_id)
static

Definition at line 345 of file class.ilBookingReservation.php.

References ilBookingObject\getNrOfItemsForObjects().

Referenced by ilObjBookingPoolGUI\confirmedBookingObject().

346  {
347  global $ilDB;
348 
349  $all = ilBookingObject::getNrOfItemsForObjects(array($a_obj_id));
350  $all = (int)$all[$a_obj_id];
351 
352  $set = $ilDB->query('SELECT COUNT(*) cnt'.
353  ' FROM booking_reservation r'.
354  ' JOIN booking_object o ON (o.booking_object_id = r.object_id)'.
355  ' WHERE (status IS NULL OR status <> '.$ilDB->quote(self::STATUS_CANCELLED, 'integer').')'.
356  ' AND r.object_id = '.$ilDB->quote($a_obj_id, 'integer'));
357  $cnt = $ilDB->fetchAssoc($set);
358  $cnt = (int)$cnt['cnt'];
359 
360  return (bool)($all-$cnt); // #11864
361  }
static getNrOfItemsForObjects(array $a_obj_ids)
Get nr of available items.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isValidStatus()

static ilBookingReservation::isValidStatus (   $a_status)
static

Check if given status is valid.

Parameters
int$a_status
Returns
bool

Definition at line 149 of file class.ilBookingReservation.php.

Referenced by setStatus().

150  {
151  if(in_array($a_status, array(self::STATUS_IN_USE, self::STATUS_CANCELLED)))
152  {
153  return true;
154  }
155  return false;
156  }
+ Here is the caller graph for this function:

◆ read()

ilBookingReservation::read ( )
protected

Get dataset from db.

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

References $row, setFrom(), setGroupId(), setObjectId(), setStatus(), setTo(), and setUserId().

Referenced by __construct().

180  {
181  global $ilDB;
182 
183  if($this->id)
184  {
185  $set = $ilDB->query('SELECT *'.
186  ' FROM booking_reservation'.
187  ' WHERE booking_reservation_id = '.$ilDB->quote($this->id, 'integer'));
188  $row = $ilDB->fetchAssoc($set);
189  $this->setUserId($row['user_id']);
190  $this->setObjectId($row['object_id']);
191  $this->setFrom($row['date_from']);
192  $this->setTo($row['date_to']);
193  $this->setStatus($row['status']);
194  $this->setGroupId($row['group_id']);
195  }
196  }
setStatus($a_status)
Set booking status.
setGroupId($a_group_id)
Set group id.
setFrom($a_from)
Set booking from date.
setObjectId($a_object_id)
Set object id.
setUserId($a_user_id)
Set booking user id.
setTo($a_to)
Set booking to date.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilBookingReservation::save ( )

Create new entry in db.

Returns
bool

Definition at line 202 of file class.ilBookingReservation.php.

References getFrom(), getGroupId(), getObjectId(), getStatus(), getTo(), and getUserId().

203  {
204  global $ilDB;
205 
206  if($this->id)
207  {
208  return false;
209  }
210 
211  $this->id = $ilDB->nextId('booking_reservation');
212 
213  return $ilDB->manipulate('INSERT INTO booking_reservation'.
214  ' (booking_reservation_id,user_id,object_id,date_from,date_to,status,group_id)'.
215  ' VALUES ('.$ilDB->quote($this->id, 'integer').
216  ','.$ilDB->quote($this->getUserId(), 'integer').
217  ','.$ilDB->quote($this->getObjectId(), 'integer').
218  ','.$ilDB->quote($this->getFrom(), 'integer').
219  ','.$ilDB->quote($this->getTo(), 'integer').
220  ','.$ilDB->quote($this->getStatus(), 'integer').
221  ','.$ilDB->quote($this->getGroupId(), 'integer').')');
222  }
getStatus()
Get booking status.
getFrom()
Get booking from date.
getUserId()
Get booking user id.
getTo()
Get booking to date.
+ Here is the call graph for this function:

◆ setFrom()

ilBookingReservation::setFrom (   $a_from)

Set booking from date.

Parameters
int$a_from

Definition at line 87 of file class.ilBookingReservation.php.

Referenced by read().

88  {
89  $this->from = (int)$a_from;
90  }
+ Here is the caller graph for this function:

◆ setGroupId()

ilBookingReservation::setGroupId (   $a_group_id)

Set group id.

Parameters
int$a_group_id

Definition at line 162 of file class.ilBookingReservation.php.

Referenced by read().

163  {
164  $this->group_id = $a_group_id;
165  }
+ Here is the caller graph for this function:

◆ setObjectId()

ilBookingReservation::setObjectId (   $a_object_id)

Set object id.

Parameters
int$a_object_id

Definition at line 51 of file class.ilBookingReservation.php.

Referenced by read().

52  {
53  $this->object_id = $a_object_id;
54  }
+ Here is the caller graph for this function:

◆ setStatus()

ilBookingReservation::setStatus (   $a_status)

Set booking status.

Parameters
int$a_status

Definition at line 123 of file class.ilBookingReservation.php.

References isValidStatus().

Referenced by ilCalendarAppointmentGUI\cancelConfirmed(), and read().

124  {
125  if($a_status === NULL)
126  {
127  $this->status = NULL;
128  }
129  if($this->isValidStatus((int)$a_status))
130  {
131  $this->status = (int)$a_status;
132  }
133  }
static isValidStatus($a_status)
Check if given status is valid.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTo()

ilBookingReservation::setTo (   $a_to)

Set booking to date.

Parameters
int$a_to

Definition at line 105 of file class.ilBookingReservation.php.

Referenced by read().

106  {
107  $this->to = (int)$a_to;
108  }
+ Here is the caller graph for this function:

◆ setUserId()

ilBookingReservation::setUserId (   $a_user_id)

Set booking user id.

Parameters
int$a_user_id

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

Referenced by read().

70  {
71  $this->user_id = (int)$a_user_id;
72  }
+ Here is the caller graph for this function:

◆ update()

ilBookingReservation::update ( )

Update entry in db.

Returns
bool

Definition at line 228 of file class.ilBookingReservation.php.

229  {
230  global $ilDB;
231 
232  if(!$this->id)
233  {
234  return false;
235  }
236 
237  /* there can only be 1
238  if($this->getStatus() == self::STATUS_IN_USE)
239  {
240  $ilDB->manipulate('UPDATE booking_reservation'.
241  ' SET status = '.$ilDB->quote(NULL, 'integer').
242  ' WHERE object_id = '.$ilDB->quote($this->getObjectId(), 'integer').
243  ' AND status = '.$ilDB->quote(self::STATUS_IN_USE, 'integer'));
244  }
245  */
246 
247  return $ilDB->manipulate('UPDATE booking_reservation'.
248  ' SET object_id = '.$ilDB->quote($this->getObjectId(), 'text').
249  ', user_id = '.$ilDB->quote($this->getUserId(), 'integer').
250  ', date_from = '.$ilDB->quote($this->getFrom(), 'integer').
251  ', date_to = '.$ilDB->quote($this->getTo(), 'integer').
252  ', status = '.$ilDB->quote($this->getStatus(), 'integer').
253  ', group_id = '.$ilDB->quote($this->getGroupId(), 'integer').
254  ' WHERE booking_reservation_id = '.$ilDB->quote($this->id, 'integer'));
255  }

Field Documentation

◆ $from

ilBookingReservation::$from
protected

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

Referenced by getAvailableObject(), and getFrom().

◆ $group_id

ilBookingReservation::$group_id
protected

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

Referenced by getGroupedList(), and getGroupId().

◆ $id

ilBookingReservation::$id
protected

Definition at line 14 of file class.ilBookingReservation.php.

Referenced by getAvailableObject(), and getId().

◆ $object_id

ilBookingReservation::$object_id
protected

Definition at line 15 of file class.ilBookingReservation.php.

Referenced by getObjectId().

◆ $status

ilBookingReservation::$status
protected

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

Referenced by getStatus().

◆ $to

ilBookingReservation::$to
protected

Definition at line 18 of file class.ilBookingReservation.php.

Referenced by getAvailableObject(), and getTo().

◆ $user_id

ilBookingReservation::$user_id
protected

Definition at line 16 of file class.ilBookingReservation.php.

Referenced by getUserId().

◆ STATUS_CANCELLED

◆ STATUS_IN_USE


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