@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class State extends BaseEnum { |
8 | - const ACTIVE="active",DISABLED="disabled",LOADING="loading"; |
|
8 | + const ACTIVE="active", DISABLED="disabled", LOADING="loading"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Side extends BaseEnum { |
8 | - const BOTTOM="bottom",BOTH="",TOP="top"; |
|
8 | + const BOTTOM="bottom", BOTH="", TOP="top"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Variation extends BaseEnum { |
8 | - const ANIMATED="animated",AVATAR="avatar",COMPACT="compact",INVERTED="inverted",PADDED="padded"; |
|
8 | + const ANIMATED="animated", AVATAR="avatar", COMPACT="compact", INVERTED="inverted", PADDED="padded"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -9,20 +9,20 @@ discard block |
||
9 | 9 | protected $_states=[]; |
10 | 10 | protected $_baseClass; |
11 | 11 | |
12 | - public function addVariation($variation){ |
|
12 | + public function addVariation($variation) { |
|
13 | 13 | return $this->addToPropertyCtrl("class", $variation, $this->_variations); |
14 | 14 | } |
15 | 15 | |
16 | - public function addState($state){ |
|
16 | + public function addState($state) { |
|
17 | 17 | return $this->addToPropertyCtrl("class", $state, $this->_states); |
18 | 18 | } |
19 | 19 | |
20 | - public function setVariation($variation){ |
|
20 | + public function setVariation($variation) { |
|
21 | 21 | $this->setPropertyCtrl("class", $variation, $this->_variations); |
22 | 22 | return $this->addToProperty("class", $this->_baseClass); |
23 | 23 | } |
24 | 24 | |
25 | - public function setState($state){ |
|
25 | + public function setState($state) { |
|
26 | 26 | $this->setPropertyCtrl("class", $state, $this->_states); |
27 | 27 | return $this->addToProperty("class", $this->_baseClass); |
28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * {@inheritDoc} |
32 | 32 | * @see \Ajax\common\html\HtmlSingleElement::setSize() |
33 | 33 | */ |
34 | - public function setSize($size){ |
|
34 | + public function setSize($size) { |
|
35 | 35 | return $this->addToPropertyCtrl("class", $size, Size::getConstants()); |
36 | 36 | } |
37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * show it is currently unable to be interacted with |
40 | 40 | * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement |
41 | 41 | */ |
42 | - public function setDisabled(){ |
|
42 | + public function setDisabled() { |
|
43 | 43 | return $this->addToProperty("class", "disabled"); |
44 | 44 | } |
45 | 45 | |
@@ -47,18 +47,18 @@ discard block |
||
47 | 47 | * @param string $color |
48 | 48 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
49 | 49 | */ |
50 | - public function setColor($color){ |
|
51 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
50 | + public function setColor($color) { |
|
51 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function setFluid(){ |
|
54 | + public function setFluid() { |
|
55 | 55 | $this->addToProperty("class", "fluid"); |
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * can be formatted to appear on dark backgrounds |
60 | 60 | */ |
61 | - public function setInverted(){ |
|
61 | + public function setInverted() { |
|
62 | 62 | $this->addToProperty("class", "inverted"); |
63 | 63 | } |
64 | 64 | } |
65 | 65 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
10 | 10 | * @param string $value |
11 | 11 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
12 | 12 | */ |
13 | - public function setTextAlignment($value=TextAlignment::LEFT){ |
|
14 | - return $this->addToPropertyCtrl("class", $value,TextAlignment::getConstants()); |
|
13 | + public function setTextAlignment($value=TextAlignment::LEFT) { |
|
14 | + return $this->addToPropertyCtrl("class", $value, TextAlignment::getConstants()); |
|
15 | 15 | } |
16 | 16 | } |
17 | 17 | \ No newline at end of file |
@@ -18,26 +18,26 @@ discard block |
||
18 | 18 | use BaseTrait; |
19 | 19 | protected $_popup=NULL; |
20 | 20 | |
21 | - public function __construct($identifier, $tagName="p",$baseClass="ui") { |
|
21 | + public function __construct($identifier, $tagName="p", $baseClass="ui") { |
|
22 | 22 | parent::__construct($identifier, $tagName); |
23 | 23 | $this->_baseClass=$baseClass; |
24 | 24 | $this->setClass($baseClass); |
25 | 25 | } |
26 | 26 | |
27 | - public function setPopupAttributes($variation=NULL,$popupEvent=NULL){ |
|
28 | - if(isset($this->_popup)) |
|
29 | - $this->_popup->setAttributes($variation,$popupEvent); |
|
27 | + public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
|
28 | + if (isset($this->_popup)) |
|
29 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
30 | 30 | } |
31 | 31 | |
32 | - public function addPopup($title="",$content="",$variation=NULL,$params=array()){ |
|
33 | - $this->_popup=new InternalPopup($this,$title,$content,$variation,$params); |
|
32 | + public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
|
33 | + $this->_popup=new InternalPopup($this, $title, $content, $variation, $params); |
|
34 | 34 | return $this; |
35 | 35 | } |
36 | 36 | |
37 | - public function addPopupHtml($html="",$variation=NULL,$params=array()){ |
|
37 | + public function addPopupHtml($html="", $variation=NULL, $params=array()) { |
|
38 | 38 | $this->_popup=new InternalPopup($this); |
39 | 39 | $this->_popup->setHtml($html); |
40 | - $this->_popup->setAttributes($variation,$params); |
|
40 | + $this->_popup->setAttributes($variation, $params); |
|
41 | 41 | return $this; |
42 | 42 | } |
43 | 43 | |
@@ -48,27 +48,27 @@ discard block |
||
48 | 48 | * @param boolean $labeled |
49 | 49 | * @return \Ajax\semantic\html\elements\HtmlIcon |
50 | 50 | */ |
51 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
51 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
52 | 52 | $iconO=$icon; |
53 | - if(\is_string($icon)){ |
|
53 | + if (\is_string($icon)) { |
|
54 | 54 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
55 | 55 | } |
56 | - if($labeled!==false){ |
|
56 | + if ($labeled!==false) { |
|
57 | 57 | $this->addToProperty("class", "labeled icon"); |
58 | 58 | $this->tagName="div"; |
59 | 59 | } |
60 | - $this->addContent($iconO,$before); |
|
60 | + $this->addContent($iconO, $before); |
|
61 | 61 | return $iconO; |
62 | 62 | } |
63 | 63 | |
64 | - public function compile(JsUtils $js=NULL, View $view=NULL){ |
|
65 | - if(isset($this->_popup)) |
|
64 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
65 | + if (isset($this->_popup)) |
|
66 | 66 | $this->_popup->compile(); |
67 | - return parent::compile($js,$view); |
|
67 | + return parent::compile($js, $view); |
|
68 | 68 | } |
69 | - public function run(JsUtils $js){ |
|
69 | + public function run(JsUtils $js) { |
|
70 | 70 | parent::run($js); |
71 | - if(isset($this->_popup)){ |
|
71 | + if (isset($this->_popup)) { |
|
72 | 72 | $this->_popup->run($js); |
73 | 73 | //$this->addEventsOnRun($js); |
74 | 74 | //return $this->_bsComponent; |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | * @param string $type one of text,item |
27 | 27 | * @return \Ajax\semantic\html\collections\HtmlMenu |
28 | 28 | */ |
29 | - public function setType($type=""){ |
|
30 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
29 | + public function setType($type="") { |
|
30 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
31 | 31 | } |
32 | 32 | |
33 | - public function setActiveItem($index){ |
|
33 | + public function setActiveItem($index) { |
|
34 | 34 | $item=$this->getItem($index); |
35 | - if($item!==null){ |
|
35 | + if ($item!==null) { |
|
36 | 36 | $item->addToProperty("class", "active"); |
37 | 37 | } |
38 | 38 | return $this; |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * {@inheritDoc} |
43 | 43 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
44 | 44 | */ |
45 | - public function addItem($item){ |
|
45 | + public function addItem($item) { |
|
46 | 46 | $item=parent::addItem($item); |
47 | - if(!$item instanceof HtmlMenu) |
|
48 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
49 | - else{ |
|
47 | + if (!$item instanceof HtmlMenu) |
|
48 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
49 | + else { |
|
50 | 50 | $this->setSecondary(); |
51 | 51 | } |
52 | 52 | } |
@@ -55,51 +55,51 @@ discard block |
||
55 | 55 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
56 | 56 | */ |
57 | 57 | protected function createItem($value) { |
58 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
58 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
59 | 59 | return $itemO->setClass("item"); |
60 | 60 | } |
61 | 61 | |
62 | - public function setInverted(){ |
|
62 | + public function setInverted() { |
|
63 | 63 | return $this->addToProperty("class", "inverted"); |
64 | 64 | } |
65 | 65 | |
66 | - public function setSecondary(){ |
|
66 | + public function setSecondary() { |
|
67 | 67 | return $this->addToProperty("class", "secondary"); |
68 | 68 | } |
69 | 69 | |
70 | - public function setVertical(){ |
|
70 | + public function setVertical() { |
|
71 | 71 | return $this->addToProperty("class", "vertical"); |
72 | 72 | } |
73 | 73 | |
74 | - public function setPosition($value="right"){ |
|
75 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
74 | + public function setPosition($value="right") { |
|
75 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
76 | 76 | } |
77 | 77 | |
78 | - public function setPointing($value=Direction::NONE){ |
|
79 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
78 | + public function setPointing($value=Direction::NONE) { |
|
79 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
80 | 80 | } |
81 | 81 | |
82 | - public function asTab($vertical=false){ |
|
83 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
84 | - if($vertical===true) |
|
82 | + public function asTab($vertical=false) { |
|
83 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
84 | + if ($vertical===true) |
|
85 | 85 | $this->setVertical(); |
86 | 86 | return $this->addToProperty("class", "tabular"); |
87 | 87 | } |
88 | 88 | |
89 | - public function asPagination(){ |
|
90 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
89 | + public function asPagination() { |
|
90 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
91 | 91 | return $this->addToProperty("class", "pagination"); |
92 | 92 | } |
93 | 93 | |
94 | - public function setFixed(){ |
|
94 | + public function setFixed() { |
|
95 | 95 | return $this->addToProperty("class", "fixed"); |
96 | 96 | } |
97 | 97 | |
98 | - public function setFluid(){ |
|
98 | + public function setFluid() { |
|
99 | 99 | return $this->addToProperty("class", "fluid"); |
100 | 100 | } |
101 | 101 | |
102 | - public function setCompact(){ |
|
102 | + public function setCompact() { |
|
103 | 103 | return $this->addToProperty("class", "compact"); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | \ No newline at end of file |
@@ -15,23 +15,23 @@ discard block |
||
15 | 15 | * @author jc |
16 | 16 | * @version 1.001 |
17 | 17 | */ |
18 | -class HtmlGrid extends HtmlSemCollection{ |
|
18 | +class HtmlGrid extends HtmlSemCollection { |
|
19 | 19 | use TextAlignmentTrait; |
20 | 20 | private $_createCols; |
21 | 21 | private $_colSizing=true; |
22 | 22 | private $_implicitRows=false; |
23 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
24 | - parent::__construct( $identifier, "div","ui grid"); |
|
23 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
24 | + parent::__construct($identifier, "div", "ui grid"); |
|
25 | 25 | $this->_implicitRows=$implicitRows; |
26 | 26 | $this->_createCols=$createCols; |
27 | - if(isset($numCols)){ |
|
27 | + if (isset($numCols)) { |
|
28 | 28 | //if($this->_createCols){ |
29 | 29 | $this->_colSizing=false; |
30 | 30 | //} |
31 | 31 | $cols=Wide::getConstants()["W".$numCols]; |
32 | - $this->addToProperty("class",$cols." column"); |
|
32 | + $this->addToProperty("class", $cols." column"); |
|
33 | 33 | } |
34 | - $this->setNumRows($numRows,$numCols); |
|
34 | + $this->setNumRows($numRows, $numCols); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * @param int $numCols |
41 | 41 | * @return \Ajax\semantic\html\collections\HtmlGrid |
42 | 42 | */ |
43 | - public function setNumRows($numRows,$numCols=NULL){ |
|
43 | + public function setNumRows($numRows, $numCols=NULL) { |
|
44 | 44 | $count=$this->count(); |
45 | - for($i=$count;$i<$numRows;$i++){ |
|
45 | + for ($i=$count; $i<$numRows; $i++) { |
|
46 | 46 | $this->addItem($numCols); |
47 | 47 | } |
48 | 48 | return $this; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $index |
54 | 54 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
55 | 55 | */ |
56 | - public function getRow($index){ |
|
56 | + public function getRow($index) { |
|
57 | 57 | return $this->getItem($index); |
58 | 58 | } |
59 | 59 | |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * @param int $col |
63 | 63 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
64 | 64 | */ |
65 | - public function getCell($row,$col){ |
|
65 | + public function getCell($row, $col) { |
|
66 | 66 | $row=$this->getItem($row); |
67 | - if(isset($row)){ |
|
67 | + if (isset($row)) { |
|
68 | 68 | $col=$row->getItem($col); |
69 | 69 | } |
70 | 70 | return $col; |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @param boolean $vertically |
76 | 76 | * @return \Ajax\semantic\html\collections\HtmlGrid |
77 | 77 | */ |
78 | - public function setDivided($vertically=false){ |
|
79 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
78 | + public function setDivided($vertically=false) { |
|
79 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
80 | 80 | return $this->addToProperty("class", $value); |
81 | 81 | } |
82 | 82 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @param boolean $internal true for internal cells |
86 | 86 | * @return \Ajax\semantic\html\collections\HtmlGrid |
87 | 87 | */ |
88 | - public function setCelled($internal=false){ |
|
89 | - $value=($internal===true)?"internal celled":"celled"; |
|
88 | + public function setCelled($internal=false) { |
|
89 | + $value=($internal===true) ? "internal celled" : "celled"; |
|
90 | 90 | return $this->addToProperty("class", $value); |
91 | 91 | } |
92 | 92 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * automatically resize all elements to split the available width evenly |
95 | 95 | * @return \Ajax\semantic\html\collections\HtmlGrid |
96 | 96 | */ |
97 | - public function setEqualWidth(){ |
|
97 | + public function setEqualWidth() { |
|
98 | 98 | return $this->addToProperty("class", "equal width"); |
99 | 99 | } |
100 | 100 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * @param string $value |
104 | 104 | * @return \Ajax\semantic\html\collections\HtmlGrid |
105 | 105 | */ |
106 | - public function setPadded($value=NULL){ |
|
107 | - if(isset($value)) |
|
108 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
106 | + public function setPadded($value=NULL) { |
|
107 | + if (isset($value)) |
|
108 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
109 | 109 | return $this->addToProperty("class", "padded"); |
110 | 110 | } |
111 | 111 | |
@@ -113,37 +113,37 @@ discard block |
||
113 | 113 | * @param boolean $very |
114 | 114 | * @return \Ajax\semantic\html\collections\HtmlGrid |
115 | 115 | */ |
116 | - public function setRelaxed($very=false){ |
|
117 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
116 | + public function setRelaxed($very=false) { |
|
117 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
118 | 118 | return $this->addToProperty("class", $value); |
119 | 119 | } |
120 | 120 | |
121 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
122 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
121 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
122 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
126 | 126 | * {@inheritDoc} |
127 | 127 | * @see \Ajax\common\html\HtmlCollection::createItem() |
128 | 128 | */ |
129 | - protected function createItem($value){ |
|
130 | - if($this->_createCols===false) |
|
129 | + protected function createItem($value) { |
|
130 | + if ($this->_createCols===false) |
|
131 | 131 | $value=null; |
132 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
132 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
133 | 133 | return $item; |
134 | 134 | } |
135 | 135 | |
136 | - public function setValues($values){ |
|
136 | + public function setValues($values) { |
|
137 | 137 | $count=$this->count(); |
138 | - if($this->_createCols===false){ |
|
139 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
138 | + if ($this->_createCols===false) { |
|
139 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
140 | 140 | $colSize=\sizeof($values[$i]); |
141 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
141 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
142 | 142 | } |
143 | 143 | } |
144 | - $count=\min(array($this->count(),\sizeof($values))); |
|
145 | - for($i=0;$i<$count;$i++){ |
|
146 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
144 | + $count=\min(array($this->count(), \sizeof($values))); |
|
145 | + for ($i=0; $i<$count; $i++) { |
|
146 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | class HtmlDropdown extends HtmlSemDoubleElement { |
14 | 14 | protected $mClass="menu"; |
15 | 15 | protected $mTagName="div"; |
16 | - protected $items=array (); |
|
16 | + protected $items=array(); |
|
17 | 17 | protected $params=array("action"=>"select"); |
18 | 18 | protected $input; |
19 | 19 | |
@@ -21,40 +21,40 @@ discard block |
||
21 | 21 | parent::__construct($identifier, "div"); |
22 | 22 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
23 | 23 | $this->setProperty("class", "ui dropdown"); |
24 | - $content=new HtmlSemDoubleElement("","div"); |
|
24 | + $content=new HtmlSemDoubleElement("", "div"); |
|
25 | 25 | $content->setClass("text"); |
26 | 26 | $content->setContent($value); |
27 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
27 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
28 | 28 | $this->content=array($content); |
29 | 29 | $this->tagName="div"; |
30 | 30 | $this->addItems($items); |
31 | 31 | } |
32 | 32 | |
33 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
33 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
34 | 34 | $itemO=$item; |
35 | - if(\is_object($item)===false){ |
|
36 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
35 | + if (\is_object($item)===false) { |
|
36 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
37 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
38 | 38 | $this->addToProperty("class", "vertical"); |
39 | 39 | } |
40 | 40 | $this->items[]=$itemO; |
41 | 41 | return $itemO; |
42 | 42 | } |
43 | 43 | |
44 | - public function addInput($name){ |
|
45 | - if(!isset($name)) |
|
44 | + public function addInput($name) { |
|
45 | + if (!isset($name)) |
|
46 | 46 | $name="input-".$this->identifier; |
47 | 47 | $this->setAction("activate"); |
48 | - $this->input=new HtmlInput($name,"hidden"); |
|
48 | + $this->input=new HtmlInput($name, "hidden"); |
|
49 | 49 | } |
50 | 50 | |
51 | - public function addItems($items){ |
|
52 | - if(JArray::isAssociative($items)){ |
|
53 | - foreach ($items as $k=>$v){ |
|
51 | + public function addItems($items) { |
|
52 | + if (JArray::isAssociative($items)) { |
|
53 | + foreach ($items as $k=>$v) { |
|
54 | 54 | $this->addItem($v)->setData($k); |
55 | 55 | } |
56 | - }else{ |
|
57 | - foreach ($items as $item){ |
|
56 | + }else { |
|
57 | + foreach ($items as $item) { |
|
58 | 58 | $this->addItem($item); |
59 | 59 | } |
60 | 60 | } |
@@ -63,51 +63,51 @@ discard block |
||
63 | 63 | /** |
64 | 64 | * @param boolean $dropdown |
65 | 65 | */ |
66 | - public function asDropdown($dropdown){ |
|
67 | - if($dropdown===false){ |
|
66 | + public function asDropdown($dropdown) { |
|
67 | + if ($dropdown===false) { |
|
68 | 68 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
69 | 69 | $dropdown="menu"; |
70 | - }else{ |
|
70 | + }else { |
|
71 | 71 | $dropdown="dropdown"; |
72 | 72 | $this->mClass="menu"; |
73 | 73 | } |
74 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
74 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
75 | 75 | } |
76 | 76 | |
77 | - public function setVertical(){ |
|
78 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
77 | + public function setVertical() { |
|
78 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
79 | 79 | } |
80 | 80 | |
81 | - public function setSimple(){ |
|
82 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
81 | + public function setSimple() { |
|
82 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
83 | 83 | } |
84 | 84 | |
85 | - public function asButton($floating=false){ |
|
86 | - if($floating) |
|
85 | + public function asButton($floating=false) { |
|
86 | + if ($floating) |
|
87 | 87 | $this->addToProperty("class", "floating"); |
88 | 88 | return $this->addToProperty("class", "button"); |
89 | 89 | } |
90 | 90 | |
91 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
92 | - if(isset($name)) |
|
91 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
92 | + if (isset($name)) |
|
93 | 93 | $this->addInput($name); |
94 | - if($multiple) |
|
94 | + if ($multiple) |
|
95 | 95 | $this->addToProperty("class", "multiple"); |
96 | 96 | if ($selection) |
97 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
97 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
98 | 98 | return $this; |
99 | 99 | } |
100 | 100 | |
101 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
102 | - $this->asSelect($name,$multiple,$selection); |
|
101 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
102 | + $this->asSelect($name, $multiple, $selection); |
|
103 | 103 | return $this->addToProperty("class", "search"); |
104 | 104 | } |
105 | 105 | |
106 | - public function setSelect($name=NULL,$multiple=false){ |
|
107 | - if(!isset($name)) |
|
106 | + public function setSelect($name=NULL, $multiple=false) { |
|
107 | + if (!isset($name)) |
|
108 | 108 | $name="select-".$this->identifier; |
109 | 109 | $this->input=null; |
110 | - if($multiple){ |
|
110 | + if ($multiple) { |
|
111 | 111 | $this->setProperty("multiple", true); |
112 | 112 | $this->addToProperty("class", "multiple"); |
113 | 113 | } |
@@ -115,28 +115,28 @@ discard block |
||
115 | 115 | $this->tagName="select"; |
116 | 116 | $this->setProperty("name", $name); |
117 | 117 | $this->content=null; |
118 | - foreach ($this->items as $item){ |
|
118 | + foreach ($this->items as $item) { |
|
119 | 119 | $item->asOption(); |
120 | 120 | } |
121 | 121 | return $this; |
122 | 122 | } |
123 | 123 | |
124 | - public function asSubmenu($pointing=NULL){ |
|
124 | + public function asSubmenu($pointing=NULL) { |
|
125 | 125 | $this->setClass("ui dropdown link item"); |
126 | - if(isset($pointing)){ |
|
126 | + if (isset($pointing)) { |
|
127 | 127 | $this->setPointing($pointing); |
128 | 128 | } |
129 | 129 | return $this; |
130 | 130 | } |
131 | 131 | |
132 | - public function setPointing($value=Direction::NONE){ |
|
133 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
132 | + public function setPointing($value=Direction::NONE) { |
|
133 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
134 | 134 | } |
135 | 135 | |
136 | - public function setValue($value){ |
|
137 | - if(isset($this->input)){ |
|
136 | + public function setValue($value) { |
|
137 | + if (isset($this->input)) { |
|
138 | 138 | $this->input->setProperty("value", $value); |
139 | - }else{ |
|
139 | + }else { |
|
140 | 140 | $this->setProperty("value", $value); |
141 | 141 | } |
142 | 142 | return $this; |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | * @see BaseHtml::run() |
148 | 148 | */ |
149 | 149 | public function run(JsUtils $js) { |
150 | - if($this->propertyContains("class", "simple")===false){ |
|
151 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
150 | + if ($this->propertyContains("class", "simple")===false) { |
|
151 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->params); |
|
152 | 152 | $this->addEventsOnRun($js); |
153 | 153 | return $this->_bsComponent; |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - public function setAction($action){ |
|
157 | + public function setAction($action) { |
|
158 | 158 | $this->params["action"]=$action; |
159 | 159 | } |
160 | 160 | } |
161 | 161 | \ No newline at end of file |