@@ -34,8 +34,9 @@ |
||
34 | 34 | * @see BaseHtml::run() |
35 | 35 | */ |
36 | 36 | public function run(JsUtils $js) { |
37 | - if(isset($this->_bsComponent)===false) |
|
38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
37 | + if(isset($this->_bsComponent)===false) { |
|
38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
39 | + } |
|
39 | 40 | $this->addEventsOnRun($js); |
40 | 41 | return $this->_bsComponent; |
41 | 42 | } |
@@ -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%"; |
@@ -6,26 +6,26 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\content\HtmlAccordionItem; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -class HtmlAccordion extends HtmlSemCollection{ |
|
9 | +class HtmlAccordion extends HtmlSemCollection { |
|
10 | 10 | |
11 | 11 | protected $params=array(); |
12 | 12 | |
13 | - public function __construct( $identifier, $tagName="div", $baseClass="ui"){ |
|
14 | - parent::__construct( $identifier, "div", "ui accordion"); |
|
13 | + public function __construct($identifier, $tagName="div", $baseClass="ui") { |
|
14 | + parent::__construct($identifier, "div", "ui accordion"); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | |
18 | - protected function createItem($value){ |
|
18 | + protected function createItem($value) { |
|
19 | 19 | $count=$this->count(); |
20 | 20 | $title=$value; |
21 | 21 | $content=NULL; |
22 | - if(\is_array($value)){ |
|
23 | - $title=@$value[0];$content=@$value[1]; |
|
22 | + if (\is_array($value)) { |
|
23 | + $title=@$value[0]; $content=@$value[1]; |
|
24 | 24 | } |
25 | - return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title,$content); |
|
25 | + return new HtmlAccordionItem("item-".$this->identifier."-".$count, $title, $content); |
|
26 | 26 | } |
27 | 27 | |
28 | - protected function createCondition($value){ |
|
28 | + protected function createCondition($value) { |
|
29 | 29 | return ($value instanceof HtmlAccordionItem)===false; |
30 | 30 | } |
31 | 31 | |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | * @see BaseHtml::run() |
35 | 35 | */ |
36 | 36 | public function run(JsUtils $js) { |
37 | - if(isset($this->_bsComponent)===false) |
|
38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
37 | + if (isset($this->_bsComponent)===false) |
|
38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
39 | 39 | $this->addEventsOnRun($js); |
40 | 40 | return $this->_bsComponent; |
41 | 41 | } |
42 | 42 | |
43 | - public function setStyled(){ |
|
43 | + public function setStyled() { |
|
44 | 44 | return $this->addToProperty("class", "styled"); |
45 | 45 | } |
46 | 46 | |
47 | - public function setActive($index){ |
|
47 | + public function setActive($index) { |
|
48 | 48 | $this->getItem($index)->setActive(true); |
49 | 49 | return $this; |
50 | 50 | } |
51 | 51 | |
52 | - public function setExclusive($value){ |
|
52 | + public function setExclusive($value) { |
|
53 | 53 | $this->params["exclusive"]=$value; |
54 | 54 | } |
55 | 55 | } |
56 | 56 | \ 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%"; |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | use Ajax\semantic\html\content\HtmlAccordionMenuItem; |
7 | 7 | use Ajax\JsUtils; |
8 | 8 | |
9 | -class HtmlAccordionMenu extends HtmlMenu{ |
|
9 | +class HtmlAccordionMenu extends HtmlMenu { |
|
10 | 10 | protected $params=array(); |
11 | 11 | |
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 | $this->addToProperty("class", "accordion"); |
15 | 15 | $this->setVertical(); |
16 | 16 | } |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | protected function createItem($value) { |
23 | 23 | $title=$value; |
24 | 24 | $content=""; |
25 | - if(\is_array($value)){ |
|
26 | - $title=@$value[0];$content=@$value[1]; |
|
25 | + if (\is_array($value)) { |
|
26 | + $title=@$value[0]; $content=@$value[1]; |
|
27 | 27 | } |
28 | 28 | $itemO=new HtmlAccordionMenuItem("item-".$this->identifier."-".$this->count(), $title, $content); |
29 | 29 | return $itemO->setClass("item"); |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @see BaseHtml::run() |
35 | 35 | */ |
36 | 36 | public function run(JsUtils $js) { |
37 | - if(isset($this->_bsComponent)===false) |
|
38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
37 | + if (isset($this->_bsComponent)===false) |
|
38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier, $this->params); |
|
39 | 39 | $this->addEventsOnRun($js); |
40 | 40 | return $this->_bsComponent; |
41 | 41 | } |
42 | 42 | |
43 | - public function setExclusive($value){ |
|
43 | + public function setExclusive($value) { |
|
44 | 44 | $this->params["exclusive"]=$value; |
45 | 45 | } |
46 | 46 | } |
47 | 47 | \ No newline at end of file |
@@ -34,8 +34,9 @@ |
||
34 | 34 | * @see BaseHtml::run() |
35 | 35 | */ |
36 | 36 | public function run(JsUtils $js) { |
37 | - if(isset($this->_bsComponent)===false) |
|
38 | - $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
37 | + if(isset($this->_bsComponent)===false) { |
|
38 | + $this->_bsComponent=$js->semantic()->accordion("#".$this->identifier,$this->params); |
|
39 | + } |
|
39 | 40 | $this->addEventsOnRun($js); |
40 | 41 | return $this->_bsComponent; |
41 | 42 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | /** |
26 | 26 | * Sets the menu type |
27 | 27 | * @param string $type one of text,item |
28 | - * @return \Ajax\semantic\html\collections\HtmlMenu |
|
28 | + * @return HtmlMenu |
|
29 | 29 | */ |
30 | 30 | public function setType($type=""){ |
31 | 31 | return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @param string $type one of text,item |
28 | 28 | * @return \Ajax\semantic\html\collections\HtmlMenu |
29 | 29 | */ |
30 | - public function setType($type=""){ |
|
31 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
30 | + public function setType($type="") { |
|
31 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
32 | 32 | } |
33 | 33 | |
34 | - public function setActiveItem($index){ |
|
34 | + public function setActiveItem($index) { |
|
35 | 35 | $item=$this->getItem($index); |
36 | - if($item!==null){ |
|
36 | + if ($item!==null) { |
|
37 | 37 | $item->addToProperty("class", "active"); |
38 | 38 | } |
39 | 39 | return $this; |
@@ -43,24 +43,24 @@ discard block |
||
43 | 43 | * {@inheritDoc} |
44 | 44 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
45 | 45 | */ |
46 | - public function addItem($item){ |
|
47 | - if($item instanceof \Ajax\semantic\html\elements\HtmlInput){ |
|
48 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier,"div"); |
|
46 | + public function addItem($item) { |
|
47 | + if ($item instanceof \Ajax\semantic\html\elements\HtmlInput) { |
|
48 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div"); |
|
49 | 49 | $itemO->setContent($item); |
50 | 50 | $item=$itemO; |
51 | 51 | } |
52 | 52 | $item=parent::addItem($item); |
53 | - if(!$item instanceof HtmlMenu) |
|
54 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
55 | - else{ |
|
53 | + if (!$item instanceof HtmlMenu) |
|
54 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
55 | + else { |
|
56 | 56 | $this->setSecondary(); |
57 | 57 | } |
58 | 58 | } |
59 | - public function generateMenuAsItem($menu,$header=null){ |
|
59 | + public function generateMenuAsItem($menu, $header=null) { |
|
60 | 60 | $count=$this->count(); |
61 | - $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"div"); |
|
62 | - if(isset($header)){ |
|
63 | - $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count,"div","header"); |
|
61 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
62 | + if (isset($header)) { |
|
63 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
64 | 64 | $headerItem->setContent($header); |
65 | 65 | $item->addContent($headerItem); |
66 | 66 | } |
@@ -68,59 +68,59 @@ discard block |
||
68 | 68 | $item->addContent($menu); |
69 | 69 | return $item; |
70 | 70 | } |
71 | - public function addMenuAsItem($menu,$header=null){ |
|
72 | - return $this->addItem($this->generateMenuAsItem($menu,$header)); |
|
71 | + public function addMenuAsItem($menu, $header=null) { |
|
72 | + return $this->addItem($this->generateMenuAsItem($menu, $header)); |
|
73 | 73 | } |
74 | 74 | /** |
75 | 75 | * {@inheritDoc} |
76 | 76 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
77 | 77 | */ |
78 | 78 | protected function createItem($value) { |
79 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
79 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
80 | 80 | return $itemO->setClass("item"); |
81 | 81 | } |
82 | 82 | |
83 | - public function setInverted(){ |
|
83 | + public function setInverted() { |
|
84 | 84 | return $this->addToProperty("class", "inverted"); |
85 | 85 | } |
86 | 86 | |
87 | - public function setSecondary(){ |
|
87 | + public function setSecondary() { |
|
88 | 88 | return $this->addToProperty("class", "secondary"); |
89 | 89 | } |
90 | 90 | |
91 | - public function setVertical(){ |
|
92 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
91 | + public function setVertical() { |
|
92 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
93 | 93 | } |
94 | 94 | |
95 | - public function setPosition($value="right"){ |
|
96 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
95 | + public function setPosition($value="right") { |
|
96 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
97 | 97 | } |
98 | 98 | |
99 | - public function setPointing($value=Direction::NONE){ |
|
100 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
99 | + public function setPointing($value=Direction::NONE) { |
|
100 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
101 | 101 | } |
102 | 102 | |
103 | - public function asTab($vertical=false){ |
|
104 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
105 | - if($vertical===true) |
|
103 | + public function asTab($vertical=false) { |
|
104 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
105 | + if ($vertical===true) |
|
106 | 106 | $this->setVertical(); |
107 | 107 | return $this->addToProperty("class", "tabular"); |
108 | 108 | } |
109 | 109 | |
110 | - public function asPagination(){ |
|
111 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
110 | + public function asPagination() { |
|
111 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
112 | 112 | return $this->addToProperty("class", "pagination"); |
113 | 113 | } |
114 | 114 | |
115 | - public function setFixed(){ |
|
115 | + public function setFixed() { |
|
116 | 116 | return $this->addToProperty("class", "fixed"); |
117 | 117 | } |
118 | 118 | |
119 | - public function setFluid(){ |
|
119 | + public function setFluid() { |
|
120 | 120 | return $this->addToProperty("class", "fluid"); |
121 | 121 | } |
122 | 122 | |
123 | - public function setCompact(){ |
|
123 | + public function setCompact() { |
|
124 | 124 | return $this->addToProperty("class", "compact"); |
125 | 125 | } |
126 | 126 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function fromDatabaseObject($object, $function) { |
131 | 131 | $return=$function($object); |
132 | - if(\is_array($return)) |
|
132 | + if (\is_array($return)) |
|
133 | 133 | $this->addItems($return); |
134 | 134 | else |
135 | 135 | $this->addItem($return); |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $item=$itemO; |
51 | 51 | } |
52 | 52 | $item=parent::addItem($item); |
53 | - if(!$item instanceof HtmlMenu) |
|
54 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
55 | - else{ |
|
53 | + if(!$item instanceof HtmlMenu) { |
|
54 | + $item->addToPropertyCtrl("class", "item",array("item")); |
|
55 | + } else{ |
|
56 | 56 | $this->setSecondary(); |
57 | 57 | } |
58 | 58 | } |
@@ -102,8 +102,9 @@ discard block |
||
102 | 102 | |
103 | 103 | public function asTab($vertical=false){ |
104 | 104 | $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
105 | - if($vertical===true) |
|
106 | - $this->setVertical(); |
|
105 | + if($vertical===true) { |
|
106 | + $this->setVertical(); |
|
107 | + } |
|
107 | 108 | return $this->addToProperty("class", "tabular"); |
108 | 109 | } |
109 | 110 | |
@@ -129,9 +130,10 @@ discard block |
||
129 | 130 | */ |
130 | 131 | public function fromDatabaseObject($object, $function) { |
131 | 132 | $return=$function($object); |
132 | - if(\is_array($return)) |
|
133 | - $this->addItems($return); |
|
134 | - else |
|
135 | - $this->addItem($return); |
|
133 | + if(\is_array($return)) { |
|
134 | + $this->addItems($return); |
|
135 | + } else { |
|
136 | + $this->addItem($return); |
|
137 | + } |
|
136 | 138 | } |
137 | 139 | } |
138 | 140 | \ No newline at end of file |
@@ -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 | } |
@@ -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 $view=NULL){ |
|
39 | + public function compile(JsUtils $js=NULL, View $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"); |
@@ -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 |
@@ -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(){ |
@@ -8,26 +8,26 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlFormField extends HtmlSemDoubleElement { |
10 | 10 | protected $_container; |
11 | - public function __construct($identifier, $field,$label=NULL) { |
|
12 | - parent::__construct($identifier, "div","field"); |
|
11 | + public function __construct($identifier, $field, $label=NULL) { |
|
12 | + parent::__construct($identifier, "div", "field"); |
|
13 | 13 | $this->content=array(); |
14 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
15 | - if(isset($label)) |
|
14 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
15 | + if (isset($label)) |
|
16 | 16 | $this->setLabel($label); |
17 | 17 | $this->setField($field); |
18 | 18 | } |
19 | 19 | |
20 | - public function setLabel($label){ |
|
20 | + public function setLabel($label) { |
|
21 | 21 | $labelO=$label; |
22 | - if(\is_string($label)){ |
|
23 | - $labelO=new HtmlSemDoubleElement("","label"); |
|
22 | + if (\is_string($label)) { |
|
23 | + $labelO=new HtmlSemDoubleElement("", "label"); |
|
24 | 24 | $labelO->setContent($label); |
25 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
25 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
26 | 26 | } |
27 | 27 | $this->content["label"]=$labelO; |
28 | 28 | } |
29 | 29 | |
30 | - public function setField($field){ |
|
30 | + public function setField($field) { |
|
31 | 31 | $this->content["field"]=$field; |
32 | 32 | } |
33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * Returns the label or null |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function getLabel(){ |
|
39 | - if(\array_key_exists("label", $this->content)) |
|
38 | + public function getLabel() { |
|
39 | + if (\array_key_exists("label", $this->content)) |
|
40 | 40 | return $this->content["label"]; |
41 | 41 | } |
42 | 42 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | * Return the field |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function getField(){ |
|
47 | + public function getField() { |
|
48 | 48 | return $this->content["field"]; |
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * puts the label before or behind |
53 | 53 | */ |
54 | - public function swapLabel(){ |
|
54 | + public function swapLabel() { |
|
55 | 55 | $label=$this->getLabel(); |
56 | 56 | unset($this->content["label"]); |
57 | 57 | $this->content["label"]=$label; |
@@ -62,27 +62,27 @@ discard block |
||
62 | 62 | * @param int $width |
63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
64 | 64 | */ |
65 | - public function setWidth($width){ |
|
66 | - if(\is_int($width)){ |
|
65 | + public function setWidth($width) { |
|
66 | + if (\is_int($width)) { |
|
67 | 67 | $width=Wide::getConstants()["W".$width]; |
68 | 68 | } |
69 | 69 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
70 | - if(isset($this->_container)){ |
|
70 | + if (isset($this->_container)) { |
|
71 | 71 | $this->_container->setEqualWidth(false); |
72 | 72 | } |
73 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
73 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Field displays an error state |
78 | 78 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
79 | 79 | */ |
80 | - public function setError(){ |
|
80 | + public function setError() { |
|
81 | 81 | return $this->addToProperty("class", "error"); |
82 | 82 | } |
83 | 83 | |
84 | - public function jsState($state){ |
|
85 | - return $this->jsDoJquery("addClass",$state); |
|
84 | + public function jsState($state) { |
|
85 | + return $this->jsDoJquery("addClass", $state); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function setContainer($_container) { |
@@ -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,39 +44,39 @@ 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 | } |
78 | 78 | |
79 | - public function setGrouped(){ |
|
79 | + public function setGrouped() { |
|
80 | 80 | $this->_equalWidth=false; |
81 | 81 | $this->addToProperty("class", "grouped"); |
82 | 82 | } |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | - public static function radios($name,$items=array(),$label=NULL){ |
|
93 | + public static function radios($name, $items=array(), $label=NULL) { |
|
94 | 94 | $fields=array(); |
95 | 95 | $i=0; |
96 | - foreach ($items as $item){ |
|
97 | - $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
|
96 | + foreach ($items as $item) { |
|
97 | + $fields[]=new HtmlFormRadio($name."-".$i++, $name, $item, $item); |
|
98 | 98 | } |
99 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
100 | - if(isset($label)) |
|
99 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
100 | + if (isset($label)) |
|
101 | 101 | $radios->setLabel($label)->setProperty("for", $name); |
102 | 102 | return $radios; |
103 | 103 | } |
@@ -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 | |
@@ -97,8 +101,9 @@ discard block |
||
97 | 101 | $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
98 | 102 | } |
99 | 103 | $radios=new HtmlFormFields("fields-".$name,$fields); |
100 | - if(isset($label)) |
|
101 | - $radios->setLabel($label)->setProperty("for", $name); |
|
104 | + if(isset($label)) { |
|
105 | + $radios->setLabel($label)->setProperty("for", $name); |
|
106 | + } |
|
102 | 107 | return $radios; |
103 | 108 | } |
104 | 109 |