ILIAS  Release_4_4_x_branch Revision 61816
 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
 getLocationType ()
 setLocationType ($a_type)
 setRemoteUrl ($a_url)
 getRemoteUrl ()
 setRemoteUser ($a_user)
 getRemoteUser ()
 setRemotePass ($a_pass)
 getRemotePass ()
 setRemoteSyncLastExecution (ilDateTime $dt=null)
 Set remote sync last execution.
 getRemoteSyncLastExecution ()
 Get last execution date of remote sync.
 add ()
 add new category
 update ()
 update
 delete ()
 delete
 validate ()
 validate

Static Public Member Functions

static _getInstanceByObjId ($a_obj_id)
 get instance by obj_id
static getInstanceByCategoryId ($a_cat_id)
 Get instance by category id.
static lookupCategorySortIndex ($a_type_id)
 Lookup sort index of calendar type.
static lookupAppointments ($a_category_id)
 get all assigned appointment ids

Data Fields

const LTYPE_LOCAL = 1
const LTYPE_REMOTE = 2
const DEFAULT_COLOR = '#04427e'
const TYPE_USR = 1
const TYPE_OBJ = 2
const TYPE_GLOBAL = 3
const TYPE_CH = 4
const TYPE_BOOK = 5

Protected Attributes

 $cat_id
 $color
 $type = self::TYPE_USR
 $obj_id
 $obj_type = null
 $title
 $location = self::LTYPE_LOCAL
 $remote_url
 $remote_user
 $remote_pass
 $remote_sync = null
 $db

Static Protected Attributes

static $SORTED_TYPES

Private Member Functions

 read ()
 read

Static Private Attributes

static $instances = null

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 78 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 95 of file class.ilCalendarCategory.php.

References $query, $res, $row, 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 ,'integer')." ".
"AND type = ".$ilDB->quote(self::TYPE_OBJ ,'integer');
$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 331 of file class.ilCalendarCategory.php.

References $cat_id, $query, getColor(), getLocationType(), getObjId(), getRemotePass(), getRemoteSyncLastExecution(), getRemoteUrl(), getRemoteUser(), getTitle(), getType(), IL_CAL_DATETIME, and ilTimeZone\UTC.

{
global $ilDB;
$next_id = $ilDB->nextId('cal_categories');
$query = "INSERT INTO cal_categories (cat_id,obj_id,color,type,title,loc_type,remote_url,remote_user,remote_pass,remote_sync) ".
"VALUES ( ".
$ilDB->quote($next_id,'integer').", ".
$this->db->quote($this->getObjId() ,'integer').", ".
$this->db->quote($this->getColor() ,'text').", ".
$this->db->quote($this->getType() ,'integer').", ".
$this->db->quote($this->getTitle() ,'text').", ".
$this->db->quote($this->getLocationType(),'integer').', '.
$this->db->quote($this->getRemoteUrl(),'text').', '.
$this->db->quote($this->getRemoteUser(),'text').', '.
$this->db->quote($this->getRemotePass(),'text').', '.
$this->db->quote($this->getRemoteSyncLastExecution()->get(IL_CAL_DATETIME,'', ilTimeZone::UTC),'timestamp').' '.
")";
$ilDB->manipulate($query);
$this->cat_id = $next_id;
return $this->cat_id;
}

+ Here is the call graph for this function:

ilCalendarCategory::delete ( )

delete

public

Returns

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

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

{
global $ilDB;
$query = "DELETE FROM cal_categories ".
"WHERE cat_id = ".$this->db->quote($this->cat_id ,'integer')." ";
$res = $ilDB->manipulate($query);
include_once('./Services/Calendar/classes/class.ilCalendarHidden.php');
include_once('./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
foreach(ilCalendarCategoryAssignments::_getAssignedAppointments(array($this->cat_id)) as $app_id)
{
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 157 of file class.ilCalendarCategory.php.

References $cat_id.

Referenced by ilCalendarRemoteReader\importIcal(), and read().

{
return $this->cat_id;
}

+ Here is the caller graph for this function:

ilCalendarCategory::getColor ( )

get color

public

Returns

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

References $color.

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

{
return $this->color;
}

+ Here is the caller graph for this function:

static ilCalendarCategory::getInstanceByCategoryId (   $a_cat_id)
static

Get instance by category id.

Parameters
int$a_cat_id
Returns
ilCalendarCategory

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

Referenced by ilCalendarExport\buildAppointmentUrl().

{
if(!self::$instances[$a_cat_id])
{
return self::$instances[$a_cat_id] = new ilCalendarCategory($a_cat_id);
}
return self::$instances[$a_cat_id];
}

+ Here is the caller graph for this function:

ilCalendarCategory::getLocationType ( )

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

References $location.

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

{
}

+ Here is the caller graph for this function:

ilCalendarCategory::getObjId ( )

get obj_id

public

Returns

Definition at line 247 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 257 of file class.ilCalendarCategory.php.

References $obj_type.

{
}
ilCalendarCategory::getRemotePass ( )

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

References $remote_pass.

Referenced by add(), ilCalendarCategoryGUI\doSynchronisation(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarCategory::getRemoteSyncLastExecution ( )

Get last execution date of remote sync.

Returns

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

References $remote_sync.

Referenced by add(), and update().

{
if($this->remote_sync instanceof ilDateTime)
{
}
return new ilDateTime();
}

+ Here is the caller graph for this function:

ilCalendarCategory::getRemoteUrl ( )

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

References $remote_url.

Referenced by add(), ilCalendarCategoryGUI\doSynchronisation(), update(), and validate().

{
}

+ Here is the caller graph for this function:

ilCalendarCategory::getRemoteUser ( )

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

References $remote_user.

Referenced by add(), ilCalendarCategoryGUI\doSynchronisation(), and update().

{
}

+ Here is the caller graph for this function:

ilCalendarCategory::getTitle ( )

get title

public

Returns
string title

Definition at line 180 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 225 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:

static ilCalendarCategory::lookupAppointments (   $a_category_id)
static

get all assigned appointment ids

Returns
Parameters
object$a_category_id

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT * FROM cal_cat_assignments ".
'WHERE cat_id = '.$ilDB->quote($a_category_id,'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$apps[] = $row->cal_id;
}
return $apps ? $apps : array();
}
static ilCalendarCategory::lookupCategorySortIndex (   $a_type_id)
static

Lookup sort index of calendar type.

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

Referenced by ilCalendarSelectionBlockGUI\getCalendars(), ilCalendarCategoryTableGUI\parse(), and ilCalendarManageTableGUI\parse().

{
return array_search($a_type_id, self::$SORTED_TYPES);
}

+ Here is the caller graph for this function:

ilCalendarCategory::read ( )
private

read

protected

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

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

Referenced by __construct().

{
global $ilDB;
if(!$this->cat_id)
{
return true;
}
$query = "SELECT * FROM cal_categories ".
"WHERE cat_id = ".$this->db->quote($this->getCategoryID() ,'integer')." ";
$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;
$this->location = $row->loc_type;
$this->remote_url = $row->remote_url;
$this->remote_user = $row->remote_user;
$this->remote_pass = $row->remote_pass;
if($row->remote_sync)
{
$this->remote_sync = new ilDateTime($row->remote_sync,IL_CAL_DATETIME,'UTC');
}
else
{
$this->remote_sync = new ilDateTime();
}
}
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 192 of file class.ilCalendarCategory.php.

{
$this->color = $a_color;
}
ilCalendarCategory::setLocationType (   $a_type)

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

{
$this->location = $a_type;
}
ilCalendarCategory::setObjId (   $a_obj_id)

set obj id

public

Parameters
intobj_id

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

{
$this->obj_id = $a_obj_id;
}
ilCalendarCategory::setRemotePass (   $a_pass)

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

{
$this->remote_pass = $a_pass;
}
ilCalendarCategory::setRemoteSyncLastExecution ( ilDateTime  $dt = null)

Set remote sync last execution.

Parameters
ilDateTime$dt

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

{
$this->remote_sync = $dt;
}
ilCalendarCategory::setRemoteUrl (   $a_url)

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

{
$this->remote_url = $a_url;
}
ilCalendarCategory::setRemoteUser (   $a_user)

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

{
$this->remote_user = $a_user;
}
ilCalendarCategory::setTitle (   $a_title)

set title

public

Parameters
stringtitle
Returns

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

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

set type

public

Parameters
inttype

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

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

update

public

Returns

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

References $query, $res, getColor(), getLocationType(), getObjId(), getRemotePass(), getRemoteSyncLastExecution(), getRemoteUrl(), getRemoteUser(), getTitle(), getType(), IL_CAL_DATETIME, and ilTimeZone\UTC.

{
global $ilDB;
$query = "UPDATE cal_categories ".
"SET obj_id = ".$this->db->quote($this->getObjId() ,'integer').", ".
"color = ".$this->db->quote($this->getColor() ,'text').", ".
"type = ".$this->db->quote($this->getType() ,'integer').", ".
"title = ".$this->db->quote($this->getTitle() ,'text').", ".
"loc_type = ".$this->db->quote($this->getLocationType(),'integer').', '.
"remote_url = ".$this->db->quote($this->getRemoteUrl(),'text').', '.
"remote_user = ".$this->db->quote($this->getRemoteUser(),'text').', '.
"remote_pass = ".$this->db->quote($this->getRemotePass(),'text').', '.
'remote_sync = '.$this->db->quote($this->getRemoteSyncLastExecution()->get(IL_CAL_DATETIME,'', ilTimeZone::UTC),'timestamp').' '.
"WHERE cat_id = ".$this->db->quote($this->cat_id ,'integer')." ";
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

ilCalendarCategory::validate ( )

validate

public

Returns
bool

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

References getColor(), getLocationType(), getRemoteUrl(), getTitle(), getType(), and LTYPE_REMOTE.

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

+ Here is the call graph for this function:

Field Documentation

ilCalendarCategory::$cat_id
protected

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

Referenced by add(), and getCategoryID().

ilCalendarCategory::$color
protected

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

Referenced by getColor().

ilCalendarCategory::$db
protected

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

ilCalendarCategory::$instances = null
staticprivate

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

ilCalendarCategory::$location = self::LTYPE_LOCAL
protected

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

Referenced by getLocationType().

ilCalendarCategory::$obj_id
protected

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

Referenced by getObjId().

ilCalendarCategory::$obj_type = null
protected

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

Referenced by getObjType().

ilCalendarCategory::$remote_pass
protected

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

Referenced by getRemotePass().

ilCalendarCategory::$remote_sync = null
protected

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

Referenced by getRemoteSyncLastExecution().

ilCalendarCategory::$remote_url
protected

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

Referenced by getRemoteUrl().

ilCalendarCategory::$remote_user
protected

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

Referenced by getRemoteUser().

ilCalendarCategory::$SORTED_TYPES
staticprotected
Initial value:
array(
0 => self::TYPE_GLOBAL,
1 => self::TYPE_USR,
2 => self::TYPE_CH,
3 => self::TYPE_BOOK,
4 => self::TYPE_OBJ
)

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

ilCalendarCategory::$title
protected

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

Referenced by getTitle().

ilCalendarCategory::$type = self::TYPE_USR
protected

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

Referenced by getType().

const ilCalendarCategory::DEFAULT_COLOR = '#04427e'
const ilCalendarCategory::LTYPE_LOCAL = 1

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

Referenced by ilCalendarCategoryGUI\initFormCategory().


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