ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilCalendarAppointmentColors Class Reference
+ Collaboration diagram for ilCalendarAppointmentColors:

Public Member Functions

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

Static Public Member Functions

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

Protected Attributes

 $db
 
 $user_id
 
 $appointment_colors
 

Static Protected Attributes

static $colors
 

Private Member Functions

 read ()
 read More...
 

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

◆ __construct()

ilCalendarAppointmentColors::__construct (   $a_user_id)

Constructor.

public

Parameters
intuser_id
Returns

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

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

91  {
92  global $ilDB;
93 
94  $this->db = $ilDB;
95 
96  $this->user_id = $a_user_id;
97 
98  $this->categories = ilCalendarCategories::_getInstance();
99  $this->read();
100  }
static _getInstance($a_usr_id=0)
get singleton instance
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ _getColorsByType()

static ilCalendarAppointmentColors::_getColorsByType (   $a_type)
static

get selectable colors

public

Parameters

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

Referenced by ilObjBookingPoolGUI\renderSlots().

196  {
197  return self::$colors[$a_type];
198  }
+ Here is the caller graph for this function:

◆ _getRandomColorByType()

static ilCalendarAppointmentColors::_getRandomColorByType (   $a_type)
static

get random color entry for type

public

Parameters

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

Referenced by ilCalendarAppEventListener\createCategory().

163  {
164  return self::$colors[$a_type][rand(0,count(self::$colors[$a_type]) - 1)];
165  }
+ Here is the caller graph for this function:

◆ dumpColors()

static ilCalendarAppointmentColors::dumpColors ( )
static

public

Parameters

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

176  {
177  foreach(self::$colors['grp'] as $color)
178  {
179  echo '<font color="'.$color.'">HALLO</font><br/>';
180  }
181  foreach(self::$colors['crs'] as $color)
182  {
183  echo '<font color="'.$color.'">HALLO</font><br/>';
184  }
185  }

◆ getColorByAppointment()

ilCalendarAppointmentColors::getColorByAppointment (   $a_cal_id)

get color by appointment

public

Parameters
intcalendar appointment id
Returns

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

110  {
111  $cat_id = $this->cat_app_ass[$a_cal_id];
112  $cat_id = $this->cat_substitutions[$cat_id];
113 
114  return isset($this->appointment_colors[$cat_id]) ? $this->appointment_colors[$cat_id] : 'red';
115  }

◆ read()

ilCalendarAppointmentColors::read ( )
private

read

private

Parameters

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

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

Referenced by __construct().

125  {
126  global $ilDB;
127 
128  // Store assignment of subitem categories
129  foreach($this->categories->getCategoriesInfo() as $c_data)
130  {
131  if(isset($c_data['subitem_ids']) and count($c_data['subitem_ids']))
132  {
133  foreach($c_data['subitem_ids'] as $sub_item_id)
134  {
135  $this->cat_substitutions[$sub_item_id] = $c_data['cat_id'];
136  }
137 
138  }
139  $this->cat_substitutions[$c_data['cat_id']] = $c_data['cat_id'];
140  }
141 
142  $query = "SELECT cat.cat_id,cat.color, ass.cal_id FROM cal_categories cat ".
143  "JOIN cal_cat_assignments ass ON cat.cat_id = ass.cat_id ".
144  "WHERE ".$ilDB->in('cat.cat_id',$this->categories->getCategories(true),false,'integer');
145 
146  $res = $this->db->query($query);
147  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
148  {
149  $this->appointment_colors[$row->cat_id] = $row->color;
150  $this->cat_app_ass[$row->cal_id] = $row->cat_id;
151  }
152  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

Field Documentation

◆ $appointment_colors

ilCalendarAppointmentColors::$appointment_colors
protected

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

◆ $colors

ilCalendarAppointmentColors::$colors
staticprotected

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

◆ $db

ilCalendarAppointmentColors::$db
protected

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

◆ $user_id

ilCalendarAppointmentColors::$user_id
protected

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


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