ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSystemStyleIconColorSet Class Reference
+ Collaboration diagram for ilSystemStyleIconColorSet:

Public Member Functions

 addColor (ilSystemStyleIconColor $color)
 
 getColors ()
 
 setColors (array $colors)
 
 getColorById (string $id='')
 
 doesColorExist (string $id)
 
 mergeColorSet (ilSystemStyleIconColorSet $color_set)
 Merges an other colorset into this one. More...
 
 getColorsSortedAsArray ()
 Orders and sorts the colors to be displayed in GUI (form) More...
 
 asArray ()
 Returns the ids of the colors of this color set as array. More...
 
 asString ()
 Returns the ids of the colors of this color set as string. More...
 

Protected Attributes

array $colors = []
 

Detailed Description

Definition at line 24 of file class.ilSystemStyleIconColorSet.php.

Member Function Documentation

◆ addColor()

ilSystemStyleIconColorSet::addColor ( ilSystemStyleIconColor  $color)

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

References ilSystemStyleIconColor\getId().

Referenced by mergeColorSet().

34  : void
35  {
36  $this->colors[$color->getId()] = $color;
37  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ asArray()

ilSystemStyleIconColorSet::asArray ( )

Returns the ids of the colors of this color set as array.

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

References $colors, and getColors().

104  : array
105  {
106  $colors = [];
107  foreach ($this->getColors() as $color) {
108  $colors[] = $color->getId();
109  }
110  return $colors;
111  }
+ Here is the call graph for this function:

◆ asString()

ilSystemStyleIconColorSet::asString ( )

Returns the ids of the colors of this color set as string.

Definition at line 116 of file class.ilSystemStyleIconColorSet.php.

References $colors, and getColors().

116  : string
117  {
118  $colors = '';
119  foreach ($this->getColors() as $color) {
120  $colors .= $color->getId() . '; ';
121  }
122  return $colors;
123  }
+ Here is the call graph for this function:

◆ doesColorExist()

ilSystemStyleIconColorSet::doesColorExist ( string  $id)

Definition at line 66 of file class.ilSystemStyleIconColorSet.php.

Referenced by mergeColorSet().

66  : bool
67  {
68  return array_key_exists($id, $this->colors);
69  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ getColorById()

ilSystemStyleIconColorSet::getColorById ( string  $id = '')
Exceptions
ilSystemStyleException

Definition at line 58 of file class.ilSystemStyleIconColorSet.php.

References $id, and ilSystemStyleException\INVALID_ID.

59  {
60  if (!array_key_exists($id, $this->colors)) {
62  }
63  return $this->colors[$id];
64  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getColors()

ilSystemStyleIconColorSet::getColors ( )
Returns
ilSystemStyleIconColor[]

Definition at line 42 of file class.ilSystemStyleIconColorSet.php.

References $colors.

Referenced by asArray(), asString(), getColorsSortedAsArray(), and mergeColorSet().

42  : array
43  {
44  return $this->colors;
45  }
+ Here is the caller graph for this function:

◆ getColorsSortedAsArray()

ilSystemStyleIconColorSet::getColorsSortedAsArray ( )

Orders and sorts the colors to be displayed in GUI (form)

Returns
array [CategoryOfColor][color]

Definition at line 87 of file class.ilSystemStyleIconColorSet.php.

References getColors().

87  : array
88  {
89  $colors_categories = [];
90  foreach ($this->getColors() as $color) {
91  $colors_categories[$color->getDominatAspect()][] = $color;
92  }
93  ksort($colors_categories);
94  foreach ($colors_categories as $category => $colors) {
95  usort($colors_categories[$category], ['ilSystemStyleIconColor','compareColors']);
96  }
97 
98  return $colors_categories;
99  }
+ Here is the call graph for this function:

◆ mergeColorSet()

ilSystemStyleIconColorSet::mergeColorSet ( ilSystemStyleIconColorSet  $color_set)

Merges an other colorset into this one.

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

References addColor(), doesColorExist(), and getColors().

74  : void
75  {
76  foreach ($color_set->getColors() as $color) {
77  if (!$this->doesColorExist($color->getId())) {
78  $this->addColor($color);
79  }
80  }
81  }
addColor(ilSystemStyleIconColor $color)
+ Here is the call graph for this function:

◆ setColors()

ilSystemStyleIconColorSet::setColors ( array  $colors)
Parameters
ilSystemStyleIconColor[]$colors

Definition at line 50 of file class.ilSystemStyleIconColorSet.php.

References $colors.

50  : void
51  {
52  $this->colors = $colors;
53  }

Field Documentation

◆ $colors

array ilSystemStyleIconColorSet::$colors = []
protected

Definition at line 31 of file class.ilSystemStyleIconColorSet.php.

Referenced by asArray(), asString(), getColors(), and setColors().


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