ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 ()
 @access 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.

@access public

Parameters
intuser_id
Returns

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getColorsByType()

static ilCalendarAppointmentColors::_getColorsByType (   $a_type)
static

get selectable colors

@access public

Parameters

return

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

206 {
207 return self::$colors[$a_type];
208 }

Referenced by ilObjBookingPoolGUI\renderSlots().

+ Here is the caller graph for this function:

◆ _getRandomColorByType()

static ilCalendarAppointmentColors::_getRandomColorByType (   $a_type)
static

get random color entry for type

@access public

Parameters

return

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

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

Referenced by ilCalendarAppEventListener\createCategory().

+ Here is the caller graph for this function:

◆ dumpColors()

static ilCalendarAppointmentColors::dumpColors ( )
static

@access public

Parameters

return

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

186 {
187 foreach(self::$colors['grp'] as $color)
188 {
189 echo '<font color="'.$color.'">HALLO</font><br/>';
190 }
191 foreach(self::$colors['crs'] as $color)
192 {
193 echo '<font color="'.$color.'">HALLO</font><br/>';
194 }
195 }

◆ getColorByAppointment()

ilCalendarAppointmentColors::getColorByAppointment (   $a_cal_id)

get color by appointment

@access 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 #18647 and #21078
115 if(isset($this->appointment_colors[$cat_id])) {
116 return $this->appointment_colors[$cat_id];
117 } else if(isset($this->cat_substitutions_colors[$cat_id])) {
118 return $this->cat_substitutions_colors[$cat_id];
119 } else {
120 return 'red';
121 }
122
123 }

◆ read()

ilCalendarAppointmentColors::read ( )
private

read

@access private

Parameters

return

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

133 {
134 global $ilDB;
135
136 // Store assignment of subitem categories
137 foreach($this->categories->getCategoriesInfo() as $c_data)
138 {
139 if(isset($c_data['subitem_ids']) and count($c_data['subitem_ids']))
140 {
141 foreach($c_data['subitem_ids'] as $sub_item_id)
142 {
143 $this->cat_substitutions[$sub_item_id] = $c_data['cat_id'];
144 }
145
146 }
147 $this->cat_substitutions[$c_data['cat_id']] = $c_data['cat_id'];
148 #18647 and #21078
149 $this->cat_substitutions_colors[$c_data['cat_id']] = $c_data['color'];
150 }
151
152 $query = "SELECT cat.cat_id,cat.color, ass.cal_id FROM cal_categories cat ".
153 "JOIN cal_cat_assignments ass ON cat.cat_id = ass.cat_id ".
154 "WHERE ".$ilDB->in('cat.cat_id',$this->categories->getCategories(true),false,'integer');
155
156 $res = $this->db->query($query);
157 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
158 {
159 $this->appointment_colors[$row->cat_id] = $row->color;
160 $this->cat_app_ass[$row->cal_id] = $row->cat_id;
161 }
162 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

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

Referenced by __construct().

+ 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: