@@ -44,6 +44,11 @@ discard block |
||
| 44 | 44 | $this->show($modelInstance); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + /** |
|
| 48 | + * @param InstanceViewer $instanceViewer |
|
| 49 | + * @param string $contentKey |
|
| 50 | + * @param boolean $edition |
|
| 51 | + */ |
|
| 47 | 52 | protected function _init($instanceViewer,$contentKey,$content,$edition){ |
| 48 | 53 | $this->_instanceViewer=$instanceViewer; |
| 49 | 54 | $this->content=[$contentKey=>$content]; |
@@ -96,16 +101,26 @@ discard block |
||
| 96 | 101 | return $this; |
| 97 | 102 | } |
| 98 | 103 | |
| 104 | + /** |
|
| 105 | + * @param \Closure $field |
|
| 106 | + */ |
|
| 99 | 107 | public function addField($field){ |
| 100 | 108 | $this->_instanceViewer->addField($field); |
| 101 | 109 | return $this; |
| 102 | 110 | } |
| 103 | 111 | |
| 112 | + /** |
|
| 113 | + * @param integer $index |
|
| 114 | + * @param \Closure $field |
|
| 115 | + */ |
|
| 104 | 116 | public function insertField($index,$field){ |
| 105 | 117 | $this->_instanceViewer->insertField($index, $field); |
| 106 | 118 | return $this; |
| 107 | 119 | } |
| 108 | 120 | |
| 121 | + /** |
|
| 122 | + * @param \Closure $field |
|
| 123 | + */ |
|
| 109 | 124 | public function insertInField($index,$field){ |
| 110 | 125 | $this->_instanceViewer->insertInField($index, $field); |
| 111 | 126 | return $this; |
@@ -25,9 +25,18 @@ discard block |
||
| 25 | 25 | trait FieldAsTrait{ |
| 26 | 26 | |
| 27 | 27 | abstract protected function _getFieldIdentifier($prefix,$name=""); |
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @param \Closure $callback |
|
| 31 | + */ |
|
| 28 | 32 | abstract public function setValueFunction($index,$callback); |
| 29 | 33 | abstract protected function _getFieldName($index); |
| 30 | 34 | abstract protected function _getFieldCaption($index); |
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param HtmlButton $button |
|
| 38 | + * @param string $event |
|
| 39 | + */ |
|
| 31 | 40 | abstract protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL); |
| 32 | 41 | |
| 33 | 42 | /** |
@@ -64,12 +73,19 @@ discard block |
||
| 64 | 73 | } |
| 65 | 74 | } |
| 66 | 75 | |
| 76 | + /** |
|
| 77 | + * @param HtmlFormInput $field |
|
| 78 | + */ |
|
| 67 | 79 | protected function _prepareFormFields(&$field,$name,&$attributes){ |
| 68 | 80 | $field->setName($name); |
| 69 | 81 | $this->_addRules($field, $attributes); |
| 70 | 82 | return $field; |
| 71 | 83 | } |
| 72 | 84 | |
| 85 | + /** |
|
| 86 | + * @param \Closure $elementCallback |
|
| 87 | + * @param string $prefix |
|
| 88 | + */ |
|
| 73 | 89 | protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){ |
| 74 | 90 | $this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){ |
| 75 | 91 | $caption=$this->_getFieldCaption($index); |
@@ -18,6 +18,9 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class DataForm extends Widget { |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $identifier |
|
| 23 | + */ |
|
| 21 | 24 | public function __construct($identifier, $modelInstance=NULL) { |
| 22 | 25 | parent::__construct($identifier, null,$modelInstance); |
| 23 | 26 | $this->_form=new HtmlForm($identifier); |
@@ -40,6 +40,10 @@ discard block |
||
| 40 | 40 | return parent::run($js); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $identifier |
|
| 45 | + * @param string $model |
|
| 46 | + */ |
|
| 43 | 47 | public function __construct($identifier,$model,$modelInstance=NULL) { |
| 44 | 48 | parent::__construct($identifier, $model,$modelInstance); |
| 45 | 49 | $this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false); |
@@ -163,6 +167,9 @@ discard block |
||
| 163 | 167 | return $this; |
| 164 | 168 | } |
| 165 | 169 | |
| 170 | + /** |
|
| 171 | + * @param PositionInTable $part |
|
| 172 | + */ |
|
| 166 | 173 | private function addToolbarRow($part,$table,$captions){ |
| 167 | 174 | $hasPart=$table->hasPart($part); |
| 168 | 175 | if($hasPart){ |
@@ -207,7 +214,7 @@ discard block |
||
| 207 | 214 | /** |
| 208 | 215 | * @param string $caption |
| 209 | 216 | * @param callable $callback |
| 210 | - * @return callable |
|
| 217 | + * @return \Closure |
|
| 211 | 218 | */ |
| 212 | 219 | private function getFieldButtonCallable($caption,$callback=null){ |
| 213 | 220 | return $this->getCallable("getFieldButton",[$caption],$callback); |
@@ -215,9 +222,9 @@ discard block |
||
| 215 | 222 | |
| 216 | 223 | /** |
| 217 | 224 | * @param callable $thisCallback |
| 218 | - * @param array $parameters |
|
| 225 | + * @param string[] $parameters |
|
| 219 | 226 | * @param callable $callback |
| 220 | - * @return callable |
|
| 227 | + * @return \Closure |
|
| 221 | 228 | */ |
| 222 | 229 | private function getCallable($thisCallback,$parameters,$callback=null){ |
| 223 | 230 | $result=function($instance) use($thisCallback,$parameters,$callback){ |
@@ -278,11 +285,19 @@ discard block |
||
| 278 | 285 | return $this; |
| 279 | 286 | } |
| 280 | 287 | |
| 288 | + /** |
|
| 289 | + * @param string $icon |
|
| 290 | + * @param string $class |
|
| 291 | + */ |
|
| 281 | 292 | private function addDefaultButton($icon,$class=null,$callback=null){ |
| 282 | 293 | $this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
| 283 | 294 | return $this; |
| 284 | 295 | } |
| 285 | 296 | |
| 297 | + /** |
|
| 298 | + * @param string $icon |
|
| 299 | + * @param string $class |
|
| 300 | + */ |
|
| 286 | 301 | private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){ |
| 287 | 302 | $this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback)); |
| 288 | 303 | return $this; |