Completed
Push — master ( aa1d0c...064b6c )
by Jean-Christophe
04:19
created
Ajax/php/micro/JsUtils.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,34 +4,34 @@
 block discarded – undo
4 4
 
5 5
 use micro\controllers\Startup;
6 6
 use micro\utils\RequestUtils;
7
-class JsUtils extends \Ajax\JsUtils{
7
+class JsUtils extends \Ajax\JsUtils {
8 8
 
9
-	public function getUrl($url){
9
+	public function getUrl($url) {
10 10
 		return RequestUtils::getUrl($url);
11 11
 	}
12 12
 
13
-	public function addViewElement($identifier,$content,&$view){
13
+	public function addViewElement($identifier, $content, &$view) {
14 14
 		$controls=$view->getVar("q");
15
-		if (isset($controls) === false) {
16
-			$controls=array ();
15
+		if (isset($controls)===false) {
16
+			$controls=array();
17 17
 		}
18 18
 		$controls[$identifier]=$content;
19 19
 		$view->setVar("q", $controls);
20 20
 	}
21 21
 
22
-	public function createScriptVariable(&$view,$view_var, $output){
23
-		$view->setVar($view_var,$output);
22
+	public function createScriptVariable(&$view, $view_var, $output) {
23
+		$view->setVar($view_var, $output);
24 24
 	}
25 25
 
26
-	public function forward($initialController,$controller,$action,$params=array()){
27
-		return $initialController->forward($controller,$action,$params,true,true,true);
26
+	public function forward($initialController, $controller, $action, $params=array()) {
27
+		return $initialController->forward($controller, $action, $params, true, true, true);
28 28
 	}
29 29
 
30
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
31
-		return $initialControllerInstance->loadView($viewName,$params,true);
30
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
31
+		return $initialControllerInstance->loadView($viewName, $params, true);
32 32
 	}
33 33
 
34
-	public function fromDispatcher($dispatcher){
34
+	public function fromDispatcher($dispatcher) {
35 35
 		return Startup::$urlParts;
36 36
 	}
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlStepItem.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,52 +8,52 @@
 block discarded – undo
8 8
 class HtmlStepItem extends HtmlAbsractItem {
9 9
 
10 10
 	public function __construct($identifier, $content) {
11
-		parent::__construct($identifier,"step",$content);
11
+		parent::__construct($identifier, "step", $content);
12 12
 	}
13
-	protected function initContent($content){
14
-		if(\is_array($content)){
15
-			if(JArray::isAssociative($content)===false){
13
+	protected function initContent($content) {
14
+		if (\is_array($content)) {
15
+			if (JArray::isAssociative($content)===false) {
16 16
 				$icon=@$content[0];
17 17
 				$title=@$content[1];
18 18
 				$desc=@$content[2];
19 19
 				$status=@$content[3];
20
-			}else{
20
+			} else {
21 21
 				$icon=@$content["icon"];
22 22
 				$title=@$content["title"];
23 23
 				$desc=@$content["description"];
24 24
 				$status=@$content["status"];
25 25
 			}
26
-			if(isset($icon)===true){
26
+			if (isset($icon)===true) {
27 27
 				$this->setIcon($icon);
28 28
 			}
29
-			if(isset($status)===true){
29
+			if (isset($status)===true) {
30 30
 				$this->setStatus($status);
31 31
 			}
32
-			if(isset($title)===true){
33
-				$this->setTitle($title,$desc);
32
+			if (isset($title)===true) {
33
+				$this->setTitle($title, $desc);
34 34
 			}
35
-		}else{
35
+		} else {
36 36
 			$this->setContent($content);
37 37
 		}
38 38
 	}
39 39
 
40
-	public function setActive($value=true){
41
-		if($value)
40
+	public function setActive($value=true) {
41
+		if ($value)
42 42
 			$this->setStatus(StepStatus::ACTIVE);
43 43
 		else
44 44
 			$this->setStatus(StepStatus::NONE);
45 45
 		return $this;
46 46
 	}
47 47
 
48
-	public function setCompleted(){
48
+	public function setCompleted() {
49 49
 		return $this->setStatus(StepStatus::COMPLETED);
50 50
 	}
51 51
 
52
-	public function setStatus($status){
52
+	public function setStatus($status) {
53 53
 		return $this->addToPropertyCtrl("class", $status, StepStatus::getConstants());
54 54
 	}
55 55
 
56
-	public function removeStatus(){
56
+	public function removeStatus() {
57 57
 		$this->removePropertyValues("class", StepStatus::getConstants());
58 58
 	}
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 				$title=@$content[1];
18 18
 				$desc=@$content[2];
19 19
 				$status=@$content[3];
20
-			}else{
20
+			} else{
21 21
 				$icon=@$content["icon"];
22 22
 				$title=@$content["title"];
23 23
 				$desc=@$content["description"];
@@ -32,16 +32,17 @@  discard block
 block discarded – undo
32 32
 			if(isset($title)===true){
33 33
 				$this->setTitle($title,$desc);
34 34
 			}
35
-		}else{
35
+		} else{
36 36
 			$this->setContent($content);
37 37
 		}
38 38
 	}
39 39
 
40 40
 	public function setActive($value=true){
41
-		if($value)
42
-			$this->setStatus(StepStatus::ACTIVE);
43
-		else
44
-			$this->setStatus(StepStatus::NONE);
41
+		if($value) {
42
+					$this->setStatus(StepStatus::ACTIVE);
43
+		} else {
44
+					$this->setStatus(StepStatus::NONE);
45
+		}
45 46
 		return $this;
46 47
 	}
47 48
 
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlTab.php 2 patches
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
  * @author jc
15 15
  * @version 1.001
16 16
  */
17
-class HtmlTab extends HtmlSemCollection{
17
+class HtmlTab extends HtmlSemCollection {
18 18
 
19 19
 	protected $params=array("debug"=>true);
20 20
 
21
-	public function __construct( $identifier, $tabs=array()){
22
-		parent::__construct( $identifier, "div", "");
21
+	public function __construct($identifier, $tabs=array()) {
22
+		parent::__construct($identifier, "div", "");
23 23
 		$menu=new HtmlMenu("menu".$this->identifier);
24
-		$menu->asTab(false)->setAttachment(NULL,Side::TOP);
24
+		$menu->asTab(false)->setAttachment(NULL, Side::TOP);
25 25
 		$this->content["menu"]=$menu;
26 26
 		$this->addItems($tabs);
27 27
 	}
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
32 32
 	 * @return HtmlSegment
33 33
 	 */
34
-	protected function createItem($value){
34
+	protected function createItem($value) {
35 35
 		$count=$this->count();
36 36
 		$title=$value;
37 37
 		$content=NULL;
38
-		if(\is_array($value)){
39
-			$title=@$value[0];$content=@$value[1];
38
+		if (\is_array($value)) {
39
+			$title=@$value[0]; $content=@$value[1];
40 40
 		}
41 41
 		$menuItem=$this->content["menu"]->addItem($title);
42 42
 		$menuItem->addToProperty("data-tab", $menuItem->getIdentifier());
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 * @param string $datatab
51 51
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
52 52
 	 */
53
-	private function createSegment($count,$content,$datatab){
53
+	private function createSegment($count, $content, $datatab) {
54 54
 		$segment=new HtmlSegment("item-".$this->identifier."-".$count, $content);
55
-		$segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab);
55
+		$segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab);
56 56
 		return $segment;
57 57
 	}
58 58
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 	 * @param String $content new content
63 63
 	 * @return \Ajax\semantic\html\modules\HtmlTab
64 64
 	 */
65
-	public function setTabContent($index,$content){
65
+	public function setTabContent($index, $content) {
66 66
 		$menu=$this->content["menu"];
67
-		if($index<$menu->count()){
68
-			if(isset($this->content[$index])===false){
67
+		if ($index<$menu->count()) {
68
+			if (isset($this->content[$index])===false) {
69 69
 				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier());
70
-			}else
70
+			} else
71 71
 				$this->content[$index]->setContent($content);
72 72
 		}
73 73
 		return $this;
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @param array $contents
79 79
 	 * @return \Ajax\semantic\html\modules\HtmlTab
80 80
 	 */
81
-	public function setTabsContent($contents){
82
-		for($i=0;$i<\sizeof($contents);$i++){
81
+	public function setTabsContent($contents) {
82
+		for ($i=0; $i<\sizeof($contents); $i++) {
83 83
 			$this->setTabContent($i, $contents[$i]);
84 84
 		}
85 85
 		return $this;
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param int $index
91 91
 	 * @return \Ajax\semantic\html\modules\HtmlTab
92 92
 	 */
93
-	public function activate($index){
93
+	public function activate($index) {
94 94
 		$this->content["menu"]->getItem($index)->setActive(true);
95 95
 		$this->content[$index]->setActive(true);
96 96
 		return $this;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 	 * @param string $content
103 103
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
104 104
 	 */
105
-	public function addTab($title,$content){
106
-		return $this->addItem([$title,$content]);
105
+	public function addTab($title, $content) {
106
+		return $this->addItem([$title, $content]);
107 107
 	}
108 108
 
109 109
 	/**
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 	 * @param array $params
118 118
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
119 119
 	 */
120
-	public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
121
-		if(\array_key_exists($index, $this->content)){
122
-			$this->content[$index]=$js->forward($initialController, $controller, $action,$params);
120
+	public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
121
+		if (\array_key_exists($index, $this->content)) {
122
+			$this->content[$index]=$js->forward($initialController, $controller, $action, $params);
123 123
 			return $this->content[$index];
124 124
 		}
125 125
 
126
-		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params);
126
+		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params);
127 127
 	}
128 128
 
129 129
 	/**
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	 * @param $params The parameters to pass to the view
137 137
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
138 138
 	 */
139
-	public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) {
140
-		if(\array_key_exists($index, $this->content)){
141
-			$this->content[$index]=$js->renderContent($initialController, $viewName,$params);
139
+	public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) {
140
+		if (\array_key_exists($index, $this->content)) {
141
+			$this->content[$index]=$js->renderContent($initialController, $viewName, $params);
142 142
 			return $this->content[$index];
143 143
 		}
144
-		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params);
144
+		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params);
145 145
 	}
146 146
 
147 147
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param array $params
156 156
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
157 157
 	 */
158
-	public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
159
-		return $this->addTab($title, $js->forward($initialController, $controller, $action,$params));
158
+	public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
159
+		return $this->addTab($title, $js->forward($initialController, $controller, $action, $params));
160 160
 	}
161 161
 
162 162
 	/**
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @param $params The parameters to pass to the view
169 169
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
170 170
 	 */
171
-	public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
172
-		return $this->addTab($title, $js->renderContent($initialController, $viewName,$params));
171
+	public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
172
+		return $this->addTab($title, $js->renderContent($initialController, $viewName, $params));
173 173
 	}
174 174
 
175 175
 	public function setPointing($value=Direction::NONE) {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @param int $index
186 186
 	 * @return Ajax\semantic\html\content\HtmlMenuItem
187 187
 	 */
188
-	public function getMenuTab($index){
188
+	public function getMenuTab($index) {
189 189
 		return $this->content["menu"]->getItem($index);
190 190
 	}
191 191
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 * @param int $index
195 195
 	 * @return HtmlSegment
196 196
 	 */
197
-	public function getTab($index){
197
+	public function getTab($index) {
198 198
 		return $this->content[$index];
199 199
 	}
200 200
 
@@ -203,20 +203,20 @@  discard block
 block discarded – undo
203 203
 	 * @param HtmlMenu $menu
204 204
 	 * @return \Ajax\semantic\html\modules\HtmlTab
205 205
 	 */
206
-	public function setMenu($menu){
207
-		for($i=0;$i<\sizeof($this->content);$i++){
208
-			if($menu->getItem($i)!==NULL){
209
-				if(isset($this->content[$i])===true){
210
-					$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
206
+	public function setMenu($menu) {
207
+		for ($i=0; $i<\sizeof($this->content); $i++) {
208
+			if ($menu->getItem($i)!==NULL) {
209
+				if (isset($this->content[$i])===true) {
210
+					$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
211 211
 				}
212 212
 			}
213 213
 		}
214
-		for($i=0;$i<$menu->count();$i++){
214
+		for ($i=0; $i<$menu->count(); $i++) {
215 215
 			$menu->getItem($i)->removeProperty("href");
216
-			if(isset($this->content[$i])===false){
216
+			if (isset($this->content[$i])===false) {
217 217
 				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier());
218 218
 			}
219
-			$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
219
+			$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
220 220
 		}
221 221
 
222 222
 		$this->content["menu"]=$menu;
@@ -228,15 +228,15 @@  discard block
 block discarded – undo
228 228
 	 * @see BaseHtml::run()
229 229
 	 */
230 230
 	public function run(JsUtils $js) {
231
-		if(isset($this->_bsComponent)===false)
232
-			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
231
+		if (isset($this->_bsComponent)===false)
232
+			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params);
233 233
 			$this->addEventsOnRun($js);
234 234
 			return $this->_bsComponent;
235 235
 	}
236 236
 
237 237
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
238
-		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
238
+		if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
239 239
 			$this->activate(0);
240
-		return parent::compile($js,$view);
240
+		return parent::compile($js, $view);
241 241
 	}
242 242
 }
243 243
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,8 +67,9 @@  discard block
 block discarded – undo
67 67
 		if($index<$menu->count()){
68 68
 			if(isset($this->content[$index])===false){
69 69
 				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier());
70
-			}else
71
-				$this->content[$index]->setContent($content);
70
+			} else {
71
+							$this->content[$index]->setContent($content);
72
+			}
72 73
 		}
73 74
 		return $this;
74 75
 	}
@@ -228,15 +229,17 @@  discard block
 block discarded – undo
228 229
 	 * @see BaseHtml::run()
229 230
 	 */
230 231
 	public function run(JsUtils $js) {
231
-		if(isset($this->_bsComponent)===false)
232
-			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
232
+		if(isset($this->_bsComponent)===false) {
233
+					$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
234
+		}
233 235
 			$this->addEventsOnRun($js);
234 236
 			return $this->_bsComponent;
235 237
 	}
236 238
 
237 239
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
238
-		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
239
-			$this->activate(0);
240
+		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1) {
241
+					$this->activate(0);
242
+		}
240 243
 		return parent::compile($js,$view);
241 244
 	}
242 245
 }
243 246
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/MenuItemTrait.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	/**
26 26
 	 * @param string $placeholder
27 27
 	 * @param string $icon
28
-	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
28
+	 * @return MenuItemTrait
29 29
 	 */
30 30
 	public function asSearchInput($placeholder=NULL,$icon=NULL){
31 31
 		$this->setClass("ui icon search input");
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	}
40 40
 
41 41
 	/**
42
-	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
42
+	 * @return MenuItemTrait
43 43
 	 */
44 44
 	public function asDivider(){
45 45
 		$this->content=NULL;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * @param string $caption
53 53
 	 * @param string $icon
54
-	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
54
+	 * @return MenuItemTrait
55 55
 	 */
56 56
 	public function asHeader($caption=NULL,$icon=NULL){
57 57
 		$this->setClass("header");
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@  discard block
 block discarded – undo
8 8
 
9 9
 trait MenuItemTrait {
10 10
 
11
-	public function setContent($content){
12
-		if($content==="-"){
11
+	public function setContent($content) {
12
+		if ($content==="-") {
13 13
 			$this->asDivider();
14
-		}elseif($content==="-search-"){
15
-			$values=\explode(",",$content,-1);
16
-			$this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search"));
17
-		}elseif(JString::startswith($content, "-")){
18
-			$content=\ltrim($content,"-");
14
+		}elseif ($content==="-search-") {
15
+			$values=\explode(",", $content, -1);
16
+			$this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search"));
17
+		}elseif (JString::startswith($content, "-")) {
18
+			$content=\ltrim($content, "-");
19 19
 			$this->asHeader($content);
20
-		}else
20
+		} else
21 21
 			parent::setContent($content);
22 22
 		return $this;
23 23
 	}
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	 * @param string $icon
28 28
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
29 29
 	 */
30
-	public function asSearchInput($placeholder=NULL,$icon=NULL){
30
+	public function asSearchInput($placeholder=NULL, $icon=NULL) {
31 31
 		$this->setClass("ui icon search input");
32 32
 		$input=new HtmlInput("search-".$this->identifier);
33
-		if(isset($placeholder))
33
+		if (isset($placeholder))
34 34
 			$input->setProperty("placeholder", $placeholder);
35 35
 			$this->content=$input;
36
-			if(isset($icon))
36
+			if (isset($icon))
37 37
 				$this->addIcon($icon);
38 38
 				return $this;
39 39
 	}
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	/**
42 42
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
43 43
 	 */
44
-	public function asDivider(){
44
+	public function asDivider() {
45 45
 		$this->content=NULL;
46 46
 		$this->tagName="div";
47 47
 		$this->setClass("divider");
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 	 * @param string $icon
54 54
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem
55 55
 	 */
56
-	public function asHeader($caption=NULL,$icon=NULL){
56
+	public function asHeader($caption=NULL, $icon=NULL) {
57 57
 		$this->setClass("header");
58 58
 		$this->tagName="div";
59 59
 		$this->content=$caption;
60
-		if(isset($icon))
61
-			$this->addIcon($icon,Direction::LEFT);
60
+		if (isset($icon))
61
+			$this->addIcon($icon, Direction::LEFT);
62 62
 			return $this;
63 63
 	}
64 64
 
65
-	public function setPosition($direction){
66
-		$this->addToProperty("class",$direction);
65
+	public function setPosition($direction) {
66
+		$this->addToProperty("class", $direction);
67 67
 	}
68 68
 }
69 69
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,14 +11,15 @@  discard block
 block discarded – undo
11 11
 	public function setContent($content){
12 12
 		if($content==="-"){
13 13
 			$this->asDivider();
14
-		}elseif($content==="-search-"){
14
+		} elseif($content==="-search-"){
15 15
 			$values=\explode(",",$content,-1);
16 16
 			$this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search"));
17
-		}elseif(JString::startswith($content, "-")){
17
+		} elseif(JString::startswith($content, "-")){
18 18
 			$content=\ltrim($content,"-");
19 19
 			$this->asHeader($content);
20
-		}else
21
-			parent::setContent($content);
20
+		} else {
21
+					parent::setContent($content);
22
+		}
22 23
 		return $this;
23 24
 	}
24 25
 
@@ -30,11 +31,13 @@  discard block
 block discarded – undo
30 31
 	public function asSearchInput($placeholder=NULL,$icon=NULL){
31 32
 		$this->setClass("ui icon search input");
32 33
 		$input=new HtmlInput("search-".$this->identifier);
33
-		if(isset($placeholder))
34
-			$input->setProperty("placeholder", $placeholder);
34
+		if(isset($placeholder)) {
35
+					$input->setProperty("placeholder", $placeholder);
36
+		}
35 37
 			$this->content=$input;
36
-			if(isset($icon))
37
-				$this->addIcon($icon);
38
+			if(isset($icon)) {
39
+							$this->addIcon($icon);
40
+			}
38 41
 				return $this;
39 42
 	}
40 43
 
@@ -57,8 +60,9 @@  discard block
 block discarded – undo
57 60
 		$this->setClass("header");
58 61
 		$this->tagName="div";
59 62
 		$this->content=$caption;
60
-		if(isset($icon))
61
-			$this->addIcon($icon,Direction::LEFT);
63
+		if(isset($icon)) {
64
+					$this->addIcon($icon,Direction::LEFT);
65
+		}
62 66
 			return $this;
63 67
 	}
64 68
 
Please login to merge, or discard this patch.
Ajax/semantic/html/content/InternalPopup.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -12,6 +12,10 @@  discard block
 block discarded – undo
12 12
 	protected $variation;
13 13
 	protected $params;
14 14
 	protected $semElement;
15
+
16
+	/**
17
+	 * @param HtmlSemDoubleElement $semElement
18
+	 */
15 19
 	public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){
16 20
 		$this->semElement=$semElement;
17 21
 		$this->title=$title;
@@ -19,6 +23,9 @@  discard block
 block discarded – undo
19 23
 		$this->setAttributes($variation,$params);
20 24
 	}
21 25
 
26
+	/**
27
+	 * @param string $html
28
+	 */
22 29
 	public function setHtml($html) {
23 30
 		$this->html= $html;
24 31
 		return $this;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,58 +12,58 @@
 block discarded – undo
12 12
 	protected $variation;
13 13
 	protected $params;
14 14
 	protected $semElement;
15
-	public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){
15
+	public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) {
16 16
 		$this->semElement=$semElement;
17 17
 		$this->title=$title;
18 18
 		$this->content=$content;
19
-		$this->setAttributes($variation,$params);
19
+		$this->setAttributes($variation, $params);
20 20
 	}
21 21
 
22 22
 	public function setHtml($html) {
23
-		$this->html= $html;
23
+		$this->html=$html;
24 24
 		return $this;
25 25
 	}
26 26
 
27
-	public function setAttributes($variation=NULL,$params=array()){
27
+	public function setAttributes($variation=NULL, $params=array()) {
28 28
 		$this->variation=$variation;
29 29
 		$this->params=$params;
30 30
 	}
31 31
 
32
-	public function onShow($jsCode){
32
+	public function onShow($jsCode) {
33 33
 		$this->params["onShow"]=$jsCode;
34 34
 	}
35 35
 
36
-	public function compile(JsUtils $js=NULL){
37
-		if(JString::isNotNull($this->title)){
36
+	public function compile(JsUtils $js=NULL) {
37
+		if (JString::isNotNull($this->title)) {
38 38
 			$this->semElement->addToProperty("data-title", $this->title);
39 39
 		}
40
-		if(JString::isNotNull($this->content)){
40
+		if (JString::isNotNull($this->content)) {
41 41
 			$this->semElement->addToProperty("data-content", $this->content);
42 42
 		}
43
-		if(JString::isNotNull($this->html)){
43
+		if (JString::isNotNull($this->html)) {
44 44
 			$html=$this->html;
45
-			if(\is_array($html)){
45
+			if (\is_array($html)) {
46 46
 				\array_walk($html, function(&$item) use($js){
47
-					if($item instanceof HtmlSemDoubleElement){
47
+					if ($item instanceof HtmlSemDoubleElement) {
48 48
 						$comp=$item->compile($js);
49 49
 						$bs=$item->run($js);
50
-						if(isset($bs))
50
+						if (isset($bs))
51 51
 							$this->params['onShow']=$bs->getScript();
52 52
 						$item=$comp;
53 53
 					}
54 54
 				});
55
-				$html=\implode("",$html);
55
+				$html=\implode("", $html);
56 56
 			}
57 57
 			$html=\str_replace("\"", "'", $html);
58 58
 			$this->semElement->addToProperty("data-html", $html);
59 59
 		}
60
-		if(JString::isNotNull($this->variation)){
60
+		if (JString::isNotNull($this->variation)) {
61 61
 			$this->semElement->addToProperty("data-variation", $this->variation);
62 62
 		}
63 63
 	}
64 64
 
65
-	public function run(JsUtils $js){
66
-		$js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params);
65
+	public function run(JsUtils $js) {
66
+		$js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params);
67 67
 	}
68 68
 
69 69
 }
70 70
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,8 +47,9 @@
 block discarded – undo
47 47
 					if($item instanceof HtmlSemDoubleElement){
48 48
 						$comp=$item->compile($js);
49 49
 						$bs=$item->run($js);
50
-						if(isset($bs))
51
-							$this->params['onShow']=$bs->getScript();
50
+						if(isset($bs)) {
51
+													$this->params['onShow']=$bs->getScript();
52
+						}
52 53
 						$item=$comp;
53 54
 					}
54 55
 				});
Please login to merge, or discard this patch.
Ajax/semantic/components/Popup.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 * @return $this
28 28
 	 */
29 29
 	public function setOnShow($jsCode) {
30
-		$jsCode=str_ireplace("\"","%quote%", $jsCode);
30
+		$jsCode=str_ireplace("\"", "%quote%", $jsCode);
31 31
 		return $this->setParam("onShow", "%function(){".$jsCode."}%");
32 32
 	}
33 33
 
34
-	public function setExclusive($value){
34
+	public function setExclusive($value) {
35 35
 		return $this->setParam("exclusive", $value);
36 36
 	}
37 37
 
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	 * @param string $popup the css selector of the popup
41 41
 	 * @return \Ajax\semantic\components\Popup
42 42
 	 */
43
-	public function setPopup($popup){
43
+	public function setPopup($popup) {
44 44
 		return $this->setParam("popup", $popup);
45 45
 	}
46 46
 
47
-	public function setInline($value){
47
+	public function setInline($value) {
48 48
 		return $this->setParam("inline", $value);
49 49
 	}
50 50
 
51
-	public function setPosition($value){
51
+	public function setPosition($value) {
52 52
 		return $this->setParam("position", $value);
53 53
 	}
54 54
 	//TODO other events implementation
Please login to merge, or discard this patch.
Ajax/semantic/html/base/HtmlSemDoubleElement.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	public function setPopupAttributes($variation=NULL, $popupEvent=NULL) {
35
-		if (isset($this->_popup))
36
-			$this->_popup->setAttributes($variation, $popupEvent);
35
+		if (isset($this->_popup)) {
36
+					$this->_popup->setAttributes($variation, $popupEvent);
37
+		}
37 38
 	}
38 39
 
39 40
 	public function addPopup($title="", $content="", $variation=NULL, $params=array()) {
@@ -60,8 +61,9 @@  discard block
 block discarded – undo
60 61
 		$labelO=$label;
61 62
 		if (\is_object($label) === false) {
62 63
 			$labelO=new HtmlLabel("label-" . $this->identifier, $label);
63
-			if (isset($icon))
64
-				$labelO->addIcon($icon);
64
+			if (isset($icon)) {
65
+							$labelO->addIcon($icon);
66
+			}
65 67
 		} else {
66 68
 			$labelO->addToPropertyCtrl("class", "label", array ("label" ));
67 69
 		}
@@ -80,21 +82,24 @@  discard block
 block discarded – undo
80 82
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
81 83
 	 */
82 84
 	public function asLink($href=NULL) {
83
-		if (isset($href))
84
-			$this->setProperty("href", $href);
85
+		if (isset($href)) {
86
+					$this->setProperty("href", $href);
87
+		}
85 88
 		return $this->setTagName("a");
86 89
 	}
87 90
 
88 91
 	public function jsShowDimmer($show=true) {
89 92
 		$status="hide";
90
-		if ($show === true)
91
-			$status="show";
93
+		if ($show === true) {
94
+					$status="show";
95
+		}
92 96
 		return '$("#.' . $this->identifier . ').dimmer("' . $status . '");';
93 97
 	}
94 98
 
95 99
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
96
-	if (isset($this->_popup))
97
-			$this->_popup->compile($js);
100
+	if (isset($this->_popup)) {
101
+				$this->_popup->compile($js);
102
+	}
98 103
 		return parent::compile($js, $view);
99 104
 	}
100 105
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	use BaseTrait;
22 22
 	protected $_popup=NULL;
23 23
 	protected $_dimmer=NULL;
24
-	protected $_params=array ();
24
+	protected $_params=array();
25 25
 
26 26
 
27 27
 	public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	}
52 52
 
53 53
 	public function addDimmer($params=array(), $content=NULL) {
54
-		$dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content);
54
+		$dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content);
55 55
 		$dimmer->setParams($params);
56 56
 		$dimmer->setContainer($this);
57 57
 		$this->addContent($dimmer);
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 
61 61
 	public function addLabel($label, $before=false, $icon=NULL) {
62 62
 		$labelO=$label;
63
-		if (\is_object($label) === false) {
64
-			$labelO=new HtmlLabel("label-" . $this->identifier, $label);
63
+		if (\is_object($label)===false) {
64
+			$labelO=new HtmlLabel("label-".$this->identifier, $label);
65 65
 			if (isset($icon))
66 66
 				$labelO->addIcon($icon);
67 67
 		} else {
68
-			$labelO->addToPropertyCtrl("class", "label", array ("label" ));
68
+			$labelO->addToPropertyCtrl("class", "label", array("label"));
69 69
 		}
70 70
 		$this->addContent($labelO, $before);
71 71
 		return $labelO;
72 72
 	}
73 73
 
74
-	public function attachLabel($label,$side,$direction=Direction::NONE,$icon=NULL){
75
-		$label=$this->addLabel($label,true,$icon);
76
-		$label->setAttached($side,$direction);
74
+	public function attachLabel($label, $side, $direction=Direction::NONE, $icon=NULL) {
75
+		$label=$this->addLabel($label, true, $icon);
76
+		$label->setAttached($side, $direction);
77 77
 		return $this;
78 78
 	}
79 79
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
 	public function jsShowDimmer($show=true) {
91 91
 		$status="hide";
92
-		if ($show === true)
92
+		if ($show===true)
93 93
 			$status="show";
94
-		return '$("#.' . $this->identifier . ').dimmer("' . $status . '");';
94
+		return '$("#.'.$this->identifier.').dimmer("'.$status.'");';
95 95
 	}
96 96
 
97 97
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 
103 103
 	public function run(JsUtils $js) {
104
-		$this->_bsComponent=$js->semantic()->generic("#" . $this->identifier);
104
+		$this->_bsComponent=$js->semantic()->generic("#".$this->identifier);
105 105
 		parent::run($js);
106 106
 		$this->addEventsOnRun($js);
107 107
 		if (isset($this->_popup)) {
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 3 patches
Braces   +28 added lines, -20 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		}
72 72
 		if(!$item instanceof HtmlDropdownItem){
73 73
 			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
74
-		}elseif($itemO instanceof HtmlDropdownItem){
74
+		} elseif($itemO instanceof HtmlDropdownItem){
75 75
 			$this->addToProperty("class", "vertical");
76 76
 		}
77 77
 		return $itemO;
@@ -85,8 +85,9 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 
87 87
 	public function addInput($name){
88
-		if(!isset($name))
89
-			$name="input-".$this->identifier;
88
+		if(!isset($name)) {
89
+					$name="input-".$this->identifier;
90
+		}
90 91
 		$this->setAction("activate");
91 92
 		$this->input=new HtmlInput($name,"hidden");
92 93
 	}
@@ -143,7 +144,7 @@  discard block
 block discarded – undo
143 144
 			foreach ($items as $k=>$v){
144 145
 				$this->addItem($v)->setData($k);
145 146
 			}
146
-		}else{
147
+		} else{
147 148
 			foreach ($items as $item){
148 149
 				$this->addItem($item);
149 150
 			}
@@ -167,7 +168,7 @@  discard block
 block discarded – undo
167 168
 		if($dropdown===false){
168 169
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
169 170
 			$dropdown="menu";
170
-		}else{
171
+		} else{
171 172
 			$dropdown="dropdown";
172 173
 			$this->mClass="menu";
173 174
 		}
@@ -187,20 +188,24 @@  discard block
 block discarded – undo
187 188
 	}
188 189
 
189 190
 	public function asButton($floating=false){
190
-		if($floating)
191
-			$this->addToProperty("class", "floating");
191
+		if($floating) {
192
+					$this->addToProperty("class", "floating");
193
+		}
192 194
 		$this->removePropertyValue("class", "selection");
193 195
 		return $this->addToProperty("class", "button");
194 196
 	}
195 197
 
196 198
 	public function asSelect($name=NULL,$multiple=false,$selection=true){
197
-		if(isset($name))
198
-			$this->addInput($name);
199
-		if($multiple)
200
-			$this->addToProperty("class", "multiple");
199
+		if(isset($name)) {
200
+					$this->addInput($name);
201
+		}
202
+		if($multiple) {
203
+					$this->addToProperty("class", "multiple");
204
+		}
201 205
 		if ($selection){
202
-			if($this->propertyContains("class", "button")===false)
203
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
206
+			if($this->propertyContains("class", "button")===false) {
207
+							$this->addToPropertyCtrl("class", "selection",array("selection"));
208
+			}
204 209
 		}
205 210
 		return $this;
206 211
 	}
@@ -211,8 +216,9 @@  discard block
 block discarded – undo
211 216
 	}
212 217
 
213 218
 	public function setSelect($name=NULL,$multiple=false){
214
-		if(!isset($name))
215
-			$name="select-".$this->identifier;
219
+		if(!isset($name)) {
220
+					$name="select-".$this->identifier;
221
+		}
216 222
 		$this->input=null;
217 223
 		if($multiple){
218 224
 			$this->setProperty("multiple", true);
@@ -248,12 +254,13 @@  discard block
 block discarded – undo
248 254
 		$value=$this->value;
249 255
 		if(isset($this->input) && isset($value)){
250 256
 			$this->input->setProperty("value", $value);
251
-		}else{
257
+		} else{
252 258
 			$this->setProperty("value", $value);
253 259
 		}
254 260
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
255
-			if(isset($textElement))
256
-				$textElement->setContent($value);
261
+			if(isset($textElement)) {
262
+							$textElement->setContent($value);
263
+			}
257 264
 		return $this;
258 265
 	}
259 266
 
@@ -263,8 +270,9 @@  discard block
 block discarded – undo
263 270
 	 */
264 271
 	public function run(JsUtils $js) {
265 272
 		if($this->propertyContains("class", "simple")===false){
266
-			if(isset($this->_bsComponent)===false)
267
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
273
+			if(isset($this->_bsComponent)===false) {
274
+							$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
275
+			}
268 276
 			$this->addEventsOnRun($js);
269 277
 			return $this->_bsComponent;
270 278
 		}
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	/**
50 50
 	 * Insert an item at a position
51 51
 	 * @param mixed $item
52
-	 * @param number $position
52
+	 * @param integer $position
53 53
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
54 54
 	 */
55 55
 	public function insertItem($item,$position=0){
@@ -240,6 +240,9 @@  discard block
 block discarded – undo
240 240
 		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
241 241
 	}
242 242
 
243
+	/**
244
+	 * @param string $value
245
+	 */
243 246
 	public function setValue($value){
244 247
 		$this->value=$value;
245 248
 		return $this;
@@ -274,6 +277,9 @@  discard block
 block discarded – undo
274 277
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
275 278
 	}
276 279
 
280
+	/**
281
+	 * @param string $action
282
+	 */
277 283
 	public function setAction($action){
278 284
 		$this->_params["action"]=$action;
279 285
 	}
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 use Ajax\semantic\html\collections\form\traits\FieldTrait;
14 14
 
15 15
 class HtmlDropdown extends HtmlSemDoubleElement {
16
-	use FieldTrait,LabeledIconTrait {
16
+	use FieldTrait, LabeledIconTrait {
17 17
 		addIcon as addIconP;
18 18
 	}
19 19
 	protected $mClass="menu";
20 20
 	protected $mTagName="div";
21
-	protected $items=array ();
22
-	protected $_params=array("action"=>"nothing","on"=>"hover");
21
+	protected $items=array();
22
+	protected $_params=array("action"=>"nothing", "on"=>"hover");
23 23
 	protected $input;
24 24
 	protected $value;
25 25
 
@@ -27,27 +27,27 @@  discard block
 block discarded – undo
27 27
 		parent::__construct($identifier, "div");
28 28
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
29 29
 		$this->setProperty("class", "ui dropdown");
30
-		$content=new HtmlSemDoubleElement("text-".$this->identifier,"div");
30
+		$content=new HtmlSemDoubleElement("text-".$this->identifier, "div");
31 31
 		$content->setClass("text");
32 32
 		$this->setValue($value);
33
-		$content->wrap("",new HtmlIcon("", "dropdown"));
33
+		$content->wrap("", new HtmlIcon("", "dropdown"));
34 34
 		$this->content=array($content);
35 35
 		$this->tagName="div";
36 36
 		$this->addItems($items);
37 37
 	}
38 38
 
39
-	public function getField(){
39
+	public function getField() {
40 40
 		return $this->input;
41 41
 	}
42 42
 
43
-	public function addItem($item,$value=NULL,$image=NULL,$description=NULL){
44
-		$itemO=$this->beforeAddItem($item,$value,$image,$description);
43
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
44
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
45 45
 		$this->items[]=$itemO;
46 46
 		return $itemO;
47 47
 	}
48 48
 
49
-	public function addIcon($icon,$before=true,$labeled=false){
50
-		$this->addIconP($icon,$before,$labeled);
49
+	public function addIcon($icon, $before=true, $labeled=false) {
50
+		$this->addIconP($icon, $before, $labeled);
51 51
 		return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter("");
52 52
 	}
53 53
 
@@ -57,26 +57,26 @@  discard block
 block discarded – undo
57 57
 	 * @param number $position
58 58
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
59 59
 	 */
60
-	public function insertItem($item,$position=0){
60
+	public function insertItem($item, $position=0) {
61 61
 		$itemO=$this->beforeAddItem($item);
62
-		 $start = array_slice($this->items, 0, $position);
63
-		 $end = array_slice($this->items, $position);
64
-		 $start[] = $item;
62
+		 $start=array_slice($this->items, 0, $position);
63
+		 $end=array_slice($this->items, $position);
64
+		 $start[]=$item;
65 65
 		 $this->items=array_merge($start, $end);
66 66
 		 return $itemO;
67 67
 	}
68 68
 
69
-	protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){
69
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
70 70
 		$itemO=$item;
71
-		if(\is_array($item)){
71
+		if (\is_array($item)) {
72 72
 			$description=JArray::getValue($item, "description", 3);
73 73
 			$value=JArray::getValue($item, "value", 1);
74 74
 			$image=JArray::getValue($item, "image", 2);
75 75
 			$item=JArray::getValue($item, "item", 0);
76 76
 		}
77
-		if(!$item instanceof HtmlDropdownItem){
78
-			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
79
-		}elseif($itemO instanceof HtmlDropdownItem){
77
+		if (!$item instanceof HtmlDropdownItem) {
78
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
79
+		}elseif ($itemO instanceof HtmlDropdownItem) {
80 80
 			$this->addToProperty("class", "vertical");
81 81
 		}
82 82
 		return $itemO;
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 		$this->addItem($function($object));
90 90
 	}
91 91
 
92
-	public function addInput($name){
93
-		if(!isset($name))
92
+	public function addInput($name) {
93
+		if (!isset($name))
94 94
 			$name="input-".$this->identifier;
95 95
 		$this->setAction("activate");
96
-		$this->input=new HtmlInput($name,"hidden");
96
+		$this->input=new HtmlInput($name, "hidden");
97 97
 	}
98 98
 
99 99
 	/**
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
 	 * @param string $icon
103 103
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
104 104
 	 */
105
-	public function addSearchInputItem($placeHolder=NULL,$icon=NULL){
106
-		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon));
105
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
106
+		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
107 107
 	}
108 108
 
109 109
 	/**
110 110
 	 * Adds a divider item
111 111
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
112 112
 	 */
113
-	public function addDividerItem(){
113
+	public function addDividerItem() {
114 114
 		return $this->addItem(HtmlDropdownItem::divider());
115 115
 	}
116 116
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	 * @param string $icon
121 121
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
122 122
 	 */
123
-	public function addHeaderItem($caption=NULL,$icon=NULL){
124
-		return $this->addItem(HtmlDropdownItem::header($caption,$icon));
123
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
124
+		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 * @param string $color
131 131
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
132 132
 	 */
133
-	public function addCircularLabelItem($caption,$color){
133
+	public function addCircularLabelItem($caption, $color) {
134 134
 		return $this->addItem(HtmlDropdownItem::circular($caption, $color));
135 135
 	}
136 136
 
@@ -139,87 +139,87 @@  discard block
 block discarded – undo
139 139
 	 * @param string $image
140 140
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
141 141
 	 */
142
-	public function addMiniAvatarImageItem($caption,$image){
142
+	public function addMiniAvatarImageItem($caption, $image) {
143 143
 		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
144 144
 	}
145 145
 
146
-	public function addItems($items){
147
-		if(\is_array($items) && JArray::isAssociative($items)){
148
-			foreach ($items as $k=>$v){
146
+	public function addItems($items) {
147
+		if (\is_array($items) && JArray::isAssociative($items)) {
148
+			foreach ($items as $k=>$v) {
149 149
 				$this->addItem($v)->setData($k);
150 150
 			}
151
-		}else{
152
-			foreach ($items as $item){
151
+		} else {
152
+			foreach ($items as $item) {
153 153
 				$this->addItem($item);
154 154
 			}
155 155
 		}
156 156
 	}
157 157
 
158
-	public function getItem($index){
158
+	public function getItem($index) {
159 159
 		return $this->items[$index];
160 160
 	}
161 161
 
162 162
 	/**
163 163
 	 * @return int
164 164
 	 */
165
-	public function count(){
165
+	public function count() {
166 166
 		return \sizeof($this->items);
167 167
 	}
168 168
 	/**
169 169
 	 * @param boolean $dropdown
170 170
 	 */
171
-	public function asDropdown($dropdown){
172
-		if($dropdown===false){
171
+	public function asDropdown($dropdown) {
172
+		if ($dropdown===false) {
173 173
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
174 174
 			$dropdown="menu";
175
-		}else{
175
+		} else {
176 176
 			$dropdown="dropdown";
177 177
 			$this->mClass="menu";
178 178
 		}
179
-		return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown"));
179
+		return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown"));
180 180
 	}
181 181
 
182
-	public function setVertical(){
183
-		return $this->addToPropertyCtrl("class", "vertical",array("vertical"));
182
+	public function setVertical() {
183
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
184 184
 	}
185 185
 
186
-	public function setInline(){
187
-		return $this->addToPropertyCtrl("class", "inline",["inline"]);
186
+	public function setInline() {
187
+		return $this->addToPropertyCtrl("class", "inline", ["inline"]);
188 188
 	}
189 189
 
190
-	public function setSimple(){
191
-		return $this->addToPropertyCtrl("class", "simple",array("simple"));
190
+	public function setSimple() {
191
+		return $this->addToPropertyCtrl("class", "simple", array("simple"));
192 192
 	}
193 193
 
194
-	public function asButton($floating=false){
195
-		if($floating)
194
+	public function asButton($floating=false) {
195
+		if ($floating)
196 196
 			$this->addToProperty("class", "floating");
197 197
 		$this->removePropertyValue("class", "selection");
198 198
 		return $this->addToProperty("class", "button");
199 199
 	}
200 200
 
201
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
202
-		if(isset($name))
201
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
202
+		if (isset($name))
203 203
 			$this->addInput($name);
204
-		if($multiple)
204
+		if ($multiple)
205 205
 			$this->addToProperty("class", "multiple");
206
-		if ($selection){
207
-			if($this->propertyContains("class", "button")===false)
208
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
206
+		if ($selection) {
207
+			if ($this->propertyContains("class", "button")===false)
208
+				$this->addToPropertyCtrl("class", "selection", array("selection"));
209 209
 		}
210 210
 		return $this;
211 211
 	}
212 212
 
213
-	public function asSearch($name=NULL,$multiple=false,$selection=true){
214
-		$this->asSelect($name,$multiple,$selection);
213
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
214
+		$this->asSelect($name, $multiple, $selection);
215 215
 		return $this->addToProperty("class", "search");
216 216
 	}
217 217
 
218
-	public function setSelect($name=NULL,$multiple=false){
219
-		if(!isset($name))
218
+	public function setSelect($name=NULL, $multiple=false) {
219
+		if (!isset($name))
220 220
 			$name="select-".$this->identifier;
221 221
 		$this->input=null;
222
-		if($multiple){
222
+		if ($multiple) {
223 223
 			$this->setProperty("multiple", true);
224 224
 			$this->addToProperty("class", "multiple");
225 225
 		}
@@ -227,37 +227,37 @@  discard block
 block discarded – undo
227 227
 		$this->tagName="select";
228 228
 		$this->setProperty("name", $name);
229 229
 		$this->content=null;
230
-		foreach ($this->items as $item){
230
+		foreach ($this->items as $item) {
231 231
 			$item->asOption();
232 232
 		}
233 233
 		return $this;
234 234
 	}
235 235
 
236
-	public function asSubmenu($pointing=NULL){
236
+	public function asSubmenu($pointing=NULL) {
237 237
 		$this->setClass("ui dropdown link item");
238
-		if(isset($pointing)){
238
+		if (isset($pointing)) {
239 239
 			$this->setPointing($pointing);
240 240
 		}
241 241
 		return $this;
242 242
 	}
243 243
 
244
-	public function setPointing($value=Direction::NONE){
245
-		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
244
+	public function setPointing($value=Direction::NONE) {
245
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
246 246
 	}
247 247
 
248
-	public function setValue($value){
248
+	public function setValue($value) {
249 249
 		$this->value=$value;
250 250
 		return $this;
251 251
 	}
252
-	private function applyValue(){
252
+	private function applyValue() {
253 253
 		$value=$this->value;
254
-		if(isset($this->input) && isset($value)){
254
+		if (isset($this->input) && isset($value)) {
255 255
 			$this->input->setProperty("value", $value);
256
-		}else{
256
+		} else {
257 257
 			$this->setProperty("value", $value);
258 258
 		}
259 259
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
260
-			if(isset($textElement))
260
+			if (isset($textElement))
261 261
 				$textElement->setContent($value);
262 262
 		return $this;
263 263
 	}
@@ -267,29 +267,29 @@  discard block
 block discarded – undo
267 267
 	 * @see BaseHtml::run()
268 268
 	 */
269 269
 	public function run(JsUtils $js) {
270
-		if($this->propertyContains("class", "simple")===false){
271
-			if(isset($this->_bsComponent)===false)
272
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
270
+		if ($this->propertyContains("class", "simple")===false) {
271
+			if (isset($this->_bsComponent)===false)
272
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
273 273
 			$this->addEventsOnRun($js);
274 274
 			return $this->_bsComponent;
275 275
 		}
276 276
 	}
277 277
 
278
-	public function setCompact(){
278
+	public function setCompact() {
279 279
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
280 280
 	}
281 281
 
282
-	public function setAction($action){
282
+	public function setAction($action) {
283 283
 		$this->_params["action"]=$action;
284 284
 	}
285 285
 
286
-	public function setFullTextSearch($value){
286
+	public function setFullTextSearch($value) {
287 287
 		$this->_params["fullTextSearch"]=$value;
288 288
 	}
289 289
 
290 290
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
291 291
 		$this->applyValue();
292
-		return parent::compile($js,$view);
292
+		return parent::compile($js, $view);
293 293
 	}
294 294
 
295 295
 	public function getInput() {
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlDropdownItem.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -12,34 +12,34 @@  discard block
 block discarded – undo
12 12
 use Ajax\semantic\html\base\traits\MenuItemTrait;
13 13
 
14 14
 class HtmlDropdownItem extends HtmlSemDoubleElement {
15
-	use IconTrait,MenuItemTrait;
16
-	public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) {
15
+	use IconTrait, MenuItemTrait;
16
+	public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) {
17 17
 		parent::__construct($identifier, "a");
18 18
 		$this->setClass("item");
19 19
 		$this->setContent($content);
20
-		if($value!==NULL)
20
+		if ($value!==NULL)
21 21
 			$this->setData($value);
22
-		if($image!==NULL)
22
+		if ($image!==NULL)
23 23
 			$this->asMiniAvatar($image);
24
-		if($description!==NULL)
24
+		if ($description!==NULL)
25 25
 			$this->setDescription($description);
26 26
 	}
27 27
 
28
-	public function setDescription($description){
29
-		$descO=new HtmlDoubleElement("desc-".$this->identifier,"span");
28
+	public function setDescription($description) {
29
+		$descO=new HtmlDoubleElement("desc-".$this->identifier, "span");
30 30
 		$descO->setClass("description");
31 31
 		$descO->setContent($description);
32
-		return $this->addContent($descO,true);
32
+		return $this->addContent($descO, true);
33 33
 	}
34 34
 
35
-	public function setData($value){
35
+	public function setData($value) {
36 36
 		$this->setProperty("data-value", $value);
37 37
 		return $this;
38 38
 	}
39 39
 
40
-	public function asOption(){
40
+	public function asOption() {
41 41
 		$this->tagName="option";
42
-		if($this->getProperty("data-value")!==null)
42
+		if ($this->getProperty("data-value")!==null)
43 43
 			$this->setProperty("value", $this->getProperty("data-value"));
44 44
 	}
45 45
 
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @param string $image the image src
48 48
 	 * @return \Ajax\common\html\html5\HtmlImg
49 49
 	 */
50
-	public function asMiniAvatar($image){
50
+	public function asMiniAvatar($image) {
51 51
 		$this->tagName="div";
52
-		$img=new HtmlImg("image-".$this->identifier,$image);
52
+		$img=new HtmlImg("image-".$this->identifier, $image);
53 53
 		$img->setClass("ui mini avatar image");
54
-		$this->addContent($img,true);
54
+		$this->addContent($img, true);
55 55
 		return $this;
56 56
 	}
57 57
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 * @param string $icon
61 61
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
62 62
 	 */
63
-	public function asIcon($caption,$icon){
63
+	public function asIcon($caption, $icon) {
64 64
 		$this->setContent($caption);
65
-		$this->addContent(new HtmlIcon("", $icon),true);
65
+		$this->addContent(new HtmlIcon("", $icon), true);
66 66
 		return $this;
67 67
 	}
68 68
 
@@ -71,23 +71,23 @@  discard block
 block discarded – undo
71 71
 	 * @param string $color
72 72
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
73 73
 	 */
74
-	public function asCircularLabel($caption,$color){
74
+	public function asCircularLabel($caption, $color) {
75 75
 		$this->setContent($caption);
76 76
 		$lbl=new HtmlLabel("");
77 77
 		$lbl->setCircular()->setColor($color)->setEmpty();
78
-		$this->addContent($lbl,true);
78
+		$this->addContent($lbl, true);
79 79
 		return $this;
80 80
 	}
81 81
 
82 82
 
83 83
 
84 84
 	public function addMenuItem($items) {
85
-		$menu=new HtmlMenu("menu-" . $this->identifier, $items);
85
+		$menu=new HtmlMenu("menu-".$this->identifier, $items);
86 86
 		$content=$this->content;
87 87
 		$this->setTagName("div");
88 88
 		$this->setProperty("class", "item");
89 89
 		$icon=new HtmlIcon("", "dropdown");
90
-		$this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu];
90
+		$this->content=[$icon, new HtmlSemDoubleElement("", "span", "text", $content), $menu];
91 91
 		return $menu;
92 92
 	}
93 93
 
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 	 * @param string $icon
97 97
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
98 98
 	 */
99
-	public static function searchInput($placeholder=NULL,$icon=NULL){
100
-		return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon);
99
+	public static function searchInput($placeholder=NULL, $icon=NULL) {
100
+		return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon);
101 101
 	}
102 102
 
103 103
 	/**
104 104
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
105 105
 	 */
106
-	public static function divider(){
106
+	public static function divider() {
107 107
 		return (new HtmlDropdownItem(""))->asDivider();
108 108
 	}
109 109
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * @param string $icon
113 113
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
114 114
 	 */
115
-	public static function header($caption=NULL,$icon=NULL){
116
-		return (new HtmlDropdownItem(""))->asHeader($caption,$icon);
115
+	public static function header($caption=NULL, $icon=NULL) {
116
+		return (new HtmlDropdownItem(""))->asHeader($caption, $icon);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param string $color
122 122
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
123 123
 	 */
124
-	public static function circular($caption,$color){
125
-		return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color);
124
+	public static function circular($caption, $color) {
125
+		return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color);
126 126
 	}
127 127
 
128 128
 	/**
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 * @param string $icon
131 131
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
132 132
 	 */
133
-	public static function icon($caption,$icon){
134
-		return (new HtmlDropdownItem(""))->asIcon($caption,$icon);
133
+	public static function icon($caption, $icon) {
134
+		return (new HtmlDropdownItem(""))->asIcon($caption, $icon);
135 135
 	}
136 136
 
137 137
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @param unknown $image
140 140
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
141 141
 	 */
142
-	public static function avatar($caption,$image){
143
-		return (new HtmlDropdownItem("",$caption))->asMiniAvatar($image);
142
+	public static function avatar($caption, $image) {
143
+		return (new HtmlDropdownItem("", $caption))->asMiniAvatar($image);
144 144
 	}
145 145
 }
146 146
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,12 +17,15 @@  discard block
 block discarded – undo
17 17
 		parent::__construct($identifier, "a");
18 18
 		$this->setClass("item");
19 19
 		$this->setContent($content);
20
-		if($value!==NULL)
21
-			$this->setData($value);
22
-		if($image!==NULL)
23
-			$this->asMiniAvatar($image);
24
-		if($description!==NULL)
25
-			$this->setDescription($description);
20
+		if($value!==NULL) {
21
+					$this->setData($value);
22
+		}
23
+		if($image!==NULL) {
24
+					$this->asMiniAvatar($image);
25
+		}
26
+		if($description!==NULL) {
27
+					$this->setDescription($description);
28
+		}
26 29
 	}
27 30
 
28 31
 	public function setDescription($description){
@@ -39,8 +42,9 @@  discard block
 block discarded – undo
39 42
 
40 43
 	public function asOption(){
41 44
 		$this->tagName="option";
42
-		if($this->getProperty("data-value")!==null)
43
-			$this->setProperty("value", $this->getProperty("data-value"));
45
+		if($this->getProperty("data-value")!==null) {
46
+					$this->setProperty("value", $this->getProperty("data-value"));
47
+		}
44 48
 	}
45 49
 
46 50
 	/**
Please login to merge, or discard this patch.