@@ -37,28 +37,28 @@ discard block |
||
37 | 37 | protected $_edition; |
38 | 38 | |
39 | 39 | |
40 | - public function __construct($identifier,$model,$modelInstance=NULL) { |
|
40 | + public function __construct($identifier, $model, $modelInstance=NULL) { |
|
41 | 41 | parent::__construct($identifier); |
42 | 42 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
43 | 43 | $this->setModel($model); |
44 | - if(isset($modelInstance)); |
|
44 | + if (isset($modelInstance)); |
|
45 | 45 | $this->show($modelInstance); |
46 | 46 | } |
47 | 47 | |
48 | - protected function _init($instanceViewer,$contentKey,$content,$edition){ |
|
48 | + protected function _init($instanceViewer, $contentKey, $content, $edition) { |
|
49 | 49 | $this->_instanceViewer=$instanceViewer; |
50 | 50 | $this->content=[$contentKey=>$content]; |
51 | 51 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
52 | 52 | $this->_edition=$edition; |
53 | 53 | } |
54 | 54 | |
55 | - protected function _getFieldIdentifier($prefix){ |
|
55 | + protected function _getFieldIdentifier($prefix) { |
|
56 | 56 | return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier(); |
57 | 57 | } |
58 | 58 | |
59 | - abstract protected function _setToolbarPosition($table,$captions=NULL); |
|
59 | + abstract protected function _setToolbarPosition($table, $captions=NULL); |
|
60 | 60 | |
61 | - public function show($modelInstance){ |
|
61 | + public function show($modelInstance) { |
|
62 | 62 | $this->_modelInstance=$modelInstance; |
63 | 63 | } |
64 | 64 | |
@@ -82,42 +82,42 @@ discard block |
||
82 | 82 | |
83 | 83 | abstract public function getHtmlComponent(); |
84 | 84 | |
85 | - public function setColor($color){ |
|
85 | + public function setColor($color) { |
|
86 | 86 | return $this->getHtmlComponent()->setColor($color); |
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | - public function setCaptions($captions){ |
|
90 | + public function setCaptions($captions) { |
|
91 | 91 | $this->_instanceViewer->setCaptions($captions); |
92 | 92 | return $this; |
93 | 93 | } |
94 | 94 | |
95 | - public function setFields($fields){ |
|
95 | + public function setFields($fields) { |
|
96 | 96 | $this->_instanceViewer->setVisibleProperties($fields); |
97 | 97 | return $this; |
98 | 98 | } |
99 | 99 | |
100 | - public function addField($field){ |
|
100 | + public function addField($field) { |
|
101 | 101 | $this->_instanceViewer->addField($field); |
102 | 102 | return $this; |
103 | 103 | } |
104 | 104 | |
105 | - public function insertField($index,$field){ |
|
105 | + public function insertField($index, $field) { |
|
106 | 106 | $this->_instanceViewer->insertField($index, $field); |
107 | 107 | return $this; |
108 | 108 | } |
109 | 109 | |
110 | - public function insertInField($index,$field){ |
|
110 | + public function insertInField($index, $field) { |
|
111 | 111 | $this->_instanceViewer->insertInField($index, $field); |
112 | 112 | return $this; |
113 | 113 | } |
114 | 114 | |
115 | - public function setValueFunction($index,$callback){ |
|
115 | + public function setValueFunction($index, $callback) { |
|
116 | 116 | $this->_instanceViewer->setValueFunction($index, $callback); |
117 | 117 | return $this; |
118 | 118 | } |
119 | 119 | |
120 | - public function setIdentifierFunction($callback){ |
|
120 | + public function setIdentifierFunction($callback) { |
|
121 | 121 | $this->_instanceViewer->setIdentifierFunction($callback); |
122 | 122 | return $this; |
123 | 123 | } |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
127 | 127 | */ |
128 | - public function getToolbar(){ |
|
129 | - if(isset($this->_toolbar)===false){ |
|
128 | + public function getToolbar() { |
|
129 | + if (isset($this->_toolbar)===false) { |
|
130 | 130 | $this->_toolbar=new HtmlMenu("toolbar-".$this->identifier); |
131 | 131 | //$this->_toolbar->setSecondary(); |
132 | 132 | } |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | * @param callable $callback function to call on $element |
140 | 140 | * @return \Ajax\common\html\HtmlDoubleElement |
141 | 141 | */ |
142 | - public function addInToolbar($element,$callback=NULL){ |
|
142 | + public function addInToolbar($element, $callback=NULL) { |
|
143 | 143 | $tb=$this->getToolbar(); |
144 | - if(isset($callback)){ |
|
145 | - if(\is_callable($callback)){ |
|
144 | + if (isset($callback)) { |
|
145 | + if (\is_callable($callback)) { |
|
146 | 146 | $callback($element); |
147 | 147 | } |
148 | 148 | } |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * @param callable $callback function($element) |
156 | 156 | * @return \Ajax\common\html\HtmlDoubleElement |
157 | 157 | */ |
158 | - public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){ |
|
159 | - $result=$this->addInToolbar($caption,$callback); |
|
160 | - if(isset($icon)) |
|
158 | + public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) { |
|
159 | + $result=$this->addInToolbar($caption, $callback); |
|
160 | + if (isset($icon)) |
|
161 | 161 | $result->addIcon($icon); |
162 | 162 | return $result; |
163 | 163 | } |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | * @param callable $callback function($element) |
168 | 168 | * @return \Ajax\common\Widget |
169 | 169 | */ |
170 | - public function addItemsInToolbar(array $items,$callback=NULL){ |
|
171 | - if(JArray::isAssociative($items)){ |
|
172 | - foreach ($items as $icon=>$item){ |
|
173 | - $this->addItemInToolbar($item,$icon,$callback); |
|
170 | + public function addItemsInToolbar(array $items, $callback=NULL) { |
|
171 | + if (JArray::isAssociative($items)) { |
|
172 | + foreach ($items as $icon=>$item) { |
|
173 | + $this->addItemInToolbar($item, $icon, $callback); |
|
174 | 174 | } |
175 | - }else{ |
|
176 | - foreach ($items as $item){ |
|
177 | - $this->addItemInToolbar($item,null,$callback); |
|
175 | + } else { |
|
176 | + foreach ($items as $item) { |
|
177 | + $this->addItemInToolbar($item, null, $callback); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | return $this; |
@@ -186,12 +186,12 @@ discard block |
||
186 | 186 | * @param callable $callback function($element) |
187 | 187 | * @return \Ajax\common\html\HtmlDoubleElement |
188 | 188 | */ |
189 | - public function addDropdownInToolbar($value,$items,$callback=NULL){ |
|
189 | + public function addDropdownInToolbar($value, $items, $callback=NULL) { |
|
190 | 190 | $dd=$value; |
191 | 191 | if (\is_string($value)) { |
192 | - $dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items); |
|
192 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items); |
|
193 | 193 | } |
194 | - return $this->addInToolbar($dd,$callback); |
|
194 | + return $this->addInToolbar($dd, $callback); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | * @param callable $callback function($element) |
200 | 200 | * @return \Ajax\common\html\HtmlDoubleElement |
201 | 201 | */ |
202 | - public function addButtonInToolbar($caption,$callback=NULL){ |
|
203 | - $bt=new HtmlButton("",$caption); |
|
204 | - return $this->addInToolbar($bt,$callback); |
|
202 | + public function addButtonInToolbar($caption, $callback=NULL) { |
|
203 | + $bt=new HtmlButton("", $caption); |
|
204 | + return $this->addInToolbar($bt, $callback); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * @param callable $callback function($element) |
211 | 211 | * @return \Ajax\common\html\HtmlDoubleElement |
212 | 212 | */ |
213 | - public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){ |
|
214 | - $bts=new HtmlButtonGroups("",$captions,$asIcon); |
|
215 | - return $this->addInToolbar($bts,$callback); |
|
213 | + public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) { |
|
214 | + $bts=new HtmlButtonGroups("", $captions, $asIcon); |
|
215 | + return $this->addInToolbar($bts, $callback); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | * @param boolean $labeled |
223 | 223 | * @return \Ajax\common\html\HtmlDoubleElement |
224 | 224 | */ |
225 | - public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){ |
|
226 | - $bt=new HtmlButton("",$caption); |
|
227 | - $bt->addIcon($icon,$before,$labeled); |
|
225 | + public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) { |
|
226 | + $bt=new HtmlButton("", $caption); |
|
227 | + $bt->addIcon($icon, $before, $labeled); |
|
228 | 228 | return $this->addInToolbar($bt); |
229 | 229 | } |
230 | 230 | |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | * @param callable $defaultValueFunction |
255 | 255 | * @return \Ajax\common\Widget |
256 | 256 | */ |
257 | - public function setDefaultValueFunction($defaultValueFunction){ |
|
257 | + public function setDefaultValueFunction($defaultValueFunction) { |
|
258 | 258 | $this->_instanceViewer->setDefaultValueFunction($defaultValueFunction); |
259 | 259 | return $this; |
260 | 260 | } |
261 | 261 | |
262 | - public function jsDisabled($disable=true){ |
|
262 | + public function jsDisabled($disable=true) { |
|
263 | 263 | return "$('#".$this->identifier." .ui.input').toggleClass('disabled',".$disable.");"; |
264 | 264 | } |
265 | 265 | |
@@ -268,11 +268,11 @@ discard block |
||
268 | 268 | * @param callable $callback function($element) |
269 | 269 | * @return \Ajax\common\html\HtmlDoubleElement |
270 | 270 | */ |
271 | - public function addEditButtonInToolbar($caption,$callback=NULL){ |
|
272 | - $bt=new HtmlButton($this->identifier."-editBtn",$caption); |
|
271 | + public function addEditButtonInToolbar($caption, $callback=NULL) { |
|
272 | + $bt=new HtmlButton($this->identifier."-editBtn", $caption); |
|
273 | 273 | $bt->setToggle(); |
274 | 274 | $bt->onClick($this->jsDisabled(Javascript::prep_value("$(event.target).hasClass('active')"))); |
275 | - return $this->addInToolbar($bt,$callback); |
|
275 | + return $this->addInToolbar($bt, $callback); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | } |
279 | 279 | \ No newline at end of file |
@@ -17,165 +17,165 @@ discard block |
||
17 | 17 | |
18 | 18 | public static $index=0; |
19 | 19 | |
20 | - public function __construct($identifier,$instance=NULL,$captions=NULL){ |
|
20 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
21 | 21 | $this->widgetIdentifier=$identifier; |
22 | 22 | $this->values=[]; |
23 | 23 | $this->afterCompile=[]; |
24 | - if(isset($instance)) |
|
24 | + if (isset($instance)) |
|
25 | 25 | $this->setInstance($instance); |
26 | 26 | $this->setCaptions($captions); |
27 | 27 | $this->captionCallback=NULL; |
28 | - $this->defaultValueFunction=function($name,$value){return $value;}; |
|
28 | + $this->defaultValueFunction=function($name, $value) {return $value; }; |
|
29 | 29 | } |
30 | 30 | |
31 | - public function getValues(){ |
|
31 | + public function getValues() { |
|
32 | 32 | $values=[]; |
33 | 33 | $index=0; |
34 | 34 | $count=$this->count(); |
35 | - while($index<$count){ |
|
35 | + while ($index<$count) { |
|
36 | 36 | $values[]=$this->getValue($index++); |
37 | 37 | } |
38 | 38 | return $values; |
39 | 39 | } |
40 | 40 | |
41 | - public function getIdentifier(){ |
|
41 | + public function getIdentifier() { |
|
42 | 42 | $value=self::$index; |
43 | - if(isset($this->values["identifier"])) |
|
44 | - $value=$this->values["identifier"](self::$index,$this->instance); |
|
43 | + if (isset($this->values["identifier"])) |
|
44 | + $value=$this->values["identifier"](self::$index, $this->instance); |
|
45 | 45 | return $value; |
46 | 46 | } |
47 | 47 | |
48 | - public function getValue($index){ |
|
48 | + public function getValue($index) { |
|
49 | 49 | $property=$this->properties[$index]; |
50 | 50 | return $this->_getValue($property, $index); |
51 | 51 | } |
52 | 52 | |
53 | - protected function _beforeAddProperty($index,&$field){ |
|
53 | + protected function _beforeAddProperty($index, &$field) { |
|
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | - protected function _getDefaultValue($name,$value,$index){ |
|
57 | + protected function _getDefaultValue($name, $value, $index) { |
|
58 | 58 | $func=$this->defaultValueFunction; |
59 | - return $func($name,$value,$index); |
|
59 | + return $func($name, $value, $index); |
|
60 | 60 | } |
61 | 61 | |
62 | - protected function _getValue($property,$index){ |
|
63 | - if($property instanceof \ReflectionProperty){ |
|
62 | + protected function _getValue($property, $index) { |
|
63 | + if ($property instanceof \ReflectionProperty) { |
|
64 | 64 | $property->setAccessible(true); |
65 | 65 | $value=$property->getValue($this->instance); |
66 | - if(isset($this->values[$index])){ |
|
67 | - $value= $this->values[$index]($value,$this->instance,$index); |
|
68 | - }else{ |
|
69 | - $value=$this->_getDefaultValue($property->getName(),$value, $index); |
|
66 | + if (isset($this->values[$index])) { |
|
67 | + $value=$this->values[$index]($value, $this->instance, $index); |
|
68 | + } else { |
|
69 | + $value=$this->_getDefaultValue($property->getName(), $value, $index); |
|
70 | 70 | } |
71 | - }else{ |
|
72 | - if(\is_callable($property)) |
|
71 | + } else { |
|
72 | + if (\is_callable($property)) |
|
73 | 73 | $value=$property($this->instance); |
74 | - elseif(\is_array($property)){ |
|
75 | - $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property); |
|
74 | + elseif (\is_array($property)) { |
|
75 | + $values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property); |
|
76 | 76 | $value=\implode("", $values); |
77 | - }else{ |
|
78 | - if(isset($this->values[$index])){ |
|
79 | - $value= $this->values[$index]($property,$this->instance,$index); |
|
80 | - }else{ |
|
77 | + } else { |
|
78 | + if (isset($this->values[$index])) { |
|
79 | + $value=$this->values[$index]($property, $this->instance, $index); |
|
80 | + } else { |
|
81 | 81 | $value=$property; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |
85 | - if(isset($this->afterCompile[$index])){ |
|
86 | - if(\is_callable($this->afterCompile[$index])){ |
|
87 | - $this->afterCompile[$index]($value,$this->instance,$index); |
|
85 | + if (isset($this->afterCompile[$index])) { |
|
86 | + if (\is_callable($this->afterCompile[$index])) { |
|
87 | + $this->afterCompile[$index]($value, $this->instance, $index); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | return $value; |
91 | 91 | } |
92 | 92 | |
93 | - public function insertField($index,$field){ |
|
94 | - array_splice( $this->visibleProperties, $index, 0, $field ); |
|
93 | + public function insertField($index, $field) { |
|
94 | + array_splice($this->visibleProperties, $index, 0, $field); |
|
95 | 95 | return $this; |
96 | 96 | } |
97 | 97 | |
98 | - public function insertInField($index,$field){ |
|
98 | + public function insertInField($index, $field) { |
|
99 | 99 | $vb=$this->visibleProperties; |
100 | - if(isset($vb[$index])){ |
|
101 | - if(\is_array($vb[$index])){ |
|
100 | + if (isset($vb[$index])) { |
|
101 | + if (\is_array($vb[$index])) { |
|
102 | 102 | $this->visibleProperties[$index][]=$field; |
103 | - }else{ |
|
104 | - $this->visibleProperties[$index]=[$vb[$index],$field]; |
|
103 | + } else { |
|
104 | + $this->visibleProperties[$index]=[$vb[$index], $field]; |
|
105 | 105 | } |
106 | - }else{ |
|
106 | + } else { |
|
107 | 107 | return $this->insertField($index, $field); |
108 | 108 | } |
109 | 109 | return $this; |
110 | 110 | } |
111 | 111 | |
112 | - public function addField($field){ |
|
112 | + public function addField($field) { |
|
113 | 113 | $this->visibleProperties[]=$field; |
114 | 114 | return $this; |
115 | 115 | } |
116 | 116 | |
117 | - public function count(){ |
|
117 | + public function count() { |
|
118 | 118 | return \sizeof($this->properties); |
119 | 119 | } |
120 | 120 | |
121 | - public function visiblePropertiesCount(){ |
|
121 | + public function visiblePropertiesCount() { |
|
122 | 122 | return \sizeof($this->visibleProperties); |
123 | 123 | } |
124 | 124 | |
125 | - public function getProperty($index){ |
|
125 | + public function getProperty($index) { |
|
126 | 126 | return $this->properties[$index]; |
127 | 127 | } |
128 | 128 | |
129 | - protected function showableProperty(\ReflectionProperty $rProperty){ |
|
130 | - return JString::startswith($rProperty->getName(),"_")===false; |
|
129 | + protected function showableProperty(\ReflectionProperty $rProperty) { |
|
130 | + return JString::startswith($rProperty->getName(), "_")===false; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public function setInstance($instance) { |
134 | - if(\is_string($instance)){ |
|
134 | + if (\is_string($instance)) { |
|
135 | 135 | $instance=new $instance(); |
136 | 136 | } |
137 | 137 | $this->instance=$instance; |
138 | 138 | $this->properties=[]; |
139 | 139 | $this->reflect=new \ReflectionClass($instance); |
140 | - if(\sizeof($this->visibleProperties)===0){ |
|
140 | + if (\sizeof($this->visibleProperties)===0) { |
|
141 | 141 | $this->properties=$this->getDefaultProperties(); |
142 | - }else{ |
|
143 | - foreach ($this->visibleProperties as $property){ |
|
142 | + } else { |
|
143 | + foreach ($this->visibleProperties as $property) { |
|
144 | 144 | $this->setInstanceProperty($property); |
145 | 145 | } |
146 | 146 | } |
147 | 147 | return $this; |
148 | 148 | } |
149 | 149 | |
150 | - private function setInstanceProperty($property){ |
|
151 | - if(\is_callable($property)){ |
|
150 | + private function setInstanceProperty($property) { |
|
151 | + if (\is_callable($property)) { |
|
152 | 152 | $this->properties[]=$property; |
153 | - }elseif(\is_string($property)){ |
|
154 | - try{ |
|
153 | + }elseif (\is_string($property)) { |
|
154 | + try { |
|
155 | 155 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
156 | 156 | $rProperty=$this->reflect->getProperty($property); |
157 | 157 | $this->properties[]=$rProperty; |
158 | - }catch(\Exception $e){ |
|
158 | + }catch (\Exception $e) { |
|
159 | 159 | $this->_beforeAddProperty(\sizeof($this->properties), $property); |
160 | 160 | $this->properties[]=$property; |
161 | 161 | } |
162 | - }elseif(\is_int($property)){ |
|
162 | + }elseif (\is_int($property)) { |
|
163 | 163 | $props=$this->getDefaultProperties(); |
164 | - if(isset($props[$property])) |
|
164 | + if (isset($props[$property])) |
|
165 | 165 | $this->properties[]=$props[$property]; |
166 | 166 | else |
167 | 167 | $this->properties[]=$property; |
168 | - }else{ |
|
168 | + } else { |
|
169 | 169 | $this->properties[]=$property; |
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - protected function getDefaultProperties(){ |
|
173 | + protected function getDefaultProperties() { |
|
174 | 174 | $result=[]; |
175 | 175 | $properties=$this->reflect->getProperties(); |
176 | - foreach ($properties as $property){ |
|
176 | + foreach ($properties as $property) { |
|
177 | 177 | $showable=$this->showableProperty($property); |
178 | - if($showable!==false){ |
|
178 | + if ($showable!==false) { |
|
179 | 179 | $result[]=$property; |
180 | 180 | } |
181 | 181 | } |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | return $this; |
188 | 188 | } |
189 | 189 | |
190 | - public function setValueFunction($index,$callback){ |
|
190 | + public function setValueFunction($index, $callback) { |
|
191 | 191 | $this->values[$index]=$callback; |
192 | 192 | return $this; |
193 | 193 | } |
194 | 194 | |
195 | - public function setIdentifierFunction($callback){ |
|
195 | + public function setIdentifierFunction($callback) { |
|
196 | 196 | $this->values["identifier"]=$callback; |
197 | 197 | return $this; |
198 | 198 | } |
@@ -205,41 +205,41 @@ discard block |
||
205 | 205 | return $this->properties; |
206 | 206 | } |
207 | 207 | |
208 | - public function getCaption($index){ |
|
209 | - if(isset($this->captions[$index])){ |
|
208 | + public function getCaption($index) { |
|
209 | + if (isset($this->captions[$index])) { |
|
210 | 210 | return $this->captions[$index]; |
211 | 211 | } |
212 | - if($this->properties[$index] instanceof \ReflectionProperty) |
|
212 | + if ($this->properties[$index] instanceof \ReflectionProperty) |
|
213 | 213 | return $this->properties[$index]->getName(); |
214 | - elseif(\is_callable($this->properties[$index])) |
|
214 | + elseif (\is_callable($this->properties[$index])) |
|
215 | 215 | return ""; |
216 | 216 | else |
217 | 217 | return $this->properties[$index]; |
218 | 218 | } |
219 | 219 | |
220 | - public function getCaptions(){ |
|
221 | - if(isset($this->captions)){ |
|
222 | - $captions= $this->captions; |
|
223 | - for($i=\sizeof($captions);$i<$this->count();$i++){ |
|
220 | + public function getCaptions() { |
|
221 | + if (isset($this->captions)) { |
|
222 | + $captions=$this->captions; |
|
223 | + for ($i=\sizeof($captions); $i<$this->count(); $i++) { |
|
224 | 224 | $captions[]=""; |
225 | 225 | } |
226 | - }else{ |
|
226 | + } else { |
|
227 | 227 | $captions=[]; |
228 | 228 | $index=0; |
229 | 229 | $count=$this->count(); |
230 | - while($index<$count){ |
|
230 | + while ($index<$count) { |
|
231 | 231 | $captions[]=$this->getCaption($index++); |
232 | 232 | } |
233 | 233 | } |
234 | - if(isset($this->captionCallback) && \is_callable($this->captionCallback)){ |
|
234 | + if (isset($this->captionCallback) && \is_callable($this->captionCallback)) { |
|
235 | 235 | $callback=$this->captionCallback; |
236 | - $callback($captions,$this->instance); |
|
236 | + $callback($captions, $this->instance); |
|
237 | 237 | } |
238 | 238 | return $captions; |
239 | 239 | } |
240 | 240 | |
241 | - public function setCaption($index,$caption){ |
|
242 | - if(isset($this->captions)===false) |
|
241 | + public function setCaption($index, $caption) { |
|
242 | + if (isset($this->captions)===false) |
|
243 | 243 | $this->captions=[]; |
244 | 244 | $this->captions[$index]=$caption; |
245 | 245 | return $this; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param callable $callback function called after the field compilation |
258 | 258 | * @return \Ajax\semantic\widgets\datatable\InstanceViewer |
259 | 259 | */ |
260 | - public function afterCompile($index,$callback){ |
|
260 | + public function afterCompile($index, $callback) { |
|
261 | 261 | $this->afterCompile[$index]=$callback; |
262 | 262 | return $this; |
263 | 263 | } |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | protected $image; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $content=NULL) { |
12 | - parent::__construct($identifier,"item",$content); |
|
12 | + parent::__construct($identifier, "item", $content); |
|
13 | 13 | } |
14 | - protected function initContent($content){ |
|
15 | - if(\is_array($content)){ |
|
16 | - if(JArray::isAssociative($content)===false){ |
|
14 | + protected function initContent($content) { |
|
15 | + if (\is_array($content)) { |
|
16 | + if (JArray::isAssociative($content)===false) { |
|
17 | 17 | $icon=@$content[0]; |
18 | 18 | $title=@$content[1]; |
19 | 19 | $desc=@$content[2]; |
20 | - }else{ |
|
20 | + } else { |
|
21 | 21 | $icon=@$content["icon"]; |
22 | 22 | $image=@$content["image"]; |
23 | 23 | $title=@$content["title"]; |
@@ -25,21 +25,21 @@ discard block |
||
25 | 25 | $desc=@$content["description"]; |
26 | 26 | $items=@$content["items"]; |
27 | 27 | } |
28 | - if(isset($icon)){ |
|
28 | + if (isset($icon)) { |
|
29 | 29 | $this->setIcon($icon); |
30 | 30 | } |
31 | - if(isset($image)){ |
|
31 | + if (isset($image)) { |
|
32 | 32 | $this->setImage($image); |
33 | 33 | } |
34 | - if(isset($title)){ |
|
35 | - $this->setTitle($title,$desc); |
|
36 | - }elseif (isset($header)){ |
|
37 | - $this->setTitle($header,$desc,"header"); |
|
34 | + if (isset($title)) { |
|
35 | + $this->setTitle($title, $desc); |
|
36 | + }elseif (isset($header)) { |
|
37 | + $this->setTitle($header, $desc, "header"); |
|
38 | 38 | } |
39 | - if(isset($items)){ |
|
39 | + if (isset($items)) { |
|
40 | 40 | $this->addList($items); |
41 | 41 | } |
42 | - }else{ |
|
42 | + } else { |
|
43 | 43 | $this->setContent($content); |
44 | 44 | } |
45 | 45 | } |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | return $list; |
51 | 51 | } |
52 | 52 | |
53 | - public function getList(){ |
|
53 | + public function getList() { |
|
54 | 54 | return $this->content["list"]; |
55 | 55 | } |
56 | 56 | |
57 | - public function getItem($index){ |
|
57 | + public function getItem($index) { |
|
58 | 58 | return $this->getList()->getItem($index); |
59 | 59 | } |
60 | 60 | } |
61 | 61 | \ No newline at end of file |
@@ -13,53 +13,53 @@ discard block |
||
13 | 13 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
14 | 14 | |
15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
16 | - use FieldTrait,LabeledIconTrait { |
|
16 | + use FieldTrait, LabeledIconTrait { |
|
17 | 17 | addIcon as addIconP; |
18 | 18 | } |
19 | 19 | protected $mClass="menu"; |
20 | 20 | protected $mTagName="div"; |
21 | - protected $items=array (); |
|
22 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
21 | + protected $items=array(); |
|
22 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
23 | 23 | protected $input; |
24 | 24 | protected $value; |
25 | 25 | protected $_associative; |
26 | 26 | |
27 | - public function __construct($identifier, $value="", $items=array(),$associative=true) { |
|
27 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
28 | 28 | parent::__construct($identifier, "div"); |
29 | 29 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
30 | 30 | $this->setProperty("class", "ui dropdown"); |
31 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
31 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
32 | 32 | $content->setClass("text"); |
33 | 33 | $this->setValue($value); |
34 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
34 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
35 | 35 | $this->content=array($content); |
36 | 36 | $this->tagName="div"; |
37 | 37 | $this->_associative=$associative; |
38 | 38 | $this->addItems($items); |
39 | 39 | } |
40 | 40 | |
41 | - public function getField(){ |
|
41 | + public function getField() { |
|
42 | 42 | return $this->input; |
43 | 43 | } |
44 | 44 | |
45 | - public function getDataField(){ |
|
45 | + public function getDataField() { |
|
46 | 46 | return $this->input; |
47 | 47 | } |
48 | 48 | |
49 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
50 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
49 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
50 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
51 | 51 | $this->items[]=$itemO; |
52 | 52 | return $itemO; |
53 | 53 | } |
54 | 54 | |
55 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
56 | - $this->addIconP($icon,$before,$labeled); |
|
55 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
56 | + $this->addIconP($icon, $before, $labeled); |
|
57 | 57 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
58 | 58 | } |
59 | 59 | |
60 | - public function addIcons($icons){ |
|
60 | + public function addIcons($icons) { |
|
61 | 61 | $count=$this->count(); |
62 | - for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){ |
|
62 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
63 | 63 | $this->getItem($i)->addIcon($icons[$i]); |
64 | 64 | } |
65 | 65 | } |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | * @param number $position |
71 | 71 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
72 | 72 | */ |
73 | - public function insertItem($item,$position=0){ |
|
73 | + public function insertItem($item, $position=0) { |
|
74 | 74 | $itemO=$this->beforeAddItem($item); |
75 | - $start = array_slice($this->items, 0, $position); |
|
76 | - $end = array_slice($this->items, $position); |
|
77 | - $start[] = $item; |
|
75 | + $start=array_slice($this->items, 0, $position); |
|
76 | + $end=array_slice($this->items, $position); |
|
77 | + $start[]=$item; |
|
78 | 78 | $this->items=array_merge($start, $end); |
79 | 79 | return $itemO; |
80 | 80 | } |
81 | 81 | |
82 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
82 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
83 | 83 | $itemO=$item; |
84 | - if(\is_array($item)){ |
|
84 | + if (\is_array($item)) { |
|
85 | 85 | $description=JArray::getValue($item, "description", 3); |
86 | 86 | $value=JArray::getValue($item, "value", 1); |
87 | 87 | $image=JArray::getValue($item, "image", 2); |
88 | 88 | $item=JArray::getValue($item, "item", 0); |
89 | 89 | } |
90 | - if(!$item instanceof HtmlDropdownItem){ |
|
91 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
92 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
90 | + if (!$item instanceof HtmlDropdownItem) { |
|
91 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
92 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
93 | 93 | $this->addToProperty("class", "vertical"); |
94 | 94 | } |
95 | 95 | return $itemO; |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | $this->addItem($function($object)); |
103 | 103 | } |
104 | 104 | |
105 | - public function addInput($name){ |
|
106 | - if(!isset($name)) |
|
105 | + public function addInput($name) { |
|
106 | + if (!isset($name)) |
|
107 | 107 | $name="input-".$this->identifier; |
108 | 108 | $this->setAction("activate"); |
109 | - $this->input=new HtmlInput($name,"hidden"); |
|
109 | + $this->input=new HtmlInput($name, "hidden"); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -115,15 +115,15 @@ discard block |
||
115 | 115 | * @param string $icon |
116 | 116 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
117 | 117 | */ |
118 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
119 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
118 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
119 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | 123 | * Adds a divider item |
124 | 124 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
125 | 125 | */ |
126 | - public function addDividerItem(){ |
|
126 | + public function addDividerItem() { |
|
127 | 127 | return $this->addItem(HtmlDropdownItem::divider()); |
128 | 128 | } |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param string $icon |
134 | 134 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
135 | 135 | */ |
136 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
137 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
136 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
137 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $color |
144 | 144 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
145 | 145 | */ |
146 | - public function addCircularLabelItem($caption,$color){ |
|
146 | + public function addCircularLabelItem($caption, $color) { |
|
147 | 147 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
148 | 148 | } |
149 | 149 | |
@@ -152,87 +152,87 @@ discard block |
||
152 | 152 | * @param string $image |
153 | 153 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
154 | 154 | */ |
155 | - public function addMiniAvatarImageItem($caption,$image){ |
|
155 | + public function addMiniAvatarImageItem($caption, $image) { |
|
156 | 156 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
157 | 157 | } |
158 | 158 | |
159 | - public function addItems($items){ |
|
160 | - if(\is_array($items) && $this->_associative){ |
|
161 | - foreach ($items as $k=>$v){ |
|
159 | + public function addItems($items) { |
|
160 | + if (\is_array($items) && $this->_associative) { |
|
161 | + foreach ($items as $k=>$v) { |
|
162 | 162 | $this->addItem($v)->setData($k); |
163 | 163 | } |
164 | - }else{ |
|
165 | - foreach ($items as $item){ |
|
164 | + } else { |
|
165 | + foreach ($items as $item) { |
|
166 | 166 | $this->addItem($item); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - public function getItem($index){ |
|
171 | + public function getItem($index) { |
|
172 | 172 | return $this->items[$index]; |
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
176 | 176 | * @return int |
177 | 177 | */ |
178 | - public function count(){ |
|
178 | + public function count() { |
|
179 | 179 | return \sizeof($this->items); |
180 | 180 | } |
181 | 181 | /** |
182 | 182 | * @param boolean $dropdown |
183 | 183 | */ |
184 | - public function asDropdown($dropdown){ |
|
185 | - if($dropdown===false){ |
|
184 | + public function asDropdown($dropdown) { |
|
185 | + if ($dropdown===false) { |
|
186 | 186 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
187 | 187 | $dropdown="menu"; |
188 | - }else{ |
|
188 | + } else { |
|
189 | 189 | $dropdown="dropdown"; |
190 | 190 | $this->mClass="menu"; |
191 | 191 | } |
192 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
192 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
193 | 193 | } |
194 | 194 | |
195 | - public function setVertical(){ |
|
196 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
195 | + public function setVertical() { |
|
196 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
197 | 197 | } |
198 | 198 | |
199 | - public function setInline(){ |
|
200 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
199 | + public function setInline() { |
|
200 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
201 | 201 | } |
202 | 202 | |
203 | - public function setSimple(){ |
|
204 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
203 | + public function setSimple() { |
|
204 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
205 | 205 | } |
206 | 206 | |
207 | - public function asButton($floating=false){ |
|
208 | - if($floating) |
|
207 | + public function asButton($floating=false) { |
|
208 | + if ($floating) |
|
209 | 209 | $this->addToProperty("class", "floating"); |
210 | 210 | $this->removePropertyValue("class", "selection"); |
211 | 211 | return $this->addToProperty("class", "button"); |
212 | 212 | } |
213 | 213 | |
214 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
215 | - if(isset($name)) |
|
214 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
215 | + if (isset($name)) |
|
216 | 216 | $this->addInput($name); |
217 | - if($multiple) |
|
217 | + if ($multiple) |
|
218 | 218 | $this->addToProperty("class", "multiple"); |
219 | - if ($selection){ |
|
220 | - if($this->propertyContains("class", "button")===false) |
|
221 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
219 | + if ($selection) { |
|
220 | + if ($this->propertyContains("class", "button")===false) |
|
221 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
222 | 222 | } |
223 | 223 | return $this; |
224 | 224 | } |
225 | 225 | |
226 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
227 | - $this->asSelect($name,$multiple,$selection); |
|
226 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
227 | + $this->asSelect($name, $multiple, $selection); |
|
228 | 228 | return $this->addToProperty("class", "search"); |
229 | 229 | } |
230 | 230 | |
231 | - public function setSelect($name=NULL,$multiple=false){ |
|
232 | - if(!isset($name)) |
|
231 | + public function setSelect($name=NULL, $multiple=false) { |
|
232 | + if (!isset($name)) |
|
233 | 233 | $name="select-".$this->identifier; |
234 | 234 | $this->input=null; |
235 | - if($multiple){ |
|
235 | + if ($multiple) { |
|
236 | 236 | $this->setProperty("multiple", true); |
237 | 237 | $this->addToProperty("class", "multiple"); |
238 | 238 | } |
@@ -240,37 +240,37 @@ discard block |
||
240 | 240 | $this->tagName="select"; |
241 | 241 | $this->setProperty("name", $name); |
242 | 242 | $this->content=null; |
243 | - foreach ($this->items as $item){ |
|
243 | + foreach ($this->items as $item) { |
|
244 | 244 | $item->asOption(); |
245 | 245 | } |
246 | 246 | return $this; |
247 | 247 | } |
248 | 248 | |
249 | - public function asSubmenu($pointing=NULL){ |
|
249 | + public function asSubmenu($pointing=NULL) { |
|
250 | 250 | $this->setClass("ui dropdown link item"); |
251 | - if(isset($pointing)){ |
|
251 | + if (isset($pointing)) { |
|
252 | 252 | $this->setPointing($pointing); |
253 | 253 | } |
254 | 254 | return $this; |
255 | 255 | } |
256 | 256 | |
257 | - public function setPointing($value=Direction::NONE){ |
|
258 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
257 | + public function setPointing($value=Direction::NONE) { |
|
258 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
259 | 259 | } |
260 | 260 | |
261 | - public function setValue($value){ |
|
261 | + public function setValue($value) { |
|
262 | 262 | $this->value=$value; |
263 | 263 | return $this; |
264 | 264 | } |
265 | - private function applyValue(){ |
|
265 | + private function applyValue() { |
|
266 | 266 | $value=$this->value; |
267 | - if(isset($this->input) && isset($value)){ |
|
267 | + if (isset($this->input) && isset($value)) { |
|
268 | 268 | $this->input->setProperty("value", $value); |
269 | - }else{ |
|
269 | + } else { |
|
270 | 270 | $this->setProperty("value", $value); |
271 | 271 | } |
272 | 272 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
273 | - if(isset($textElement)) |
|
273 | + if (isset($textElement)) |
|
274 | 274 | $textElement->setContent($value); |
275 | 275 | return $this; |
276 | 276 | } |
@@ -280,29 +280,29 @@ discard block |
||
280 | 280 | * @see BaseHtml::run() |
281 | 281 | */ |
282 | 282 | public function run(JsUtils $js) { |
283 | - if($this->propertyContains("class", "simple")===false){ |
|
284 | - if(isset($this->_bsComponent)===false) |
|
285 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
283 | + if ($this->propertyContains("class", "simple")===false) { |
|
284 | + if (isset($this->_bsComponent)===false) |
|
285 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
286 | 286 | $this->addEventsOnRun($js); |
287 | 287 | return $this->_bsComponent; |
288 | 288 | } |
289 | 289 | } |
290 | 290 | |
291 | - public function setCompact(){ |
|
291 | + public function setCompact() { |
|
292 | 292 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
293 | 293 | } |
294 | 294 | |
295 | - public function setAction($action){ |
|
295 | + public function setAction($action) { |
|
296 | 296 | $this->_params["action"]=$action; |
297 | 297 | } |
298 | 298 | |
299 | - public function setFullTextSearch($value){ |
|
299 | + public function setFullTextSearch($value) { |
|
300 | 300 | $this->_params["fullTextSearch"]=$value; |
301 | 301 | } |
302 | 302 | |
303 | 303 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
304 | 304 | $this->applyValue(); |
305 | - return parent::compile($js,$view); |
|
305 | + return parent::compile($js, $view); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | public function getInput() { |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | * @license Apache 2 http://www.apache.org/licenses/ |
16 | 16 | **/ |
17 | 17 | class Jquery { |
18 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
18 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
19 | 19 | protected $_ui; |
20 | 20 | protected $_bootstrap; |
21 | 21 | protected $_semantic; |
22 | - protected $jquery_code_for_compile=array (); |
|
22 | + protected $jquery_code_for_compile=array(); |
|
23 | 23 | protected $jsUtils; |
24 | 24 | protected $params; |
25 | 25 | |
26 | - protected $jquery_events=array ( |
|
27 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
26 | + protected $jquery_events=array( |
|
27 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | public function ui($ui=NULL) { |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | return $this->_semantic; |
49 | 49 | } |
50 | 50 | |
51 | - public function __construct($params,$jsUtils) { |
|
51 | + public function __construct($params, $jsUtils) { |
|
52 | 52 | $this->params=array(); |
53 | - foreach ( $params as $key => $val ) { |
|
53 | + foreach ($params as $key => $val) { |
|
54 | 54 | $this->params[$key]=$params[$key]; |
55 | 55 | } |
56 | 56 | $this->jsUtils=$jsUtils; |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function _output($array_js='') { |
116 | 116 | if (!is_array($array_js)) { |
117 | - $array_js=array ( |
|
117 | + $array_js=array( |
|
118 | 118 | $array_js |
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
122 | - foreach ( $array_js as $js ) { |
|
122 | + foreach ($array_js as $js) { |
|
123 | 123 | $this->jquery_code_for_compile[]="\t$js\n"; |
124 | 124 | } |
125 | 125 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param string $param |
132 | 132 | * @param boolean $immediatly delayed if false |
133 | 133 | */ |
134 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
134 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
135 | 135 | $element=Javascript::prep_element($element); |
136 | 136 | if (isset($param)) { |
137 | 137 | $param=Javascript::prep_value($param); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param boolean $immediatly delayed if false |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
153 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
154 | 154 | $to=Javascript::prep_element($to); |
155 | 155 | $element=Javascript::prep_element($element); |
156 | 156 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function sortable($element, $options=array()) { |
170 | 170 | if (count($options)>0) { |
171 | - $sort_options=array (); |
|
172 | - foreach ( $options as $k => $v ) { |
|
171 | + $sort_options=array(); |
|
172 | + foreach ($options as $k => $v) { |
|
173 | 173 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
174 | 174 | } |
175 | 175 | $sort_options=implode(",", $sort_options); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
204 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
205 | 205 | if (is_array($js)) { |
206 | 206 | $js=implode("\n\t\t", $js); |
207 | 207 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
216 | 216 | else |
217 | 217 | $event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
218 | - if($immediatly) |
|
218 | + if ($immediatly) |
|
219 | 219 | $this->jquery_code_for_compile[]=$event; |
220 | 220 | return $event; |
221 | 221 | } |
@@ -247,18 +247,18 @@ discard block |
||
247 | 247 | $script.='});'; |
248 | 248 | |
249 | 249 | $this->jquery_code_for_compile=array(); |
250 | - if($this->params["debug"]===false){ |
|
250 | + if ($this->params["debug"]===false) { |
|
251 | 251 | $script=$this->minify($script); |
252 | 252 | } |
253 | 253 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
254 | 254 | |
255 | - if ($view!==NULL){ |
|
256 | - $this->jsUtils->createScriptVariable($view,$view_var, $output); |
|
255 | + if ($view!==NULL) { |
|
256 | + $this->jsUtils->createScriptVariable($view, $view_var, $output); |
|
257 | 257 | } |
258 | 258 | return $output; |
259 | 259 | } |
260 | 260 | |
261 | - private function _compileLibrary($library){ |
|
261 | + private function _compileLibrary($library) { |
|
262 | 262 | if ($library!=NULL) { |
263 | 263 | if ($library->isAutoCompile()) { |
264 | 264 | $library->compile(true); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @return void |
277 | 277 | */ |
278 | 278 | public function _clear_compile() { |
279 | - $this->jquery_code_for_compile=array (); |
|
279 | + $this->jquery_code_for_compile=array(); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,18 +285,18 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function _document_ready($js) { |
287 | 287 | if (!is_array($js)) { |
288 | - $js=array ( |
|
288 | + $js=array( |
|
289 | 289 | $js |
290 | 290 | ); |
291 | 291 | } |
292 | 292 | |
293 | - foreach ( $js as $script ) { |
|
293 | + foreach ($js as $script) { |
|
294 | 294 | $this->jquery_code_for_compile[]=$script; |
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | 298 | private function minify($input) { |
299 | - if(trim($input) === "") return $input; |
|
299 | + if (trim($input)==="") return $input; |
|
300 | 300 | return preg_replace( |
301 | 301 | array( |
302 | 302 | // Remove comment(s) |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | 9 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
10 | - protected $_params=array (); |
|
10 | + protected $_params=array(); |
|
11 | 11 | |
12 | 12 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
13 | 13 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | $this->setLabel($label); |
19 | 19 | } |
20 | 20 | |
21 | - public function setChecked($value=true){ |
|
22 | - if($value===true){ |
|
21 | + public function setChecked($value=true) { |
|
22 | + if ($value===true) { |
|
23 | 23 | $this->getField()->setProperty("checked", "checked"); |
24 | - }else{ |
|
24 | + } else { |
|
25 | 25 | $this->getField()->removeProperty("checked"); |
26 | 26 | } |
27 | 27 | return $this; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
84 | 84 | */ |
85 | 85 | public function attachEvent($selector, $action=NULL) { |
86 | - if (isset($action)||\is_numeric($action)===true) { |
|
86 | + if (isset($action) || \is_numeric($action)===true) { |
|
87 | 87 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
88 | 88 | } else { |
89 | 89 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function attachEvents($events=array()) { |
101 | 101 | if (\is_array($events)) { |
102 | - foreach ( $events as $action => $selector ) { |
|
102 | + foreach ($events as $action => $selector) { |
|
103 | 103 | $this->attachEvent($selector, $action); |
104 | 104 | } |
105 | 105 | } |
@@ -110,16 +110,16 @@ discard block |
||
110 | 110 | return $this->addToProperty("class", "fitted"); |
111 | 111 | } |
112 | 112 | |
113 | - public function setOnChecked($jsCode){ |
|
113 | + public function setOnChecked($jsCode) { |
|
114 | 114 | $this->_params["onChecked"]=$jsCode; |
115 | 115 | } |
116 | 116 | |
117 | - public function setOnUnchecked($jsCode){ |
|
117 | + public function setOnUnchecked($jsCode) { |
|
118 | 118 | $this->_params["onUnchecked"]=$jsCode; |
119 | 119 | } |
120 | 120 | |
121 | 121 | public function run(JsUtils $js) { |
122 | - $this->_bsComponent=$js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
122 | + $this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params); |
|
123 | 123 | return parent::run($js); |
124 | 124 | } |
125 | 125 | } |
126 | 126 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | |
18 | 18 | class HtmlTabs extends HtmlBsDoubleElement { |
19 | - protected $tabs=array (); |
|
19 | + protected $tabs=array(); |
|
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | } |
28 | 28 | |
29 | 29 | protected function addTab_($tab, $index=null) { |
30 | - if($tab instanceof HtmlDropdown){ |
|
30 | + if ($tab instanceof HtmlDropdown) { |
|
31 | 31 | $tab->setMTagName("li"); |
32 | 32 | } |
33 | 33 | if (isset($index)) { |
34 | - $inserted=array ( |
|
34 | + $inserted=array( |
|
35 | 35 | $tab |
36 | 36 | ); |
37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $this->tabs []=$tab; |
40 | 40 | } |
41 | 41 | |
42 | - public function setActive($index){ |
|
42 | + public function setActive($index) { |
|
43 | 43 | $size=\sizeof($this->tabs); |
44 | - for ($i=0;$i<$size;$i++){ |
|
44 | + for ($i=0; $i<$size; $i++) { |
|
45 | 45 | $this->tabs[$i]->setActive($i==$index); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - public function disable($index){ |
|
49 | + public function disable($index) { |
|
50 | 50 | $this->tabs[$index]->disable(); |
51 | 51 | } |
52 | 52 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | public function addTabs($tabs) { |
80 | - foreach ( $tabs as $tab ) { |
|
80 | + foreach ($tabs as $tab) { |
|
81 | 81 | $this->addTab($tab); |
82 | 82 | } |
83 | 83 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function run(JsUtils $js) { |
109 | 109 | $this->_bsComponent=new Tabs($js); |
110 | - foreach ( $this->tabs as $tab ) { |
|
110 | + foreach ($this->tabs as $tab) { |
|
111 | 111 | $this->_bsComponent->addTab($tab->run($js)); |
112 | 112 | } |
113 | 113 | $this->addEventsOnRun($js); |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | public function createTabContents() { |
118 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
119 | - foreach ( $this->tabs as $tab ) { |
|
119 | + foreach ($this->tabs as $tab) { |
|
120 | 120 | if ($tab instanceof HtmlTabItem) |
121 | 121 | $tabContent->addTabItem($tab->getHref()); |
122 | 122 | elseif ($tab instanceof HtmlDropdown) { |
123 | - foreach ( $tab->getItems() as $dropdownItem ) { |
|
123 | + foreach ($tab->getItems() as $dropdownItem) { |
|
124 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
125 | 125 | } |
126 | 126 | } |
@@ -155,21 +155,21 @@ discard block |
||
155 | 155 | if (sizeof($this->content->getTabItems())>0) { |
156 | 156 | $this->content->getTabItem(0)->addToProperty("class", "fade in"); |
157 | 157 | $size=sizeof($this->tabs); |
158 | - for($index=0; $index<$size; $index++) { |
|
158 | + for ($index=0; $index<$size; $index++) { |
|
159 | 159 | $this->content->getTabItem($index)->addToProperty("class", "fade"); |
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){ |
|
165 | - foreach ($this->tabs as $tab){ |
|
166 | - $tab->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
164 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
165 | + foreach ($this->tabs as $tab) { |
|
166 | + $tab->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
167 | 167 | } |
168 | 168 | return $this; |
169 | 169 | } |
170 | 170 | |
171 | - public function setStacked($stacked=true){ |
|
172 | - if($stacked) |
|
171 | + public function setStacked($stacked=true) { |
|
172 | + if ($stacked) |
|
173 | 173 | $this->stacked="nav-stacked"; |
174 | 174 | else $this->stacked=""; |
175 | 175 | } |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * @author jc |
15 | 15 | * @version 1.001 |
16 | 16 | */ |
17 | -class HtmlTab extends HtmlSemCollection{ |
|
17 | +class HtmlTab extends HtmlSemCollection { |
|
18 | 18 | |
19 | 19 | protected $params=array("debug"=>true); |
20 | 20 | |
21 | - public function __construct( $identifier, $tabs=array()){ |
|
22 | - parent::__construct( $identifier, "div", ""); |
|
21 | + public function __construct($identifier, $tabs=array()) { |
|
22 | + parent::__construct($identifier, "div", ""); |
|
23 | 23 | $menu=new HtmlMenu("menu".$this->identifier); |
24 | - $menu->asTab(false)->setAttachment(NULL,Side::TOP); |
|
24 | + $menu->asTab(false)->setAttachment(NULL, Side::TOP); |
|
25 | 25 | $this->content["menu"]=$menu; |
26 | 26 | $this->addItems($tabs); |
27 | 27 | } |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | * @see \Ajax\common\html\HtmlCollection::createItem() |
32 | 32 | * @return HtmlSegment |
33 | 33 | */ |
34 | - protected function createItem($value){ |
|
34 | + protected function createItem($value) { |
|
35 | 35 | $count=$this->count(); |
36 | 36 | $title=$value; |
37 | 37 | $content=NULL; |
38 | - if(\is_array($value)){ |
|
39 | - $title=@$value[0];$content=@$value[1]; |
|
38 | + if (\is_array($value)) { |
|
39 | + $title=@$value[0]; $content=@$value[1]; |
|
40 | 40 | } |
41 | 41 | $menuItem=$this->content["menu"]->addItem($title); |
42 | 42 | $menuItem->addToProperty("data-tab", $menuItem->getIdentifier()); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @param string $datatab |
51 | 51 | * @return \Ajax\semantic\html\elements\HtmlSegment |
52 | 52 | */ |
53 | - private function createSegment($count,$content,$datatab){ |
|
53 | + private function createSegment($count, $content, $datatab) { |
|
54 | 54 | $segment=new HtmlSegment("item-".$this->identifier."-".$count, $content); |
55 | - $segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab); |
|
55 | + $segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab); |
|
56 | 56 | return $segment; |
57 | 57 | } |
58 | 58 | |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | * @param String $content new content |
63 | 63 | * @return \Ajax\semantic\html\modules\HtmlTab |
64 | 64 | */ |
65 | - public function setTabContent($index,$content){ |
|
65 | + public function setTabContent($index, $content) { |
|
66 | 66 | $menu=$this->content["menu"]; |
67 | - if($index<$menu->count()){ |
|
68 | - if(isset($this->content[$index])===false){ |
|
67 | + if ($index<$menu->count()) { |
|
68 | + if (isset($this->content[$index])===false) { |
|
69 | 69 | $this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier()); |
70 | - }else |
|
70 | + } else |
|
71 | 71 | $this->content[$index]->setContent($content); |
72 | 72 | } |
73 | 73 | return $this; |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @param array $contents |
79 | 79 | * @return \Ajax\semantic\html\modules\HtmlTab |
80 | 80 | */ |
81 | - public function setTabsContent($contents){ |
|
81 | + public function setTabsContent($contents) { |
|
82 | 82 | $size=\sizeof($contents); |
83 | - for($i=0;$i<$size;$i++){ |
|
83 | + for ($i=0; $i<$size; $i++) { |
|
84 | 84 | $this->setTabContent($i, $contents[$i]); |
85 | 85 | } |
86 | 86 | return $this; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param int $index |
92 | 92 | * @return \Ajax\semantic\html\modules\HtmlTab |
93 | 93 | */ |
94 | - public function activate($index){ |
|
94 | + public function activate($index) { |
|
95 | 95 | $this->content["menu"]->getItem($index)->setActive(true); |
96 | 96 | $this->content[$index]->setActive(true); |
97 | 97 | return $this; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @param string $content |
104 | 104 | * @return \Ajax\semantic\html\elements\HtmlSegment |
105 | 105 | */ |
106 | - public function addTab($title,$content){ |
|
107 | - return $this->addItem([$title,$content]); |
|
106 | + public function addTab($title, $content) { |
|
107 | + return $this->addItem([$title, $content]); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -118,13 +118,13 @@ discard block |
||
118 | 118 | * @param array $params |
119 | 119 | * @return \Ajax\semantic\html\elements\HtmlSegment |
120 | 120 | */ |
121 | - public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
122 | - if(\array_key_exists($index, $this->content)){ |
|
123 | - $this->content[$index]=$js->forward($initialController, $controller, $action,$params); |
|
121 | + public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
122 | + if (\array_key_exists($index, $this->content)) { |
|
123 | + $this->content[$index]=$js->forward($initialController, $controller, $action, $params); |
|
124 | 124 | return $this->content[$index]; |
125 | 125 | } |
126 | 126 | |
127 | - return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params); |
|
127 | + return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | * @param $params The parameters to pass to the view |
138 | 138 | * @return \Ajax\semantic\html\elements\HtmlSegment |
139 | 139 | */ |
140 | - public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
141 | - if(\array_key_exists($index, $this->content)){ |
|
142 | - $this->content[$index]=$js->renderContent($initialController, $viewName,$params); |
|
140 | + public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
141 | + if (\array_key_exists($index, $this->content)) { |
|
142 | + $this->content[$index]=$js->renderContent($initialController, $viewName, $params); |
|
143 | 143 | return $this->content[$index]; |
144 | 144 | } |
145 | - return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params); |
|
145 | + return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @param array $params |
157 | 157 | * @return \Ajax\semantic\html\elements\HtmlSegment |
158 | 158 | */ |
159 | - public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
160 | - return $this->addTab($title, $js->forward($initialController, $controller, $action,$params)); |
|
159 | + public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
160 | + return $this->addTab($title, $js->forward($initialController, $controller, $action, $params)); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @param $params The parameters to pass to the view |
170 | 170 | * @return \Ajax\semantic\html\elements\HtmlSegment |
171 | 171 | */ |
172 | - public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
173 | - return $this->addTab($title, $js->renderContent($initialController, $viewName,$params)); |
|
172 | + public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
173 | + return $this->addTab($title, $js->renderContent($initialController, $viewName, $params)); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | public function setPointing($value=Direction::NONE) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param int $index |
187 | 187 | * @return Ajax\semantic\html\content\HtmlMenuItem |
188 | 188 | */ |
189 | - public function getMenuTab($index){ |
|
189 | + public function getMenuTab($index) { |
|
190 | 190 | return $this->content["menu"]->getItem($index); |
191 | 191 | } |
192 | 192 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param int $index |
196 | 196 | * @return HtmlSegment |
197 | 197 | */ |
198 | - public function getTab($index){ |
|
198 | + public function getTab($index) { |
|
199 | 199 | return $this->content[$index]; |
200 | 200 | } |
201 | 201 | |
@@ -204,22 +204,22 @@ discard block |
||
204 | 204 | * @param HtmlMenu $menu |
205 | 205 | * @return \Ajax\semantic\html\modules\HtmlTab |
206 | 206 | */ |
207 | - public function setMenu($menu){ |
|
207 | + public function setMenu($menu) { |
|
208 | 208 | $contentSize=\sizeof($this->content); |
209 | - for($i=0;$i<$contentSize;$i++){ |
|
210 | - if($menu->getItem($i)!==NULL){ |
|
211 | - if(isset($this->content[$i])){ |
|
212 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
209 | + for ($i=0; $i<$contentSize; $i++) { |
|
210 | + if ($menu->getItem($i)!==NULL) { |
|
211 | + if (isset($this->content[$i])) { |
|
212 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | 216 | $menuSize=$menu->count(); |
217 | - for($i=0;$i<$menuSize;$i++){ |
|
217 | + for ($i=0; $i<$menuSize; $i++) { |
|
218 | 218 | $menu->getItem($i)->removeProperty("href"); |
219 | - if(isset($this->content[$i])===false){ |
|
219 | + if (isset($this->content[$i])===false) { |
|
220 | 220 | $this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier()); |
221 | 221 | } |
222 | - $menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab")); |
|
222 | + $menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab")); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | $this->content["menu"]=$menu; |
@@ -231,15 +231,15 @@ discard block |
||
231 | 231 | * @see BaseHtml::run() |
232 | 232 | */ |
233 | 233 | public function run(JsUtils $js) { |
234 | - if(isset($this->_bsComponent)===false) |
|
235 | - $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params); |
|
234 | + if (isset($this->_bsComponent)===false) |
|
235 | + $this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params); |
|
236 | 236 | $this->addEventsOnRun($js); |
237 | 237 | return $this->_bsComponent; |
238 | 238 | } |
239 | 239 | |
240 | 240 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
241 | - if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
241 | + if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1) |
|
242 | 242 | $this->activate(0); |
243 | - return parent::compile($js,$view); |
|
243 | + return parent::compile($js, $view); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | \ No newline at end of file |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | * @author jc |
17 | 17 | * @version 1.001 |
18 | 18 | */ |
19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
19 | +class HtmlGridRow extends HtmlSemCollection { |
|
20 | 20 | use TextAlignmentTrait; |
21 | 21 | |
22 | 22 | private $_colSize; |
23 | 23 | private $_implicite=false; |
24 | 24 | |
25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
26 | - parent::__construct( $identifier,"div","row"); |
|
25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
26 | + parent::__construct($identifier, "div", "row"); |
|
27 | 27 | $this->_implicite=$implicite; |
28 | 28 | $width=null; |
29 | - if(isset($numCols)){ |
|
30 | - $numCols=min(16,$numCols); |
|
31 | - $numCols=max(1,$numCols); |
|
32 | - if($colSizing) |
|
29 | + if (isset($numCols)) { |
|
30 | + $numCols=min(16, $numCols); |
|
31 | + $numCols=max(1, $numCols); |
|
32 | + if ($colSizing) |
|
33 | 33 | $width=(int)(16/$numCols); |
34 | 34 | else |
35 | 35 | $this->_colSize=16/$numCols; |
36 | - for ($i=0;$i<$numCols;$i++){ |
|
36 | + for ($i=0; $i<$numCols; $i++) { |
|
37 | 37 | $this->addItem($width); |
38 | 38 | } |
39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @param int $width |
45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
46 | 46 | */ |
47 | - public function setWidth($width){ |
|
48 | - if(\is_int($width)){ |
|
47 | + public function setWidth($width) { |
|
48 | + if (\is_int($width)) { |
|
49 | 49 | $width=Wide::getConstants()["W".$width]; |
50 | 50 | } |
51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -57,29 +57,29 @@ discard block |
||
57 | 57 | * @param int $index |
58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
59 | 59 | */ |
60 | - public function getCol($index){ |
|
60 | + public function getCol($index) { |
|
61 | 61 | return $this->getItem($index); |
62 | 62 | } |
63 | 63 | |
64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
65 | 65 | $this->setWidth($colsCount); |
66 | - if($toCreate===true){ |
|
66 | + if ($toCreate===true) { |
|
67 | 67 | $count=$this->count(); |
68 | - for($i=$count;$i<$colsCount;$i++){ |
|
68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
69 | 69 | $this->addItem(null); |
70 | 70 | } |
71 | 71 | } |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | - public function addCols($colCount){ |
|
76 | - for($i=0;$i<$colCount;$i++){ |
|
75 | + public function addCols($colCount) { |
|
76 | + for ($i=0; $i<$colCount; $i++) { |
|
77 | 77 | $this->addItem(null); |
78 | 78 | } |
79 | 79 | return $this; |
80 | 80 | } |
81 | 81 | |
82 | - public function addCol($width=NULL){ |
|
82 | + public function addCol($width=NULL) { |
|
83 | 83 | return $this->addItem($width); |
84 | 84 | } |
85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * stretch the row contents to take up the entire column height |
88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
89 | 89 | */ |
90 | - public function setStretched(){ |
|
90 | + public function setStretched() { |
|
91 | 91 | return $this->addToProperty("class", "stretched"); |
92 | 92 | } |
93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
95 | 95 | * @param string $color |
96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
97 | 97 | */ |
98 | - public function setColor($color){ |
|
99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
98 | + public function setColor($color) { |
|
99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
100 | 100 | } |
101 | 101 | |
102 | - public function setValues($values,$force=false){ |
|
102 | + public function setValues($values, $force=false) { |
|
103 | 103 | $count=$this->count(); |
104 | 104 | $valuesSize=\sizeof($values); |
105 | - if($force===true){ |
|
106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
105 | + if ($force===true) { |
|
106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
108 | 108 | } |
109 | 109 | } |
110 | - $count=\min(array($this->count(),$valuesSize)); |
|
111 | - for($i=0;$i<$count;$i++){ |
|
110 | + $count=\min(array($this->count(), $valuesSize)); |
|
111 | + for ($i=0; $i<$count; $i++) { |
|
112 | 112 | $this->content[$i]->setValue($values[$i]); |
113 | 113 | } |
114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | * {@inheritDoc} |
119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
120 | 120 | */ |
121 | - protected function createItem($value){ |
|
122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
121 | + protected function createItem($value) { |
|
122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
123 | 123 | return $col; |
124 | 124 | } |
125 | 125 | |
126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
127 | - if($this->_implicite===true){ |
|
126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
127 | + if ($this->_implicite===true) { |
|
128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
129 | 129 | } |
130 | - return parent::compile($js,$view); |
|
130 | + return parent::compile($js, $view); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | \ No newline at end of file |