@@ -49,6 +49,10 @@ discard block |
||
49 | 49 | return $itemO; |
50 | 50 | } |
51 | 51 | |
52 | + /** |
|
53 | + * @param string $classname |
|
54 | + * @param integer $index |
|
55 | + */ |
|
52 | 56 | protected function setItemIdentifier($item,$classname,$index){ |
53 | 57 | if($item instanceof BaseWidget){ |
54 | 58 | if($item->getIdentifier()===""){ |
@@ -93,6 +97,9 @@ discard block |
||
93 | 97 | return $this; |
94 | 98 | } |
95 | 99 | |
100 | + /** |
|
101 | + * @param integer $index |
|
102 | + */ |
|
96 | 103 | public function removeItem($index){ |
97 | 104 | return array_splice($this->content, $index, 1); |
98 | 105 | } |
@@ -108,6 +115,9 @@ discard block |
||
108 | 115 | return $this->addItem($function($object)); |
109 | 116 | } |
110 | 117 | |
118 | + /** |
|
119 | + * @param \Closure $callBack |
|
120 | + */ |
|
111 | 121 | public function apply($callBack){ |
112 | 122 | foreach ($this->content as $item){ |
113 | 123 | $callBack($item); |
@@ -13,15 +13,28 @@ discard block |
||
13 | 13 | * @property InstanceViewer $_instanceViewer |
14 | 14 | */ |
15 | 15 | trait DataTableFieldAsTrait{ |
16 | + |
|
17 | + /** |
|
18 | + * @param \Closure $field |
|
19 | + */ |
|
16 | 20 | abstract public function addField($field); |
21 | + |
|
22 | + /** |
|
23 | + * @param integer $index |
|
24 | + * @param \Closure $field |
|
25 | + */ |
|
17 | 26 | abstract public function insertField($index,$field); |
27 | + |
|
28 | + /** |
|
29 | + * @param \Closure $field |
|
30 | + */ |
|
18 | 31 | abstract public function insertInField($index,$field); |
19 | 32 | abstract public function fieldAs($index,$type,$attributes=NULL); |
20 | 33 | /** |
21 | 34 | * @param string $caption |
22 | 35 | * @param callable $callback |
23 | 36 | * @param boolean $visibleHover |
24 | - * @return callable |
|
37 | + * @return \Closure |
|
25 | 38 | */ |
26 | 39 | private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){ |
27 | 40 | return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback); |
@@ -31,7 +44,7 @@ discard block |
||
31 | 44 | * @param callable $thisCallback |
32 | 45 | * @param array $parameters |
33 | 46 | * @param callable $callback |
34 | - * @return callable |
|
47 | + * @return \Closure |
|
35 | 48 | */ |
36 | 49 | private function getCallable($thisCallback,$parameters,$callback=null){ |
37 | 50 | $result=function($instance) use($thisCallback,$parameters,$callback){ |
@@ -83,6 +96,9 @@ discard block |
||
83 | 96 | }, $index,$attributes); |
84 | 97 | } |
85 | 98 | |
99 | + /** |
|
100 | + * @param HtmlButton $element |
|
101 | + */ |
|
86 | 102 | protected function _visibleOver($element){ |
87 | 103 | $this->_visibleHover=true; |
88 | 104 | return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;"); |
@@ -93,7 +109,7 @@ discard block |
||
93 | 109 | * @param string $caption |
94 | 110 | * @param callable $callback |
95 | 111 | * @param boolean $visibleHover |
96 | - * @return \Ajax\semantic\widgets\datatable\DataTable |
|
112 | + * @return DataTableFieldAsTrait |
|
97 | 113 | */ |
98 | 114 | public function addFieldButton($caption,$visibleHover=true,$callback=null){ |
99 | 115 | $this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback)); |
@@ -105,7 +121,7 @@ discard block |
||
105 | 121 | * @param int $index |
106 | 122 | * @param string $caption |
107 | 123 | * @param callable $callback |
108 | - * @return \Ajax\semantic\widgets\datatable\DataTable |
|
124 | + * @return DataTableFieldAsTrait |
|
109 | 125 | */ |
110 | 126 | public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
111 | 127 | $this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
@@ -117,18 +133,26 @@ discard block |
||
117 | 133 | * @param int $index |
118 | 134 | * @param string $caption |
119 | 135 | * @param callable $callback |
120 | - * @return \Ajax\semantic\widgets\datatable\DataTable |
|
136 | + * @return DataTableFieldAsTrait |
|
121 | 137 | */ |
122 | 138 | public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){ |
123 | 139 | $this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback)); |
124 | 140 | return $this; |
125 | 141 | } |
126 | 142 | |
143 | + /** |
|
144 | + * @param string $icon |
|
145 | + * @param string $class |
|
146 | + */ |
|
127 | 147 | private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){ |
128 | 148 | $this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
129 | 149 | return $this; |
130 | 150 | } |
131 | 151 | |
152 | + /** |
|
153 | + * @param string $icon |
|
154 | + * @param string $class |
|
155 | + */ |
|
132 | 156 | private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){ |
133 | 157 | $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback)); |
134 | 158 | return $this; |
@@ -146,7 +170,7 @@ discard block |
||
146 | 170 | * @param boolean $visibleHover |
147 | 171 | * @param array $deleteBehavior |
148 | 172 | * @param callable $callback |
149 | - * @return DataTable |
|
173 | + * @return DataTableFieldAsTrait |
|
150 | 174 | */ |
151 | 175 | public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){ |
152 | 176 | $this->_deleteBehavior=$deleteBehavior; |
@@ -15,6 +15,7 @@ |
||
15 | 15 | * {@inheritdoc} |
16 | 16 | * |
17 | 17 | * @see \Ajax\semantic\widgets\dataform\DataForm::__construct() |
18 | + * @param string $identifier |
|
18 | 19 | */ |
19 | 20 | public function __construct($identifier,$modelInstance=null,$fieldsOrder,$fieldsDefinition,$fields=[],$captions=[],$separators=[]) { |
20 | 21 | if(!isset($modelInstance)){ |
@@ -18,6 +18,9 @@ discard block |
||
18 | 18 | private $_container; |
19 | 19 | private $_row; |
20 | 20 | |
21 | + /** |
|
22 | + * @param string $identifier |
|
23 | + */ |
|
21 | 24 | public function __construct($identifier) { |
22 | 25 | parent::__construct($identifier, "tr", ""); |
23 | 26 | $this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ]; |
@@ -78,6 +81,7 @@ discard block |
||
78 | 81 | /** |
79 | 82 | * Sets or adds values to the row cols |
80 | 83 | * @param mixed $values |
84 | + * @param \Closure $callback |
|
81 | 85 | */ |
82 | 86 | protected function _addOrSetValues($values,$callback) { |
83 | 87 | $count=$this->count(); |
@@ -63,6 +63,9 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $op |
|
68 | + */ |
|
66 | 69 | protected function _generateBehavior($op,$params,JsUtils $js){ |
67 | 70 | if(isset($this->_urls[$op])){ |
68 | 71 | $params=\array_merge($params,["attr"=>"data-ajax"]); |
@@ -139,6 +142,9 @@ discard block |
||
139 | 142 | } |
140 | 143 | } |
141 | 144 | |
145 | + /** |
|
146 | + * @param string $checkedClass |
|
147 | + */ |
|
142 | 148 | protected function _generateRow($instance,&$table,$checkedClass=null){ |
143 | 149 | $this->_instanceViewer->setInstance($instance); |
144 | 150 | InstanceViewer::$index++; |
@@ -215,6 +221,9 @@ discard block |
||
215 | 221 | return $this; |
216 | 222 | } |
217 | 223 | |
224 | + /** |
|
225 | + * @param PositionInTable $part |
|
226 | + */ |
|
218 | 227 | private function addToolbarRow($part,$table,$captions){ |
219 | 228 | $hasPart=$table->hasPart($part); |
220 | 229 | if($hasPart){ |
@@ -254,7 +263,7 @@ discard block |
||
254 | 263 | * Paginates the DataTable element with a Semantic HtmlPaginationMenu component |
255 | 264 | * @param number $page the active page number |
256 | 265 | * @param number $total_rowcount the total number of items |
257 | - * @param number $items_per_page The number of items per page |
|
266 | + * @param integer $items_per_page The number of items per page |
|
258 | 267 | * @param number $pages_visibles The number of visible pages in the Pagination component |
259 | 268 | * @return DataTable |
260 | 269 | */ |
@@ -265,9 +274,9 @@ discard block |
||
265 | 274 | |
266 | 275 | /** |
267 | 276 | * Auto Paginates the DataTable element with a Semantic HtmlPaginationMenu component |
268 | - * @param number $page the active page number |
|
269 | - * @param number $items_per_page The number of items per page |
|
270 | - * @param number $pages_visibles The number of visible pages in the Pagination component |
|
277 | + * @param integer $page the active page number |
|
278 | + * @param integer $items_per_page The number of items per page |
|
279 | + * @param integer $pages_visibles The number of visible pages in the Pagination component |
|
271 | 280 | * @return DataTable |
272 | 281 | */ |
273 | 282 | public function autoPaginate($page=1,$items_per_page=10,$pages_visibles=4){ |
@@ -333,6 +342,9 @@ discard block |
||
333 | 342 | return $this; |
334 | 343 | } |
335 | 344 | |
345 | + /** |
|
346 | + * @return string |
|
347 | + */ |
|
336 | 348 | public function getRefreshSelector() { |
337 | 349 | if(isset($this->_refreshSelector)) |
338 | 350 | return $this->_refreshSelector; |
@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | return $tr; |
63 | 63 | } |
64 | 64 | |
65 | + /** |
|
66 | + * @param integer $value |
|
67 | + */ |
|
65 | 68 | public function newRow($value) { |
66 | 69 | return $this->createItem($value); |
67 | 70 | } |
@@ -160,6 +163,9 @@ discard block |
||
160 | 163 | return $this; |
161 | 164 | } |
162 | 165 | |
166 | + /** |
|
167 | + * @param integer $colIndex |
|
168 | + */ |
|
163 | 169 | public function setColValues($colIndex, $values=array()) { |
164 | 170 | $count=$this->count(); |
165 | 171 | if (!\is_array($values)) { |
@@ -180,6 +186,9 @@ discard block |
||
180 | 186 | return $this; |
181 | 187 | } |
182 | 188 | |
189 | + /** |
|
190 | + * @param integer $rowIndex |
|
191 | + */ |
|
183 | 192 | public function setRowValues($rowIndex, $values=array()) { |
184 | 193 | $count=$this->count(); |
185 | 194 | if (!\is_array($values)) { |
@@ -189,6 +198,9 @@ discard block |
||
189 | 198 | return $this; |
190 | 199 | } |
191 | 200 | |
201 | + /** |
|
202 | + * @param string $function |
|
203 | + */ |
|
192 | 204 | private function colAlign($colIndex, $function) { |
193 | 205 | $count=$this->count(); |
194 | 206 | for($i=0; $i < $count; $i++) { |
@@ -266,7 +278,7 @@ discard block |
||
266 | 278 | } |
267 | 279 | |
268 | 280 | /** |
269 | - * @param mixed $callback |
|
281 | + * @param callable $callback |
|
270 | 282 | * @param string $format |
271 | 283 | * @return HtmlTableContent |
272 | 284 | */ |
@@ -279,7 +291,7 @@ discard block |
||
279 | 291 | } |
280 | 292 | |
281 | 293 | /** |
282 | - * @param mixed $callback |
|
294 | + * @param callable $callback |
|
283 | 295 | * @param string $format |
284 | 296 | * @return HtmlTableContent |
285 | 297 | */ |
@@ -292,7 +304,7 @@ discard block |
||
292 | 304 | } |
293 | 305 | |
294 | 306 | /** |
295 | - * @param mixed $callback |
|
307 | + * @param callable $callback |
|
296 | 308 | * @return HtmlTableContent |
297 | 309 | */ |
298 | 310 | public function applyCells($callback) { |
@@ -304,7 +316,7 @@ discard block |
||
304 | 316 | } |
305 | 317 | |
306 | 318 | /** |
307 | - * @param mixed $callback |
|
319 | + * @param callable $callback |
|
308 | 320 | * @return HtmlTableContent |
309 | 321 | */ |
310 | 322 | public function applyRows($callback) { |
@@ -30,9 +30,17 @@ discard block |
||
30 | 30 | trait FieldAsTrait{ |
31 | 31 | |
32 | 32 | abstract protected function _getFieldIdentifier($prefix,$name=""); |
33 | + |
|
34 | + /** |
|
35 | + * @param \Closure $callback |
|
36 | + */ |
|
33 | 37 | abstract public function setValueFunction($index,$callback); |
34 | 38 | abstract protected function _getFieldName($index); |
35 | 39 | abstract protected function _getFieldCaption($index); |
40 | + |
|
41 | + /** |
|
42 | + * @param string $event |
|
43 | + */ |
|
36 | 44 | abstract protected function _buttonAsSubmit(BaseHtml &$button,$event,$url,$responseElement=NULL,$parameters=NULL); |
37 | 45 | |
38 | 46 | /** |
@@ -243,6 +251,9 @@ discard block |
||
243 | 251 | } |
244 | 252 | } |
245 | 253 | |
254 | + /** |
|
255 | + * @param integer $index |
|
256 | + */ |
|
246 | 257 | public function fieldAs($index,$type,$attributes=NULL){ |
247 | 258 | $method="fieldAs".\ucfirst($type); |
248 | 259 | if(\method_exists($this, $method)){ |
@@ -249,6 +249,9 @@ discard block |
||
249 | 249 | return $this; |
250 | 250 | } |
251 | 251 | |
252 | + /** |
|
253 | + * @param integer $index |
|
254 | + */ |
|
252 | 255 | public static function setIndex($index) { |
253 | 256 | self::$index=$index; |
254 | 257 | } |
@@ -307,7 +310,7 @@ discard block |
||
307 | 310 | * The $callback function can take the following arguments : $field=>the compiled field, $instance : the active instance of the object, $index: the field position |
308 | 311 | * @param int $index postion of the compiled field |
309 | 312 | * @param callable $callback function called after the field compilation |
310 | - * @return \Ajax\semantic\widgets\datatable\InstanceViewer |
|
313 | + * @return InstanceViewer |
|
311 | 314 | */ |
312 | 315 | public function afterCompile($index,$callback){ |
313 | 316 | $this->afterCompile[$index]=$callback; |
@@ -63,6 +63,10 @@ discard block |
||
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | + /** |
|
67 | + * @param string $name |
|
68 | + * @param string[] $typeCtrl |
|
69 | + */ |
|
66 | 70 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
67 | 71 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
68 | 72 | return $name=$value; |
@@ -80,6 +84,10 @@ discard block |
||
80 | 84 | |
81 | 85 | |
82 | 86 | |
87 | + /** |
|
88 | + * @param string $name |
|
89 | + * @param string[] $typeCtrl |
|
90 | + */ |
|
83 | 91 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
84 | 92 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
85 | 93 | if (\is_array($typeCtrl)) { |
@@ -90,6 +98,9 @@ discard block |
||
90 | 98 | return $this; |
91 | 99 | } |
92 | 100 | |
101 | + /** |
|
102 | + * @param string $name |
|
103 | + */ |
|
93 | 104 | protected function addToMember(&$name, $value, $separator=" ") { |
94 | 105 | $name=str_ireplace($value, "", $name) . $separator . $value; |
95 | 106 | return $this; |
@@ -102,6 +113,9 @@ discard block |
||
102 | 113 | $oldValue=trim($oldValue); |
103 | 114 | } |
104 | 115 | |
116 | + /** |
|
117 | + * @param \Closure $callback |
|
118 | + */ |
|
105 | 119 | protected function _getElementBy($callback,$elements){ |
106 | 120 | if (\is_array($elements)) { |
107 | 121 | $elements=\array_values($elements); |