@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\service\JArray; |
6 | 6 | trait FieldsTrait { |
7 | - protected function createItem($value){ |
|
8 | - if(\is_array($value)){ |
|
9 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
7 | + protected function createItem($value) { |
|
8 | + if (\is_array($value)) { |
|
9 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
10 | 10 | return $itemO; |
11 | 11 | }else |
12 | 12 | return new HtmlFormInput($value); |
@@ -12,21 +12,21 @@ |
||
12 | 12 | */ |
13 | 13 | class HtmlFormCheckbox extends HtmlFormInput { |
14 | 14 | |
15 | - public function __construct($identifier, $label=NULL,$value=NULL,$type=NULL) { |
|
15 | + public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
16 | 16 | parent::__construct($identifier, $label, "checkbox", $value=NULL); |
17 | - if(isset($label)){ |
|
17 | + if (isset($label)) { |
|
18 | 18 | $this->swapLabel(); |
19 | 19 | $label=$this->getLabel(); |
20 | 20 | $label->setClass="hidden"; |
21 | - $label->setProperty("tabindex",0); |
|
21 | + $label->setProperty("tabindex", 0); |
|
22 | 22 | } |
23 | 23 | $this->setClass("ui checkbox"); |
24 | - if(isset($type)) |
|
24 | + if (isset($type)) |
|
25 | 25 | $this->setType($type); |
26 | - $this->wrap("<div class='field'>","</div>"); |
|
26 | + $this->wrap("<div class='field'>", "</div>"); |
|
27 | 27 | } |
28 | 28 | |
29 | - public function setType($checkboxType){ |
|
29 | + public function setType($checkboxType) { |
|
30 | 30 | return $this->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants()); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlHeader extends HtmlSemDoubleElement { |
10 | 10 | protected $image; |
11 | - public function __construct($identifier, $niveau=1,$content=NULL,$type="page") { |
|
12 | - parent::__construct($identifier, "div","ui header"); |
|
11 | + public function __construct($identifier, $niveau=1, $content=NULL, $type="page") { |
|
12 | + parent::__construct($identifier, "div", "ui header"); |
|
13 | 13 | $this->_template="<%tagName% %properties%>%image%%content%</%tagName%>"; |
14 | - if(isset($type)){ |
|
15 | - if($type=="page"){ |
|
14 | + if (isset($type)) { |
|
15 | + if ($type=="page") { |
|
16 | 16 | $this->asPageHeader($niveau); |
17 | 17 | }else |
18 | 18 | $this->asContentHeader($niveau); |
@@ -20,39 +20,39 @@ discard block |
||
20 | 20 | $this->content=$content; |
21 | 21 | } |
22 | 22 | |
23 | - public function asPageHeader($niveau){ |
|
23 | + public function asPageHeader($niveau) { |
|
24 | 24 | $this->tagName="h".$niveau; |
25 | 25 | } |
26 | 26 | |
27 | - public function asContentHeader($niveau){ |
|
27 | + public function asContentHeader($niveau) { |
|
28 | 28 | $this->tagName="div"; |
29 | - if(\is_int($niveau)){ |
|
29 | + if (\is_int($niveau)) { |
|
30 | 30 | $niveau=Size::getConstantValues()[$niveau]; |
31 | 31 | } |
32 | 32 | $this->setSize($niveau); |
33 | 33 | } |
34 | 34 | |
35 | - public function asIcon($icon,$title,$subHeader=NULL){ |
|
35 | + public function asIcon($icon, $title, $subHeader=NULL) { |
|
36 | 36 | $this->addToProperty("class", "icon"); |
37 | 37 | $this->image=new HtmlIcon("icon-".$this->identifier, $icon); |
38 | - return $this->asTitle($title,$subHeader); |
|
38 | + return $this->asTitle($title, $subHeader); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function asImage($src,$title,$subHeader=NULL){ |
|
42 | - $this->image=new HtmlImage("img-".$this->identifier, $src,$title); |
|
43 | - return $this->asTitle($title,$subHeader); |
|
41 | + public function asImage($src, $title, $subHeader=NULL) { |
|
42 | + $this->image=new HtmlImage("img-".$this->identifier, $src, $title); |
|
43 | + return $this->asTitle($title, $subHeader); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function asTitle($title,$subHeader=NULL){ |
|
47 | - if(!\is_object($title)){ |
|
48 | - $this->content=new HtmlDoubleElement("content-".$this->identifier,"div"); |
|
46 | + public function asTitle($title, $subHeader=NULL) { |
|
47 | + if (!\is_object($title)) { |
|
48 | + $this->content=new HtmlDoubleElement("content-".$this->identifier, "div"); |
|
49 | 49 | $this->content->setContent($title); |
50 | - }else{ |
|
50 | + }else { |
|
51 | 51 | $this->content=$title; |
52 | 52 | } |
53 | 53 | $this->content->setClass("content"); |
54 | - if(isset($subHeader)){ |
|
55 | - $sub=new HtmlDoubleElement("subheader-".$this->identifier,"div"); |
|
54 | + if (isset($subHeader)) { |
|
55 | + $sub=new HtmlDoubleElement("subheader-".$this->identifier, "div"); |
|
56 | 56 | $sub->setClass("sub header"); |
57 | 57 | $sub->setContent($subHeader); |
58 | 58 | $this->content->addContent($sub); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return $this->image; |
65 | 65 | } |
66 | 66 | |
67 | - public function setDividing(){ |
|
67 | + public function setDividing() { |
|
68 | 68 | $this->addToProperty("class", "dividing"); |
69 | 69 | } |
70 | 70 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class CheckboxType extends BaseEnum { |
8 | - const STANDARD="",TOGGLE="toggle",SLIDER="slider"; |
|
8 | + const STANDARD="", TOGGLE="toggle", SLIDER="slider"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -9,10 +9,10 @@ |
||
9 | 9 | * @author jc |
10 | 10 | * @version 1.001 |
11 | 11 | */ |
12 | -abstract class HtmlSemCollection extends HtmlCollection{ |
|
12 | +abstract class HtmlSemCollection extends HtmlCollection { |
|
13 | 13 | use BaseTrait; |
14 | - public function __construct( $identifier, $tagName="div",$baseClass=""){ |
|
15 | - parent::__construct( $identifier, $tagName); |
|
14 | + public function __construct($identifier, $tagName="div", $baseClass="") { |
|
15 | + parent::__construct($identifier, $tagName); |
|
16 | 16 | $this->_baseClass=$baseClass; |
17 | 17 | $this->setClass($baseClass); |
18 | 18 | } |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class HtmlTextarea extends HtmlDoubleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
10 | + public function __construct($identifier, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
11 | 11 | parent::__construct($identifier, "textarea"); |
12 | 12 | $this->setValue($value); |
13 | 13 | $this->setPlaceholder($placeholder); |
14 | - if(isset($rows)) |
|
14 | + if (isset($rows)) |
|
15 | 15 | $this->setRows($rows); |
16 | 16 | } |
17 | 17 | public function setValue($value) { |
18 | - if(isset($value)) |
|
18 | + if (isset($value)) |
|
19 | 19 | $this->setContent($value); |
20 | 20 | return $this; |
21 | 21 | } |
22 | 22 | |
23 | - public function setPlaceholder($value){ |
|
24 | - if(JString::isNotNull($value)) |
|
23 | + public function setPlaceholder($value) { |
|
24 | + if (JString::isNotNull($value)) |
|
25 | 25 | $this->setProperty("placeholder", $value); |
26 | 26 | return $this; |
27 | 27 | } |
28 | 28 | |
29 | - public function setRows($count){ |
|
29 | + public function setRows($count) { |
|
30 | 30 | $this->setProperty("rows", $count); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -13,35 +13,35 @@ discard block |
||
13 | 13 | */ |
14 | 14 | abstract class HtmlCollection extends HtmlDoubleElement { |
15 | 15 | |
16 | - public function __construct($identifier,$tagName="div"){ |
|
17 | - parent::__construct($identifier,$tagName); |
|
16 | + public function __construct($identifier, $tagName="div") { |
|
17 | + parent::__construct($identifier, $tagName); |
|
18 | 18 | $this->content=array(); |
19 | 19 | } |
20 | 20 | |
21 | - public function addItems($items){ |
|
22 | - if(JArray::isAssociative($items)){ |
|
23 | - foreach ($items as $k=>$v){ |
|
24 | - $this->addItem([$k,$v]); |
|
21 | + public function addItems($items) { |
|
22 | + if (JArray::isAssociative($items)) { |
|
23 | + foreach ($items as $k=>$v) { |
|
24 | + $this->addItem([$k, $v]); |
|
25 | 25 | } |
26 | - }else{ |
|
27 | - foreach ($items as $item){ |
|
26 | + }else { |
|
27 | + foreach ($items as $item) { |
|
28 | 28 | $this->addItem($item); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - public function setItems($items){ |
|
33 | + public function setItems($items) { |
|
34 | 34 | $this->content=$items; |
35 | 35 | return $this; |
36 | 36 | } |
37 | 37 | |
38 | - public function getItems(){ |
|
38 | + public function getItems() { |
|
39 | 39 | return $this->content; |
40 | 40 | } |
41 | 41 | |
42 | - protected function getItemToAdd($item){ |
|
42 | + protected function getItemToAdd($item) { |
|
43 | 43 | $itemO=$item; |
44 | - if($this->createCondition($item)===true){ |
|
44 | + if ($this->createCondition($item)===true) { |
|
45 | 45 | $itemO=$this->createItem($item); |
46 | 46 | } |
47 | 47 | return $itemO; |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | * @param HtmlDoubleElement|string $item |
53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
54 | 54 | */ |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $itemO=$this->getItemToAdd($item); |
57 | 57 | $this->addContent($itemO); |
58 | 58 | return $itemO; |
59 | 59 | } |
60 | 60 | |
61 | - public function insertItem($item,$position=0){ |
|
61 | + public function insertItem($item, $position=0) { |
|
62 | 62 | $itemO=$this->getItemToAdd($item); |
63 | - \array_splice( $this->content, $position, 0, array($itemO)); |
|
63 | + \array_splice($this->content, $position, 0, array($itemO)); |
|
64 | 64 | return $itemO; |
65 | 65 | } |
66 | 66 | |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | return $this; |
84 | 84 | } |
85 | 85 | |
86 | - public function removeItem($index){ |
|
86 | + public function removeItem($index) { |
|
87 | 87 | return array_splice($this->content, $index, 1); |
88 | 88 | } |
89 | 89 | |
90 | - public function count(){ |
|
90 | + public function count() { |
|
91 | 91 | return \sizeof($this->content); |
92 | 92 | } |
93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $this->addItem($function($object)); |
99 | 99 | } |
100 | 100 | |
101 | - public function apply($callBack){ |
|
102 | - foreach ($this->content as $item){ |
|
101 | + public function apply($callBack) { |
|
102 | + foreach ($this->content as $item) { |
|
103 | 103 | $callBack($item); |
104 | 104 | } |
105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected abstract function createItem($value); |
119 | 119 | |
120 | - protected function createCondition($value){ |
|
120 | + protected function createCondition($value) { |
|
121 | 121 | return \is_object($value)===false; |
122 | 122 | } |
123 | 123 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | return $this->_bsComponent; |
133 | 133 | } |
134 | 134 | |
135 | - protected function contentAs($tagName){ |
|
136 | - foreach ($this->content as $item){ |
|
135 | + protected function contentAs($tagName) { |
|
136 | + foreach ($this->content as $item) { |
|
137 | 137 | $item->setTagName($tagName); |
138 | 138 | } |
139 | 139 | } |
@@ -11,17 +11,17 @@ |
||
11 | 11 | */ |
12 | 12 | class HtmlFormRadio extends HtmlFormInput { |
13 | 13 | |
14 | - public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) { |
|
14 | + public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL) { |
|
15 | 15 | parent::__construct($identifier, $label, "radio", $value=NULL); |
16 | - if(isset($name)) |
|
16 | + if (isset($name)) |
|
17 | 17 | $this->getField()->setProperty("name", $name); |
18 | - if(isset($label)){ |
|
18 | + if (isset($label)) { |
|
19 | 19 | $this->swapLabel(); |
20 | 20 | $label=$this->getLabel(); |
21 | 21 | $label->setClass="hidden"; |
22 | - $label->setProperty("tabindex",0); |
|
22 | + $label->setProperty("tabindex", 0); |
|
23 | 23 | } |
24 | 24 | $this->setClass("ui radio checkbox"); |
25 | - $this->wrap("<div class='field'>","</div>"); |
|
25 | + $this->wrap("<div class='field'>", "</div>"); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |
@@ -8,17 +8,17 @@ |
||
8 | 8 | class HtmlFormTextarea extends HtmlFormField { |
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
12 | - if(!isset($placeholder)) |
|
11 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
12 | + if (!isset($placeholder)) |
|
13 | 13 | $placeholder=$label; |
14 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
14 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Defines the textarea row count |
19 | 19 | * @param int $count |
20 | 20 | */ |
21 | - public function setRows($count){ |
|
21 | + public function setRows($count) { |
|
22 | 22 | $this->getField()->setRows($count); |
23 | 23 | } |
24 | 24 | } |
25 | 25 | \ No newline at end of file |