ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarCategoryAssignments Class Reference
+ Collaboration diagram for ilCalendarCategoryAssignments:

Public Member Functions

 __construct ($a_cal_entry_id)
 Constructor.
 getFirstAssignment ()
 get first assignment
 getAssignments ()
 get assignments
 addAssignment ($a_cal_cat_id)
 add assignment
 deleteAssignment ($a_cat_id)
 delete assignment
 deleteAssignments ()
 delete assignments

Static Public Member Functions

static _lookupCategories ($a_cal_id)
 lookup categories
static _lookupCategory ($a_cal_id)
 Lookup category id.
static _getAssignedAppointments ($a_cat_id)
 lookup appointment ids by calendar
static _getAutoGeneratedAppointmentsByObjId ($a_obj_id)
 get automatic generated appointments of category
static _deleteByAppointmentId ($a_app_id)
 Delete appointment assignment.
static _deleteByCategoryId ($a_cat_id)
 Delete assignments by category id.

Protected Attributes

 $db
 $cal_entry_id = 0
 $assignments = array()

Private Member Functions

 read ()
 read assignments

Detailed Description

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

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

Constructor & Destructor Documentation

ilCalendarCategoryAssignments::__construct (   $a_cal_entry_id)

Constructor.

public

Parameters
intcalendar entry id

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

References read().

{
global $ilDB;
$this->db = $ilDB;
$this->cal_entry_id = $a_cal_entry_id;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCalendarCategoryAssignments::_deleteByAppointmentId (   $a_app_id)
static

Delete appointment assignment.

public

Parameters
intappointment id

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

References $res.

Referenced by ilCalendarAppointmentGUI\delete(), ilCalendarAppEventListener\deleteAppointments(), and ilCalendarCategoryGUI\deleteAppointments().

{
global $ilDB;
$query = "DELETE FROM cal_category_assignments ".
"WHERE cal_id = ".$ilDB->quote($a_app_id)." ";
$res = $ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

static ilCalendarCategoryAssignments::_deleteByCategoryId (   $a_cat_id)
static

Delete assignments by category id.

public

Parameters
intcategory_id
Returns

Definition at line 168 of file class.ilCalendarCategoryAssignments.php.

References $res.

Referenced by ilCalendarCategory\delete().

{
global $ilDB;
$query = "DELETE FROM cal_category_assignments ".
"WHERE cat_id = ".$ilDB->quote($a_cat_id)." ";
$res = $ilDB->query($query);
return true;
}

+ Here is the caller graph for this function:

static ilCalendarCategoryAssignments::_getAssignedAppointments (   $a_cat_id)
static

lookup appointment ids by calendar

public

Parameters
arraycalendar category id(s)
Returns
array int cal entry ids

Definition at line 102 of file class.ilCalendarCategoryAssignments.php.

References $res, DB_FETCHMODE_OBJECT, and ilUtil\quoteArray().

Referenced by ilCalendarCategory\delete(), ilCalendarInboxSharedTableGUI\parse(), and ilCalendarCategoryGUI\showAssignedAppointments().

{
global $ilDB;
$query = "SELECT * FROM cal_category_assignments ".
"WHERE cat_id IN ( ".implode(',',ilUtil::quoteArray($a_cat_id))." )";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$cal_ids[] = $row->cal_id;
}
return $cal_ids ? $cal_ids : array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilCalendarCategoryAssignments::_getAutoGeneratedAppointmentsByObjId (   $a_obj_id)
static

get automatic generated appointments of category

public

Parameters
intobj_id
Returns

Definition at line 125 of file class.ilCalendarCategoryAssignments.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilCalendarAppEventListener\deleteAppointments().

{
global $ilDB;
$query = "SELECT ce.cal_id FROM cal_categories AS cc ".
"JOIN cal_category_assignments AS cca ON cc.cat_id = cca.cat_id ".
"JOIN cal_entries AS ce ON cca.cal_id = ce.cal_id ".
"WHERE auto_generated = 1 ".
"AND obj_id = ".$ilDB->quote($a_obj_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$apps[] = $row->cal_id;
}
return $apps ? $apps : array();
}

+ Here is the caller graph for this function:

static ilCalendarCategoryAssignments::_lookupCategories (   $a_cal_id)
static

lookup categories

public

Parameters
intcal_id
Returns
array of categories

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

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilCalendarHidden\isAppointmentVisible().

{
global $ilDB;
$query = "SELECT cat_id FROM cal_category_assignments ".
"WHERE cal_id = ".$ilDB->quote($a_cal_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$cat_ids[] = $row->cat_id;
}
return $cat_ids ? $cat_ids : array();
}

+ Here is the caller graph for this function:

static ilCalendarCategoryAssignments::_lookupCategory (   $a_cal_id)
static

Lookup category id.

public

Parameters
@return

Definition at line 85 of file class.ilCalendarCategoryAssignments.php.

Referenced by ilCalendarAppointmentGUI\edit(), ilCalendarAppointmentPanelGUI\getHTML(), and ilCalendarAppointmentGUI\showInfoScreen().

{
if(count($cats = self::_lookupCategories($a_cal_id)))
{
return $cats[0];
}
return 0;
}

+ Here is the caller graph for this function:

ilCalendarCategoryAssignments::addAssignment (   $a_cal_cat_id)

add assignment

public

Parameters
intcalendar category id
Returns

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

Referenced by ilCalendarAppEventListener\createAppointments(), ilCalendarAppointmentGUI\save(), and ilICalParser\writeEvent().

{
$query = "INSERT INTO cal_category_assignments ".
"SET cal_id = ".$this->db->quote($this->cal_entry_id).", ".
"cat_id = ".$this->db->quote($a_cal_cat_id)." ";
$this->db->query($query);
$this->assignments[] = (int) $a_cal_cat_id;
return true;
}

+ Here is the caller graph for this function:

ilCalendarCategoryAssignments::deleteAssignment (   $a_cat_id)

delete assignment

public

Parameters
intcalendar category id
Returns

Definition at line 225 of file class.ilCalendarCategoryAssignments.php.

{
$query = "DELETE FROM cal_category_assignments ".
"WHERE cal_id = ".$this->db->quote($this->cal_entry_id).", ".
"AND cat_id = ".$this->db->quote($a_cat_id)." ";
$this->db->query($query);
if(($key = array_search($a_cat_id,$this->assignments)) !== false)
{
unset($this->assignments[$key]);
}
return true;
}
ilCalendarCategoryAssignments::deleteAssignments ( )

delete assignments

public

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

Referenced by ilCalendarAppointmentGUI\update().

{
$query = "DELETE FROM cal_category_assignments ".
"WHERE cal_id = ".$this->db->quote($this->cal_entry_id)." ";
$this->db->query($query);
return true;
}

+ Here is the caller graph for this function:

ilCalendarCategoryAssignments::getAssignments ( )

get assignments

public

Returns

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

{
return $this->assignments ? $this->assignments : array();
}
ilCalendarCategoryAssignments::getFirstAssignment ( )

get first assignment

public

Returns

Definition at line 184 of file class.ilCalendarCategoryAssignments.php.

Referenced by ilCalendarAppointmentGUI\initForm().

{
return isset($this->assignments[0]) ? $this->assignments[0] : false;
}

+ Here is the caller graph for this function:

ilCalendarCategoryAssignments::read ( )
private

read assignments

private

Returns

Definition at line 259 of file class.ilCalendarCategoryAssignments.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

{
$query = "SELECT * FROM cal_category_assignments ".
"WHERE cal_id = ".$this->db->quote($this->cal_entry_id)." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->assignments[] = $row->cat_id;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilCalendarCategoryAssignments::$assignments = array()
protected

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

ilCalendarCategoryAssignments::$cal_entry_id = 0
protected

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

ilCalendarCategoryAssignments::$db
protected

Definition at line 34 of file class.ilCalendarCategoryAssignments.php.


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