@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | foreach ($items as $k=>$v){ |
18 | 18 | $this->addItem([$k,$v]); |
19 | 19 | } |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | foreach ($items as $item){ |
22 | 22 | $this->addItem($item); |
23 | 23 | } |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
54 | 54 | */ |
55 | 55 | public function getItem($index) { |
56 | - if (is_int($index)) |
|
57 | - return $this->content[$index]; |
|
58 | - else { |
|
56 | + if (is_int($index)) { |
|
57 | + return $this->content[$index]; |
|
58 | + } else { |
|
59 | 59 | $elm=$this->getElementById($index, $this->content); |
60 | 60 | return $elm; |
61 | 61 | } |
@@ -15,8 +15,9 @@ discard block |
||
15 | 15 | if(isset($type)){ |
16 | 16 | if($type=="page"){ |
17 | 17 | $this->asPageHeader($niveau); |
18 | - }else |
|
19 | - $this->asContentHeader($niveau); |
|
18 | + } else { |
|
19 | + $this->asContentHeader($niveau); |
|
20 | + } |
|
20 | 21 | } |
21 | 22 | $this->content=$content; |
22 | 23 | } |
@@ -48,7 +49,7 @@ discard block |
||
48 | 49 | if(!\is_object($title)){ |
49 | 50 | $this->content=new HtmlDoubleElement("content-".$this->identifier,"div"); |
50 | 51 | $this->content->setContent($title); |
51 | - }else{ |
|
52 | + } else{ |
|
52 | 53 | $this->content=$title; |
53 | 54 | } |
54 | 55 | $this->content->setClass("content"); |
@@ -24,9 +24,9 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public static function getConstantValues($postFix=""){ |
27 | - if($postFix!=="") |
|
28 | - return \array_values(self::getConstants()); |
|
29 | - else{ |
|
27 | + if($postFix!=="") { |
|
28 | + return \array_values(self::getConstants()); |
|
29 | + } else{ |
|
30 | 30 | return \array_map(function ($elem) use ($postFix) {return $elem." ".$postFix;},\array_values(self::getConstants())); |
31 | 31 | } |
32 | 32 | } |
@@ -19,8 +19,9 @@ |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function asAvatar($caption=NULL){ |
22 | - if(isset($caption)) |
|
23 | - $this->wrap("",$caption); |
|
22 | + if(isset($caption)) { |
|
23 | + $this->wrap("",$caption); |
|
24 | + } |
|
24 | 25 | return $this->addToProperty("class", "avatar"); |
25 | 26 | } |
26 | 27 | } |
27 | 28 | \ No newline at end of file |
@@ -11,8 +11,9 @@ |
||
11 | 11 | parent::__construct($identifier, "input"); |
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setProperty("value", $value); |
14 | - if(JString::isNotNull($placeholder)) |
|
15 | - $this->setProperty("placeholder", $placeholder); |
|
14 | + if(JString::isNotNull($placeholder)) { |
|
15 | + $this->setProperty("placeholder", $placeholder); |
|
16 | + } |
|
16 | 17 | $this->setProperty("type", $type); |
17 | 18 | } |
18 | 19 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
30 | 30 | $this->addContent($iconO,false); |
31 | 31 | $this->_hasIcon=true; |
32 | - }else{ |
|
32 | + } else{ |
|
33 | 33 | $iconO=$this->getIcon(); |
34 | 34 | $iconO->setIcon($icon); |
35 | 35 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | public function getIcon(){ |
41 | 41 | if(\is_array($this->content)){ |
42 | 42 | foreach ($this->content as $item){ |
43 | - if($item instanceof HtmlIcon) |
|
44 | - return $item; |
|
43 | + if($item instanceof HtmlIcon) { |
|
44 | + return $item; |
|
45 | + } |
|
45 | 46 | } |
46 | 47 | } |
47 | 48 | } |
@@ -57,9 +58,10 @@ discard block |
||
57 | 58 | $labelO=$label; |
58 | 59 | if(\is_object($label)===false){ |
59 | 60 | $labelO=new HtmlLabel("label-".$this->identifier,$label); |
60 | - if(isset($icon)) |
|
61 | - $labelO->addIcon($icon); |
|
62 | - }else{ |
|
61 | + if(isset($icon)) { |
|
62 | + $labelO->addIcon($icon); |
|
63 | + } |
|
64 | + } else{ |
|
63 | 65 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
64 | 66 | } |
65 | 67 | $this->addToProperty("class", $direction." labeled"); |
@@ -75,8 +77,9 @@ discard block |
||
75 | 77 | $actionO=$action; |
76 | 78 | if(\is_object($action)===false){ |
77 | 79 | $actionO=new HtmlButton("action-".$this->identifier,$action); |
78 | - if(isset($icon)) |
|
79 | - $actionO->addIcon($icon,true,$labeled); |
|
80 | + if(isset($icon)) { |
|
81 | + $actionO->addIcon($icon,true,$labeled); |
|
82 | + } |
|
80 | 83 | } |
81 | 84 | $this->addToProperty("class", $direction." action"); |
82 | 85 | $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
@@ -19,8 +19,9 @@ |
||
19 | 19 | if(\is_array($value)){ |
20 | 20 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
21 | 21 | $item->addIcon($value[1]); |
22 | - }else |
|
23 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
22 | + } else { |
|
23 | + $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
24 | + } |
|
24 | 25 | return $item; |
25 | 26 | } |
26 | 27 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $itemO=$item; |
35 | 35 | if(\is_object($item)===false){ |
36 | 36 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
37 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
37 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
38 | 38 | $this->addToProperty("class", "vertical"); |
39 | 39 | } |
40 | 40 | $this->items[]=$itemO; |
@@ -42,8 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | public function addInput($name){ |
45 | - if(!isset($name)) |
|
46 | - $name="input-".$this->identifier; |
|
45 | + if(!isset($name)) { |
|
46 | + $name="input-".$this->identifier; |
|
47 | + } |
|
47 | 48 | $this->setAction("activate"); |
48 | 49 | $this->input=new HtmlInput($name,"hidden"); |
49 | 50 | } |
@@ -53,7 +54,7 @@ discard block |
||
53 | 54 | foreach ($items as $k=>$v){ |
54 | 55 | $this->addItem($v)->setData($k); |
55 | 56 | } |
56 | - }else{ |
|
57 | + } else{ |
|
57 | 58 | foreach ($items as $item){ |
58 | 59 | $this->addItem($item); |
59 | 60 | } |
@@ -67,7 +68,7 @@ discard block |
||
67 | 68 | if($dropdown===false){ |
68 | 69 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
69 | 70 | $dropdown="menu"; |
70 | - }else{ |
|
71 | + } else{ |
|
71 | 72 | $dropdown="dropdown"; |
72 | 73 | $this->mClass="menu"; |
73 | 74 | } |
@@ -83,18 +84,22 @@ discard block |
||
83 | 84 | } |
84 | 85 | |
85 | 86 | public function asButton($floating=false){ |
86 | - if($floating) |
|
87 | - $this->addToProperty("class", "floating"); |
|
87 | + if($floating) { |
|
88 | + $this->addToProperty("class", "floating"); |
|
89 | + } |
|
88 | 90 | return $this->addToProperty("class", "button"); |
89 | 91 | } |
90 | 92 | |
91 | 93 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
92 | - if(isset($name)) |
|
93 | - $this->addInput($name); |
|
94 | - if($multiple) |
|
95 | - $this->addToProperty("class", "multiple"); |
|
96 | - if ($selection) |
|
97 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
94 | + if(isset($name)) { |
|
95 | + $this->addInput($name); |
|
96 | + } |
|
97 | + if($multiple) { |
|
98 | + $this->addToProperty("class", "multiple"); |
|
99 | + } |
|
100 | + if ($selection) { |
|
101 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
102 | + } |
|
98 | 103 | return $this; |
99 | 104 | } |
100 | 105 | |
@@ -104,8 +109,9 @@ discard block |
||
104 | 109 | } |
105 | 110 | |
106 | 111 | public function setSelect($name=NULL,$multiple=false){ |
107 | - if(!isset($name)) |
|
108 | - $name="select-".$this->identifier; |
|
112 | + if(!isset($name)) { |
|
113 | + $name="select-".$this->identifier; |
|
114 | + } |
|
109 | 115 | $this->input=null; |
110 | 116 | if($multiple){ |
111 | 117 | $this->setProperty("multiple", true); |
@@ -136,12 +142,13 @@ discard block |
||
136 | 142 | public function setValue($value){ |
137 | 143 | if(isset($this->input)){ |
138 | 144 | $this->input->setProperty("value", $value); |
139 | - }else{ |
|
145 | + } else{ |
|
140 | 146 | $this->setProperty("value", $value); |
141 | 147 | } |
142 | 148 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
143 | - if(isset($textElement)) |
|
144 | - $textElement->setContent($value); |
|
149 | + if(isset($textElement)) { |
|
150 | + $textElement->setContent($value); |
|
151 | + } |
|
145 | 152 | return $this; |
146 | 153 | } |
147 | 154 | |
@@ -151,8 +158,9 @@ discard block |
||
151 | 158 | */ |
152 | 159 | public function run(JsUtils $js) { |
153 | 160 | if($this->propertyContains("class", "simple")===false){ |
154 | - if(isset($this->_bsComponent)===false) |
|
155 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
161 | + if(isset($this->_bsComponent)===false) { |
|
162 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
163 | + } |
|
156 | 164 | $this->addEventsOnRun($js); |
157 | 165 | return $this->_bsComponent; |
158 | 166 | } |
@@ -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 |