1 | <?php |
||
16 | class PulseColumnStatusValue extends PulseColumnValue |
||
17 | { |
||
18 | const DEFAULT_VALUE = self::Grey; // The default color for DaPulse columns |
||
19 | |||
20 | /** |
||
21 | * The index of the orange status |
||
22 | */ |
||
23 | const Orange = 0; |
||
|
|||
24 | |||
25 | /** |
||
26 | * The index of the light green status |
||
27 | */ |
||
28 | const L_Green = 1; |
||
29 | |||
30 | /** |
||
31 | * The index of the red status |
||
32 | */ |
||
33 | const Red = 2; |
||
34 | |||
35 | /** |
||
36 | * The index of the blue status |
||
37 | */ |
||
38 | const Blue = 3; |
||
39 | |||
40 | /** |
||
41 | * The index of the purple status |
||
42 | */ |
||
43 | const Purple = 4; |
||
44 | |||
45 | /** |
||
46 | * The index of the grey status |
||
47 | */ |
||
48 | const Grey = 5; |
||
49 | const Gray = self::Grey; // just an alias |
||
50 | |||
51 | /** |
||
52 | * The index of the green status |
||
53 | */ |
||
54 | const Green = 6; |
||
55 | |||
56 | /** |
||
57 | * The index of the light blue status |
||
58 | */ |
||
59 | const L_Blue = 7; |
||
60 | |||
61 | /** |
||
62 | * The index of the gold status |
||
63 | */ |
||
64 | const Gold = 8; |
||
65 | |||
66 | /** |
||
67 | * The index of the yellow status |
||
68 | */ |
||
69 | const Yellow = 9; |
||
70 | |||
71 | /** |
||
72 | * The index of the black status |
||
73 | */ |
||
74 | const Black = 10; |
||
75 | |||
76 | /** |
||
77 | * Get the numerical representation of the color that a status column is set to. |
||
78 | * |
||
79 | * @api |
||
80 | * |
||
81 | * @since 0.1.0 |
||
82 | * |
||
83 | * @return int The color value of a column |
||
84 | */ |
||
85 | 2 | public function getValue () |
|
89 | |||
90 | /** |
||
91 | * Update the status of a status column |
||
92 | * |
||
93 | * It is highly recommended that you use the constants available in the **PulseColumnColorValue** class to match the |
||
94 | * colors; keep in mind this value cannot be higher than 11. |
||
95 | * |
||
96 | * @api |
||
97 | * |
||
98 | * @param int $color The numerical value of the new color value |
||
99 | * |
||
100 | * @see PulseColumnStatusValue::Orange PulseColumnStatusValue::Orange |
||
101 | * @see PulseColumnStatusValue::L_Green PulseColumnStatusValue::L_Green |
||
102 | * @see PulseColumnStatusValue::Red PulseColumnStatusValue::Red |
||
103 | * @see PulseColumnStatusValue::Blue PulseColumnStatusValue::Blue |
||
104 | * @see PulseColumnStatusValue::Purple PulseColumnStatusValue::Purple |
||
105 | * @see PulseColumnStatusValue::Grey PulseColumnStatusValue::Grey |
||
106 | * @see PulseColumnStatusValue::Green PulseColumnStatusValue::Green |
||
107 | * @see PulseColumnStatusValue::L_Blue PulseColumnStatusValue::L_Blue |
||
108 | * @see PulseColumnStatusValue::Gold PulseColumnStatusValue::Gold |
||
109 | * @see PulseColumnStatusValue::Yellow PulseColumnStatusValue::Yellow |
||
110 | * @see PulseColumnStatusValue::Black PulseColumnStatusValue::Black |
||
111 | * |
||
112 | * @since 0.1.0 |
||
113 | * |
||
114 | * @throws \InvalidArgumentException if the $color is not an int or is not between 0-10 |
||
115 | */ |
||
116 | 5 | public function updateValue ($color) |
|
132 | |||
133 | /** |
||
134 | * Get the hex value of the color used on DaPulse to represent the different statuses. |
||
135 | * |
||
136 | * @api |
||
137 | * |
||
138 | * @param int $numericalValue The numerical value of the column |
||
139 | * |
||
140 | * @since 0.1.0 |
||
141 | * |
||
142 | * @return string A hex value **without** the leading # |
||
143 | */ |
||
144 | public static function getHexColor ($numericalValue) |
||
162 | |||
163 | 2 | protected function setValue ($response) |
|
171 | } |