ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 204 of file class.ilCalendarAppointmentColors.php.

References $a_type.

Referenced by ilObjBookingPoolGUI\renderSlots().

205  {
206  return self::$colors[$a_type];
207  }
$a_type
Definition: workflow.php:93
+ 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 171 of file class.ilCalendarAppointmentColors.php.

References $a_type.

Referenced by ilCalendarAppEventListener\createCategory().

172  {
173  return self::$colors[$a_type][rand(0,count(self::$colors[$a_type]) - 1)];
174  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ dumpColors()

static ilCalendarAppointmentColors::dumpColors ( )
static

public

Parameters

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

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

◆ 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  #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  }

◆ read()

ilCalendarAppointmentColors::read ( )
private

read

private

Parameters

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

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __construct().

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