Completed
Push — master ( 7ed867...85d12a )
by Jean-Christophe
02:44
created
Ajax/semantic/html/base/traits/AttachedTrait.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -7,6 +7,11 @@
 block discarded – undo
7 7
 use Ajax\common\html\HtmlDoubleElement;
8 8
 
9 9
 trait AttachedTrait {
10
+
11
+	/**
12
+	 * @param string $name
13
+	 * @param string $value
14
+	 */
10 15
 	abstract public function addToPropertyCtrl($name, $value, $typeCtrl);
11 16
 	/**
12 17
 	 * @param HtmlSemDoubleElement $toElement
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,6 @@
 block discarded – undo
17 17
 		if (isset($toElement) && \method_exists($toElement, "setAttached")) {
18 18
 			$toElement->setAttached(true);
19 19
 		}
20
-		return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached"));
20
+		return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
21 21
 	}
22 22
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/base/constants/Social.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,5 +2,5 @@
 block discarded – undo
2 2
 namespace Ajax\semantic\html\base\constants;
3 3
 	use Ajax\common\BaseEnum;
4 4
 abstract class Social extends BaseEnum {
5
-	const FACEBOOK="facebook", TWITTER="twitter",GOOGLEPLUS="google plus",VK="vk",LINKEDIN="linkedin",INSTAGRAM="instagram",YOUTUBE="youtube",GITHUB="github";
5
+	const FACEBOOK="facebook", TWITTER="twitter", GOOGLEPLUS="google plus", VK="vk", LINKEDIN="linkedin", INSTAGRAM="instagram", YOUTUBE="youtube", GITHUB="github";
6 6
 }
Please login to merge, or discard this patch.
Ajax/semantic/components/Popup.php 1 patch
Spacing   +6 added lines, -6 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,19 +40,19 @@  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
 
55
-	public function setSetFluidWidth($value){
55
+	public function setSetFluidWidth($value) {
56 56
 		return $this->setParam("setFluidWidth", $value);
57 57
 	}
58 58
 }
Please login to merge, or discard this patch.
Ajax/semantic/traits/SemanticWidgetsTrait.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 	 * @param array $instances
19 19
 	 * @return DataTable
20 20
 	 */
21
-	public function dataTable($identifier,$model, $instances){
22
-		return $this->addHtmlComponent(new DataTable($identifier,$model,$instances));
21
+	public function dataTable($identifier, $model, $instances) {
22
+		return $this->addHtmlComponent(new DataTable($identifier, $model, $instances));
23 23
 	}
24 24
 
25 25
 	/**
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 * @param array $instances
29 29
 	 * @return JsonDataTable
30 30
 	 */
31
-	public function jsonDataTable($identifier,$model, $instances){
32
-		return $this->addHtmlComponent(new JsonDataTable($identifier,$model,$instances));
31
+	public function jsonDataTable($identifier, $model, $instances) {
32
+		return $this->addHtmlComponent(new JsonDataTable($identifier, $model, $instances));
33 33
 	}
34 34
 
35 35
 	/**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param object $instance
38 38
 	 * @return DataElement
39 39
 	 */
40
-	public function dataElement($identifier, $instance){
41
-		return $this->addHtmlComponent(new DataElement($identifier,$instance));
40
+	public function dataElement($identifier, $instance) {
41
+		return $this->addHtmlComponent(new DataElement($identifier, $instance));
42 42
 	}
43 43
 
44 44
 	/**
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 	 * @param object $instance
47 47
 	 * @return DataForm
48 48
 	 */
49
-	public function dataForm($identifier, $instance){
50
-		return $this->addHtmlComponent(new DataForm($identifier,$instance));
49
+	public function dataForm($identifier, $instance) {
50
+		return $this->addHtmlComponent(new DataForm($identifier, $instance));
51 51
 	}
52 52
 
53 53
 	/**
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @param object $instance
56 56
 	 * @return FormLogin
57 57
 	 */
58
-	public function defaultLogin($identifier,$instance=null){
59
-		return $this->addHtmlComponent(FormLogin::regular($identifier,$instance));
58
+	public function defaultLogin($identifier, $instance=null) {
59
+		return $this->addHtmlComponent(FormLogin::regular($identifier, $instance));
60 60
 	}
61 61
 
62 62
 	/**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 * @param object $instance
65 65
 	 * @return FormLogin
66 66
 	 */
67
-	public function smallLogin($identifier,$instance=null){
68
-		return $this->addHtmlComponent(FormLogin::small($identifier,$instance));
67
+	public function smallLogin($identifier, $instance=null) {
68
+		return $this->addHtmlComponent(FormLogin::small($identifier, $instance));
69 69
 	}
70 70
 
71 71
 	/**
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 	 * @param object $instance
74 74
 	 * @return FormLogin
75 75
 	 */
76
-	public function segmentedLogin($identifier,$instance=null){
77
-		return $this->addHtmlComponent(FormLogin::attachedSegment($identifier,$instance));
76
+	public function segmentedLogin($identifier, $instance=null) {
77
+		return $this->addHtmlComponent(FormLogin::attachedSegment($identifier, $instance));
78 78
 	}
79 79
 
80 80
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @param object $instance
83 83
 	 * @return FormAccount
84 84
 	 */
85
-	public function defaultAccount($identifier,$instance=null){
86
-		return $this->addHtmlComponent(FormAccount::regular($identifier,$instance));
85
+	public function defaultAccount($identifier, $instance=null) {
86
+		return $this->addHtmlComponent(FormAccount::regular($identifier, $instance));
87 87
 	}
88 88
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/business/user/FormAccount.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,61 +10,61 @@
 block discarded – undo
10 10
 	 * @param string $identifier
11 11
 	 * @param object $modelInstance
12 12
 	 */
13
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) {
14
-		parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators);
13
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) {
14
+		parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
15 15
 	}
16 16
 
17
-	protected function getDefaultModelInstance(){
17
+	protected function getDefaultModelInstance() {
18 18
 		return new UserModel();
19 19
 	}
20 20
 
21
-	public static function regular($identifier,$modelInstance=null){
22
-		return new FormAccount($identifier,$modelInstance,
23
-				["message","login","password","passwordConf","email","submit","error"],
21
+	public static function regular($identifier, $modelInstance=null) {
22
+		return new FormAccount($identifier, $modelInstance,
23
+				["message", "login", "password", "passwordConf", "email", "submit", "error"],
24 24
 				["message"=>[["icon"=>"sign in"]],
25 25
 						"input0"=>[["rules"=>"empty"]],
26
-						"input1"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty']]],
27
-						"input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]],
26
+						"input1"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty']]],
27
+						"input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]],
28 28
 						"input3"=>[["rules"=>"email"]],
29 29
 						"submit"=>["green fluid"],
30 30
 						"message2"=>[["error"=>true]]],
31
-				["Account","login","password","passwordConf","email","submit","error"],
32
-				["Please enter your account informations","Login","Password","Password confirmation","Email address","Creation"],
33
-				[0,1,3,4,5,6]);
31
+				["Account", "login", "password", "passwordConf", "email", "submit", "error"],
32
+				["Please enter your account informations", "Login", "Password", "Password confirmation", "Email address", "Creation"],
33
+				[0, 1, 3, 4, 5, 6]);
34 34
 	}
35 35
 
36
-	public static function smallInline($identifier,$modelInstance=null){
37
-		$result=new FormAccount($identifier,$modelInstance,
38
-				["login","password","submit"],
39
-				["input0"=>[["rules"=>"empty"]],"input1"=>[["inputType"=>"password","rules"=>"empty"]],"submit"=>["green basic"]],
40
-				["login","password","submit"],
41
-				["","","Connection"],
36
+	public static function smallInline($identifier, $modelInstance=null) {
37
+		$result=new FormAccount($identifier, $modelInstance,
38
+				["login", "password", "submit"],
39
+				["input0"=>[["rules"=>"empty"]], "input1"=>[["inputType"=>"password", "rules"=>"empty"]], "submit"=>["green basic"]],
40
+				["login", "password", "submit"],
41
+				["", "", "Connection"],
42 42
 				[2]);
43 43
 			$result->addDividerBefore(0, "Connection");
44 44
 		return $result;
45 45
 	}
46 46
 
47
-	public static function small($identifier,$modelInstance=null){
48
-		$result=new FormAccount($identifier,$modelInstance,
49
-				["login","password","passwordConf","email","submit"],
47
+	public static function small($identifier, $modelInstance=null) {
48
+		$result=new FormAccount($identifier, $modelInstance,
49
+				["login", "password", "passwordConf", "email", "submit"],
50 50
 				[
51 51
 						"input0"=>[["rules"=>"empty"]],
52
-						"input1"=>[["inputType"=>"password","rules"=>['minLength[6]', 'empty']]],
53
-						"input2"=>[["inputType"=>"password","rules"=> ['minLength[6]', 'empty', 'match[password]']]],
52
+						"input1"=>[["inputType"=>"password", "rules"=>['minLength[6]', 'empty']]],
53
+						"input2"=>[["inputType"=>"password", "rules"=> ['minLength[6]', 'empty', 'match[password]']]],
54 54
 						"input3"=>[["rules"=>"email"]],
55 55
 						"submit"=>["green basic"]],
56
-				["login","password","passwordConf","email","submit"],
57
-				["Login","Password","Password confirmation","Email address","Creation"],
58
-				[1,2]);
56
+				["login", "password", "passwordConf", "email", "submit"],
57
+				["Login", "Password", "Password confirmation", "Email address", "Creation"],
58
+				[1, 2]);
59 59
 		$result->addDividerBefore(0, "Creation");
60 60
 		return $result;
61 61
 	}
62 62
 
63
-	public static function attachedSegment($identifier,$modelInstance=null){
64
-		$result=self::regular($identifier,$modelInstance);
65
-		$result->fieldAsMessage("message",["icon"=>"sign in","attached"=>true]);
66
-		$result->addWrapper("message",null,"<div class='ui attached segment'>");
67
-		$result->addWrapper("error", null,"</div>");
63
+	public static function attachedSegment($identifier, $modelInstance=null) {
64
+		$result=self::regular($identifier, $modelInstance);
65
+		$result->fieldAsMessage("message", ["icon"=>"sign in", "attached"=>true]);
66
+		$result->addWrapper("message", null, "<div class='ui attached segment'>");
67
+		$result->addWrapper("error", null, "</div>");
68 68
 		return $result;
69 69
 	}
70 70
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/LabeledIconTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 trait LabeledIconTrait {
14 14
 
15 15
 	abstract public function addToProperty($name, $value, $separator=" ");
16
-	abstract public function addContent($content,$before=false);
16
+	abstract public function addContent($content, $before=false);
17 17
 
18 18
 	/**
19 19
 	 * Adds an icon before or after
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 	 * @param boolean $labeled
23 23
 	 * @return \Ajax\semantic\html\elements\HtmlIcon
24 24
 	 */
25
-	public function addIcon($icon,$before=true,$labeled=false){
25
+	public function addIcon($icon, $before=true, $labeled=false) {
26 26
 		$iconO=$icon;
27
-		if(\is_string($icon)){
27
+		if (\is_string($icon)) {
28 28
 			$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
29 29
 		}
30
-		if($labeled!==false){
31
-			$direction=($before===true)?Direction::LEFT:Direction::RIGHT;
30
+		if ($labeled!==false) {
31
+			$direction=($before===true) ?Direction::LEFT : Direction::RIGHT;
32 32
 			$this->addToProperty("class", $direction." labeled icon");
33 33
 			$this->tagName="div";
34 34
 		}
35
-		$this->addContent($iconO,$before);
35
+		$this->addContent($iconO, $before);
36 36
 		return $iconO;
37 37
 	}
38 38
 }
Please login to merge, or discard this patch.
Ajax/semantic/components/Modal.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,16 +16,16 @@
 block discarded – undo
16 16
 		return $this;
17 17
 	}
18 18
 
19
-	public function showDimmer(){
19
+	public function showDimmer() {
20 20
 		return $this->setBehavior("hide dimmer");
21 21
 	}
22 22
 
23
-	public function setInverted(){
23
+	public function setInverted() {
24 24
 		$this->params["inverted"]=true;
25 25
 	}
26 26
 
27 27
 	public function setOnHidden($jsCode) {
28
-		$jsCode=str_ireplace("\"","%quote%", $jsCode);
28
+		$jsCode=str_ireplace("\"", "%quote%", $jsCode);
29 29
 		return $this->setParam("onHidden", "%function(){".$jsCode."}%");
30 30
 	}
31 31
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTD.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 use Ajax\JsUtils;
13 13
 
14 14
 class HtmlTD extends HtmlSemDoubleElement {
15
-	use TextAlignmentTrait,TableElementTrait;
15
+	use TextAlignmentTrait, TableElementTrait;
16 16
 	private $_container;
17 17
 	private $_row;
18 18
 	private $_col;
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 */
29 29
 	public function __construct($identifier, $content=NULL, $tagName="td") {
30 30
 		parent::__construct($identifier, $tagName, "", $content);
31
-		$this->_variations=[ Variation::COLLAPSING ];
32
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
31
+		$this->_variations=[Variation::COLLAPSING];
32
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
33 33
 	}
34 34
 
35 35
 	public function setContainer($container, $row, $col) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setRowspan($rowspan) {
52
-		$to=min($this->_container->count(), $this->_row + $rowspan - 1);
53
-		for($i=$to; $i > $this->_row; $i--) {
52
+		$to=min($this->_container->count(), $this->_row+$rowspan-1);
53
+		for ($i=$to; $i>$this->_row; $i--) {
54 54
 			$this->_container->toDelete($i, $this->_col);
55 55
 		}
56 56
 		$this->setProperty("rowspan", $rowspan);
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 
60 60
 	public function mergeRow() {
61
-		if(!$this->_rowMerged){
61
+		if (!$this->_rowMerged) {
62 62
 			$this->_rowMerged=true;
63 63
 			return $this->setRowspan($this->_container->count());
64 64
 		}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	public function mergeCol() {
69
-		if(!$this->_colMerged){
69
+		if (!$this->_colMerged) {
70 70
 			$this->_colMerged=true;
71 71
 			return $this->setColspan($this->_container->getRow($this->_row)->count());
72 72
 		}
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	}
75 75
 
76 76
 	public function setColspan($colspan) {
77
-		$to=min($this->_container->getRow($this->_row)->count(), $this->_col + $colspan - 1);
78
-		for($i=$to; $i > $this->_col; $i--) {
79
-			$this->_container->toDelete($this->_row, $this->_col + 1);
77
+		$to=min($this->_container->getRow($this->_row)->count(), $this->_col+$colspan-1);
78
+		for ($i=$to; $i>$this->_col; $i--) {
79
+			$this->_container->toDelete($this->_row, $this->_col+1);
80 80
 		}
81 81
 		$this->setProperty("colspan", $colspan);
82 82
 		return $this->_container;
@@ -115,21 +115,21 @@  discard block
 block discarded – undo
115 115
 		return $this->addToProperty("class", "selectable");
116 116
 	}
117 117
 
118
-	public function setWidth($width){
118
+	public function setWidth($width) {
119 119
 		if (\is_int($width)) {
120
-			$width=Wide::getConstants()["W" . $width];
120
+			$width=Wide::getConstants()["W".$width];
121 121
 		}
122 122
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
123
-		return $this->addToPropertyCtrl("class", "wide", array ("wide" ));
123
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
124 124
 	}
125 125
 
126
-	public function toDelete(){
126
+	public function toDelete() {
127 127
 		$this->_deleted=true;
128 128
 		return $this;
129 129
 	}
130 130
 
131 131
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
132
-		if(!$this->_deleted)
132
+		if (!$this->_deleted)
133 133
 			return parent::compile();
134 134
 		return;
135 135
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -84,15 +84,17 @@  discard block
 block discarded – undo
84 84
 
85 85
 	public function getColspan() {
86 86
 		$colspan=1;
87
-		if (\array_key_exists("colspan", $this->properties))
88
-			$colspan=$this->getProperty("colspan");
87
+		if (\array_key_exists("colspan", $this->properties)) {
88
+					$colspan=$this->getProperty("colspan");
89
+		}
89 90
 		return $colspan;
90 91
 	}
91 92
 
92 93
 	public function getRowspan() {
93 94
 		$rowspan=1;
94
-		if (\array_key_exists("rowspan", $this->properties))
95
-			$rowspan=$this->getProperty("rowspan");
95
+		if (\array_key_exists("rowspan", $this->properties)) {
96
+					$rowspan=$this->getProperty("rowspan");
97
+		}
96 98
 		return $rowspan;
97 99
 	}
98 100
 
@@ -129,8 +131,9 @@  discard block
 block discarded – undo
129 131
 	}
130 132
 
131 133
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
132
-		if(!$this->_deleted)
133
-			return parent::compile();
134
+		if(!$this->_deleted) {
135
+					return parent::compile();
136
+		}
134 137
 		return;
135 138
 	}
136 139
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 3 patches
Doc Comments   +14 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,6 +25,9 @@  discard block
 block discarded – undo
25 25
 	protected $_associative;
26 26
 	protected $_multiple;
27 27
 
28
+	/**
29
+	 * @param string $identifier
30
+	 */
28 31
 	public function __construct($identifier, $value="", $items=array(),$associative=true) {
29 32
 		parent::__construct($identifier, "div");
30 33
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
@@ -78,7 +81,7 @@  discard block
 block discarded – undo
78 81
 	/**
79 82
 	 * Insert an item at a position
80 83
 	 * @param mixed $item
81
-	 * @param number $position
84
+	 * @param integer $position
82 85
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
83 86
 	 */
84 87
 	public function insertItem($item,$position=0){
@@ -190,7 +193,7 @@  discard block
 block discarded – undo
190 193
 	 * Sets the values of a property for each item in the collection
191 194
 	 * @param string $property
192 195
 	 * @param array $values
193
-	 * @return HtmlCollection
196
+	 * @return HtmlDropdown
194 197
 	 */
195 198
 	public function setPropertyValues($property,$values){
196 199
 		$i=0;
@@ -209,6 +212,9 @@  discard block
 block discarded – undo
209 212
 		return $this;
210 213
 	}
211 214
 
215
+	/**
216
+	 * @param integer $index
217
+	 */
212 218
 	public function getItem($index){
213 219
 		return $this->items[$index];
214 220
 	}
@@ -302,6 +308,9 @@  discard block
 block discarded – undo
302 308
 		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
303 309
 	}
304 310
 
311
+	/**
312
+	 * @param string $value
313
+	 */
305 314
 	public function setValue($value){
306 315
 		$this->value=$value;
307 316
 		return $this;
@@ -338,6 +347,9 @@  discard block
 block discarded – undo
338 347
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
339 348
 	}
340 349
 
350
+	/**
351
+	 * @param string $action
352
+	 */
341 353
 	public function setAction($action){
342 354
 		$this->_params["action"]=$action;
343 355
 	}
Please login to merge, or discard this patch.
Braces   +24 added lines, -19 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		if(isset($value)){
35 35
 			if($value instanceof HtmlSemDoubleElement){
36 36
 				$text=$value;
37
-			}else{
37
+			} else{
38 38
 				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
39 39
 				$text->setClass("text");
40 40
 				$this->setValue($value);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		}
108 108
 		if(!$item instanceof HtmlDropdownItem){
109 109
 			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
110
-		}elseif($itemO instanceof HtmlDropdownItem){
110
+		} elseif($itemO instanceof HtmlDropdownItem){
111 111
 			$this->addToProperty("class", "vertical");
112 112
 		}
113 113
 		return $itemO;
@@ -121,8 +121,9 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	public function addInput($name){
124
-		if(!isset($name))
125
-			$name="input-".$this->identifier;
124
+		if(!isset($name)) {
125
+					$name="input-".$this->identifier;
126
+		}
126 127
 		$this->setAction("activate");
127 128
 		$this->input=new HtmlInput($name,"hidden");
128 129
 	}
@@ -179,7 +180,7 @@  discard block
 block discarded – undo
179 180
 			foreach ($items as $k=>$v){
180 181
 				$this->addItem($v)->setData($k);
181 182
 			}
182
-		}else{
183
+		} else{
183 184
 			foreach ($items as $item){
184 185
 				$this->addItem($item);
185 186
 			}
@@ -201,8 +202,7 @@  discard block
 block discarded – undo
201 202
 			$c=$this->items[$i++];
202 203
 			if(isset($c)){
203 204
 				$c->setProperty($property,$value);
204
-			}
205
-			else{
205
+			} else{
206 206
 				return $this;
207 207
 			}
208 208
 		}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		if($dropdown===false){
227 227
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
228 228
 			$dropdown="menu";
229
-		}else{
229
+		} else{
230 230
 			$dropdown="dropdown";
231 231
 			$this->mClass="menu";
232 232
 		}
@@ -247,22 +247,25 @@  discard block
 block discarded – undo
247 247
 
248 248
 	public function asButton($floating=false){
249 249
 		$this->removeArrow();
250
-		if($floating)
251
-			$this->addToProperty("class", "floating");
250
+		if($floating) {
251
+					$this->addToProperty("class", "floating");
252
+		}
252 253
 		$this->removePropertyValue("class", "selection");
253 254
 		return $this->addToProperty("class", "button");
254 255
 	}
255 256
 
256 257
 	public function asSelect($name=NULL,$multiple=false,$selection=true){
257 258
 		$this->_multiple=$multiple;
258
-		if(isset($name))
259
-			$this->addInput($name);
259
+		if(isset($name)) {
260
+					$this->addInput($name);
261
+		}
260 262
 		if($multiple){
261 263
 			$this->addToProperty("class", "multiple");
262 264
 		}
263 265
 		if ($selection){
264
-			if($this->propertyContains("class", "button")===false)
265
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
266
+			if($this->propertyContains("class", "button")===false) {
267
+							$this->addToPropertyCtrl("class", "selection",array("selection"));
268
+			}
266 269
 		}
267 270
 		return $this;
268 271
 	}
@@ -273,8 +276,9 @@  discard block
 block discarded – undo
273 276
 	}
274 277
 
275 278
 	public function setSelect($name=NULL,$multiple=false){
276
-		if(!isset($name))
277
-			$name="select-".$this->identifier;
279
+		if(!isset($name)) {
280
+					$name="select-".$this->identifier;
281
+		}
278 282
 		$this->input=null;
279 283
 		if($multiple){
280 284
 			$this->setProperty("multiple", true);
@@ -310,12 +314,13 @@  discard block
 block discarded – undo
310 314
 		$value=$this->value;
311 315
 		if(isset($this->input) && isset($value)){
312 316
 			$this->input->setProperty("value", $value);
313
-		}else{
317
+		} else{
314 318
 			$this->setProperty("value", $value);
315 319
 		}
316 320
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
317
-			if(isset($textElement) && !$this->_multiple)
318
-				$textElement->setContent($value);
321
+			if(isset($textElement) && !$this->_multiple) {
322
+							$textElement->setContent($value);
323
+			}
319 324
 		return $this;
320 325
 	}
321 326
 
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -13,29 +13,29 @@  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","showOnFocus"=>false);
21
+	protected $items=array();
22
+	protected $_params=array("action"=>"nothing", "on"=>"hover", "showOnFocus"=>false);
23 23
 	protected $input;
24 24
 	protected $value;
25 25
 	protected $_associative;
26 26
 	protected $_multiple;
27 27
 
28
-	public function __construct($identifier, $value="", $items=array(),$associative=true) {
28
+	public function __construct($identifier, $value="", $items=array(), $associative=true) {
29 29
 		parent::__construct($identifier, "div");
30 30
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
31 31
 		$this->setProperty("class", "ui dropdown");
32 32
 		$this->_multiple=false;
33 33
 		$content=[];
34
-		if(isset($value)){
35
-			if($value instanceof HtmlSemDoubleElement){
34
+		if (isset($value)) {
35
+			if ($value instanceof HtmlSemDoubleElement) {
36 36
 				$text=$value;
37
-			}else{
38
-				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
37
+			} else {
38
+				$text=new HtmlSemDoubleElement("text-".$this->identifier, "div");
39 39
 				$text->setClass("text");
40 40
 				$this->setValue($value);
41 41
 			}
@@ -48,29 +48,29 @@  discard block
 block discarded – undo
48 48
 		$this->addItems($items);
49 49
 	}
50 50
 
51
-	public function getField(){
51
+	public function getField() {
52 52
 		return $this->input;
53 53
 	}
54 54
 
55
-	public function getDataField(){
55
+	public function getDataField() {
56 56
 		return $this->input;
57 57
 	}
58 58
 
59
-	public function addItem($item,$value=NULL,$image=NULL,$description=NULL){
60
-		$itemO=$this->beforeAddItem($item,$value,$image,$description);
59
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
60
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
61 61
 		$this->items[]=$itemO;
62 62
 		return $itemO;
63 63
 	}
64 64
 
65
-	public function addIcon($icon,$before=true,$labeled=false){
65
+	public function addIcon($icon, $before=true, $labeled=false) {
66 66
 		$this->removeArrow();
67
-		$this->addIconP($icon,$before,$labeled);
67
+		$this->addIconP($icon, $before, $labeled);
68 68
 		return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter("");
69 69
 	}
70 70
 
71
-	public function addIcons($icons){
71
+	public function addIcons($icons) {
72 72
 		$count=$this->count();
73
-		for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){
73
+		for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) {
74 74
 			$this->getItem($i)->addIcon($icons[$i]);
75 75
 		}
76 76
 	}
@@ -81,33 +81,33 @@  discard block
 block discarded – undo
81 81
 	 * @param number $position
82 82
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
83 83
 	 */
84
-	public function insertItem($item,$position=0){
84
+	public function insertItem($item, $position=0) {
85 85
 		$itemO=$this->beforeAddItem($item);
86
-		 $start = array_slice($this->items, 0, $position);
87
-		 $end = array_slice($this->items, $position);
88
-		 $start[] = $item;
86
+		 $start=array_slice($this->items, 0, $position);
87
+		 $end=array_slice($this->items, $position);
88
+		 $start[]=$item;
89 89
 		 $this->items=array_merge($start, $end);
90 90
 		 return $itemO;
91 91
 	}
92 92
 
93
-	protected function removeArrow(){
94
-		if(\sizeof($this->content)>1){
93
+	protected function removeArrow() {
94
+		if (\sizeof($this->content)>1) {
95 95
 			unset($this->content["arrow"]);
96 96
 			$this->content=\array_values($this->content);
97 97
 		}
98 98
 	}
99 99
 
100
-	protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){
100
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
101 101
 		$itemO=$item;
102
-		if(\is_array($item)){
102
+		if (\is_array($item)) {
103 103
 			$description=JArray::getValue($item, "description", 3);
104 104
 			$value=JArray::getValue($item, "value", 1);
105 105
 			$image=JArray::getValue($item, "image", 2);
106 106
 			$item=JArray::getValue($item, "item", 0);
107 107
 		}
108
-		if(!$item instanceof HtmlDropdownItem){
109
-			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
110
-		}elseif($itemO instanceof HtmlDropdownItem){
108
+		if (!$item instanceof HtmlDropdownItem) {
109
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
110
+		}elseif ($itemO instanceof HtmlDropdownItem) {
111 111
 			$this->addToProperty("class", "vertical");
112 112
 		}
113 113
 		return $itemO;
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		$this->addItem($function($object));
121 121
 	}
122 122
 
123
-	public function addInput($name){
124
-		if(!isset($name))
123
+	public function addInput($name) {
124
+		if (!isset($name))
125 125
 			$name="input-".$this->identifier;
126 126
 		$this->setAction("activate");
127
-		$this->input=new HtmlInput($name,"hidden");
127
+		$this->input=new HtmlInput($name, "hidden");
128 128
 	}
129 129
 
130 130
 	/**
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 	 * @param string $icon
134 134
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
135 135
 	 */
136
-	public function addSearchInputItem($placeHolder=NULL,$icon=NULL){
137
-		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon));
136
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
137
+		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
138 138
 	}
139 139
 
140 140
 	/**
141 141
 	 * Adds a divider item
142 142
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
143 143
 	 */
144
-	public function addDividerItem(){
144
+	public function addDividerItem() {
145 145
 		return $this->addItem(HtmlDropdownItem::divider());
146 146
 	}
147 147
 
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	 * @param string $icon
152 152
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
153 153
 	 */
154
-	public function addHeaderItem($caption=NULL,$icon=NULL){
155
-		return $this->addItem(HtmlDropdownItem::header($caption,$icon));
154
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
155
+		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
156 156
 	}
157 157
 
158 158
 	/**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @param string $color
162 162
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown
163 163
 	 */
164
-	public function addCircularLabelItem($caption,$color){
164
+	public function addCircularLabelItem($caption, $color) {
165 165
 		return $this->addItem(HtmlDropdownItem::circular($caption, $color));
166 166
 	}
167 167
 
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 	 * @param string $image
171 171
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
172 172
 	 */
173
-	public function addMiniAvatarImageItem($caption,$image){
173
+	public function addMiniAvatarImageItem($caption, $image) {
174 174
 		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
175 175
 	}
176 176
 
177
-	public function addItems($items){
178
-		if(\is_array($items) && $this->_associative){
179
-			foreach ($items as $k=>$v){
177
+	public function addItems($items) {
178
+		if (\is_array($items) && $this->_associative) {
179
+			foreach ($items as $k=>$v) {
180 180
 				$this->addItem($v)->setData($k);
181 181
 			}
182
-		}else{
183
-			foreach ($items as $item){
182
+		} else {
183
+			foreach ($items as $item) {
184 184
 				$this->addItem($item);
185 185
 			}
186 186
 		}
@@ -192,98 +192,98 @@  discard block
 block discarded – undo
192 192
 	 * @param array $values
193 193
 	 * @return HtmlCollection
194 194
 	 */
195
-	public function setPropertyValues($property,$values){
195
+	public function setPropertyValues($property, $values) {
196 196
 		$i=0;
197
-		if(\is_array($values)===false){
198
-			$values=\array_fill(0, $this->count(),$values);
197
+		if (\is_array($values)===false) {
198
+			$values=\array_fill(0, $this->count(), $values);
199 199
 		}
200
-		foreach ($values as $value){
200
+		foreach ($values as $value) {
201 201
 			$c=$this->items[$i++];
202
-			if(isset($c)){
203
-				$c->setProperty($property,$value);
202
+			if (isset($c)) {
203
+				$c->setProperty($property, $value);
204 204
 			}
205
-			else{
205
+			else {
206 206
 				return $this;
207 207
 			}
208 208
 		}
209 209
 		return $this;
210 210
 	}
211 211
 
212
-	public function each($callBack){
213
-		foreach ($this->items as $index=>$value){
214
-			$callBack($index,$value);
212
+	public function each($callBack) {
213
+		foreach ($this->items as $index=>$value) {
214
+			$callBack($index, $value);
215 215
 		}
216 216
 		return $this;
217 217
 	}
218 218
 
219
-	public function getItem($index){
219
+	public function getItem($index) {
220 220
 		return $this->items[$index];
221 221
 	}
222 222
 
223 223
 	/**
224 224
 	 * @return int
225 225
 	 */
226
-	public function count(){
226
+	public function count() {
227 227
 		return \sizeof($this->items);
228 228
 	}
229 229
 	/**
230 230
 	 * @param boolean $dropdown
231 231
 	 */
232
-	public function asDropdown($dropdown){
233
-		if($dropdown===false){
232
+	public function asDropdown($dropdown) {
233
+		if ($dropdown===false) {
234 234
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
235 235
 			$dropdown="menu";
236
-		}else{
236
+		} else {
237 237
 			$dropdown="dropdown";
238 238
 			$this->mClass="menu";
239 239
 		}
240
-		return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown"));
240
+		return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown"));
241 241
 	}
242 242
 
243
-	public function setVertical(){
244
-		return $this->addToPropertyCtrl("class", "vertical",array("vertical"));
243
+	public function setVertical() {
244
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
245 245
 	}
246 246
 
247
-	public function setInline(){
248
-		return $this->addToPropertyCtrl("class", "inline",["inline"]);
247
+	public function setInline() {
248
+		return $this->addToPropertyCtrl("class", "inline", ["inline"]);
249 249
 	}
250 250
 
251
-	public function setSimple(){
252
-		return $this->addToPropertyCtrl("class", "simple",array("simple"));
251
+	public function setSimple() {
252
+		return $this->addToPropertyCtrl("class", "simple", array("simple"));
253 253
 	}
254 254
 
255
-	public function asButton($floating=false){
255
+	public function asButton($floating=false) {
256 256
 		$this->removeArrow();
257
-		if($floating)
257
+		if ($floating)
258 258
 			$this->addToProperty("class", "floating");
259 259
 		$this->removePropertyValue("class", "selection");
260 260
 		return $this->addToProperty("class", "button");
261 261
 	}
262 262
 
263
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
263
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
264 264
 		$this->_multiple=$multiple;
265
-		if(isset($name))
265
+		if (isset($name))
266 266
 			$this->addInput($name);
267
-		if($multiple){
267
+		if ($multiple) {
268 268
 			$this->addToProperty("class", "multiple");
269 269
 		}
270
-		if ($selection){
271
-			if($this->propertyContains("class", "button")===false)
272
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
270
+		if ($selection) {
271
+			if ($this->propertyContains("class", "button")===false)
272
+				$this->addToPropertyCtrl("class", "selection", array("selection"));
273 273
 		}
274 274
 		return $this;
275 275
 	}
276 276
 
277
-	public function asSearch($name=NULL,$multiple=false,$selection=true){
278
-		$this->asSelect($name,$multiple,$selection);
277
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
278
+		$this->asSelect($name, $multiple, $selection);
279 279
 		return $this->addToProperty("class", "search");
280 280
 	}
281 281
 
282
-	public function setSelect($name=NULL,$multiple=false){
283
-		if(!isset($name))
282
+	public function setSelect($name=NULL, $multiple=false) {
283
+		if (!isset($name))
284 284
 			$name="select-".$this->identifier;
285 285
 		$this->input=null;
286
-		if($multiple){
286
+		if ($multiple) {
287 287
 			$this->setProperty("multiple", true);
288 288
 			$this->addToProperty("class", "multiple");
289 289
 		}
@@ -291,37 +291,37 @@  discard block
 block discarded – undo
291 291
 		$this->tagName="select";
292 292
 		$this->setProperty("name", $name);
293 293
 		$this->content=null;
294
-		foreach ($this->items as $item){
294
+		foreach ($this->items as $item) {
295 295
 			$item->asOption();
296 296
 		}
297 297
 		return $this;
298 298
 	}
299 299
 
300
-	public function asSubmenu($pointing=NULL){
300
+	public function asSubmenu($pointing=NULL) {
301 301
 		$this->setClass("ui dropdown link item");
302
-		if(isset($pointing)){
302
+		if (isset($pointing)) {
303 303
 			$this->setPointing($pointing);
304 304
 		}
305 305
 		return $this;
306 306
 	}
307 307
 
308
-	public function setPointing($value=Direction::NONE){
309
-		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
308
+	public function setPointing($value=Direction::NONE) {
309
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
310 310
 	}
311 311
 
312
-	public function setValue($value){
312
+	public function setValue($value) {
313 313
 		$this->value=$value;
314 314
 		return $this;
315 315
 	}
316
-	private function applyValue(){
316
+	private function applyValue() {
317 317
 		$value=$this->value;
318
-		if(isset($this->input) && isset($value)){
318
+		if (isset($this->input) && isset($value)) {
319 319
 			$this->input->setProperty("value", $value);
320
-		}else{
320
+		} else {
321 321
 			$this->setProperty("value", $value);
322 322
 		}
323 323
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
324
-			if(isset($textElement) && !$this->_multiple)
324
+			if (isset($textElement) && !$this->_multiple)
325 325
 				$textElement->setContent($value);
326 326
 		return $this;
327 327
 	}
@@ -331,9 +331,9 @@  discard block
 block discarded – undo
331 331
 	 * @see BaseHtml::run()
332 332
 	 */
333 333
 	public function run(JsUtils $js) {
334
-		if($this->propertyContains("class", "simple")===false){
335
-			if(isset($this->_bsComponent)===false){
336
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
334
+		if ($this->propertyContains("class", "simple")===false) {
335
+			if (isset($this->_bsComponent)===false) {
336
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
337 337
 				$this->_bsComponent->setItemSelector(".item");
338 338
 			}
339 339
 			$this->addEventsOnRun($js);
@@ -341,44 +341,44 @@  discard block
 block discarded – undo
341 341
 		}
342 342
 	}
343 343
 
344
-	public function setCompact(){
344
+	public function setCompact() {
345 345
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
346 346
 	}
347 347
 
348
-	public function setAction($action){
348
+	public function setAction($action) {
349 349
 		$this->_params["action"]=$action;
350 350
 	}
351 351
 
352
-	public function setOn($on){
352
+	public function setOn($on) {
353 353
 		$this->_params["on"]=$on;
354 354
 	}
355 355
 
356
-	public function setShowOnFocus($value){
356
+	public function setShowOnFocus($value) {
357 357
 		$this->_params["showOnFocus"]=$value;
358 358
 	}
359 359
 
360
-	public function setFullTextSearch($value){
360
+	public function setFullTextSearch($value) {
361 361
 		$this->_params["fullTextSearch"]=$value;
362 362
 	}
363 363
 
364 364
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
365 365
 		$this->applyValue();
366
-		return parent::compile($js,$view);
366
+		return parent::compile($js, $view);
367 367
 	}
368 368
 
369 369
 	public function getInput() {
370 370
 		return $this->input;
371 371
 	}
372 372
 	public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) {
373
-		return $this->_addAction($this, $action,$direction,$icon,$labeled);
373
+		return $this->_addAction($this, $action, $direction, $icon, $labeled);
374 374
 	}
375 375
 
376
-	public function setIcon($icon="dropdown"){
376
+	public function setIcon($icon="dropdown") {
377 377
 		$this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon);
378 378
 		return $this;
379 379
 	}
380 380
 
381
-	public function jsAddItem($caption){
381
+	public function jsAddItem($caption) {
382 382
 		$js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')";
383 383
 		return $js;
384 384
 	}
Please login to merge, or discard this patch.