@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | class HtmlDropdown extends HtmlSemDoubleElement { |
15 | 15 | protected $mClass="menu"; |
16 | 16 | protected $mTagName="div"; |
17 | - protected $items=array (); |
|
17 | + protected $items=array(); |
|
18 | 18 | protected $params=array("action"=>"select"); |
19 | 19 | protected $input; |
20 | 20 | |
@@ -22,40 +22,40 @@ discard block |
||
22 | 22 | parent::__construct($identifier, "div"); |
23 | 23 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
24 | 24 | $this->setProperty("class", "ui dropdown"); |
25 | - $content=new HtmlSemDoubleElement("","div"); |
|
25 | + $content=new HtmlSemDoubleElement("", "div"); |
|
26 | 26 | $content->setClass("text"); |
27 | 27 | $content->setContent($value); |
28 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
28 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
29 | 29 | $this->content=array($content); |
30 | 30 | $this->tagName="div"; |
31 | 31 | $this->addItems($items); |
32 | 32 | } |
33 | 33 | |
34 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
34 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
35 | 35 | $itemO=$item; |
36 | - if(\is_object($item)===false){ |
|
37 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
38 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
36 | + if (\is_object($item)===false) { |
|
37 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
38 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
39 | 39 | $this->addToProperty("class", "vertical"); |
40 | 40 | } |
41 | 41 | $this->items[]=$itemO; |
42 | 42 | return $itemO; |
43 | 43 | } |
44 | 44 | |
45 | - public function addInput($name){ |
|
46 | - if(!isset($name)) |
|
45 | + public function addInput($name) { |
|
46 | + if (!isset($name)) |
|
47 | 47 | $name="input-".$this->identifier; |
48 | 48 | $this->setAction("activate"); |
49 | - $this->input=new HtmlInput($name,"hidden"); |
|
49 | + $this->input=new HtmlInput($name, "hidden"); |
|
50 | 50 | } |
51 | 51 | |
52 | - public function addItems($items){ |
|
53 | - if(JArray::isAssociative($items)){ |
|
54 | - foreach ($items as $k=>$v){ |
|
52 | + public function addItems($items) { |
|
53 | + if (JArray::isAssociative($items)) { |
|
54 | + foreach ($items as $k=>$v) { |
|
55 | 55 | $this->addItem($v)->setData($k); |
56 | 56 | } |
57 | - }else{ |
|
58 | - foreach ($items as $item){ |
|
57 | + }else { |
|
58 | + foreach ($items as $item) { |
|
59 | 59 | $this->addItem($item); |
60 | 60 | } |
61 | 61 | } |
@@ -64,51 +64,51 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @param boolean $dropdown |
66 | 66 | */ |
67 | - public function asDropdown($dropdown){ |
|
68 | - if($dropdown===false){ |
|
67 | + public function asDropdown($dropdown) { |
|
68 | + if ($dropdown===false) { |
|
69 | 69 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
70 | 70 | $dropdown="menu"; |
71 | - }else{ |
|
71 | + }else { |
|
72 | 72 | $dropdown="dropdown"; |
73 | 73 | $this->mClass="menu"; |
74 | 74 | } |
75 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
75 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
76 | 76 | } |
77 | 77 | |
78 | - public function setVertical(){ |
|
79 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
78 | + public function setVertical() { |
|
79 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
80 | 80 | } |
81 | 81 | |
82 | - public function setSimple(){ |
|
83 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
82 | + public function setSimple() { |
|
83 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
84 | 84 | } |
85 | 85 | |
86 | - public function asButton($floating=false){ |
|
87 | - if($floating) |
|
86 | + public function asButton($floating=false) { |
|
87 | + if ($floating) |
|
88 | 88 | $this->addToProperty("class", "floating"); |
89 | 89 | return $this->addToProperty("class", "button"); |
90 | 90 | } |
91 | 91 | |
92 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
93 | - if(isset($name)) |
|
92 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
93 | + if (isset($name)) |
|
94 | 94 | $this->addInput($name); |
95 | - if($multiple) |
|
95 | + if ($multiple) |
|
96 | 96 | $this->addToProperty("class", "multiple"); |
97 | 97 | if ($selection) |
98 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
98 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
103 | - $this->asSelect($name,$multiple,$selection); |
|
102 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
103 | + $this->asSelect($name, $multiple, $selection); |
|
104 | 104 | return $this->addToProperty("class", "search"); |
105 | 105 | } |
106 | 106 | |
107 | - public function setSelect($name=NULL,$multiple=false){ |
|
108 | - if(!isset($name)) |
|
107 | + public function setSelect($name=NULL, $multiple=false) { |
|
108 | + if (!isset($name)) |
|
109 | 109 | $name="select-".$this->identifier; |
110 | 110 | $this->input=null; |
111 | - if($multiple){ |
|
111 | + if ($multiple) { |
|
112 | 112 | $this->setProperty("multiple", true); |
113 | 113 | $this->addToProperty("class", "multiple"); |
114 | 114 | } |
@@ -116,28 +116,28 @@ discard block |
||
116 | 116 | $this->tagName="select"; |
117 | 117 | $this->setProperty("name", $name); |
118 | 118 | $this->content=null; |
119 | - foreach ($this->items as $item){ |
|
119 | + foreach ($this->items as $item) { |
|
120 | 120 | $item->asOption(); |
121 | 121 | } |
122 | 122 | return $this; |
123 | 123 | } |
124 | 124 | |
125 | - public function asSubmenu($pointing=NULL){ |
|
125 | + public function asSubmenu($pointing=NULL) { |
|
126 | 126 | $this->setClass("ui dropdown link item"); |
127 | - if(isset($pointing)){ |
|
127 | + if (isset($pointing)) { |
|
128 | 128 | $this->setPointing($pointing); |
129 | 129 | } |
130 | 130 | return $this; |
131 | 131 | } |
132 | 132 | |
133 | - public function setPointing($value=Pointing::POINTING){ |
|
134 | - return $this->addToPropertyCtrl("class", $value,Pointing::getConstants()); |
|
133 | + public function setPointing($value=Pointing::POINTING) { |
|
134 | + return $this->addToPropertyCtrl("class", $value, Pointing::getConstants()); |
|
135 | 135 | } |
136 | 136 | |
137 | - public function setValue($value){ |
|
138 | - if(isset($this->input)){ |
|
137 | + public function setValue($value) { |
|
138 | + if (isset($this->input)) { |
|
139 | 139 | $this->input->setProperty("value", $value); |
140 | - }else{ |
|
140 | + }else { |
|
141 | 141 | $this->setProperty("value", $value); |
142 | 142 | } |
143 | 143 | return $this; |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | * @see BaseHtml::run() |
149 | 149 | */ |
150 | 150 | public function run(JsUtils $js) { |
151 | - if($this->propertyContains("class", "simple")===false){ |
|
152 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
151 | + if ($this->propertyContains("class", "simple")===false) { |
|
152 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->params); |
|
153 | 153 | $this->addEventsOnRun($js); |
154 | 154 | return $this->_bsComponent; |
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | - public function setAction($action){ |
|
158 | + public function setAction($action) { |
|
159 | 159 | $this->params["action"]=$action; |
160 | 160 | } |
161 | 161 | } |
162 | 162 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $itemO=$item; |
36 | 36 | if(\is_object($item)===false){ |
37 | 37 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
38 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
38 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
39 | 39 | $this->addToProperty("class", "vertical"); |
40 | 40 | } |
41 | 41 | $this->items[]=$itemO; |
@@ -43,8 +43,9 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function addInput($name){ |
46 | - if(!isset($name)) |
|
47 | - $name="input-".$this->identifier; |
|
46 | + if(!isset($name)) { |
|
47 | + $name="input-".$this->identifier; |
|
48 | + } |
|
48 | 49 | $this->setAction("activate"); |
49 | 50 | $this->input=new HtmlInput($name,"hidden"); |
50 | 51 | } |
@@ -54,7 +55,7 @@ discard block |
||
54 | 55 | foreach ($items as $k=>$v){ |
55 | 56 | $this->addItem($v)->setData($k); |
56 | 57 | } |
57 | - }else{ |
|
58 | + } else{ |
|
58 | 59 | foreach ($items as $item){ |
59 | 60 | $this->addItem($item); |
60 | 61 | } |
@@ -68,7 +69,7 @@ discard block |
||
68 | 69 | if($dropdown===false){ |
69 | 70 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
70 | 71 | $dropdown="menu"; |
71 | - }else{ |
|
72 | + } else{ |
|
72 | 73 | $dropdown="dropdown"; |
73 | 74 | $this->mClass="menu"; |
74 | 75 | } |
@@ -84,18 +85,22 @@ discard block |
||
84 | 85 | } |
85 | 86 | |
86 | 87 | public function asButton($floating=false){ |
87 | - if($floating) |
|
88 | - $this->addToProperty("class", "floating"); |
|
88 | + if($floating) { |
|
89 | + $this->addToProperty("class", "floating"); |
|
90 | + } |
|
89 | 91 | return $this->addToProperty("class", "button"); |
90 | 92 | } |
91 | 93 | |
92 | 94 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
93 | - if(isset($name)) |
|
94 | - $this->addInput($name); |
|
95 | - if($multiple) |
|
96 | - $this->addToProperty("class", "multiple"); |
|
97 | - if ($selection) |
|
98 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
95 | + if(isset($name)) { |
|
96 | + $this->addInput($name); |
|
97 | + } |
|
98 | + if($multiple) { |
|
99 | + $this->addToProperty("class", "multiple"); |
|
100 | + } |
|
101 | + if ($selection) { |
|
102 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
103 | + } |
|
99 | 104 | return $this; |
100 | 105 | } |
101 | 106 | |
@@ -105,8 +110,9 @@ discard block |
||
105 | 110 | } |
106 | 111 | |
107 | 112 | public function setSelect($name=NULL,$multiple=false){ |
108 | - if(!isset($name)) |
|
109 | - $name="select-".$this->identifier; |
|
113 | + if(!isset($name)) { |
|
114 | + $name="select-".$this->identifier; |
|
115 | + } |
|
110 | 116 | $this->input=null; |
111 | 117 | if($multiple){ |
112 | 118 | $this->setProperty("multiple", true); |
@@ -137,7 +143,7 @@ discard block |
||
137 | 143 | public function setValue($value){ |
138 | 144 | if(isset($this->input)){ |
139 | 145 | $this->input->setProperty("value", $value); |
140 | - }else{ |
|
146 | + } else{ |
|
141 | 147 | $this->setProperty("value", $value); |
142 | 148 | } |
143 | 149 | return $this; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | public static function getConstants() { |
15 | 15 | if (self::$constCacheArray==NULL) { |
16 | - self::$constCacheArray=[ ]; |
|
16 | + self::$constCacheArray=[]; |
|
17 | 17 | } |
18 | 18 | $calledClass=get_called_class(); |
19 | 19 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | return self::$constCacheArray [$calledClass]; |
24 | 24 | } |
25 | 25 | |
26 | - public static function getConstantValues(){ |
|
26 | + public static function getConstantValues() { |
|
27 | 27 | return \array_values(self::getConstants()); |
28 | 28 | } |
29 | 29 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param string $identifier |
62 | 62 | * @param string $icon |
63 | 63 | */ |
64 | - public function htmlIcon($identifier,$icon){ |
|
64 | + public function htmlIcon($identifier, $icon) { |
|
65 | 65 | return $this->addHtmlComponent(new HtmlIcon($identifier, $icon)); |
66 | 66 | } |
67 | 67 | |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | * @param string $size |
71 | 71 | * @param array $icons |
72 | 72 | */ |
73 | - public function htmlIconGroups($identifier,$size="",$icons=array()){ |
|
74 | - $group=new HtmlIconGroups($identifier,$size); |
|
75 | - if(JArray::isAssociative($icons)){ |
|
76 | - foreach ($icons as $icon=>$size){ |
|
77 | - $group->add($icon,$size); |
|
73 | + public function htmlIconGroups($identifier, $size="", $icons=array()) { |
|
74 | + $group=new HtmlIconGroups($identifier, $size); |
|
75 | + if (JArray::isAssociative($icons)) { |
|
76 | + foreach ($icons as $icon=>$size) { |
|
77 | + $group->add($icon, $size); |
|
78 | 78 | } |
79 | - }else{ |
|
80 | - foreach ($icons as $icon){ |
|
79 | + }else { |
|
80 | + foreach ($icons as $icon) { |
|
81 | 81 | $group->add($icon); |
82 | 82 | } |
83 | 83 | } |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param array $elements |
90 | 90 | * @param boolean $asIcons |
91 | 91 | */ |
92 | - public function htmlButtonGroups($identifier,$elements=array(),$asIcons=false){ |
|
93 | - return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements,$asIcons)); |
|
92 | + public function htmlButtonGroups($identifier, $elements=array(), $asIcons=false) { |
|
93 | + return $this->addHtmlComponent(new HtmlButtonGroups($identifier, $elements, $asIcons)); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @param string $identifier |
99 | 99 | * @param string $content |
100 | 100 | */ |
101 | - public function htmlContainer($identifier,$content=""){ |
|
101 | + public function htmlContainer($identifier, $content="") { |
|
102 | 102 | return $this->addHtmlComponent(new HtmlContainer($identifier, $content)); |
103 | 103 | } |
104 | 104 | |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @param string $identifier |
107 | 107 | * @param string $content |
108 | 108 | */ |
109 | - public function htmlDivider($identifier,$content="",$tagName="div"){ |
|
110 | - return $this->addHtmlComponent(new HtmlDivider($identifier, $content,$tagName)); |
|
109 | + public function htmlDivider($identifier, $content="", $tagName="div") { |
|
110 | + return $this->addHtmlComponent(new HtmlDivider($identifier, $content, $tagName)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -115,32 +115,32 @@ discard block |
||
115 | 115 | * @param string $content |
116 | 116 | * @param string $tagName |
117 | 117 | */ |
118 | - public function htmlLabel($identifier,$content="",$tagName="div"){ |
|
119 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$tagName)); |
|
118 | + public function htmlLabel($identifier, $content="", $tagName="div") { |
|
119 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $tagName)); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * @param string $identifier |
124 | 124 | * @param array $items |
125 | 125 | */ |
126 | - public function htmlMenu($identifier,$items=array()){ |
|
127 | - return $this->addHtmlComponent(new HtmlMenu($identifier,$items)); |
|
126 | + public function htmlMenu($identifier, $items=array()) { |
|
127 | + return $this->addHtmlComponent(new HtmlMenu($identifier, $items)); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /**Adds an icon menu |
131 | 131 | * @param string $identifier |
132 | 132 | * @param array $items icons |
133 | 133 | */ |
134 | - public function htmlIconMenu($identifier,$items=array()){ |
|
135 | - return $this->addHtmlComponent(new HtmlIconMenu($identifier,$items)); |
|
134 | + public function htmlIconMenu($identifier, $items=array()) { |
|
135 | + return $this->addHtmlComponent(new HtmlIconMenu($identifier, $items)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /**Adds an labeled icon menu |
139 | 139 | * @param string $identifier |
140 | 140 | * @param array $items icons |
141 | 141 | */ |
142 | - public function htmlLabeledIconMenu($identifier,$items=array()){ |
|
143 | - return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier,$items)); |
|
142 | + public function htmlLabeledIconMenu($identifier, $items=array()) { |
|
143 | + return $this->addHtmlComponent(new HtmlLabeledIconMenu($identifier, $items)); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | * @param string $value |
149 | 149 | * @param array $items |
150 | 150 | */ |
151 | - public function htmlDropdown($identifier, $value="", $items=array()){ |
|
152 | - return $this->addHtmlComponent(new HtmlDropdown($identifier,$value,$items)); |
|
151 | + public function htmlDropdown($identifier, $value="", $items=array()) { |
|
152 | + return $this->addHtmlComponent(new HtmlDropdown($identifier, $value, $items)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * @param string $identifier |
158 | 158 | * @param string $content |
159 | 159 | */ |
160 | - public function htmlMessage($identifier, $content=""){ |
|
161 | - return $this->addHtmlComponent(new HtmlMessage($identifier,$content)); |
|
160 | + public function htmlMessage($identifier, $content="") { |
|
161 | + return $this->addHtmlComponent(new HtmlMessage($identifier, $content)); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | * @param string $identifier |
167 | 167 | * @param string $content |
168 | 168 | */ |
169 | - public function htmlSegment($identifier, $content=""){ |
|
170 | - return $this->addHtmlComponent(new HtmlSegment($identifier,$content)); |
|
169 | + public function htmlSegment($identifier, $content="") { |
|
170 | + return $this->addHtmlComponent(new HtmlSegment($identifier, $content)); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | * @param string $identifier |
176 | 176 | * @param array $items the segments |
177 | 177 | */ |
178 | - public function htmlSegmentGroups($identifier, $items=array()){ |
|
179 | - return $this->addHtmlComponent(new HtmlSegmentGroups($identifier,$items)); |
|
178 | + public function htmlSegmentGroups($identifier, $items=array()) { |
|
179 | + return $this->addHtmlComponent(new HtmlSegmentGroups($identifier, $items)); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | 183 | * @param string $identifier |
184 | 184 | * @param mixed $content |
185 | 185 | */ |
186 | - public function htmlPopup(BaseHtml $container,$identifier,$content){ |
|
187 | - return $this->addHtmlComponent(new HtmlPopup($container,$identifier,$content)); |
|
186 | + public function htmlPopup(BaseHtml $container, $identifier, $content) { |
|
187 | + return $this->addHtmlComponent(new HtmlPopup($container, $identifier, $content)); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -194,11 +194,11 @@ discard block |
||
194 | 194 | * @param boolean $createCols |
195 | 195 | * @param boolean $implicitRows |
196 | 196 | */ |
197 | - public function htmlGrid($identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
198 | - return $this->addHtmlComponent(new HtmlGrid($identifier,$numRows,$numCols,$createCols,$implicitRows)); |
|
197 | + public function htmlGrid($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
198 | + return $this->addHtmlComponent(new HtmlGrid($identifier, $numRows, $numCols, $createCols, $implicitRows)); |
|
199 | 199 | } |
200 | 200 | |
201 | - public function htmlHeader($identifier,$niveau=1,$content=NULL,$type="page"){ |
|
202 | - return $this->addHtmlComponent(new HtmlHeader($identifier,$niveau,$content,$type)); |
|
201 | + public function htmlHeader($identifier, $niveau=1, $content=NULL, $type="page") { |
|
202 | + return $this->addHtmlComponent(new HtmlHeader($identifier, $niveau, $content, $type)); |
|
203 | 203 | } |
204 | 204 | } |
205 | 205 | \ No newline at end of file |