ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarCategory Class Reference

Stores calendar categories. More...

+ Collaboration diagram for ilCalendarCategory:

Public Member Functions

 __construct ($a_cat_id=0)
 Constructor.
 getCategoryID ()
 get category id
 setTitle ($a_title)
 set title
 getTitle ()
 get title
 setColor ($a_color)
 set color
 getColor ()
 get color
 setType ($a_type)
 set type
 getType ()
 get type
 setObjId ($a_obj_id)
 set obj id
 getObjId ()
 get obj_id
 getObjType ()
 get type
 add ()
 add new category
 update ()
 update
 delete ()
 delete
 validate ()
 validate

Static Public Member Functions

static _getInstanceByObjId ($a_obj_id)
 get instance by obj_id

Data Fields

const DEFAULT_COLOR = '#04427e'
const TYPE_USR = 1
const TYPE_OBJ = 2
const TYPE_GLOBAL = 3

Protected Attributes

 $cat_id
 $color
 $type = self::TYPE_USR
 $obj_id
 $obj_type = null
 $title
 $db

Private Member Functions

 read ()
 read

Detailed Description

Stores calendar categories.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 33 of file class.ilCalendarCategory.php.

Constructor & Destructor Documentation

ilCalendarCategory::__construct (   $a_cat_id = 0)

Constructor.

public

Definition at line 56 of file class.ilCalendarCategory.php.

References read().

{
global $ilDB;
$this->db = $ilDB;
$this->cat_id = $a_cat_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCalendarCategory::_getInstanceByObjId (   $a_obj_id)
static

get instance by obj_id

Parameters
intobj_id
Returns
object

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

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilCalendarAppEventListener\updateCategory().

{
global $ilDB;
$query = "SELECT cat_id FROM cal_categories ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND type = ".$ilDB->quote(self::TYPE_OBJ);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return new ilCalendarCategory($row->cat_id);
}
return null;
}

+ Here is the caller graph for this function:

ilCalendarCategory::add ( )

add new category

public

Returns

Definition at line 207 of file class.ilCalendarCategory.php.

References $cat_id, getColor(), getObjId(), getTitle(), and getType().

{
$query = "INSERT INTO cal_categories ".
"SET obj_id = ".$this->db->quote($this->getObjId()).", ".
"color = ".$this->db->quote($this->getColor()).", ".
"type = ".$this->db->quote($this->getType()).", ".
"title = ".$this->db->quote($this->getTitle())." ";
$this->db->query($query);
$this->cat_id = $this->db->getLastInsertId();
return $this->cat_id;
}

+ Here is the call graph for this function:

ilCalendarCategory::delete ( )

delete

public

Returns

Definition at line 244 of file class.ilCalendarCategory.php.

References ilCalendarEntry\_delete(), ilCalendarCategoryAssignments\_deleteByCategoryId(), ilCalendarHidden\_deleteCategories(), and ilCalendarCategoryAssignments\_getAssignedAppointments().

{
$query = "DELETE FROM cal_categories ".
"WHERE cat_id = ".$this->db->quote($this->cat_id)." ";
$this->db->query($query);
include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
{
include_once('./Services/Calendar/classes/class.ilCalendarEntry.php');
}
}

+ Here is the call graph for this function:

ilCalendarCategory::getCategoryID ( )

get category id

public

Returns
int category id

Definition at line 95 of file class.ilCalendarCategory.php.

References $cat_id.

Referenced by read().

{
return $this->cat_id;
}

+ Here is the caller graph for this function:

ilCalendarCategory::getColor ( )

get color

public

Returns

Definition at line 141 of file class.ilCalendarCategory.php.

References $color.

Referenced by add(), update(), and validate().

{
return $this->color;
}

+ Here is the caller graph for this function:

ilCalendarCategory::getObjId ( )

get obj_id

public

Returns

Definition at line 185 of file class.ilCalendarCategory.php.

References $obj_id.

Referenced by add(), read(), and update().

{
return $this->obj_id;
}

+ Here is the caller graph for this function:

ilCalendarCategory::getObjType ( )

get type

public

Definition at line 195 of file class.ilCalendarCategory.php.

References $obj_type.

{
}
ilCalendarCategory::getTitle ( )

get title

public

Returns
string title

Definition at line 118 of file class.ilCalendarCategory.php.

References $title.

Referenced by add(), update(), and validate().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilCalendarCategory::getType ( )

get type

public

Returns

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

References $type.

Referenced by add(), read(), update(), and validate().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilCalendarCategory::read ( )
private

read

protected

Definition at line 278 of file class.ilCalendarCategory.php.

References $res, ilObject\_lookupTitle(), ilObject\_lookupType(), DB_FETCHMODE_OBJECT, getCategoryID(), getObjId(), getType(), and TYPE_OBJ.

Referenced by __construct().

{
if(!$this->cat_id)
{
return true;
}
$query = "SELECT * FROM cal_categories ".
"WHERE cat_id = ".$this->db->quote($this->getCategoryID())." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->cat_id = $row->cat_id;
$this->obj_id = $row->obj_id;
$this->type = $row->type;
$this->color = $row->color;
$this->title = $row->title;
}
if($this->getType() == self::TYPE_OBJ)
{
$this->title = ilObject::_lookupTitle($this->getObjId());
$this->obj_type = ilObject::_lookupType($this->getObjId());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarCategory::setColor (   $a_color)

set color

public

Parameters
stringcolor

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

{
$this->color = $a_color;
}
ilCalendarCategory::setObjId (   $a_obj_id)

set obj id

public

Parameters
intobj_id

Definition at line 174 of file class.ilCalendarCategory.php.

{
$this->obj_id = $a_obj_id;
}
ilCalendarCategory::setTitle (   $a_title)

set title

public

Parameters
stringtitle
Returns

Definition at line 107 of file class.ilCalendarCategory.php.

{
$this->title = $a_title;
}
ilCalendarCategory::setType (   $a_type)

set type

public

Parameters
inttype

Definition at line 152 of file class.ilCalendarCategory.php.

{
$this->type = $a_type;
}
ilCalendarCategory::update ( )

update

public

Returns

Definition at line 226 of file class.ilCalendarCategory.php.

References getColor(), getObjId(), getTitle(), and getType().

{
$query = "UPDATE cal_categories ".
"SET obj_id = ".$this->db->quote($this->getObjId()).", ".
"color = ".$this->db->quote($this->getColor()).", ".
"type = ".$this->db->quote($this->getType()).", ".
"title = ".$this->db->quote($this->getTitle())." ".
"WHERE cat_id = ".$this->db->quote($this->cat_id)." ";
$this->db->query($query);
return true;
}

+ Here is the call graph for this function:

ilCalendarCategory::validate ( )

validate

public

Returns
bool

Definition at line 268 of file class.ilCalendarCategory.php.

References getColor(), getTitle(), and getType().

{
return strlen($this->getTitle()) and strlen($this->getColor()) and $this->getType();
}

+ Here is the call graph for this function:

Field Documentation

ilCalendarCategory::$cat_id
protected

Definition at line 41 of file class.ilCalendarCategory.php.

Referenced by add(), and getCategoryID().

ilCalendarCategory::$color
protected

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

Referenced by getColor().

ilCalendarCategory::$db
protected

Definition at line 48 of file class.ilCalendarCategory.php.

ilCalendarCategory::$obj_id
protected

Definition at line 44 of file class.ilCalendarCategory.php.

Referenced by getObjId().

ilCalendarCategory::$obj_type = null
protected

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

Referenced by getObjType().

ilCalendarCategory::$title
protected

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

Referenced by getTitle().

ilCalendarCategory::$type = self::TYPE_USR
protected

Definition at line 43 of file class.ilCalendarCategory.php.

Referenced by getType().

const ilCalendarCategory::DEFAULT_COLOR = '#04427e'

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