ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBookingObject Class Reference

a bookable ressource More...

+ Collaboration diagram for ilBookingObject:

Public Member Functions

 __construct ($a_id=NULL)
 Constructor.
 setTitle ($a_title)
 Set object title.
 getTitle ()
 Get object title.
 setTypeId ($a_type_id)
 Set booking type id.
 getTypeId ()
 Get booking type id.
 setScheduleId ($a_schedule_id)
 Set booking schedule id.
 getScheduleId ()
 Get booking schedule id.
 save ()
 Create new entry in db.
 update ()
 Update entry in db.
 delete ()
 Delete single entry.
 getByPoolId ($a_pool_id)
 Get all objects for given pool.

Static Public Member Functions

static getList ($a_type_id)
 Get list of booking objects for given type.
static updateSchedule ($a_type_id, $a_schedule_id=0)
 Remove/Update schedule for objects of given type.

Protected Member Functions

 read ()
 Get dataset from db.

Protected Attributes

 $id
 $title
 $type_id
 $schedule_id

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

ilBookingObject::__construct (   $a_id = NULL)

Constructor.

if id is given will read dataset from db

Parameters
int$a_id

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

References read().

{
$this->id = (int)$a_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilBookingObject::delete ( )

Delete single entry.

Returns
bool

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

References $ilDB.

{
global $ilDB;
if($this->id)
{
return $ilDB->manipulate('DELETE FROM booking_object'.
' WHERE booking_object_id = '.$ilDB->quote($this->id, 'integer'));
}
}
ilBookingObject::getByPoolId (   $a_pool_id)

Get all objects for given pool.

Parameters
int$a_pool_id
Returns
array

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

References $ilDB, and $row.

Referenced by ilBookingReservationsTableGUI\getItems().

{
global $ilDB;
$set = $ilDB->query('SELECT booking_object_id'.
' FROM booking_object o'.
' JOIN booking_type t ON (o.type_id = t.booking_type_id)'.
' WHERE t.pool_id = '.$ilDB->quote($a_pool_id, 'integer'));
$ids = array();
while($row = $ilDB->fetchAssoc($set))
{
$ids[] = $row['booking_object_id'];
}
return $ids;
}

+ Here is the caller graph for this function:

static ilBookingObject::getList (   $a_type_id)
static

Get list of booking objects for given type.

Parameters
int$a_type_id
Returns
array

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

References $ilDB, $res, and $row.

Referenced by ilObjBookingPoolGUI\confirmedBookingObject(), ilBookingObjectsTableGUI\getItems(), and ilObjBookingPoolGUI\renderBookingByType().

{
global $ilDB;
$set = $ilDB->query('SELECT booking_object_id,title,schedule_id'.
' FROM booking_object'.
' WHERE type_id = '.$ilDB->quote($a_type_id, 'integer').
' ORDER BY title');
$res = array();
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row;
}
return $res;
}

+ Here is the caller graph for this function:

ilBookingObject::getScheduleId ( )

Get booking schedule id.

Returns
int

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

References $schedule_id.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilBookingObject::getTitle ( )

Get object title.

Returns
string

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

References $title.

Referenced by save().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilBookingObject::getTypeId ( )

Get booking type id.

Returns
int

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

References $type_id.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilBookingObject::read ( )
protected

Get dataset from db.

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

References $ilDB, $row, setScheduleId(), setTitle(), and setTypeId().

Referenced by __construct().

{
global $ilDB;
if($this->id)
{
$set = $ilDB->query('SELECT title,type_id,schedule_id'.
' FROM booking_object'.
' WHERE booking_object_id = '.$ilDB->quote($this->id, 'integer'));
$row = $ilDB->fetchAssoc($set);
$this->setTitle($row['title']);
$this->setTypeId($row['type_id']);
$this->setScheduleId($row['schedule_id']);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingObject::save ( )

Create new entry in db.

Returns
bool

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

References $id, $ilDB, getScheduleId(), getTitle(), and getTypeId().

{
global $ilDB;
if($this->id)
{
return false;
}
$id = $ilDB->nextId('booking_object');
return $ilDB->manipulate('INSERT INTO booking_object'.
' (booking_object_id,title,type_id,schedule_id)'.
' VALUES ('.$ilDB->quote($id, 'integer').','.$ilDB->quote($this->getTitle(), 'text').
','.$ilDB->quote($this->getTypeId(), 'integer').','.$ilDB->quote($this->getScheduleId(), 'integer').')');
}

+ Here is the call graph for this function:

ilBookingObject::setScheduleId (   $a_schedule_id)

Set booking schedule id.

Parameters
int$a_schedule_id

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

Referenced by read().

{
$this->schedule_id = (int)$a_schedule_id;
}

+ Here is the caller graph for this function:

ilBookingObject::setTitle (   $a_title)

Set object title.

Parameters
string$a_title

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

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

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilBookingObject::setTypeId (   $a_type_id)

Set booking type id.

Parameters
int$a_type_id

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

Referenced by read().

{
$this->type_id = (int)$a_type_id;
}

+ Here is the caller graph for this function:

ilBookingObject::update ( )

Update entry in db.

Returns
bool

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

References $ilDB.

{
global $ilDB;
if(!$this->id)
{
return false;
}
return $ilDB->manipulate('UPDATE booking_object'.
' SET title = '.$ilDB->quote($this->getTitle(), 'text').
', type_id = '.$ilDB->quote($this->getTypeId(), 'integer').
', schedule_id = '.$ilDB->quote($this->getScheduleId(), 'integer').
' WHERE booking_object_id = '.$ilDB->quote($this->id, 'integer'));
}
static ilBookingObject::updateSchedule (   $a_type_id,
  $a_schedule_id = 0 
)
static

Remove/Update schedule for objects of given type.

Parameters
int$a_type_id
Returns
bool

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

References $ilDB.

Referenced by ilBookingType\update().

{
global $ilDB;
return $ilDB->manipulate('UPDATE booking_object'.
' SET schedule_id = '.$ilDB->quote($a_schedule_id, 'integer').
' WHERE type_id = '.$ilDB->quote($a_type_id, 'integer').
' ORDER BY title');
}

+ Here is the caller graph for this function:

Field Documentation

ilBookingObject::$id
protected

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

Referenced by save().

ilBookingObject::$schedule_id
protected

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

Referenced by getScheduleId().

ilBookingObject::$title
protected

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

Referenced by getTitle().

ilBookingObject::$type_id
protected

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

Referenced by getTypeId().


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