@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | private $page_count; |
9 | 9 | private $pages_visibles; |
10 | 10 | |
11 | - public function __construct($items_per_page=10,$pages_visibles=4,$page=1){ |
|
11 | + public function __construct($items_per_page=10, $pages_visibles=4, $page=1) { |
|
12 | 12 | $this->items_per_page=$items_per_page; |
13 | 13 | $this->page=$page; |
14 | 14 | $this->pages_visibles=$pages_visibles; |
15 | 15 | $this->visible=true; |
16 | 16 | } |
17 | 17 | |
18 | - public function getObjects($objects){ |
|
19 | - $offset = ($this->page - 1) * $this->items_per_page; |
|
18 | + public function getObjects($objects) { |
|
19 | + $offset=($this->page-1)*$this->items_per_page; |
|
20 | 20 | $os=$objects; |
21 | - if(\is_array($os)===false){ |
|
21 | + if (\is_array($os)===false) { |
|
22 | 22 | $os=[]; |
23 | - foreach ($objects as $o){ |
|
23 | + foreach ($objects as $o) { |
|
24 | 24 | $os[]=$o; |
25 | 25 | } |
26 | 26 | } |
27 | - $this->page_count = 0; |
|
27 | + $this->page_count=0; |
|
28 | 28 | $row_count=\sizeof($os); |
29 | - if (0 === $row_count) { |
|
29 | + if (0===$row_count) { |
|
30 | 30 | $this->visible=false; |
31 | 31 | } else { |
32 | 32 | $this->visible=true; |
33 | - $this->page_count = (int)ceil($row_count / $this->items_per_page); |
|
34 | - if($this->page > $this->page_count+1) { |
|
35 | - $this->page = 1; |
|
33 | + $this->page_count=(int)ceil($row_count/$this->items_per_page); |
|
34 | + if ($this->page>$this->page_count+1) { |
|
35 | + $this->page=1; |
|
36 | 36 | } |
37 | 37 | } |
38 | - return array_slice($os, $offset,$this->items_per_page); |
|
38 | + return array_slice($os, $offset, $this->items_per_page); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getItemsPerPage() { |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | return $this->page_count; |
70 | 70 | } |
71 | 71 | |
72 | - public function getPagesNumbers(){ |
|
73 | - $middle= (int)ceil(($this->pages_visibles-1)/ 2); |
|
72 | + public function getPagesNumbers() { |
|
73 | + $middle=(int)ceil(($this->pages_visibles-1)/2); |
|
74 | 74 | $first=$this->page-$middle; |
75 | - if($first<1){ |
|
75 | + if ($first<1) { |
|
76 | 76 | $first=1; |
77 | 77 | } |
78 | 78 | $last=$first+$this->pages_visibles-1; |
79 | - if($last>$this->page_count){ |
|
79 | + if ($last>$this->page_count) { |
|
80 | 80 | $last=$this->page_count; |
81 | 81 | } |
82 | 82 | return \range($first, $last); |
@@ -7,20 +7,20 @@ |
||
7 | 7 | |
8 | 8 | use Ajax\semantic\html\elements\HtmlIcon; |
9 | 9 | |
10 | -class HtmlPaginationMenu extends HtmlMenu{ |
|
10 | +class HtmlPaginationMenu extends HtmlMenu { |
|
11 | 11 | private $_page; |
12 | - public function __construct( $identifier, $items=array() ){ |
|
13 | - parent::__construct( $identifier,$items); |
|
12 | + public function __construct($identifier, $items=array()) { |
|
13 | + parent::__construct($identifier, $items); |
|
14 | 14 | } |
15 | 15 | /** |
16 | 16 | * {@inheritDoc} |
17 | 17 | * @see \Ajax\common\html\BaseHtml::compile() |
18 | 18 | */ |
19 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
20 | - $this->insertItem(new HtmlIcon("", "left chevron"))->setProperty("data-page", \max([1,$this->_page-1])); |
|
21 | - $this->addItem(new HtmlIcon("", "right chevron"))->setProperty("data-page", \min([\sizeof($this->content)-2,$this->_page+1])); |
|
19 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
20 | + $this->insertItem(new HtmlIcon("", "left chevron"))->setProperty("data-page", \max([1, $this->_page-1])); |
|
21 | + $this->addItem(new HtmlIcon("", "right chevron"))->setProperty("data-page", \min([\sizeof($this->content)-2, $this->_page+1])); |
|
22 | 22 | $this->asPagination(); |
23 | - return parent::compile($js,$view); |
|
23 | + return parent::compile($js, $view); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function setActiveItem($index) { |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | use Ajax\JsUtils; |
11 | 11 | |
12 | 12 | class HtmlInput extends HtmlSemDoubleElement { |
13 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
13 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
14 | 14 | |
15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
17 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
18 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
19 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
17 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
18 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
19 | + $this->_variations=[Variation::TRANSPARENT]; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function getField() { |
@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | |
37 | 37 | public function run(JsUtils $js) { |
38 | 38 | $result=parent::run($js); |
39 | - $result->attach("#" . $this->getDataField()->getIdentifier()); |
|
39 | + $result->attach("#".$this->getDataField()->getIdentifier()); |
|
40 | 40 | return $result; |
41 | 41 | } |
42 | 42 | |
43 | - public function setTransparent(){ |
|
43 | + public function setTransparent() { |
|
44 | 44 | return $this->addToProperty("class", "transparent"); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -8,16 +8,16 @@ discard block |
||
8 | 8 | |
9 | 9 | trait MenuItemTrait { |
10 | 10 | |
11 | - public function setContent($content){ |
|
12 | - if($content==="-"){ |
|
11 | + public function setContent($content) { |
|
12 | + if ($content==="-") { |
|
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
15 | - $values=\explode(",",$content,-1); |
|
16 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
17 | - }elseif(JString::startswith($content, "-")){ |
|
18 | - $content=\ltrim($content,"-"); |
|
14 | + }elseif ($content==="-search-") { |
|
15 | + $values=\explode(",", $content, -1); |
|
16 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
17 | + }elseif (JString::startswith($content, "-")) { |
|
18 | + $content=\ltrim($content, "-"); |
|
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
20 | + } else |
|
21 | 21 | parent::setContent($content); |
22 | 22 | return $this; |
23 | 23 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param string $icon |
28 | 28 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
29 | 29 | */ |
30 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
30 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
31 | 31 | $this->setClass("ui icon search input"); |
32 | 32 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
33 | + if (isset($placeholder)) |
|
34 | 34 | $input->setProperty("placeholder", $placeholder); |
35 | 35 | $this->content=$input; |
36 | - if(isset($icon)) |
|
36 | + if (isset($icon)) |
|
37 | 37 | $this->addIcon($icon); |
38 | 38 | return $this; |
39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | /** |
42 | 42 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
43 | 43 | */ |
44 | - public function asDivider(){ |
|
44 | + public function asDivider() { |
|
45 | 45 | $this->content=NULL; |
46 | 46 | $this->tagName="div"; |
47 | 47 | $this->setClass("divider"); |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | * @param string $icon |
54 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
55 | 55 | */ |
56 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
56 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
57 | 57 | $this->setClass("header"); |
58 | 58 | $this->tagName="div"; |
59 | 59 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
60 | + if (isset($icon)) |
|
61 | + $this->addIcon($icon, Direction::LEFT); |
|
62 | 62 | return $this; |
63 | 63 | } |
64 | 64 | |
65 | - public function setPosition($direction){ |
|
66 | - $this->addToProperty("class",$direction); |
|
65 | + public function setPosition($direction) { |
|
66 | + $this->addToProperty("class", $direction); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | \ No newline at end of file |
@@ -11,14 +11,15 @@ discard block |
||
11 | 11 | public function setContent($content){ |
12 | 12 | if($content==="-"){ |
13 | 13 | $this->asDivider(); |
14 | - }elseif($content==="-search-"){ |
|
14 | + } elseif($content==="-search-"){ |
|
15 | 15 | $values=\explode(",",$content,-1); |
16 | 16 | $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
17 | - }elseif(JString::startswith($content, "-")){ |
|
17 | + } elseif(JString::startswith($content, "-")){ |
|
18 | 18 | $content=\ltrim($content,"-"); |
19 | 19 | $this->asHeader($content); |
20 | - }else |
|
21 | - parent::setContent($content); |
|
20 | + } else { |
|
21 | + parent::setContent($content); |
|
22 | + } |
|
22 | 23 | return $this; |
23 | 24 | } |
24 | 25 | |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
31 | 32 | $this->setClass("ui icon search input"); |
32 | 33 | $input=new HtmlInput("search-".$this->identifier); |
33 | - if(isset($placeholder)) |
|
34 | - $input->setProperty("placeholder", $placeholder); |
|
34 | + if(isset($placeholder)) { |
|
35 | + $input->setProperty("placeholder", $placeholder); |
|
36 | + } |
|
35 | 37 | $this->content=$input; |
36 | - if(isset($icon)) |
|
37 | - $this->addIcon($icon); |
|
38 | + if(isset($icon)) { |
|
39 | + $this->addIcon($icon); |
|
40 | + } |
|
38 | 41 | return $this; |
39 | 42 | } |
40 | 43 | |
@@ -57,8 +60,9 @@ discard block |
||
57 | 60 | $this->setClass("header"); |
58 | 61 | $this->tagName="div"; |
59 | 62 | $this->content=$caption; |
60 | - if(isset($icon)) |
|
61 | - $this->addIcon($icon,Direction::LEFT); |
|
63 | + if(isset($icon)) { |
|
64 | + $this->addIcon($icon,Direction::LEFT); |
|
65 | + } |
|
62 | 66 | return $this; |
63 | 67 | } |
64 | 68 |
@@ -2,33 +2,33 @@ |
||
2 | 2 | namespace Ajax\service; |
3 | 3 | class JString { |
4 | 4 | |
5 | - public static function contains($hay,$needle){ |
|
6 | - return strpos($hay, $needle) !== false; |
|
5 | + public static function contains($hay, $needle) { |
|
6 | + return strpos($hay, $needle)!==false; |
|
7 | 7 | } |
8 | 8 | public static function startswith($hay, $needle) { |
9 | - return substr($hay, 0, strlen($needle)) === $needle; |
|
9 | + return substr($hay, 0, strlen($needle))===$needle; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | public static function endswith($hay, $needle) { |
13 | - return substr($hay, -strlen($needle)) === $needle; |
|
13 | + return substr($hay, -strlen($needle))===$needle; |
|
14 | 14 | } |
15 | 15 | |
16 | - public static function isNull($s){ |
|
16 | + public static function isNull($s) { |
|
17 | 17 | return (!isset($s) || NULL===$s || ""===$s); |
18 | 18 | } |
19 | - public static function isNotNull($s){ |
|
19 | + public static function isNotNull($s) { |
|
20 | 20 | return (isset($s) && NULL!==$s && ""!==$s); |
21 | 21 | } |
22 | 22 | |
23 | - public static function isBoolean($value){ |
|
23 | + public static function isBoolean($value) { |
|
24 | 24 | return \is_bool($value) || $value==1 || $value==0; |
25 | 25 | } |
26 | 26 | |
27 | - public static function isBooleanTrue($value){ |
|
27 | + public static function isBooleanTrue($value) { |
|
28 | 28 | return $value==1 || $value; |
29 | 29 | } |
30 | 30 | |
31 | - public static function isBooleanFalse($value){ |
|
31 | + public static function isBooleanFalse($value) { |
|
32 | 32 | return $value==0 || !$value; |
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -3,5 +3,5 @@ |
||
3 | 3 | use Ajax\common\BaseEnum; |
4 | 4 | |
5 | 5 | abstract class PositionInTable extends BaseEnum { |
6 | - const BEFORETABLE="beforeTable",AFTERTABLE="afterTable",HEADER="thead",FOOTER="tfoot",BODY="tbody"; |
|
6 | + const BEFORETABLE="beforeTable", AFTERTABLE="afterTable", HEADER="thead", FOOTER="tfoot", BODY="tbody"; |
|
7 | 7 | } |
8 | 8 | \ No newline at end of file |
@@ -13,6 +13,9 @@ |
||
13 | 13 | */ |
14 | 14 | class HtmlIconGroups extends HtmlSemCollection { |
15 | 15 | |
16 | + /** |
|
17 | + * @param string $identifier |
|
18 | + */ |
|
16 | 19 | public function __construct($identifier, $icons=array(), $size="") { |
17 | 20 | parent::__construct($identifier, "i", "icons"); |
18 | 21 | $this->addItems($icons); |
@@ -51,14 +51,15 @@ |
||
51 | 51 | foreach ($values as $v){ |
52 | 52 | $form->addField($v); |
53 | 53 | } |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | $separators[]=$count; |
56 | 56 | for($i=0;$i<$size-1;$i++){ |
57 | 57 | $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
58 | 58 | if(\sizeof($fields)===1){ |
59 | 59 | $form->addField($fields[0]); |
60 | - }else |
|
61 | - $form->addFields($fields); |
|
60 | + } else { |
|
61 | + $form->addFields($fields); |
|
62 | + } |
|
62 | 63 | } |
63 | 64 | } |
64 | 65 | } |
@@ -17,48 +17,48 @@ discard block |
||
17 | 17 | * @since 2.2 |
18 | 18 | */ |
19 | 19 | class DataForm extends Widget { |
20 | - use FormFieldAsTrait,FormTrait; |
|
20 | + use FormFieldAsTrait, FormTrait; |
|
21 | 21 | |
22 | 22 | public function __construct($identifier, $modelInstance=NULL) { |
23 | - parent::__construct($identifier, null,$modelInstance); |
|
23 | + parent::__construct($identifier, null, $modelInstance); |
|
24 | 24 | $this->_instanceViewer=new FormInstanceViewer(); |
25 | 25 | $this->content=["form"=>new HtmlForm($identifier)]; |
26 | 26 | $this->_toolbarPosition=PositionInTable::BEFORETABLE; |
27 | 27 | } |
28 | 28 | |
29 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
29 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
30 | 30 | $this->_instanceViewer->setInstance($this->_modelInstance); |
31 | 31 | |
32 | 32 | $form=$this->content["form"]; |
33 | 33 | $this->_generateContent($form); |
34 | 34 | |
35 | - if(isset($this->_toolbar)){ |
|
35 | + if (isset($this->_toolbar)) { |
|
36 | 36 | $this->_setToolbarPosition($form); |
37 | 37 | } |
38 | - $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]); |
|
39 | - return parent::compile($js,$view); |
|
38 | + $this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]); |
|
39 | + return parent::compile($js, $view); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @param HtmlForm $form |
44 | 44 | */ |
45 | - protected function _generateContent($form){ |
|
46 | - $values= $this->_instanceViewer->getValues(); |
|
45 | + protected function _generateContent($form) { |
|
46 | + $values=$this->_instanceViewer->getValues(); |
|
47 | 47 | $count=$this->_instanceViewer->count(); |
48 | 48 | |
49 | 49 | $separators=$this->_instanceViewer->getSeparators(); |
50 | 50 | $size=\sizeof($separators); |
51 | - if($size===1){ |
|
52 | - foreach ($values as $v){ |
|
51 | + if ($size===1) { |
|
52 | + foreach ($values as $v) { |
|
53 | 53 | $form->addField($v); |
54 | 54 | } |
55 | - }else{ |
|
55 | + } else { |
|
56 | 56 | $separators[]=$count; |
57 | - for($i=0;$i<$size;$i++){ |
|
58 | - $fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]); |
|
59 | - if(\sizeof($fields)===1){ |
|
57 | + for ($i=0; $i<$size; $i++) { |
|
58 | + $fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]); |
|
59 | + if (\sizeof($fields)===1) { |
|
60 | 60 | $form->addField($fields[0]); |
61 | - }else |
|
61 | + } else |
|
62 | 62 | $form->addFields($fields); |
63 | 63 | } |
64 | 64 | } |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * @return HtmlForm |
69 | 69 | */ |
70 | - protected function getForm(){ |
|
70 | + protected function getForm() { |
|
71 | 71 | return $this->content["form"]; |
72 | 72 | } |
73 | 73 | |
74 | - public function addSeparatorAfter($fieldNum){ |
|
74 | + public function addSeparatorAfter($fieldNum) { |
|
75 | 75 | $this->_instanceViewer->addSeparatorAfter($fieldNum); |
76 | 76 | return $this; |
77 | 77 | } |
@@ -85,26 +85,26 @@ discard block |
||
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){ |
|
89 | - $button=new HtmlButton($identifier,$value,$cssStyle); |
|
90 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement); |
|
88 | + public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) { |
|
89 | + $button=new HtmlButton($identifier, $value, $cssStyle); |
|
90 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement); |
|
91 | 91 | return $this->addInToolbar($button); |
92 | 92 | } |
93 | 93 | |
94 | - public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){ |
|
95 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle){ |
|
96 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
97 | - $this->_buttonAsSubmit($button,"click",$url,$responseElement); |
|
94 | + public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) { |
|
95 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle){ |
|
96 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
97 | + $this->_buttonAsSubmit($button, "click", $url, $responseElement); |
|
98 | 98 | return $button; |
99 | - }, $index,$attributes); |
|
99 | + }, $index, $attributes); |
|
100 | 100 | } |
101 | 101 | |
102 | - public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){ |
|
103 | - return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){ |
|
104 | - $button=new HtmlButton($id,$value,$cssStyle); |
|
102 | + public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) { |
|
103 | + return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){ |
|
104 | + $button=new HtmlButton($id, $value, $cssStyle); |
|
105 | 105 | $button->setProperty("type", "reset"); |
106 | 106 | return $button; |
107 | - }, $index,$attributes); |
|
107 | + }, $index, $attributes); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -34,17 +34,18 @@ |
||
34 | 34 | $property=$this->getProperty($index); |
35 | 35 | if($property instanceof \ReflectionProperty){ |
36 | 36 | $result=$property->getName(); |
37 | - }elseif(\is_callable($property)){ |
|
37 | + } elseif(\is_callable($property)){ |
|
38 | 38 | $result=$this->visibleProperties[$index]; |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $result=\strtolower($this->getCaption($index)); |
41 | 41 | } |
42 | 42 | return $result; |
43 | 43 | } |
44 | 44 | |
45 | 45 | public function addSeparatorAfter($fieldNum){ |
46 | - if(\array_search($fieldNum, $this->separators)===false) |
|
47 | - $this->separators[]=$fieldNum; |
|
46 | + if(\array_search($fieldNum, $this->separators)===false) { |
|
47 | + $this->separators[]=$fieldNum; |
|
48 | + } |
|
48 | 49 | return $this; |
49 | 50 | } |
50 | 51 |
@@ -9,41 +9,41 @@ |
||
9 | 9 | class FormInstanceViewer extends InstanceViewer { |
10 | 10 | protected $separators; |
11 | 11 | |
12 | - public function __construct($identifier,$instance=NULL, $captions=NULL) { |
|
13 | - parent::__construct($identifier,$instance=NULL, $captions=NULL); |
|
12 | + public function __construct($identifier, $instance=NULL, $captions=NULL) { |
|
13 | + parent::__construct($identifier, $instance=NULL, $captions=NULL); |
|
14 | 14 | $this->separators=[-1]; |
15 | - $this->defaultValueFunction=function($name,$value,$index){ |
|
15 | + $this->defaultValueFunction=function($name, $value, $index) { |
|
16 | 16 | $caption=$this->getCaption($index); |
17 | - $input=new HtmlFormInput($this->widgetIdentifier."-".$name,$caption,"text",$value); |
|
17 | + $input=new HtmlFormInput($this->widgetIdentifier."-".$name, $caption, "text", $value); |
|
18 | 18 | $input->setName($name); |
19 | 19 | return $input; |
20 | 20 | }; |
21 | 21 | } |
22 | 22 | |
23 | - protected function _beforeAddProperty($index,&$field){ |
|
24 | - if(JString::endswith($field, "\n")===true){ |
|
23 | + protected function _beforeAddProperty($index, &$field) { |
|
24 | + if (JString::endswith($field, "\n")===true) { |
|
25 | 25 | $this->addSeparatorAfter($index); |
26 | 26 | } |
27 | - if($index>1 && JString::startswith($field, "\n")===true){ |
|
27 | + if ($index>1 && JString::startswith($field, "\n")===true) { |
|
28 | 28 | $this->addSeparatorAfter($index-1); |
29 | 29 | } |
30 | 30 | $field=\str_replace("\n", "", $field); |
31 | 31 | } |
32 | 32 | |
33 | - public function getFieldName($index){ |
|
33 | + public function getFieldName($index) { |
|
34 | 34 | $property=$this->getProperty($index); |
35 | - if($property instanceof \ReflectionProperty){ |
|
35 | + if ($property instanceof \ReflectionProperty) { |
|
36 | 36 | $result=$property->getName(); |
37 | - }elseif(\is_callable($property)){ |
|
37 | + }elseif (\is_callable($property)) { |
|
38 | 38 | $result=$this->visibleProperties[$index]; |
39 | - }else{ |
|
39 | + } else { |
|
40 | 40 | $result=$property; |
41 | 41 | } |
42 | 42 | return $result; |
43 | 43 | } |
44 | 44 | |
45 | - public function addSeparatorAfter($fieldNum){ |
|
46 | - if(\array_search($fieldNum, $this->separators)===false) |
|
45 | + public function addSeparatorAfter($fieldNum) { |
|
46 | + if (\array_search($fieldNum, $this->separators)===false) |
|
47 | 47 | $this->separators[]=$fieldNum; |
48 | 48 | return $this; |
49 | 49 | } |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | * @param array $instances |
16 | 16 | * @return DataTable |
17 | 17 | */ |
18 | - public function dataTable($identifier,$model, $instances){ |
|
19 | - return $this->addHtmlComponent(new DataTable($identifier,$model,$instances)); |
|
18 | + public function dataTable($identifier, $model, $instances) { |
|
19 | + return $this->addHtmlComponent(new DataTable($identifier, $model, $instances)); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | * @param object $instance |
25 | 25 | * @return DataElement |
26 | 26 | */ |
27 | - public function dataElement($identifier, $instance){ |
|
28 | - return $this->addHtmlComponent(new DataElement($identifier,$instance)); |
|
27 | + public function dataElement($identifier, $instance) { |
|
28 | + return $this->addHtmlComponent(new DataElement($identifier, $instance)); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param object $instance |
34 | 34 | * @return DataForm |
35 | 35 | */ |
36 | - public function dataForm($identifier, $instance){ |
|
37 | - return $this->addHtmlComponent(new DataForm($identifier,$instance)); |
|
36 | + public function dataForm($identifier, $instance) { |
|
37 | + return $this->addHtmlComponent(new DataForm($identifier, $instance)); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | \ No newline at end of file |