ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Glyph.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
7 use ILIAS\UI\Component as C;
11 
12 class Glyph implements C\Glyph\Glyph {
13  use ComponentHelper;
15 
19  private $type;
20 
24  private $action;
25 
29  private $aria_label;
30 
34  private $counters;
35 
39  private $highlighted = false;
40 
41  private static $types = array
42  (self::SETTINGS
43  , self::COLLAPSE
44  , self::EXPAND
45  , self::ADD
46  , self::REMOVE
47  , self::UP
48  , self::DOWN
49  , self::BACK
50  , self::NEXT
51  , self::SORT_ASCENDING
52  , self::SORT_DESCENDING
53  , self::SORT
54  , self::USER
55  , self::MAIL
56  , self::NOTIFICATION
57  , self::TAG
58  , self::NOTE
59  , self::COMMENT
60  );
61 
62 
67  public function __construct($type, $aria_label, $action = null) {
68  $this->checkArgIsElement("type", $type, self::$types, "glyph type");
69  $this->checkStringArg("string",$aria_label);
70 
71  if ($action !== null) {
72  $this->checkStringArg("action", $action);
73  }
74  $this->type = $type;
75  $this->aria_label = $aria_label;
76  $this->action = $action;
77  $this->counters = array();
78  $this->highlighted = false;
79  }
80 
84  public function getType() {
85  return $this->type;
86  }
90  public function getAriaLabel() {
91  return $this->aria_label;
92  }
93 
97  public function getAction() {
98  return $this->action;
99  }
100 
104  public function getCounters() {
105  return array_values($this->counters);
106  }
107 
111  public function withCounter(Counter $counter) {
112  $clone = clone $this;
113  $clone->counters[$counter->getType()] = $counter;
114  return $clone;
115  }
116 
120  public function isHighlighted(){
121  return $this->highlighted;
122  }
123 
127  public function withHighlight() {
128  $clone = clone $this;
129  $clone->highlighted = true;
130  return $clone;
131  }
132 }
This tags a counter object.
Definition: Counter.php:10
__construct($type, $aria_label, $action=null)
Definition: Glyph.php:67
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
getType()
Get the type of the counter.
$counter
Create styles array
The data for the language used.