ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarAppointmentColors Class Reference
+ Collaboration diagram for ilCalendarAppointmentColors:

Public Member Functions

 __construct ($a_user_id)
 Constructor.
 getColorByAppointment ($a_cal_id)
 get color by appointment

Static Public Member Functions

static _getRandomColorByType ($a_type)
 get random color entry for type
static dumpColors ()
 public
static _getColorsByType ($a_type)
 get selectable colors

Protected Attributes

 $db
 $user_id
 $appointment_colors

Static Protected Attributes

static $colors

Private Member Functions

 read ()
 read

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 34 of file class.ilCalendarAppointmentColors.php.

Constructor & Destructor Documentation

ilCalendarAppointmentColors::__construct (   $a_user_id)

Constructor.

public

Parameters
intuser_id
Returns

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

References $ilDB, ilCalendarCategories\_getInstance(), and read().

{
global $ilDB;
$this->db = $ilDB;
$this->user_id = $a_user_id;
$this->categories = ilCalendarCategories::_getInstance();
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

static ilCalendarAppointmentColors::_getColorsByType (   $a_type)
static

get selectable colors

public

Parameters
@return

Definition at line 190 of file class.ilCalendarAppointmentColors.php.

Referenced by ilObjBookingPoolGUI\renderList().

{
return self::$colors[$a_type];
}

+ Here is the caller graph for this function:

static ilCalendarAppointmentColors::_getRandomColorByType (   $a_type)
static

get random color entry for type

public

Parameters
@return

Definition at line 157 of file class.ilCalendarAppointmentColors.php.

Referenced by ilCalendarAppEventListener\createCategory().

{
return self::$colors[$a_type][rand(0,count(self::$colors[$a_type]) - 1)];
}

+ Here is the caller graph for this function:

static ilCalendarAppointmentColors::dumpColors ( )
static

public

Parameters
@return

Definition at line 170 of file class.ilCalendarAppointmentColors.php.

{
foreach(self::$colors['grp'] as $color)
{
echo '<font color="'.$color.'">HALLO</font><br/>';
}
foreach(self::$colors['crs'] as $color)
{
echo '<font color="'.$color.'">HALLO</font><br/>';
}
}
ilCalendarAppointmentColors::getColorByAppointment (   $a_cal_id)

get color by appointment

public

Parameters
intcalendar appointment id
Returns

Definition at line 104 of file class.ilCalendarAppointmentColors.php.

{
$cat_id = $this->cat_app_ass[$a_cal_id];
$cat_id = $this->cat_substitutions[$cat_id];
return isset($this->appointment_colors[$cat_id]) ? $this->appointment_colors[$cat_id] : 'red';
}
ilCalendarAppointmentColors::read ( )
private

read

private

Parameters
@return

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

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

Referenced by __construct().

{
global $ilDB;
// Store assignment of subitem categories
foreach($this->categories->getCategoriesInfo() as $c_data)
{
if(isset($c_data['subitem_ids']) and count($c_data['subitem_ids']))
{
foreach($c_data['subitem_ids'] as $sub_item_id)
{
$this->cat_substitutions[$sub_item_id] = $c_data['cat_id'];
}
}
$this->cat_substitutions[$c_data['cat_id']] = $c_data['cat_id'];
}
$query = "SELECT cat.cat_id,cat.color, ass.cal_id FROM cal_categories cat ".
"JOIN cal_cat_assignments ass ON cat.cat_id = ass.cat_id ".
"WHERE ".$ilDB->in('cat.cat_id',$this->categories->getCategories(true),false,'integer');
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->appointment_colors[$row->cat_id] = $row->color;
$this->cat_app_ass[$row->cal_id] = $row->cat_id;
}
}

+ Here is the caller graph for this function:

Field Documentation

ilCalendarAppointmentColors::$appointment_colors
protected

Definition at line 76 of file class.ilCalendarAppointmentColors.php.

ilCalendarAppointmentColors::$colors
staticprotected

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

ilCalendarAppointmentColors::$db
protected

Definition at line 74 of file class.ilCalendarAppointmentColors.php.

ilCalendarAppointmentColors::$user_id
protected

Definition at line 75 of file class.ilCalendarAppointmentColors.php.


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