@@ -4,11 +4,11 @@ |
||
4 | 4 | |
5 | 5 | |
6 | 6 | class HtmlAccordionMenuItem extends HtmlMenuItem { |
7 | - public function __construct($identifier,$title,$content) { |
|
8 | - parent::__construct($identifier, new HtmlAccordionItem("accordion-".$identifier, $title,$content)); |
|
7 | + public function __construct($identifier, $title, $content) { |
|
8 | + parent::__construct($identifier, new HtmlAccordionItem("accordion-".$identifier, $title, $content)); |
|
9 | 9 | } |
10 | 10 | |
11 | - public function setActive($value=true){ |
|
11 | + public function setActive($value=true) { |
|
12 | 12 | $this->content->setActive($value); |
13 | 13 | return $this; |
14 | 14 | } |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | protected function createTitleElement(){ |
32 | 32 | $element=new HtmlSemDoubleElement("title-".$this->identifier,"div","title"); |
33 | 33 | $element->setContent(array(new HtmlIcon("", $this->_icon),$this->_title)); |
34 | - if($this->_active===true) |
|
35 | - $element->addToProperty("class", "active"); |
|
34 | + if($this->_active===true) { |
|
35 | + $element->addToProperty("class", "active"); |
|
36 | + } |
|
36 | 37 | return $element; |
37 | 38 | } |
38 | 39 | |
@@ -43,10 +44,11 @@ discard block |
||
43 | 44 | |
44 | 45 | public function setActive($value=true){ |
45 | 46 | $this->_active=$value; |
46 | - if($value===true) |
|
47 | - $this->addToPropertyCtrl("class", "active", array("active")); |
|
48 | - else |
|
49 | - $this->removePropertyValue("class", "active"); |
|
47 | + if($value===true) { |
|
48 | + $this->addToPropertyCtrl("class", "active", array("active")); |
|
49 | + } else { |
|
50 | + $this->removePropertyValue("class", "active"); |
|
51 | + } |
|
50 | 52 | return $this; |
51 | 53 | } |
52 | 54 | } |
53 | 55 | \ No newline at end of file |
@@ -20,30 +20,30 @@ |
||
20 | 20 | $this->_title=$title; |
21 | 21 | } |
22 | 22 | |
23 | - public function setTitle($title){ |
|
23 | + public function setTitle($title) { |
|
24 | 24 | $this->_title=$title; |
25 | 25 | } |
26 | 26 | |
27 | - public function setIcon($icon){ |
|
27 | + public function setIcon($icon) { |
|
28 | 28 | $this->_icon=$icon; |
29 | 29 | } |
30 | 30 | |
31 | - protected function createTitleElement(){ |
|
32 | - $element=new HtmlSemDoubleElement("title-".$this->identifier,"div","title"); |
|
33 | - $element->setContent(array(new HtmlIcon("", $this->_icon),$this->_title)); |
|
34 | - if($this->_active===true) |
|
31 | + protected function createTitleElement() { |
|
32 | + $element=new HtmlSemDoubleElement("title-".$this->identifier, "div", "title"); |
|
33 | + $element->setContent(array(new HtmlIcon("", $this->_icon), $this->_title)); |
|
34 | + if ($this->_active===true) |
|
35 | 35 | $element->addToProperty("class", "active"); |
36 | 36 | return $element; |
37 | 37 | } |
38 | 38 | |
39 | - public function compile(JsUtils $js=NULL, &$view=NULL){ |
|
39 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
40 | 40 | $this->titleElement=$this->createTitleElement(); |
41 | - return parent::compile($js,$view); |
|
41 | + return parent::compile($js, $view); |
|
42 | 42 | } |
43 | 43 | |
44 | - public function setActive($value=true){ |
|
44 | + public function setActive($value=true) { |
|
45 | 45 | $this->_active=$value; |
46 | - if($value===true) |
|
46 | + if ($value===true) |
|
47 | 47 | $this->addToPropertyCtrl("class", "active", array("active")); |
48 | 48 | else |
49 | 49 | $this->removePropertyValue("class", "active"); |
@@ -8,8 +8,9 @@ discard block |
||
8 | 8 | public function __construct($identifier, $field,$label=NULL) { |
9 | 9 | parent::__construct($identifier, "div","ui field"); |
10 | 10 | $this->content=array(); |
11 | - if(isset($label)) |
|
12 | - $this->setLabel($label); |
|
11 | + if(isset($label)) { |
|
12 | + $this->setLabel($label); |
|
13 | + } |
|
13 | 14 | $this->setField($field); |
14 | 15 | } |
15 | 16 | |
@@ -28,8 +29,9 @@ discard block |
||
28 | 29 | } |
29 | 30 | |
30 | 31 | public function getLabel(){ |
31 | - if(\array_key_exists("label", $this->content)) |
|
32 | - return $this->content["label"]; |
|
32 | + if(\array_key_exists("label", $this->content)) { |
|
33 | + return $this->content["label"]; |
|
34 | + } |
|
33 | 35 | } |
34 | 36 | |
35 | 37 | public function getField(){ |
@@ -10,33 +10,33 @@ discard block |
||
10 | 10 | |
11 | 11 | class HtmlFormField extends HtmlSemDoubleElement { |
12 | 12 | protected $_container; |
13 | - public function __construct($identifier, $field,$label=NULL) { |
|
14 | - parent::__construct($identifier, "div","field"); |
|
13 | + public function __construct($identifier, $field, $label=NULL) { |
|
14 | + parent::__construct($identifier, "div", "field"); |
|
15 | 15 | $this->content=array(); |
16 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
17 | - if(isset($label)) |
|
16 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
17 | + if (isset($label)) |
|
18 | 18 | $this->setLabel($label); |
19 | 19 | $this->setField($field); |
20 | 20 | } |
21 | 21 | |
22 | - public function addPointingLabel($label,$pointing=Direction::NONE){ |
|
23 | - $labelO=new HtmlLabel("",$label); |
|
22 | + public function addPointingLabel($label, $pointing=Direction::NONE) { |
|
23 | + $labelO=new HtmlLabel("", $label); |
|
24 | 24 | $labelO->setPointing($pointing); |
25 | - $this->addContent($labelO,$pointing==="below" || $pointing==="right"); |
|
25 | + $this->addContent($labelO, $pointing==="below" || $pointing==="right"); |
|
26 | 26 | return $labelO; |
27 | 27 | } |
28 | 28 | |
29 | - public function setLabel($label){ |
|
29 | + public function setLabel($label) { |
|
30 | 30 | $labelO=$label; |
31 | - if(\is_string($label)){ |
|
32 | - $labelO=new HtmlSemDoubleElement("","label",""); |
|
31 | + if (\is_string($label)) { |
|
32 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
33 | 33 | $labelO->setContent($label); |
34 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
34 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
35 | 35 | } |
36 | 36 | $this->content["label"]=$labelO; |
37 | 37 | } |
38 | 38 | |
39 | - public function setField($field){ |
|
39 | + public function setField($field) { |
|
40 | 40 | $this->content["field"]=$field; |
41 | 41 | } |
42 | 42 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * Returns the label or null |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function getLabel(){ |
|
48 | - if(\array_key_exists("label", $this->content)) |
|
47 | + public function getLabel() { |
|
48 | + if (\array_key_exists("label", $this->content)) |
|
49 | 49 | return $this->content["label"]; |
50 | 50 | } |
51 | 51 | |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | * Return the field |
54 | 54 | * @return mixed |
55 | 55 | */ |
56 | - public function getField(){ |
|
56 | + public function getField() { |
|
57 | 57 | return $this->content["field"]; |
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
61 | 61 | * puts the label before or behind |
62 | 62 | */ |
63 | - public function swapLabel(){ |
|
63 | + public function swapLabel() { |
|
64 | 64 | $label=$this->getLabel(); |
65 | 65 | unset($this->content["label"]); |
66 | 66 | $this->content["label"]=$label; |
@@ -71,31 +71,31 @@ discard block |
||
71 | 71 | * @param int $width |
72 | 72 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
73 | 73 | */ |
74 | - public function setWidth($width){ |
|
75 | - if(\is_int($width)){ |
|
74 | + public function setWidth($width) { |
|
75 | + if (\is_int($width)) { |
|
76 | 76 | $width=Wide::getConstants()["W".$width]; |
77 | 77 | } |
78 | 78 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
79 | - if(isset($this->_container)){ |
|
79 | + if (isset($this->_container)) { |
|
80 | 80 | $this->_container->setEqualWidth(false); |
81 | 81 | } |
82 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
82 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | 86 | * Field displays an error state |
87 | 87 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
88 | 88 | */ |
89 | - public function setError(){ |
|
89 | + public function setError() { |
|
90 | 90 | return $this->addToProperty("class", "error"); |
91 | 91 | } |
92 | 92 | |
93 | - public function setInline(){ |
|
93 | + public function setInline() { |
|
94 | 94 | return $this->addToProperty("class", "inline"); |
95 | 95 | } |
96 | 96 | |
97 | - public function jsState($state){ |
|
98 | - return $this->jsDoJquery("addClass",$state); |
|
97 | + public function jsState($state) { |
|
98 | + return $this->jsDoJquery("addClass", $state); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function setContainer($_container) { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return $this; |
104 | 104 | } |
105 | 105 | |
106 | - public function setReadonly(){ |
|
106 | + public function setReadonly() { |
|
107 | 107 | $this->getField()->setProperty("readonly", ""); |
108 | 108 | } |
109 | 109 |
@@ -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%"; |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
32 | + }else |
|
33 | 33 | $label=NULL; |
34 | 34 | } |
35 | 35 | } |
36 | 36 | if (isset($label)) |
37 | 37 | $this->setLabel($label); |
38 | - foreach ( $fields as $field ) { |
|
38 | + foreach ($fields as $field) { |
|
39 | 39 | $this->addItem($field); |
40 | 40 | } |
41 | 41 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | if ($this->_equalWidth) { |
66 | 66 | $count=$this->count(); |
67 | 67 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
68 | + }else |
|
69 | 69 | $this->addToProperty("class", "fields"); |
70 | 70 | return parent::compile($js, $view); |
71 | 71 | } |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
99 | - $fields=array (); |
|
99 | + $fields=array(); |
|
100 | 100 | $i=0; |
101 | - foreach ( $items as $val => $caption ) { |
|
101 | + foreach ($items as $val => $caption) { |
|
102 | 102 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
103 | 103 | if ($val===$value) { |
104 | 104 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
115 | - $fields=array (); |
|
115 | + $fields=array(); |
|
116 | 116 | $i=0; |
117 | - foreach ( $items as $val => $caption ) { |
|
117 | + foreach ($items as $val => $caption) { |
|
118 | 118 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
119 | 119 | if (\array_search($val, $values)!==false) { |
120 | 120 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -29,12 +29,14 @@ discard block |
||
29 | 29 | if (\is_string($end)) { |
30 | 30 | $label=$end; |
31 | 31 | \array_pop($fields); |
32 | - } else |
|
33 | - $label=NULL; |
|
32 | + } else { |
|
33 | + $label=NULL; |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | } |
36 | - if (isset($label)) |
|
37 | - $this->setLabel($label); |
|
37 | + if (isset($label)) { |
|
38 | + $this->setLabel($label); |
|
39 | + } |
|
38 | 40 | foreach ( $fields as $field ) { |
39 | 41 | $this->addItem($field); |
40 | 42 | } |
@@ -65,8 +67,9 @@ discard block |
||
65 | 67 | if ($this->_equalWidth) { |
66 | 68 | $count=$this->count(); |
67 | 69 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
68 | - } else |
|
69 | - $this->addToProperty("class", "fields"); |
|
70 | + } else { |
|
71 | + $this->addToProperty("class", "fields"); |
|
72 | + } |
|
70 | 73 | return parent::compile($js, $view); |
71 | 74 | } |
72 | 75 | |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | $fields[]=$itemO; |
107 | 110 | } |
108 | 111 | $radios=new HtmlFormFields("fields-".$name, $fields); |
109 | - if (isset($label)) |
|
110 | - $radios->setLabel($label)->setProperty("for", $name); |
|
112 | + if (isset($label)) { |
|
113 | + $radios->setLabel($label)->setProperty("for", $name); |
|
114 | + } |
|
111 | 115 | return $radios; |
112 | 116 | } |
113 | 117 | |
@@ -122,8 +126,9 @@ discard block |
||
122 | 126 | $fields[]=$itemO; |
123 | 127 | } |
124 | 128 | $radios=new HtmlFormFields("fields-".$name, $fields); |
125 | - if (isset($label)) |
|
126 | - $radios->setLabel($label)->setProperty("for", $name); |
|
129 | + if (isset($label)) { |
|
130 | + $radios->setLabel($label)->setProperty("for", $name); |
|
131 | + } |
|
127 | 132 | return $radios; |
128 | 133 | } |
129 | 134 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use Ajax\semantic\html\base\HtmlSemDoubleElement; |
6 | 6 | use Ajax\JsUtils; |
7 | 7 | use Ajax\service\JArray; |
8 | - |
|
9 | 8 | use Ajax\semantic\html\base\constants\State; |
10 | 9 | |
11 | 10 | class HtmlProgress extends HtmlSemDoubleElement { |
@@ -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 | } |