@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlLabeledIconMenu extends HtmlMenu{ |
|
15 | +class HtmlLabeledIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "labeled icon"); |
25 | 25 | } |
26 | 26 | |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | protected function createItem($value) { |
32 | 32 | $text=""; |
33 | 33 | $v=$value; |
34 | - if(\is_array($value)){ |
|
34 | + if (\is_array($value)) { |
|
35 | 35 | $v=@$value[0]; |
36 | 36 | $text=@$value[1]; |
37 | 37 | } |
38 | 38 | $count=\sizeof($this->content); |
39 | 39 | $value=new HtmlIcon("icon-".$count, $v); |
40 | - $value->wrap("",$text); |
|
41 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
40 | + $value->wrap("", $text); |
|
41 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
42 | 42 | return $itemO->setClass("item"); |
43 | 43 | } |
44 | 44 | } |
45 | 45 | \ No newline at end of file |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | * @author jc |
13 | 13 | * @version 1.001 |
14 | 14 | */ |
15 | -class HtmlIconMenu extends HtmlMenu{ |
|
15 | +class HtmlIconMenu extends HtmlMenu { |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @param string $identifier |
20 | 20 | * @param array $items icons |
21 | 21 | */ |
22 | - public function __construct( $identifier, $items=array()){ |
|
23 | - parent::__construct( $identifier, $items); |
|
22 | + public function __construct($identifier, $items=array()) { |
|
23 | + parent::__construct($identifier, $items); |
|
24 | 24 | $this->addToProperty("class", "icon"); |
25 | 25 | } |
26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | protected function createItem($value) { |
33 | 33 | $count=\sizeof($this->content); |
34 | 34 | $value=new HtmlIcon("icon-".$count, $value); |
35 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
35 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
36 | 36 | return $itemO->setClass("item"); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | \ No newline at end of file |
@@ -20,6 +20,9 @@ |
||
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + */ |
|
23 | 26 | public function __construct($identifier, $tagName="ul") { |
24 | 27 | parent::__construct($identifier, $tagName); |
25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -15,26 +15,26 @@ discard block |
||
15 | 15 | protected $_equalWidth; |
16 | 16 | protected $_name; |
17 | 17 | |
18 | - public function __construct($identifier, $fields=array(),$equalWidth=true) { |
|
18 | + public function __construct($identifier, $fields=array(), $equalWidth=true) { |
|
19 | 19 | parent::__construct($identifier, "div"); |
20 | 20 | $this->_equalWidth=$equalWidth; |
21 | 21 | $this->addItems($fields); |
22 | 22 | } |
23 | 23 | |
24 | - public function addFields($fields=NULL,$label=NULL){ |
|
25 | - if(!$fields instanceof HtmlFormFields){ |
|
26 | - if(\is_array($fields)===false){ |
|
27 | - $fields = \func_get_args(); |
|
24 | + public function addFields($fields=NULL, $label=NULL) { |
|
25 | + if (!$fields instanceof HtmlFormFields) { |
|
26 | + if (\is_array($fields)===false) { |
|
27 | + $fields=\func_get_args(); |
|
28 | 28 | $end=\end($fields); |
29 | - if(\is_string($end)){ |
|
29 | + if (\is_string($end)) { |
|
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | 32 | }else $label=NULL; |
33 | 33 | } |
34 | 34 | } |
35 | - if(isset($label)) |
|
35 | + if (isset($label)) |
|
36 | 36 | $this->setLabel($label); |
37 | - foreach ($fields as $field){ |
|
37 | + foreach ($fields as $field) { |
|
38 | 38 | $this->addItem($field); |
39 | 39 | } |
40 | 40 | return $this; |
@@ -44,40 +44,40 @@ discard block |
||
44 | 44 | * @param string|HtmlSemDoubleElement $label |
45 | 45 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
46 | 46 | */ |
47 | - public function setLabel($label){ |
|
47 | + public function setLabel($label) { |
|
48 | 48 | $labelO=$label; |
49 | - if(\is_string($label)){ |
|
50 | - $labelO=new HtmlSemDoubleElement("","label","",$label); |
|
49 | + if (\is_string($label)) { |
|
50 | + $labelO=new HtmlSemDoubleElement("", "label", "", $label); |
|
51 | 51 | } |
52 | - $this->insertItem($labelO,0); |
|
52 | + $this->insertItem($labelO, 0); |
|
53 | 53 | return $labelO; |
54 | 54 | } |
55 | - public function addItem($item){ |
|
55 | + public function addItem($item) { |
|
56 | 56 | $item=parent::addItem($item); |
57 | 57 | $item->setContainer($this); |
58 | 58 | return $item; |
59 | 59 | } |
60 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
61 | - if($this->_equalWidth){ |
|
60 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
61 | + if ($this->_equalWidth) { |
|
62 | 62 | $count=$this->count(); |
63 | 63 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
64 | 64 | }else |
65 | - $this->addToProperty("class","fields"); |
|
66 | - return parent::compile($js,$view); |
|
65 | + $this->addToProperty("class", "fields"); |
|
66 | + return parent::compile($js, $view); |
|
67 | 67 | } |
68 | 68 | |
69 | - public function setWidth($index,$width){ |
|
69 | + public function setWidth($index, $width) { |
|
70 | 70 | $this->_equalWidth=false; |
71 | 71 | return $this->getItem($index)->setWidth($width); |
72 | 72 | } |
73 | 73 | |
74 | - public function setInline(){ |
|
74 | + public function setInline() { |
|
75 | 75 | $this->_equalWidth=false; |
76 | 76 | $this->addToProperty("class", "inline"); |
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | - public function setGrouped(){ |
|
80 | + public function setGrouped() { |
|
81 | 81 | $this->_equalWidth=false; |
82 | 82 | $this->addToProperty("class", "grouped"); |
83 | 83 | } |
@@ -91,34 +91,34 @@ discard block |
||
91 | 91 | return $this; |
92 | 92 | } |
93 | 93 | |
94 | - public static function radios($name,$items=array(),$label=NULL,$value=null,$type=NULL){ |
|
94 | + public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
|
95 | 95 | $fields=array(); |
96 | 96 | $i=0; |
97 | - foreach ($items as $val=>$caption){ |
|
98 | - $itemO=new HtmlFormRadio($name."-".$i++,$name,$caption,$val,$type); |
|
99 | - if($val===$value){ |
|
97 | + foreach ($items as $val=>$caption) { |
|
98 | + $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
|
99 | + if ($val===$value) { |
|
100 | 100 | $itemO->getInput()->getField()->setProperty("checked", ""); |
101 | 101 | } |
102 | 102 | $fields[]=$itemO; |
103 | 103 | } |
104 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
105 | - if(isset($label)) |
|
104 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
105 | + if (isset($label)) |
|
106 | 106 | $radios->setLabel($label)->setProperty("for", $name); |
107 | 107 | return $radios; |
108 | 108 | } |
109 | 109 | |
110 | - public static function checkeds($name,$items=array(),$label=NULL,$values=array(),$type=NULL){ |
|
110 | + public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
|
111 | 111 | $fields=array(); |
112 | 112 | $i=0; |
113 | - foreach ($items as $val=>$caption){ |
|
114 | - $itemO=new HtmlFormCheckbox($name."-".$i++,$name,$caption,$val,$type); |
|
115 | - if(\array_search($val, $values)!==false){ |
|
113 | + foreach ($items as $val=>$caption) { |
|
114 | + $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
|
115 | + if (\array_search($val, $values)!==false) { |
|
116 | 116 | $itemO->getInput()->getField()->setProperty("checked", ""); |
117 | 117 | } |
118 | 118 | $fields[]=$itemO; |
119 | 119 | } |
120 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
121 | - if(isset($label)) |
|
120 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
121 | + if (isset($label)) |
|
122 | 122 | $radios->setLabel($label)->setProperty("for", $name); |
123 | 123 | return $radios; |
124 | 124 | } |
@@ -29,11 +29,14 @@ discard block |
||
29 | 29 | if(\is_string($end)){ |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - }else $label=NULL; |
|
32 | + } else { |
|
33 | + $label=NULL; |
|
34 | + } |
|
33 | 35 | } |
34 | 36 | } |
35 | - if(isset($label)) |
|
36 | - $this->setLabel($label); |
|
37 | + if(isset($label)) { |
|
38 | + $this->setLabel($label); |
|
39 | + } |
|
37 | 40 | foreach ($fields as $field){ |
38 | 41 | $this->addItem($field); |
39 | 42 | } |
@@ -61,8 +64,9 @@ discard block |
||
61 | 64 | if($this->_equalWidth){ |
62 | 65 | $count=$this->count(); |
63 | 66 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
64 | - }else |
|
65 | - $this->addToProperty("class","fields"); |
|
67 | + } else { |
|
68 | + $this->addToProperty("class","fields"); |
|
69 | + } |
|
66 | 70 | return parent::compile($js,$view); |
67 | 71 | } |
68 | 72 | |
@@ -102,8 +106,9 @@ discard block |
||
102 | 106 | $fields[]=$itemO; |
103 | 107 | } |
104 | 108 | $radios=new HtmlFormFields("fields-".$name,$fields); |
105 | - if(isset($label)) |
|
106 | - $radios->setLabel($label)->setProperty("for", $name); |
|
109 | + if(isset($label)) { |
|
110 | + $radios->setLabel($label)->setProperty("for", $name); |
|
111 | + } |
|
107 | 112 | return $radios; |
108 | 113 | } |
109 | 114 | |
@@ -118,8 +123,9 @@ discard block |
||
118 | 123 | $fields[]=$itemO; |
119 | 124 | } |
120 | 125 | $radios=new HtmlFormFields("fields-".$name,$fields); |
121 | - if(isset($label)) |
|
122 | - $radios->setLabel($label)->setProperty("for", $name); |
|
126 | + if(isset($label)) { |
|
127 | + $radios->setLabel($label)->setProperty("for", $name); |
|
128 | + } |
|
123 | 129 | return $radios; |
124 | 130 | } |
125 | 131 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class HtmlInput extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
10 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
11 | 11 | parent::__construct($identifier, "input"); |
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setValue($value); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
19 | + if (isset($value)) |
|
20 | 20 | $this->setProperty("value", $value); |
21 | 21 | return $this; |
22 | 22 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | return $this->setProperty("type", $value); |
26 | 26 | } |
27 | 27 | |
28 | - public function setPlaceholder($value){ |
|
29 | - if(JString::isNotNull($value)) |
|
28 | + public function setPlaceholder($value) { |
|
29 | + if (JString::isNotNull($value)) |
|
30 | 30 | $this->setProperty("placeholder", $value); |
31 | 31 | return $this; |
32 | 32 | } |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
20 | - $this->setProperty("value", $value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setProperty("value", $value); |
|
21 | + } |
|
21 | 22 | return $this; |
22 | 23 | } |
23 | 24 | |
@@ -26,8 +27,9 @@ discard block |
||
26 | 27 | } |
27 | 28 | |
28 | 29 | public function setPlaceholder($value){ |
29 | - if(JString::isNotNull($value)) |
|
30 | - $this->setProperty("placeholder", $value); |
|
30 | + if(JString::isNotNull($value)) { |
|
31 | + $this->setProperty("placeholder", $value); |
|
32 | + } |
|
31 | 33 | return $this; |
32 | 34 | } |
33 | 35 | } |
34 | 36 | \ No newline at end of file |
@@ -7,17 +7,17 @@ |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | } |
13 | 13 | |
14 | - public function setItems($items){ |
|
14 | + public function setItems($items) { |
|
15 | 15 | return $this->getField()->setItems($items); |
16 | 16 | } |
17 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
18 | - return $this->getField()->addItem($item,$value,$image); |
|
17 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
18 | + return $this->getField()->addItem($item, $value, $image); |
|
19 | 19 | } |
20 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL){ |
|
21 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true); |
|
20 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL) { |
|
21 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -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 |
@@ -11,18 +11,21 @@ |
||
11 | 11 | parent::__construct($identifier, "textarea"); |
12 | 12 | $this->setValue($value); |
13 | 13 | $this->setPlaceholder($placeholder); |
14 | - if(isset($rows)) |
|
15 | - $this->setRows($rows); |
|
14 | + if(isset($rows)) { |
|
15 | + $this->setRows($rows); |
|
16 | + } |
|
16 | 17 | } |
17 | 18 | public function setValue($value) { |
18 | - if(isset($value)) |
|
19 | - $this->setContent($value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setContent($value); |
|
21 | + } |
|
20 | 22 | return $this; |
21 | 23 | } |
22 | 24 | |
23 | 25 | public function setPlaceholder($value){ |
24 | - if(JString::isNotNull($value)) |
|
25 | - $this->setProperty("placeholder", $value); |
|
26 | + if(JString::isNotNull($value)) { |
|
27 | + $this->setProperty("placeholder", $value); |
|
28 | + } |
|
26 | 29 | return $this; |
27 | 30 | } |
28 | 31 |
@@ -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 |
@@ -8,8 +8,9 @@ |
||
8 | 8 | class HtmlFormInput extends HtmlFormField { |
9 | 9 | |
10 | 10 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
11 | - if(!isset($placeholder)) |
|
12 | - $placeholder=$label; |
|
11 | + if(!isset($placeholder)) { |
|
12 | + $placeholder=$label; |
|
13 | + } |
|
13 | 14 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
14 | 15 | } |
15 | 16 |