ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilBookingType Class Reference

Booking category. More...

+ Collaboration diagram for ilBookingType:

Public Member Functions

 __construct ($a_id=NULL)
 Constructor.
 getId ()
 Get id.
 setTitle ($a_title)
 Set title.
 getTitle ()
 Get title.
 setPoolId ($a_pool_id)
 Set booking pool id (aka parent obj ref id)
 getPoolId ()
 Get booking pool 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.

Static Public Member Functions

static getList ($a_pool_id)
 Get list of booking types for given pool.

Protected Member Functions

 read ()
 Get dataset from db.

Protected Attributes

 $id
 $title
 $pool_id
 $schedule_id

Detailed Description

Booking category.

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

Constructor & Destructor Documentation

ilBookingType::__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.ilBookingType.php.

References read().

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

+ Here is the call graph for this function:

Member Function Documentation

ilBookingType::delete ( )

Delete single entry.

Returns
bool

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

References $ilDB.

{
global $ilDB;
if($this->id)
{
return $ilDB->manipulate('DELETE FROM booking_type'.
' WHERE booking_type_id = '.$ilDB->quote($this->id, 'integer'));
}
}
ilBookingType::getId ( )

Get id.

Returns
int

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

References $id.

{
return $this->id;
}
static ilBookingType::getList (   $a_pool_id)
static

Get list of booking types for given pool.

Parameters
int$a_pool_id
Returns
array

Definition at line 163 of file class.ilBookingType.php.

References $ilDB, $res, and $row.

Referenced by ilBookingTypesTableGUI\getItems(), and ilBookingReservationsTableGUI\initFilter().

{
global $ilDB;
$set = $ilDB->query('SELECT booking_type.title, booking_type_id,booking_type.schedule_id,'.
' CASE WHEN type_id IS NULL THEN 0 ELSE COUNT(*) END AS counter'.
' FROM booking_type'.
' LEFT JOIN booking_object ON (type_id = booking_type_id)'.
' WHERE pool_id = '.$ilDB->quote($a_pool_id, 'integer').
' GROUP BY booking_type_id,booking_type.title,type_id,booking_type.schedule_id'.
' ORDER BY booking_type.title');
$res = array();
while($row = $ilDB->fetchAssoc($set))
{
$res[] = $row;
}
return $res;
}

+ Here is the caller graph for this function:

ilBookingType::getPoolId ( )

Get booking pool id.

Returns
int

Definition at line 73 of file class.ilBookingType.php.

References $pool_id.

Referenced by save().

{
}

+ Here is the caller graph for this function:

ilBookingType::getScheduleId ( )

Get booking schedule id.

Returns
int

Definition at line 91 of file class.ilBookingType.php.

References $schedule_id.

Referenced by save(), and update().

{
}

+ Here is the caller graph for this function:

ilBookingType::getTitle ( )

Get title.

Returns
string

Definition at line 55 of file class.ilBookingType.php.

References $title.

Referenced by save().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilBookingType::read ( )
protected

Get dataset from db.

Definition at line 99 of file class.ilBookingType.php.

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

Referenced by __construct().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilBookingType::save ( )

Create new entry in db.

Returns
bool

Definition at line 119 of file class.ilBookingType.php.

References $ilDB, getPoolId(), getScheduleId(), and getTitle().

{
global $ilDB;
$this->id = $ilDB->nextId('booking_type');
return $ilDB->manipulate('INSERT INTO booking_type (booking_type_id,title,pool_id,'.
'schedule_id) VALUES ('.$ilDB->quote($this->id, 'integer').','.$ilDB->quote($this->getTitle(), 'text').
','.$ilDB->quote($this->getPoolId(), 'integer').','.$ilDB->quote($this->getScheduleId(), 'integer').')');
}

+ Here is the call graph for this function:

ilBookingType::setPoolId (   $a_pool_id)

Set booking pool id (aka parent obj ref id)

Parameters
int$a_type_id

Definition at line 64 of file class.ilBookingType.php.

Referenced by read().

{
$this->pool_id = (int)$a_pool_id;
}

+ Here is the caller graph for this function:

ilBookingType::setScheduleId (   $a_schedule_id)

Set booking schedule id.

Parameters
int$a_schedule_id

Definition at line 82 of file class.ilBookingType.php.

Referenced by read().

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

+ Here is the caller graph for this function:

ilBookingType::setTitle (   $a_title)

Set title.

Parameters
string$a_title

Definition at line 46 of file class.ilBookingType.php.

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

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilBookingType::update ( )

Update entry in db.

Returns
bool

Definition at line 134 of file class.ilBookingType.php.

References $ilDB, getScheduleId(), and ilBookingObject\updateSchedule().

{
global $ilDB;
$set = $ilDB->query('SELECT schedule_id'.
' FROM booking_type'.
' WHERE booking_type_id = '.$ilDB->quote($this->id, 'integer'));
$schedule = $ilDB->fetchAssoc($set);
$schedule = $schedule["schedule_id"];
if(($this->getScheduleId() && !$schedule) ||
(!$this->getScheduleId() && $schedule))
{
include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
ilBookingObject::updateSchedule($this->id, $schedule);
}
return $ilDB->manipulate('UPDATE booking_type'.
' SET title = '.$ilDB->quote($this->getTitle(), 'text').
', pool_id = '.$ilDB->quote($this->getPoolId(), 'integer').
', schedule_id = '.$ilDB->quote($this->getScheduleId(), 'integer').
' WHERE booking_type_id = '.$ilDB->quote($this->id, 'integer'));
}

+ Here is the call graph for this function:

Field Documentation

ilBookingType::$id
protected

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

Referenced by getId().

ilBookingType::$pool_id
protected

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

Referenced by getPoolId().

ilBookingType::$schedule_id
protected

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

Referenced by getScheduleId().

ilBookingType::$title
protected

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

Referenced by getTitle().


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