Passed
Push — master ( 7a8d95...2ebdf0 )
by Jean-Christophe
02:02
created
Ajax/semantic/html/elements/HtmlList.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -21,17 +21,17 @@  discard block
 block discarded – undo
21 21
 
22 22
 	protected function createItem($value) {
23 23
 		$count=$this->count();
24
-		$item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value);
24
+		$item=new HtmlListItem("item-".$this->identifier."-".$count, $value);
25 25
 		return $item;
26 26
 	}
27 27
 
28 28
 	public function addHeader($niveau, $content) {
29
-		$header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page");
29
+		$header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page");
30 30
 		$this->wrap($header);
31 31
 		return $header;
32 32
 	}
33 33
 
34
-	public function getItemPart($index,$partName="header"){
34
+	public function getItemPart($index, $partName="header") {
35 35
 		return $this->getItem($index)->getPart($partName);
36 36
 	}
37 37
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 		return $this->contentAs($tagName);
40 40
 	}
41 41
 
42
-	public function asLinks($hrefs=[],$target=NUll) {
43
-		$this->addToPropertyCtrl("class", "link", array ("link" ));
44
-		return parent::asLinks($hrefs,$target);
42
+	public function asLinks($hrefs=[], $target=NUll) {
43
+		$this->addToPropertyCtrl("class", "link", array("link"));
44
+		return parent::asLinks($hrefs, $target);
45 45
 	}
46 46
 
47 47
 	public function addList($items=array()) {
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @return HtmlListItem
55 55
 	 */
56
-	public function getItem($index){
56
+	public function getItem($index) {
57 57
 		return parent::getItem($index);
58 58
 	}
59 59
 
60
-	protected function getItemToAdd($item){
60
+	protected function getItemToAdd($item) {
61 61
 		$itemO=parent::getItemToAdd($item);
62
-		if($itemO instanceof AbstractCheckbox)
62
+		if ($itemO instanceof AbstractCheckbox)
63 63
 			$itemO->addClass("item");
64 64
 		return $itemO;
65 65
 	}
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	public function run(JsUtils $js) {
80
-		if ($this->_hasCheckedList === true) {
81
-			$jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php';
82
-			$jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode);
80
+		if ($this->_hasCheckedList===true) {
81
+			$jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php';
82
+			$jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode);
83 83
 			$jsCode=\str_replace("%fireOnInit%", $this->_fireOnInit, $jsCode);
84 84
 			$jsCode=\str_replace("%onChange%", $this->_ckItemChange, $jsCode);
85 85
 			$this->executeOnRun($jsCode);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		return parent::run($js);
88 88
 	}
89 89
 	
90
-	public function onCkItemChange($jsCode){
90
+	public function onCkItemChange($jsCode) {
91 91
 		$this->_ckItemChange=$jsCode;
92 92
 	}
93 93
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param boolean $fireOnInit
96 96
 	 */
97 97
 	public function setFireOnInit($fireOnInit) {
98
-		$this->_fireOnInit = $fireOnInit;
98
+		$this->_fireOnInit=$fireOnInit;
99 99
 	}
100 100
 
101 101
 	public function setRelaxed() {
@@ -122,42 +122,42 @@  discard block
 block discarded – undo
122 122
 	 * @param string $notAllChecked
123 123
 	 * @return HtmlList
124 124
 	 */
125
-	public function addCheckedList($items=array(), $masterItem=NULL, $values=array(),$notAllChecked=false,$name=null) {
125
+	public function addCheckedList($items=array(), $masterItem=NULL, $values=array(), $notAllChecked=false, $name=null) {
126 126
 		$count=$this->count();
127
-		$identifier=$this->identifier . "-" . $count;
127
+		$identifier=$this->identifier."-".$count;
128 128
 		if (isset($masterItem)) {
129
-			if(\is_array($masterItem)){
130
-				$masterO=new HtmlFormCheckbox("master-" . $identifier, @$masterItem[0],@$masterItem[1]);
131
-				if(isset($name))
129
+			if (\is_array($masterItem)) {
130
+				$masterO=new HtmlFormCheckbox("master-".$identifier, @$masterItem[0], @$masterItem[1]);
131
+				if (isset($name))
132 132
 					$masterO->setName($name);
133
-				if(isset($masterItem[1])){
134
-					if(\array_search($masterItem[1], $values)!==false){
133
+				if (isset($masterItem[1])) {
134
+					if (\array_search($masterItem[1], $values)!==false) {
135 135
 						$masterO->getDataField()->setProperty("checked", "");
136 136
 					}
137 137
 				}
138
-			}else{
139
-				$masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem);
138
+			} else {
139
+				$masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem);
140 140
 			}
141
-			if($notAllChecked){
141
+			if ($notAllChecked) {
142 142
 				$masterO->getDataField()->addClass("_notAllChecked");
143 143
 			}
144 144
 			$masterO->getHtmlCk()->addToProperty("class", "master");
145 145
 			$masterO->setClass("item");
146 146
 			$this->addItem($masterO);
147 147
 		}
148
-		$fields=array ();
148
+		$fields=array();
149 149
 		$i=0;
150
-		foreach ( $items as $val => $caption ) {
151
-			$itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child");
152
-			if (\array_search($val, $values) !== false) {
150
+		foreach ($items as $val => $caption) {
151
+			$itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child");
152
+			if (\array_search($val, $values)!==false) {
153 153
 				$itemO->getDataField()->setProperty("checked", "");
154 154
 			}
155
-			if(isset($name))
155
+			if (isset($name))
156 156
 				$itemO->setName($name);
157 157
 			$itemO->setClass("item");
158 158
 			$fields[]=$itemO;
159 159
 		}
160
-		if (isset($masterO) === true) {
160
+		if (isset($masterO)===true) {
161 161
 			$list=new HtmlList("", $fields);
162 162
 			$list->setClass("list");
163 163
 			$masterO->addContent($list);
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 		return $this;
169 169
 	}
170 170
 
171
-	public function setIcons($icons){
172
-		if(!\is_array($icons)){
171
+	public function setIcons($icons) {
172
+		if (!\is_array($icons)) {
173 173
 			$icons=\array_fill(0, \sizeof($this->content), $icons);
174 174
 		}
175
-		$max=\min(\sizeof($icons),\sizeof($this->content));
176
-		for($i=0;$i<$max;$i++){
175
+		$max=\min(\sizeof($icons), \sizeof($this->content));
176
+		for ($i=0; $i<$max; $i++) {
177 177
 			$this->content[$i]->addIcon($icons[$i]);
178 178
 		}
179 179
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormFields.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		}
36 36
 		if (isset($label))
37 37
 			$this->setLabel($label);
38
-		foreach ( $fields as $field ) {
38
+		foreach ($fields as $field) {
39 39
 			$this->addItem($field);
40 40
 		}
41 41
 		return $this;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function addItem($item) {
59 59
 		$item=parent::addItem($item);
60
-		if($item instanceof HtmlFormField)
60
+		if ($item instanceof HtmlFormField)
61 61
 			$item->setContainer($this);
62 62
 		return $item;
63 63
 	}
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	/**
66 66
 	 * @return HtmlFormField
67 67
 	 */
68
-	public function getItem($index){
68
+	public function getItem($index) {
69 69
 		return parent::getItem($index);
70 70
 	}
71 71
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 	public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) {
108
-		$fields=array ();
108
+		$fields=array();
109 109
 		$i=0;
110
-		foreach ( $items as $val => $caption ) {
110
+		foreach ($items as $val => $caption) {
111 111
 			$itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type);
112 112
 			if ($val===$value) {
113 113
 				$itemO->getDataField()->setProperty("checked", "");
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) {
124
-		$fields=array ();
124
+		$fields=array();
125 125
 		$i=0;
126
-		foreach ( $items as $val => $caption ) {
126
+		foreach ($items as $val => $caption) {
127 127
 			$itemO=new HtmlFormCheckbox($name."-".$i++, $caption, $val, $type);
128 128
 			$itemO->setName($name);
129 129
 			if (\array_search($val, $values)!==false) {
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/CheckboxTrait.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,22 +38,22 @@  discard block
 block discarded – undo
38 38
 		return $this->getHtmlCk()->attachEvents($events);
39 39
 	}
40 40
 
41
-	public function getField(){
41
+	public function getField() {
42 42
 		return $this->content["field"];
43 43
 	}
44 44
 
45
-	public function getHtmlCk(){
45
+	public function getHtmlCk() {
46 46
 		return $this->content["field"];
47 47
 	}
48 48
 
49
-	public function setName($name){
49
+	public function setName($name) {
50 50
 		$this->getDataField()->setProperty("name", $name);
51 51
 		return $this;
52 52
 	}
53 53
 
54
-	public function getDataField(){
55
-		$field= $this->getField();
56
-		if($field instanceof AbstractCheckbox)
54
+	public function getDataField() {
55
+		$field=$this->getField();
56
+		if ($field instanceof AbstractCheckbox)
57 57
 			$field=$field->getField();
58 58
 		return $field;
59 59
 	}
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 	 * @param boolean $value
64 64
 	 * @return $this
65 65
 	 */
66
-	public function setChecked($value=true){
67
-		if($value===true){
66
+	public function setChecked($value=true) {
67
+		if ($value===true) {
68 68
 			$this->getDataField()->setProperty("checked", "checked");
69
-		}else{
69
+		} else {
70 70
 			$this->getDataField()->removeProperty("checked");
71 71
 		}
72 72
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlDropdown.php 1 patch
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
 use Ajax\common\html\HtmlDoubleElement;
16 16
 
17 17
 class HtmlDropdown extends HtmlSemDoubleElement {
18
-	use FieldTrait,LabeledIconTrait {
18
+	use FieldTrait, LabeledIconTrait {
19 19
 		addIcon as addIconP;
20 20
 	}
21 21
 	protected $mClass="menu";
22 22
 	protected $mTagName="div";
23
-	protected $items=array ();
24
-	protected $_params=array("action"=>"nothing","on"=>"hover","showOnFocus"=>false);
23
+	protected $items=array();
24
+	protected $_params=array("action"=>"nothing", "on"=>"hover", "showOnFocus"=>false);
25 25
 	protected $input;
26 26
 	protected $value;
27 27
 	protected $_associative;
28 28
 	protected $_multiple;
29 29
 
30
-	public function __construct($identifier, $value="", $items=array(),$associative=true) {
30
+	public function __construct($identifier, $value="", $items=array(), $associative=true) {
31 31
 		parent::__construct($identifier, "div");
32 32
 		$this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php';
33 33
 		$this->setProperty("class", "ui dropdown");
34 34
 		$this->_multiple=false;
35 35
 		$content=[];
36
-		if(isset($value)){
37
-			if($value instanceof HtmlSemDoubleElement){
36
+		if (isset($value)) {
37
+			if ($value instanceof HtmlSemDoubleElement) {
38 38
 				$text=$value;
39
-			}else{
40
-				$text=new HtmlSemDoubleElement("text-".$this->identifier,"div");
39
+			} else {
40
+				$text=new HtmlSemDoubleElement("text-".$this->identifier, "div");
41 41
 				$text->setClass("text");
42 42
 				$this->setValue($value);
43 43
 			}
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 		$this->addItems($items);
51 51
 	}
52 52
 
53
-	public function getField(){
53
+	public function getField() {
54 54
 		return $this->input;
55 55
 	}
56 56
 
57
-	public function getDataField(){
57
+	public function getDataField() {
58 58
 		return $this->input;
59 59
 	}
60 60
 
61
-	public function addItem($item,$value=NULL,$image=NULL,$description=NULL){
62
-		$itemO=$this->beforeAddItem($item,$value,$image,$description);
61
+	public function addItem($item, $value=NULL, $image=NULL, $description=NULL) {
62
+		$itemO=$this->beforeAddItem($item, $value, $image, $description);
63 63
 		$this->items[]=$itemO;
64 64
 		return $itemO;
65 65
 	}
66 66
 
67
-	public function addIcon($icon,$before=true,$labeled=false){
67
+	public function addIcon($icon, $before=true, $labeled=false) {
68 68
 		$this->removeArrow();
69
-		$this->addIconP($icon,$before,$labeled);
69
+		$this->addIconP($icon, $before, $labeled);
70 70
 		return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter("");
71 71
 	}
72 72
 
73
-	public function addIcons($icons){
73
+	public function addIcons($icons) {
74 74
 		$count=$this->count();
75
-		for ($i=0;$i<\sizeof($icons) && $i<$count;$i++){
75
+		for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) {
76 76
 			$this->getItem($i)->addIcon($icons[$i]);
77 77
 		}
78 78
 	}
@@ -83,33 +83,33 @@  discard block
 block discarded – undo
83 83
 	 * @param int $position
84 84
 	 * @return HtmlDropdownItem
85 85
 	 */
86
-	public function insertItem($item,$position=0){
86
+	public function insertItem($item, $position=0) {
87 87
 		$itemO=$this->beforeAddItem($item);
88
-		 $start = array_slice($this->items, 0, $position);
89
-		 $end = array_slice($this->items, $position);
90
-		 $start[] = $item;
88
+		 $start=array_slice($this->items, 0, $position);
89
+		 $end=array_slice($this->items, $position);
90
+		 $start[]=$item;
91 91
 		 $this->items=array_merge($start, $end);
92 92
 		 return $itemO;
93 93
 	}
94 94
 
95
-	protected function removeArrow(){
96
-		if(\sizeof($this->content)>1){
95
+	protected function removeArrow() {
96
+		if (\sizeof($this->content)>1) {
97 97
 			unset($this->content["arrow"]);
98 98
 			$this->content=\array_values($this->content);
99 99
 		}
100 100
 	}
101 101
 
102
-	protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){
102
+	protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) {
103 103
 		$itemO=$item;
104
-		if(\is_array($item)){
104
+		if (\is_array($item)) {
105 105
 			$description=JArray::getValue($item, "description", 3);
106 106
 			$value=JArray::getValue($item, "value", 1);
107 107
 			$image=JArray::getValue($item, "image", 2);
108 108
 			$item=JArray::getValue($item, "item", 0);
109 109
 		}
110
-		if(!$item instanceof HtmlDropdownItem){
111
-			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description);
112
-		}elseif($itemO instanceof HtmlDropdownItem){
110
+		if (!$item instanceof HtmlDropdownItem) {
111
+			$itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description);
112
+		}elseif ($itemO instanceof HtmlDropdownItem) {
113 113
 			$this->addToProperty("class", "vertical");
114 114
 		}
115 115
 		return $itemO;
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
 		$this->addItem($function($object));
123 123
 	}
124 124
 
125
-	public function addInput($name){
126
-		if(!isset($name))
125
+	public function addInput($name) {
126
+		if (!isset($name))
127 127
 			$name="input-".$this->identifier;
128 128
 		$this->setAction("activate");
129
-		$this->input=new HtmlInput($name,"hidden");
129
+		$this->input=new HtmlInput($name, "hidden");
130 130
 		$this->input->setIdentifier("input-".$this->identifier);
131 131
 		return $this->input;
132 132
 	}
@@ -137,15 +137,15 @@  discard block
 block discarded – undo
137 137
 	 * @param string $icon
138 138
 	 * @return HtmlDropdownItem
139 139
 	 */
140
-	public function addSearchInputItem($placeHolder=NULL,$icon=NULL){
141
-		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon));
140
+	public function addSearchInputItem($placeHolder=NULL, $icon=NULL) {
141
+		return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon));
142 142
 	}
143 143
 
144 144
 	/**
145 145
 	 * Adds a divider item
146 146
 	 * @return HtmlDropdownItem
147 147
 	 */
148
-	public function addDividerItem(){
148
+	public function addDividerItem() {
149 149
 		return $this->addItem(HtmlDropdownItem::divider());
150 150
 	}
151 151
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param string $icon
156 156
 	 * @return HtmlDropdownItem
157 157
 	 */
158
-	public function addHeaderItem($caption=NULL,$icon=NULL){
159
-		return $this->addItem(HtmlDropdownItem::header($caption,$icon));
158
+	public function addHeaderItem($caption=NULL, $icon=NULL) {
159
+		return $this->addItem(HtmlDropdownItem::header($caption, $icon));
160 160
 	}
161 161
 
162 162
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param string $color
166 166
 	 * @return HtmlDropdownItem
167 167
 	 */
168
-	public function addCircularLabelItem($caption,$color){
168
+	public function addCircularLabelItem($caption, $color) {
169 169
 		return $this->addItem(HtmlDropdownItem::circular($caption, $color));
170 170
 	}
171 171
 
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 	 * @param string $image
175 175
 	 * @return \Ajax\semantic\html\content\HtmlDropdownItem
176 176
 	 */
177
-	public function addMiniAvatarImageItem($caption,$image){
177
+	public function addMiniAvatarImageItem($caption, $image) {
178 178
 		return $this->addItem(HtmlDropdownItem::avatar($caption, $image));
179 179
 	}
180 180
 
181
-	public function addItems($items){
182
-		if(\is_array($items) && $this->_associative){
183
-			foreach ($items as $k=>$v){
181
+	public function addItems($items) {
182
+		if (\is_array($items) && $this->_associative) {
183
+			foreach ($items as $k=>$v) {
184 184
 				$this->addItem($v)->setData($k);
185 185
 			}
186
-		}else{
187
-			foreach ($items as $item){
186
+		} else {
187
+			foreach ($items as $item) {
188 188
 				$this->addItem($item);
189 189
 			}
190 190
 		}
@@ -196,98 +196,98 @@  discard block
 block discarded – undo
196 196
 	 * @param array|mixed $values
197 197
 	 * @return $this
198 198
 	 */
199
-	public function setPropertyValues($property,$values){
199
+	public function setPropertyValues($property, $values) {
200 200
 		$i=0;
201
-		if(\is_array($values)===false){
202
-			$values=\array_fill(0, $this->count(),$values);
201
+		if (\is_array($values)===false) {
202
+			$values=\array_fill(0, $this->count(), $values);
203 203
 		}
204
-		foreach ($values as $value){
204
+		foreach ($values as $value) {
205 205
 			$c=$this->items[$i++];
206
-			if(isset($c)){
207
-				$c->setProperty($property,$value);
206
+			if (isset($c)) {
207
+				$c->setProperty($property, $value);
208 208
 			}
209
-			else{
209
+			else {
210 210
 				return $this;
211 211
 			}
212 212
 		}
213 213
 		return $this;
214 214
 	}
215 215
 
216
-	public function each($callBack){
217
-		foreach ($this->items as $index=>$value){
218
-			$callBack($index,$value);
216
+	public function each($callBack) {
217
+		foreach ($this->items as $index=>$value) {
218
+			$callBack($index, $value);
219 219
 		}
220 220
 		return $this;
221 221
 	}
222 222
 
223
-	public function getItem($index){
223
+	public function getItem($index) {
224 224
 		return $this->items[$index];
225 225
 	}
226 226
 
227 227
 	/**
228 228
 	 * @return int
229 229
 	 */
230
-	public function count(){
230
+	public function count() {
231 231
 		return \sizeof($this->items);
232 232
 	}
233 233
 	/**
234 234
 	 * @param boolean $dropdown
235 235
 	 */
236
-	public function asDropdown($dropdown){
237
-		if($dropdown===false){
236
+	public function asDropdown($dropdown) {
237
+		if ($dropdown===false) {
238 238
 			$this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php';
239 239
 			$dropdown="menu";
240
-		}else{
240
+		} else {
241 241
 			$dropdown="dropdown";
242 242
 			$this->mClass="menu";
243 243
 		}
244
-		return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown"));
244
+		return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown"));
245 245
 	}
246 246
 
247
-	public function setVertical(){
248
-		return $this->addToPropertyCtrl("class", "vertical",array("vertical"));
247
+	public function setVertical() {
248
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
249 249
 	}
250 250
 
251
-	public function setInline(){
252
-		return $this->addToPropertyCtrl("class", "inline",["inline"]);
251
+	public function setInline() {
252
+		return $this->addToPropertyCtrl("class", "inline", ["inline"]);
253 253
 	}
254 254
 
255
-	public function setSimple(){
256
-		return $this->addToPropertyCtrl("class", "simple",array("simple"));
255
+	public function setSimple() {
256
+		return $this->addToPropertyCtrl("class", "simple", array("simple"));
257 257
 	}
258 258
 
259
-	public function asButton($floating=false){
259
+	public function asButton($floating=false) {
260 260
 		$this->removeArrow();
261
-		if($floating)
261
+		if ($floating)
262 262
 			$this->addToProperty("class", "floating");
263 263
 		$this->removePropertyValue("class", "selection");
264 264
 		return $this->addToProperty("class", "button");
265 265
 	}
266 266
 
267
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
267
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
268 268
 		$this->_multiple=$multiple;
269
-		if(isset($name))
269
+		if (isset($name))
270 270
 			$this->addInput($name);
271
-		if($multiple){
271
+		if ($multiple) {
272 272
 			$this->addToProperty("class", "multiple");
273 273
 		}
274
-		if ($selection){
275
-			if($this->propertyContains("class", "button")===false)
276
-				$this->addToPropertyCtrl("class", "selection",array("selection"));
274
+		if ($selection) {
275
+			if ($this->propertyContains("class", "button")===false)
276
+				$this->addToPropertyCtrl("class", "selection", array("selection"));
277 277
 		}
278 278
 		return $this;
279 279
 	}
280 280
 
281
-	public function asSearch($name=NULL,$multiple=false,$selection=true){
282
-		$this->asSelect($name,$multiple,$selection);
281
+	public function asSearch($name=NULL, $multiple=false, $selection=true) {
282
+		$this->asSelect($name, $multiple, $selection);
283 283
 		return $this->addToProperty("class", "search");
284 284
 	}
285 285
 
286
-	public function setSelect($name=NULL,$multiple=false){
287
-		if(!isset($name))
286
+	public function setSelect($name=NULL, $multiple=false) {
287
+		if (!isset($name))
288 288
 			$name="select-".$this->identifier;
289 289
 		$this->input=null;
290
-		if($multiple){
290
+		if ($multiple) {
291 291
 			$this->setProperty("multiple", true);
292 292
 			$this->addToProperty("class", "multiple");
293 293
 		}
@@ -295,37 +295,37 @@  discard block
 block discarded – undo
295 295
 		$this->tagName="select";
296 296
 		$this->setProperty("name", $name);
297 297
 		$this->content=null;
298
-		foreach ($this->items as $item){
298
+		foreach ($this->items as $item) {
299 299
 			$item->asOption();
300 300
 		}
301 301
 		return $this;
302 302
 	}
303 303
 
304
-	public function asSubmenu($pointing=NULL){
304
+	public function asSubmenu($pointing=NULL) {
305 305
 		$this->setClass("ui dropdown link item");
306
-		if(isset($pointing)){
306
+		if (isset($pointing)) {
307 307
 			$this->setPointing($pointing);
308 308
 		}
309 309
 		return $this;
310 310
 	}
311 311
 
312
-	public function setPointing($value=Direction::NONE){
313
-		return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing"));
312
+	public function setPointing($value=Direction::NONE) {
313
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
314 314
 	}
315 315
 
316
-	public function setValue($value){
316
+	public function setValue($value) {
317 317
 		$this->value=$value;
318 318
 		return $this;
319 319
 	}
320
-	private function applyValue(){
320
+	private function applyValue() {
321 321
 		$value=$this->value;
322
-		if(isset($this->input) && isset($value)){
322
+		if (isset($this->input) && isset($value)) {
323 323
 			$this->input->setProperty("value", $value);
324
-		}else{
324
+		} else {
325 325
 			$this->setProperty("value", $value);
326 326
 		}
327 327
 			$textElement=$this->getElementById("text-".$this->identifier, $this->content);
328
-			if(isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
328
+			if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple)
329 329
 				$textElement->setContent($value);
330 330
 		return $this;
331 331
 	}
@@ -335,9 +335,9 @@  discard block
 block discarded – undo
335 335
 	 * @see BaseHtml::run()
336 336
 	 */
337 337
 	public function run(JsUtils $js) {
338
-		if($this->propertyContains("class", "simple")===false){
339
-			if(isset($this->_bsComponent)===false){
340
-				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params);
338
+		if ($this->propertyContains("class", "simple")===false) {
339
+			if (isset($this->_bsComponent)===false) {
340
+				$this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params);
341 341
 				$this->_bsComponent->setItemSelector(".item");
342 342
 			}
343 343
 			$this->addEventsOnRun($js);
@@ -345,41 +345,41 @@  discard block
 block discarded – undo
345 345
 		}
346 346
 	}
347 347
 
348
-	public function setCompact(){
348
+	public function setCompact() {
349 349
 		return $this->addToPropertyCtrl("class", "compact", array("compact"));
350 350
 	}
351 351
 
352
-	public function setAction($action){
352
+	public function setAction($action) {
353 353
 		$this->_params["action"]=$action;
354 354
 	}
355 355
 
356
-	public function setOn($on){
356
+	public function setOn($on) {
357 357
 		$this->_params["on"]=$on;
358 358
 	}
359 359
 
360
-	public function setShowOnFocus($value){
360
+	public function setShowOnFocus($value) {
361 361
 		$this->_params["showOnFocus"]=$value;
362 362
 	}
363 363
 
364
-	public function setFullTextSearch($value){
364
+	public function setFullTextSearch($value) {
365 365
 		$this->_params["fullTextSearch"]=$value;
366 366
 	}
367 367
 
368 368
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
369 369
 		$this->applyValue();
370
-		return parent::compile($js,$view);
370
+		return parent::compile($js, $view);
371 371
 	}
372 372
 
373 373
 	public function getInput() {
374 374
 		return $this->input;
375 375
 	}
376 376
 
377
-	public function setIcon($icon="dropdown"){
377
+	public function setIcon($icon="dropdown") {
378 378
 		$this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon);
379 379
 		return $this;
380 380
 	}
381 381
 
382
-	public function jsAddItem($caption){
382
+	public function jsAddItem($caption) {
383 383
 		$js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var new =first.clone();first.parent().append(new);first.html('{$caption}};')";
384 384
 		return $js;
385 385
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTableFieldAsTrait.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -13,21 +13,21 @@  discard block
 block discarded – undo
13 13
  * @property boolean $_visibleHover
14 14
  * @property InstanceViewer $_instanceViewer
15 15
  */
16
-trait DataTableFieldAsTrait{
16
+trait DataTableFieldAsTrait {
17 17
 	abstract public function addField($field);
18
-	abstract public function insertField($index,$field);
19
-	abstract public function insertInField($index,$field);
20
-	abstract public function fieldAs($index,$type,$attributes=NULL);
18
+	abstract public function insertField($index, $field);
19
+	abstract public function insertInField($index, $field);
20
+	abstract public function fieldAs($index, $type, $attributes=NULL);
21 21
 	abstract protected function cleanIdentifier($id);
22
-	abstract protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null);
22
+	abstract protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null);
23 23
 	/**
24 24
 	 * @param string $caption
25 25
 	 * @param callable $callback
26 26
 	 * @param boolean $visibleHover
27 27
 	 * @return callable
28 28
 	 */
29
-	private function getFieldButtonCallable($caption,$visibleHover=true,$callback=null){
30
-		return $this->getCallable("getFieldButton",[$caption,$visibleHover],$callback);
29
+	private function getFieldButtonCallable($caption, $visibleHover=true, $callback=null) {
30
+		return $this->getCallable("getFieldButton", [$caption, $visibleHover], $callback);
31 31
 	}
32 32
 
33 33
 	/**
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 	 * @param callable $callback
37 37
 	 * @return callable
38 38
 	 */
39
-	private function getCallable($thisCallback,$parameters,$callback=null){
40
-		$result=function($instance) use($thisCallback,$parameters,$callback){
41
-			$object=call_user_func_array(array($this,$thisCallback), $parameters);
42
-			if(isset($callback)){
43
-				if(\is_callable($callback)){
44
-					$callback($object,$instance,$this->_instanceViewer->count()+1);
39
+	private function getCallable($thisCallback, $parameters, $callback=null) {
40
+		$result=function($instance) use($thisCallback, $parameters, $callback){
41
+			$object=call_user_func_array(array($this, $thisCallback), $parameters);
42
+			if (isset($callback)) {
43
+				if (\is_callable($callback)) {
44
+					$callback($object, $instance, $this->_instanceViewer->count()+1);
45 45
 				}
46 46
 			}
47
-			if($object instanceof HtmlSemDoubleElement){
47
+			if ($object instanceof HtmlSemDoubleElement) {
48 48
 				$id=$this->_instanceViewer->getIdentifier();
49
-				$object->setProperty("data-ajax",$id);
50
-				if($object->propertyContains("class","visibleover")){
49
+				$object->setProperty("data-ajax", $id);
50
+				if ($object->propertyContains("class", "visibleover")) {
51 51
 					$this->_visibleHover=true;
52
-					$object->setProperty("style","visibility:hidden;");
52
+					$object->setProperty("style", "visibility:hidden;");
53 53
 				}
54 54
 			}
55 55
 			return $object;
@@ -61,16 +61,16 @@  discard block
 block discarded – undo
61 61
 	 * @param string $caption
62 62
 	 * @return HtmlButton
63 63
 	 */
64
-	private function getFieldButton($caption,$visibleHover=true){
65
-		$bt= new HtmlButton($this->cleanIdentifier($caption),$caption);
66
-		if($visibleHover)
64
+	private function getFieldButton($caption, $visibleHover=true) {
65
+		$bt=new HtmlButton($this->cleanIdentifier($caption), $caption);
66
+		if ($visibleHover)
67 67
 			$this->_visibleOver($bt);
68 68
 		return $bt;
69 69
 	}
70 70
 
71
-	private function getFieldButtons($buttons,$visibleHover=true){
72
-		$bts=new HtmlButtonGroups("",$buttons);
73
-		if($visibleHover)
71
+	private function getFieldButtons($buttons, $visibleHover=true) {
72
+		$bts=new HtmlButtonGroups("", $buttons);
73
+		if ($visibleHover)
74 74
 			$this->_visibleOver($bts);
75 75
 		return $bts;
76 76
 	}
@@ -84,19 +84,19 @@  discard block
 block discarded – undo
84 84
 	 * @param array $attributes associative array (<b>ajax</b> key is for ajax post)
85 85
 	 * @return DataTable
86 86
 	 */
87
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
88
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
89
-			$button=new HtmlButton($id,$value,$cssStyle);
90
-			$button->postOnClick($url,"$(event.target).closest('tr').find(':input').serialize()",$responseElement,$attributes["ajax"]);
91
-			if(!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
87
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
88
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
89
+			$button=new HtmlButton($id, $value, $cssStyle);
90
+			$button->postOnClick($url, "$(event.target).closest('tr').find(':input').serialize()", $responseElement, $attributes["ajax"]);
91
+			if (!isset($attributes["visibleHover"]) || $attributes["visibleHover"])
92 92
 				$this->_visibleOver($button);
93 93
 				return $button;
94
-		}, $index,$attributes);
94
+		}, $index, $attributes);
95 95
 	}
96 96
 
97
-	protected function _visibleOver(BaseHtml $element){
97
+	protected function _visibleOver(BaseHtml $element) {
98 98
 		$this->_visibleHover=true;
99
-		return $element->addToProperty("class", "visibleover")->setProperty("style","visibility:hidden;");
99
+		return $element->addToProperty("class", "visibleover")->setProperty("style", "visibility:hidden;");
100 100
 	}
101 101
 
102 102
 	/**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * @param boolean $visibleHover
107 107
 	 * @return DataTable
108 108
 	 */
109
-	public function addFieldButton($caption,$visibleHover=true,$callback=null){
110
-		$this->addField($this->getCallable("getFieldButton",[$caption,$visibleHover],$callback));
109
+	public function addFieldButton($caption, $visibleHover=true, $callback=null) {
110
+		$this->addField($this->getCallable("getFieldButton", [$caption, $visibleHover], $callback));
111 111
 		return $this;
112 112
 	}
113 113
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * @param boolean $visibleHover
119 119
 	 * @return DataTable
120 120
 	 */
121
-	public function addFieldButtons($buttons,$visibleHover=true,$callback=null){
122
-		$this->addField($this->getCallable("getFieldButtons",[$buttons,$visibleHover],$callback));
121
+	public function addFieldButtons($buttons, $visibleHover=true, $callback=null) {
122
+		$this->addField($this->getCallable("getFieldButtons", [$buttons, $visibleHover], $callback));
123 123
 		return $this;
124 124
 	}
125 125
 
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
 	 * @param callable $callback
131 131
 	 * @return DataTable
132 132
 	 */
133
-	public function insertFieldButton($index,$caption,$visibleHover=true,$callback=null){
134
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
133
+	public function insertFieldButton($index, $caption, $visibleHover=true, $callback=null) {
134
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
135 135
 		return $this;
136 136
 	}
137 137
 
@@ -142,25 +142,25 @@  discard block
 block discarded – undo
142 142
 	 * @param callable $callback
143 143
 	 * @return DataTable
144 144
 	 */
145
-	public function insertInFieldButton($index,$caption,$visibleHover=true,$callback=null){
146
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$visibleHover,$callback));
145
+	public function insertInFieldButton($index, $caption, $visibleHover=true, $callback=null) {
146
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $visibleHover, $callback));
147 147
 		return $this;
148 148
 	}
149 149
 
150
-	private function addDefaultButton($icon,$class=null,$visibleHover=true,$callback=null){
151
-		$this->addField($this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
150
+	private function addDefaultButton($icon, $class=null, $visibleHover=true, $callback=null) {
151
+		$this->addField($this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
152 152
 		return $this;
153 153
 	}
154 154
 
155
-	private function insertDefaultButtonIn($index,$icon,$class=null,$visibleHover=true,$callback=null){
156
-		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class,$visibleHover],$callback));
155
+	private function insertDefaultButtonIn($index, $icon, $class=null, $visibleHover=true, $callback=null) {
156
+		$this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class, $visibleHover], $callback));
157 157
 		return $this;
158 158
 	}
159 159
 
160
-	private function getDefaultButton($icon,$class=null,$visibleHover=true){
161
-		$bt=$this->getFieldButton("",$visibleHover);
160
+	private function getDefaultButton($icon, $class=null, $visibleHover=true) {
161
+		$bt=$this->getFieldButton("", $visibleHover);
162 162
 		$bt->asIcon($icon);
163
-		if(isset($class))
163
+		if (isset($class))
164 164
 			$bt->addClass($class);
165 165
 		return $bt;
166 166
 	}
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
173 173
 	 * @return DataTable
174 174
 	 */
175
-	public function addDeleteButton($visibleHover=true,$deleteBehavior=[],$callback=null){
175
+	public function addDeleteButton($visibleHover=true, $deleteBehavior=[], $callback=null) {
176 176
 		$this->_deleteBehavior=$deleteBehavior;
177
-		return $this->addDefaultButton("remove","_delete red basic",$visibleHover,$callback);
177
+		return $this->addDefaultButton("remove", "_delete red basic", $visibleHover, $callback);
178 178
 	}
179 179
 
180 180
 	/**
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	 * @param callable $callback this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
185 185
 	 * @return DataTable
186 186
 	 */
187
-	public function addEditButton($visibleHover=true,$editBehavior=[],$callback=null){
187
+	public function addEditButton($visibleHover=true, $editBehavior=[], $callback=null) {
188 188
 		$this->_editBehavior=$editBehavior;
189
-		return $this->addDefaultButton("edit","_edit basic",$visibleHover,$callback);
189
+		return $this->addDefaultButton("edit", "_edit basic", $visibleHover, $callback);
190 190
 	}
191 191
 
192 192
 	/**
@@ -197,20 +197,20 @@  discard block
 block discarded – undo
197 197
 	 * @param callable $callbackDelete this function takes the following arguments : $object=>the delete button, $instance : the active instance of the object
198 198
 	 * @return DataTable
199 199
 	 */
200
-	public function addEditDeleteButtons($visibleHover=true,$behavior=[],$callbackEdit=null,$callbackDelete=null){
201
-		$this->addEditButton($visibleHover,$behavior,$callbackEdit);
200
+	public function addEditDeleteButtons($visibleHover=true, $behavior=[], $callbackEdit=null, $callbackDelete=null) {
201
+		$this->addEditButton($visibleHover, $behavior, $callbackEdit);
202 202
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
203
-		$this->insertDeleteButtonIn($index,$visibleHover,$behavior,$callbackDelete);
203
+		$this->insertDeleteButtonIn($index, $visibleHover, $behavior, $callbackDelete);
204 204
 		return $this;
205 205
 	}
206 206
 
207
-	public function insertDeleteButtonIn($index,$visibleHover=true,$deleteBehavior=[],$callback=null){
207
+	public function insertDeleteButtonIn($index, $visibleHover=true, $deleteBehavior=[], $callback=null) {
208 208
 		$this->_deleteBehavior=$deleteBehavior;
209
-		return $this->insertDefaultButtonIn($index,"remove","_delete red basic",$visibleHover,$callback);
209
+		return $this->insertDefaultButtonIn($index, "remove", "_delete red basic", $visibleHover, $callback);
210 210
 	}
211 211
 
212
-	public function insertEditButtonIn($index,$visibleHover=true,$editBehavior=[],$callback=null){
212
+	public function insertEditButtonIn($index, $visibleHover=true, $editBehavior=[], $callback=null) {
213 213
 		$this->_editBehavior=$editBehavior;
214
-		return $this->insertDefaultButtonIn($index,"edit","_edit basic",$visibleHover,$callback);
214
+		return $this->insertDefaultButtonIn($index, "edit", "_edit basic", $visibleHover, $callback);
215 215
 	}
216 216
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -21,83 +21,83 @@  discard block
 block discarded – undo
21 21
 	use BaseTrait;
22 22
 
23 23
 	public function __construct($identifier, $modelInstance=NULL) {
24
-		parent::__construct($identifier, null,$modelInstance);
24
+		parent::__construct($identifier, null, $modelInstance);
25 25
 		$this->_form=new HtmlForm($identifier);
26 26
 		$this->_init(new FormInstanceViewer($identifier), "form", $this->_form, true);
27 27
 	}
28 28
 
29
-	protected function _getFieldIdentifier($prefix,$name=""){
29
+	protected function _getFieldIdentifier($prefix, $name="") {
30 30
 		return $this->identifier."-{$name}-".$this->_instanceViewer->getIdentifier();
31 31
 	}
32 32
 
33
-	public function compile(JsUtils $js=NULL,&$view=NULL){
34
-		if(!$this->_generated){
33
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
34
+		if (!$this->_generated) {
35 35
 			$this->_instanceViewer->setInstance($this->_modelInstance);
36 36
 
37 37
 			$form=$this->content["form"];
38 38
 			$this->_generateContent($form);
39 39
 
40
-			if(isset($this->_toolbar)){
40
+			if (isset($this->_toolbar)) {
41 41
 				$this->_setToolbarPosition($form);
42 42
 			}
43
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]);
43
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]);
44 44
 			$this->_generated=true;
45 45
 		}
46
-		return parent::compile($js,$view);
46
+		return parent::compile($js, $view);
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * @param HtmlForm $form
51 51
 	 */
52
-	protected function _generateContent($form){
53
-		$values= $this->_instanceViewer->getValues();
52
+	protected function _generateContent($form) {
53
+		$values=$this->_instanceViewer->getValues();
54 54
 		$count=$this->_instanceViewer->count();
55 55
 		$separators=$this->_instanceViewer->getSeparators();
56 56
 		$headers=$this->_instanceViewer->getHeaders();
57 57
 		$wrappers=$this->_instanceViewer->getWrappers();
58 58
 		\sort($separators);
59 59
 		$size=\sizeof($separators);
60
-		if($size===1){
60
+		if ($size===1) {
61 61
 			$i=-1;
62
-			foreach ($values as $v){
62
+			foreach ($values as $v) {
63 63
 				$this->_generateFields($form, [$v], $headers, $i, $wrappers);
64 64
 				$i++;
65 65
 			}
66
-		}else{
66
+		} else {
67 67
 			$separators[]=$count;
68
-			for($i=0;$i<$size;$i++){
69
-				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
68
+			for ($i=0; $i<$size; $i++) {
69
+				$fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]);
70 70
 				$this->_generateFields($form, $fields, $headers, $separators[$i], $wrappers);
71 71
 			}
72 72
 		}
73 73
 	}
74 74
 
75
-	protected function _generateFields($form,$values,$headers,$sepFirst,$wrappers){
75
+	protected function _generateFields($form, $values, $headers, $sepFirst, $wrappers) {
76 76
 		$wrapper=null;
77
-		if(isset($headers[$sepFirst+1]))
78
-			$form->addHeader($headers[$sepFirst+1],4,true);
79
-		if(isset($wrappers[$sepFirst+1])){
77
+		if (isset($headers[$sepFirst+1]))
78
+			$form->addHeader($headers[$sepFirst+1], 4, true);
79
+		if (isset($wrappers[$sepFirst+1])) {
80 80
 			$wrapper=$wrappers[$sepFirst+1];
81 81
 		}
82
-		if(\sizeof($values)===1){
82
+		if (\sizeof($values)===1) {
83 83
 			$added=$form->addField($values[0]);
84
-		}elseif(\sizeof($values)>1){
84
+		}elseif (\sizeof($values)>1) {
85 85
 			$added=$form->addFields($values);
86
-		}else
86
+		} else
87 87
 			return;
88
-		if(isset($wrapper)){
89
-			$added->wrap($wrapper[0],$wrapper[1]);
88
+		if (isset($wrapper)) {
89
+			$added->wrap($wrapper[0], $wrapper[1]);
90 90
 		}
91 91
 	}
92 92
 
93 93
 	/**
94 94
 	 * @return HtmlForm
95 95
 	 */
96
-	public function getForm(){
96
+	public function getForm() {
97 97
 		return $this->content["form"];
98 98
 	}
99 99
 
100
-	public function addSeparatorAfter($fieldNum){
100
+	public function addSeparatorAfter($fieldNum) {
101 101
 		$fieldNum=$this->_getIndex($fieldNum);
102 102
 		$this->_instanceViewer->addSeparatorAfter($fieldNum);
103 103
 		return $this;
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 		return $this;
113 113
 	}
114 114
 
115
-	public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){
116
-		return $this->_fieldAs(function($id,$name,$value) use ($cssStyle){
117
-			$button=new HtmlButton($id,$value,$cssStyle);
115
+	public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) {
116
+		return $this->_fieldAs(function($id, $name, $value) use ($cssStyle){
117
+			$button=new HtmlButton($id, $value, $cssStyle);
118 118
 			$button->setProperty("type", "reset");
119 119
 			return $button;
120
-		}, $index,$attributes);
120
+		}, $index, $attributes);
121 121
 	}
122 122
 
123 123
 	/**
@@ -136,19 +136,19 @@  discard block
 block discarded – undo
136 136
 		$this->content[$this->_toolbarPosition]=$this->_toolbar;
137 137
 	}
138 138
 
139
-	public function addDividerBefore($index,$title){
139
+	public function addDividerBefore($index, $title) {
140 140
 		$index=$this->_getIndex($index);
141 141
 		$this->_instanceViewer->addHeaderDividerBefore($index, $title);
142 142
 		return $this;
143 143
 	}
144 144
 
145
-	public function addWrapper($index,$contentBefore,$contentAfter=null){
145
+	public function addWrapper($index, $contentBefore, $contentAfter=null) {
146 146
 		$index=$this->_getIndex($index);
147
-		$this->_instanceViewer->addWrapper($index, $contentBefore,$contentAfter);
147
+		$this->_instanceViewer->addWrapper($index, $contentBefore, $contentAfter);
148 148
 		return $this;
149 149
 	}
150 150
 
151
-	public function run(JsUtils $js){
151
+	public function run(JsUtils $js) {
152 152
 		parent::run($js);
153 153
 	}
154 154
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlMenuItem.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@
 block discarded – undo
9 9
 class HtmlMenuItem extends HtmlSemDoubleElement {
10 10
 	use MenuItemTrait;
11 11
 	public function __construct($identifier, $content) {
12
-		parent::__construct($identifier,"div","item",$content);
12
+		parent::__construct($identifier, "div", "item", $content);
13 13
 	}
14 14
 
15
-	protected function initContent($content){
16
-		if(\is_array($content)){
17
-			if(JArray::isAssociative($content)===false){
15
+	protected function initContent($content) {
16
+		if (\is_array($content)) {
17
+			if (JArray::isAssociative($content)===false) {
18 18
 				$icon=@$content[0];
19 19
 				$title=@$content[1];
20
-			}else{
20
+			} else {
21 21
 				$icon=@$content["icon"];
22 22
 				$title=@$content["title"];
23 23
 			}
24
-			if(isset($icon)){
24
+			if (isset($icon)) {
25 25
 				$this->addIcon($icon);
26 26
 			}
27
-			if(isset($title)){
27
+			if (isset($title)) {
28 28
 				$this->setTitle($title);
29 29
 			}
30
-		}else{
30
+		} else {
31 31
 			$this->setContent($content);
32 32
 		}
33 33
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldsTrait.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -20,35 +20,35 @@  discard block
 block discarded – undo
20 20
  * @property string $identifier
21 21
  */
22 22
 trait FieldsTrait {
23
-	abstract public function addFields($fields=NULL,$label=NULL);
23
+	abstract public function addFields($fields=NULL, $label=NULL);
24 24
 	abstract public function addItem($item);
25 25
 	abstract public function getItem($index);
26 26
 	abstract public function count();
27 27
 
28
-	protected function createItem($value){
29
-		if(\is_array($value)){
30
-			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null)));
28
+	protected function createItem($value) {
29
+		if (\is_array($value)) {
30
+			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null)));
31 31
 			return $itemO;
32
-		}elseif(\is_object($value)){
32
+		}elseif (\is_object($value)) {
33 33
 			$itemO=new HtmlFormField("field-".$this->identifier, $value);
34 34
 			return $itemO;
35
-		}else
35
+		} else
36 36
 			return new HtmlFormInput($value);
37 37
 	}
38 38
 
39
-	protected function createCondition($value){
39
+	protected function createCondition($value) {
40 40
 		return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput;
41 41
 	}
42 42
 
43
-	public function addInputs($inputs,$fieldslabel=null){
43
+	public function addInputs($inputs, $fieldslabel=null) {
44 44
 		$fields=array();
45
-		foreach ($inputs as $input){
45
+		foreach ($inputs as $input) {
46 46
 			\extract($input);
47
-			$f=new HtmlFormInput("","");
47
+			$f=new HtmlFormInput("", "");
48 48
 			$f->fromArray($input);
49 49
 			$fields[]=$f;
50 50
 		}
51
-		return $this->addFields($fields,$fieldslabel);
51
+		return $this->addFields($fields, $fieldslabel);
52 52
 	}
53 53
 
54 54
 	/**
@@ -57,35 +57,35 @@  discard block
 block discarded – undo
57 57
 	 * @param array|mixed $values
58 58
 	 * @return HtmlFormFields
59 59
 	 */
60
-	public function setFieldsPropertyValues($property,$values){
60
+	public function setFieldsPropertyValues($property, $values) {
61 61
 		$i=0;
62
-		if(\is_array($values)===false){
63
-			$values=\array_fill(0, $this->count(),$values);
62
+		if (\is_array($values)===false) {
63
+			$values=\array_fill(0, $this->count(), $values);
64 64
 		}
65
-		foreach ($values as $value){
65
+		foreach ($values as $value) {
66 66
 			$c=$this->content[$i++];
67
-			if(isset($c)){
67
+			if (isset($c)) {
68 68
 				$df=$c->getDataField();
69
-				$df->setProperty($property,$value);
69
+				$df->setProperty($property, $value);
70 70
 			}
71
-			else{
71
+			else {
72 72
 				return $this;
73 73
 			}
74 74
 		}
75 75
 		return $this;
76 76
 	}
77 77
 
78
-	public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){
78
+	public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) {
79 79
 		$field=$this->getItem($index);
80
-		if(isset($field)){
81
-			$field->addRule($type,$prompt,$value);
80
+		if (isset($field)) {
81
+			$field->addRule($type, $prompt, $value);
82 82
 		}
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function addFieldRules($index,$rules){
86
+	public function addFieldRules($index, $rules) {
87 87
 		$field=$this->getItem($index);
88
-		if(isset($field)){
88
+		if (isset($field)) {
89 89
 			$field->addRules($rules);
90 90
 		}
91 91
 		return $this;
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 	 * @param boolean $multiple
101 101
 	 * @return HtmlFormDropdown
102 102
 	 */
103
-	public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){
104
-		return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple));
103
+	public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) {
104
+		return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple));
105 105
 	}
106 106
 
107 107
 	/**
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 * @param boolean $asIcons
112 112
 	 * @return HtmlButtonGroups
113 113
 	 */
114
-	public function addButtonGroups($identifier,$elements=[],$asIcons=false){
115
-		return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons));
114
+	public function addButtonGroups($identifier, $elements=[], $asIcons=false) {
115
+		return $this->addItem(new HtmlButtonGroups($identifier, $elements, $asIcons));
116 116
 	}
117 117
 
118 118
 	/**
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @param string $icon
125 125
 	 * @return HtmlButtonGroups
126 126
 	 */
127
-	public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){
128
-		return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon));
127
+	public function addDropdownButton($identifier, $value, $items=[], $asCombo=false, $icon=null) {
128
+		return $this->addItem(HtmlButton::dropdown($identifier, $value, $items, $asCombo, $icon));
129 129
 	}
130 130
 
131 131
 	/**
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 * @param string $placeholder
137 137
 	 * @return HtmlFormInput
138 138
 	 */
139
-	public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){
140
-		return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder));
139
+	public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
140
+		return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder));
141 141
 	}
142 142
 
143 143
 	/**
@@ -148,16 +148,16 @@  discard block
 block discarded – undo
148 148
 	 * @param int $rows
149 149
 	 * @return HtmlTextarea
150 150
 	 */
151
-	public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){
152
-		return $this->addItem(new HtmlFormTextarea($identifier,$label,$value,$placeholder,$rows));
151
+	public function addTextarea($identifier, $label, $value=NULL, $placeholder=NULL, $rows=5) {
152
+		return $this->addItem(new HtmlFormTextarea($identifier, $label, $value, $placeholder, $rows));
153 153
 	}
154 154
 
155
-	public function addPassword($identifier, $label=NULL){
156
-		return $this->addItem(new HtmlFormInput($identifier,$label,"password","",""));
155
+	public function addPassword($identifier, $label=NULL) {
156
+		return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", ""));
157 157
 	}
158 158
 
159
-	public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){
160
-		return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick));
159
+	public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) {
160
+		return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick));
161 161
 	}
162 162
 
163 163
 	/**
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 	 * @param string $type
168 168
 	 * @return HtmlFormCheckbox
169 169
 	 */
170
-	public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){
171
-		return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type));
170
+	public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) {
171
+		return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type));
172 172
 	}
173 173
 
174
-	public function addRadio($identifier, $name,$label=NULL,$value=NULL){
175
-		return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value));
174
+	public function addRadio($identifier, $name, $label=NULL, $value=NULL) {
175
+		return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value));
176 176
 	}
177 177
 
178
-	public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){
179
-		$div=new HtmlSemDoubleElement($identifier,$tagName,$baseClass,$content);
180
-		return $this->addItem(new HtmlFormField("field-".$identifier, $div,$label));
178
+	public function addElement($identifier, $content, $label, $tagName="div", $baseClass="") {
179
+		$div=new HtmlSemDoubleElement($identifier, $tagName, $baseClass, $content);
180
+		return $this->addItem(new HtmlFormField("field-".$identifier, $div, $label));
181 181
 	}
182 182
 }
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  *
25 25
  */
26 26
 class DataTable extends Widget {
27
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait,BaseTrait;
27
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait, BaseTrait;
28 28
 	protected $_searchField;
29 29
 	protected $_urls;
30 30
 	protected $_pagination;
@@ -42,35 +42,35 @@  discard block
 block discarded – undo
42 42
 	protected $_colWidths;
43 43
 
44 44
 
45
-	public function __construct($identifier,$model,$modelInstance=NULL) {
46
-		parent::__construct($identifier, $model,$modelInstance);
47
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
45
+	public function __construct($identifier, $model, $modelInstance=NULL) {
46
+		parent::__construct($identifier, $model, $modelInstance);
47
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
48 48
 		$this->_urls=[];
49
-		$this->_emptyMessage=new HtmlMessage("","nothing to display");
49
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
50 50
 		$this->_emptyMessage->setIcon("info circle");
51 51
 	}
52 52
 
53
-	public function run(JsUtils $js){
54
-		if($this->_hasCheckboxes && isset($js)){
53
+	public function run(JsUtils $js) {
54
+		if ($this->_hasCheckboxes && isset($js)) {
55 55
 			$this->_runCheckboxes($js);
56 56
 		}
57
-		if($this->_visibleHover){
58
-			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
59
-			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
57
+		if ($this->_visibleHover) {
58
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]);
59
+			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]);
60 60
 		}
61
-		if(\is_array($this->_deleteBehavior))
62
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
63
-		if(\is_array($this->_editBehavior))
64
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
61
+		if (\is_array($this->_deleteBehavior))
62
+			$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
63
+		if (\is_array($this->_editBehavior))
64
+			$this->_generateBehavior("edit", $this->_editBehavior, $js);
65 65
 		parent::run($js);
66 66
 	}
67 67
 
68 68
 
69 69
 
70
-	protected function _generateBehavior($op,$params,JsUtils $js){
71
-		if(isset($this->_urls[$op])){
72
-			$params=\array_merge($params,["attr"=>"data-ajax"]);
73
-			$js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector($op),$params);
70
+	protected function _generateBehavior($op, $params, JsUtils $js) {
71
+		if (isset($this->_urls[$op])) {
72
+			$params=\array_merge($params, ["attr"=>"data-ajax"]);
73
+			$js->ajaxOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector($op), $params);
74 74
 		}
75 75
 	}
76 76
 
@@ -83,164 +83,164 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 
86
-	public function compile(JsUtils $js=NULL,&$view=NULL){
87
-		if(!$this->_generated){
86
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
87
+		if (!$this->_generated) {
88 88
 			$this->_instanceViewer->setInstance($this->_model);
89 89
 			$captions=$this->_instanceViewer->getCaptions();
90 90
 			$table=$this->content["table"];
91
-			if($this->_hasCheckboxes){
91
+			if ($this->_hasCheckboxes) {
92 92
 				$this->_generateMainCheckbox($captions);
93 93
 			}
94 94
 			$table->setRowCount(0, \sizeof($captions));
95
-			$this->_generateHeader($table,$captions);
95
+			$this->_generateHeader($table, $captions);
96 96
 
97
-			if(isset($this->_compileParts))
97
+			if (isset($this->_compileParts))
98 98
 				$table->setCompileParts($this->_compileParts);
99 99
 
100 100
 			$this->_generateContent($table);
101 101
 
102
-			$this->compileExtraElements($table, $captions,$js);
102
+			$this->compileExtraElements($table, $captions, $js);
103 103
 
104
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
104
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
105 105
 			$this->_compileForm();
106 106
 			$this->_applyStyleAttributes($table);
107 107
 			$this->_generated=true;
108 108
 		}
109
-		return parent::compile($js,$view);
109
+		return parent::compile($js, $view);
110 110
 	}
111 111
 
112
-	protected function compileExtraElements($table,$captions,JsUtils $js=NULL){
113
-		if(isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])){
114
-				$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
112
+	protected function compileExtraElements($table, $captions, JsUtils $js=NULL) {
113
+		if (isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])) {
114
+				$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
115 115
 		}
116
-		if($this->_hasCheckboxes && $table->hasPart("thead")){
116
+		if ($this->_hasCheckboxes && $table->hasPart("thead")) {
117 117
 			$table->getHeader()->getCell(0, 0)->addClass("no-sort");
118 118
 		}
119 119
 
120
-		if(isset($this->_toolbar)){
120
+		if (isset($this->_toolbar)) {
121 121
 			$this->_setToolbarPosition($table, $captions);
122 122
 		}
123
-		if(isset($this->_pagination) && $this->_pagination->getVisible()){
124
-			$this->_generatePagination($table,$js);
123
+		if (isset($this->_pagination) && $this->_pagination->getVisible()) {
124
+			$this->_generatePagination($table, $js);
125 125
 		}
126 126
 	}
127 127
 
128
-	protected function _applyStyleAttributes($table){
129
-		if(isset($this->_hiddenColumns))
128
+	protected function _applyStyleAttributes($table) {
129
+		if (isset($this->_hiddenColumns))
130 130
 			$this->_hideColumns();
131
-			if(isset($this->_colWidths)){
132
-				foreach ($this->_colWidths as $colIndex=>$width){
133
-					$table->setColWidth($colIndex,$width);
131
+			if (isset($this->_colWidths)) {
132
+				foreach ($this->_colWidths as $colIndex=>$width) {
133
+					$table->setColWidth($colIndex, $width);
134 134
 				}
135 135
 			}
136 136
 	}
137 137
 
138
-	protected function _hideColumns(){
139
-		foreach ($this->_hiddenColumns as $colIndex){
138
+	protected function _hideColumns() {
139
+		foreach ($this->_hiddenColumns as $colIndex) {
140 140
 			$this->_self->hideColumn($colIndex);
141 141
 		}
142 142
 		return $this;
143 143
 	}
144 144
 
145
-	protected function _generateHeader(HtmlTable $table,$captions){
145
+	protected function _generateHeader(HtmlTable $table, $captions) {
146 146
 		$table->setHeaderValues($captions);
147
-		if(isset($this->_sortable)){
147
+		if (isset($this->_sortable)) {
148 148
 			$table->setSortable($this->_sortable);
149 149
 		}
150 150
 	}
151 151
 
152 152
 
153 153
 
154
-	protected function _generateContent($table){
154
+	protected function _generateContent($table) {
155 155
 		$objects=$this->_modelInstance;
156
-		if(isset($this->_pagination)){
156
+		if (isset($this->_pagination)) {
157 157
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
158 158
 		}
159 159
 			InstanceViewer::setIndex(0);
160 160
 			$table->fromDatabaseObjects($objects, function($instance) use($table){
161 161
 				return $this->_generateRow($instance, $table);
162 162
 			});
163
-		if($table->getRowCount()==0){
163
+		if ($table->getRowCount()==0) {
164 164
 			$result=$table->addRow();
165 165
 			$result->mergeRow();
166 166
 			$result->setValues([$this->_emptyMessage]);
167 167
 		}
168 168
 	}
169 169
 
170
-	protected function _generateRow($instance,&$table,$checkedClass=null){
170
+	protected function _generateRow($instance, &$table, $checkedClass=null) {
171 171
 		$this->_instanceViewer->setInstance($instance);
172 172
 		InstanceViewer::$index++;
173
-		$values= $this->_instanceViewer->getValues();
173
+		$values=$this->_instanceViewer->getValues();
174 174
 		$id=$this->_instanceViewer->getIdentifier();
175 175
 		$dataAjax=$id;
176 176
 		$id=$this->cleanIdentifier($id);
177
-		if($this->_hasCheckboxes){
178
-			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id,"");
177
+		if ($this->_hasCheckboxes) {
178
+			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, "");
179 179
 			$checked=false;
180
-			if(isset($this->_checkedCallback)){
180
+			if (isset($this->_checkedCallback)) {
181 181
 				$func=$this->_checkedCallback;
182 182
 				$checked=$func($instance);
183 183
 			}
184 184
 			$ck->setChecked($checked);
185 185
 			$ck->setOnChange("event.stopPropagation();");
186 186
 			$field=$ck->getField();
187
-			$field->setProperty("value",$dataAjax);
187
+			$field->setProperty("value", $dataAjax);
188 188
 			$field->setProperty("name", "selection[]");
189
-			if(isset($checkedClass))
189
+			if (isset($checkedClass))
190 190
 				$field->setClass($checkedClass);
191 191
 			\array_unshift($values, $ck);
192 192
 		}
193 193
 		$result=$table->newRow();
194 194
 		$result->setIdentifier($this->identifier."-tr-".$id);
195
-		$result->setProperty("data-ajax",$dataAjax);
195
+		$result->setProperty("data-ajax", $dataAjax);
196 196
 		$result->setValues($values);
197
-		$result->addToProperty("class",$this->_rowClass);
197
+		$result->addToProperty("class", $this->_rowClass);
198 198
 		return $result;
199 199
 	}
200 200
 
201
-	protected function _generatePagination($table,$js=NULL){
202
-		if(isset($this->_toolbar)){
203
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
201
+	protected function _generatePagination($table, $js=NULL) {
202
+		if (isset($this->_toolbar)) {
203
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
204 204
 				$this->_toolbar->setFloated("left");
205 205
 		}
206 206
 		$footer=$table->getFooter();
207 207
 		$footer->mergeCol();
208
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
208
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
209 209
 		$menu->floatRight();
210 210
 		$menu->setActiveItem($this->_pagination->getPage()-1);
211 211
 		$footer->addValues($menu);
212
-		$this->_associatePaginationBehavior($menu,$js);
212
+		$this->_associatePaginationBehavior($menu, $js);
213 213
 	}
214 214
 
215
-	protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){
216
-		if(isset($this->_urls["refresh"])){
217
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>false]);
215
+	protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) {
216
+		if (isset($this->_urls["refresh"])) {
217
+			$menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", $this->getRefreshSelector(), ["preventDefault"=>false, "jqueryDone"=>"replaceWith", "hasLoader"=>false]);
218 218
 		}
219 219
 	}
220 220
 
221
-	protected function _getFieldName($index){
221
+	protected function _getFieldName($index) {
222 222
 		$fieldName=parent::_getFieldName($index);
223
-		if(\is_object($fieldName))
223
+		if (\is_object($fieldName))
224 224
 			$fieldName="field-".$index;
225 225
 		return $fieldName."[]";
226 226
 	}
227 227
 
228
-	protected function _getFieldCaption($index){
228
+	protected function _getFieldCaption($index) {
229 229
 		return null;
230 230
 	}
231 231
 
232
-	protected function _setToolbarPosition($table,$captions=NULL){
233
-		switch ($this->_toolbarPosition){
232
+	protected function _setToolbarPosition($table, $captions=NULL) {
233
+		switch ($this->_toolbarPosition) {
234 234
 			case PositionInTable::BEFORETABLE:
235 235
 			case PositionInTable::AFTERTABLE:
236
-				if(isset($this->_compileParts)===false){
236
+				if (isset($this->_compileParts)===false) {
237 237
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
238 238
 				}
239 239
 				break;
240 240
 			case PositionInTable::HEADER:
241 241
 			case PositionInTable::FOOTER:
242 242
 			case PositionInTable::BODY:
243
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
243
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
244 244
 				break;
245 245
 		}
246 246
 	}
@@ -252,16 +252,16 @@  discard block
 block discarded – undo
252 252
 	 * @param callable $callback function called after the field compilation
253 253
 	 * @return DataTable
254 254
 	 */
255
-	public function afterCompile($index,$callback){
256
-		$this->_instanceViewer->afterCompile($index,$callback);
255
+	public function afterCompile($index, $callback) {
256
+		$this->_instanceViewer->afterCompile($index, $callback);
257 257
 		return $this;
258 258
 	}
259 259
 
260
-	private function addToolbarRow($part,$table,$captions){
260
+	private function addToolbarRow($part, $table, $captions) {
261 261
 		$hasPart=$table->hasPart($part);
262
-		if($hasPart){
262
+		if ($hasPart) {
263 263
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
264
-		}else{
264
+		} else {
265 265
 			$row=$table->getPart($part)->getRow(0);
266 266
 		}
267 267
 		$row->mergeCol();
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @see Widget::getHtmlComponent()
274 274
 	 * @return HtmlTable
275 275
 	 */
276
-	public function getHtmlComponent(){
276
+	public function getHtmlComponent() {
277 277
 		return $this->content["table"];
278 278
 	}
279 279
 
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 	 * @return DataTable
289 289
 	 */
290 290
 	public function setUrls($urls) {
291
-		if(\is_array($urls)){
292
-			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
293
-			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
294
-			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
295
-		}else{
296
-			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
291
+		if (\is_array($urls)) {
292
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
293
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
294
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
295
+		} else {
296
+			$this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls];
297 297
 		}
298 298
 		return $this;
299 299
 	}
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
307 307
 	 * @return DataTable
308 308
 	 */
309
-	public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){
310
-		$this->_pagination=new Pagination($items_per_page,$pages_visibles,$page,$total_rowcount);
309
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
310
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
311 311
 		return $this;
312 312
 	}
313 313
 
@@ -318,8 +318,8 @@  discard block
 block discarded – undo
318 318
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
319 319
 	 * @return DataTable
320 320
 	 */
321
-	public function autoPaginate($page=1,$items_per_page=10,$pages_visibles=4){
322
-		$this->_pagination=new Pagination($items_per_page,$pages_visibles,$page);
321
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
322
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
323 323
 		return $this;
324 324
 	}
325 325
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	 * @param array $compileParts
330 330
 	 * @return DataTable
331 331
 	 */
332
-	public function refresh($compileParts=["tbody"]){
332
+	public function refresh($compileParts=["tbody"]) {
333 333
 		$this->_compileParts=$compileParts;
334 334
 		return $this;
335 335
 	}
@@ -340,14 +340,14 @@  discard block
 block discarded – undo
340 340
 	 * @param string $position
341 341
 	 * @return \Ajax\common\html\HtmlDoubleElement
342 342
 	 */
343
-	public function addSearchInToolbar($position=Direction::RIGHT){
343
+	public function addSearchInToolbar($position=Direction::RIGHT) {
344 344
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
345 345
 	}
346 346
 
347
-	public function getSearchField(){
348
-		if(isset($this->_searchField)===false){
349
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
350
-			$this->_searchField->addIcon("search",Direction::RIGHT);
347
+	public function getSearchField() {
348
+		if (isset($this->_searchField)===false) {
349
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
350
+			$this->_searchField->addIcon("search", Direction::RIGHT);
351 351
 		}
352 352
 		return $this->_searchField;
353 353
 	}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * Returns a form corresponding to the Datatable
368 368
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
369 369
 	 */
370
-	public function asForm(){
370
+	public function asForm() {
371 371
 		return $this->getForm();
372 372
 	}
373 373
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
 	protected function getTargetSelector($op) {
377 377
 		$result=$this->_targetSelector;
378
-		if(!isset($result[$op]))
378
+		if (!isset($result[$op]))
379 379
 			$result="#".$this->identifier;
380 380
 		return $result[$op];
381 381
 	}
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
 	 * @return DataTable
387 387
 	 */
388 388
 	public function setTargetSelector($_targetSelector) {
389
-		if(!\is_array($_targetSelector)){
390
-			$_targetSelector=["edit"=>$_targetSelector,"delete"=>$_targetSelector];
389
+		if (!\is_array($_targetSelector)) {
390
+			$_targetSelector=["edit"=>$_targetSelector, "delete"=>$_targetSelector];
391 391
 		}
392 392
 		$this->_targetSelector=$_targetSelector;
393 393
 		return $this;
394 394
 	}
395 395
 
396 396
 	public function getRefreshSelector() {
397
-		if(isset($this->_refreshSelector))
397
+		if (isset($this->_refreshSelector))
398 398
 			return $this->_refreshSelector;
399 399
 		return "#".$this->identifier." tbody";
400 400
 	}
@@ -412,9 +412,9 @@  discard block
 block discarded – undo
412 412
 	 * {@inheritDoc}
413 413
 	 * @see \Ajax\common\Widget::show()
414 414
 	 */
415
-	public function show($modelInstance){
416
-		if(\is_array($modelInstance)){
417
-			if(isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
415
+	public function show($modelInstance) {
416
+		if (\is_array($modelInstance)) {
417
+			if (isset($modelInstance[0]) && \is_array(array_values($modelInstance)[0]))
418 418
 				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
419 419
 		}
420 420
 		$this->_modelInstance=$modelInstance;
@@ -449,29 +449,29 @@  discard block
 block discarded – undo
449 449
 		return $this;
450 450
 	}
451 451
 
452
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
453
-		$this->_self->setActiveRowSelector($class,$event,$multiple);
452
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
453
+		$this->_self->setActiveRowSelector($class, $event, $multiple);
454 454
 		return $this;
455 455
 	}
456 456
 
457
-	public function hideColumn($colIndex){
458
-		if(!\is_array($this->_hiddenColumns))
457
+	public function hideColumn($colIndex) {
458
+		if (!\is_array($this->_hiddenColumns))
459 459
 			$this->_hiddenColumns=[];
460 460
 		$this->_hiddenColumns[]=$colIndex;
461 461
 		return $this;
462 462
 	}
463 463
 
464
-	public function setColWidth($colIndex,$width){
464
+	public function setColWidth($colIndex, $width) {
465 465
 		$this->_colWidths[$colIndex]=$width;
466 466
 		return $this;
467 467
 	}
468 468
 	public function setColWidths($_colWidths) {
469
-		$this->_colWidths = $_colWidths;
469
+		$this->_colWidths=$_colWidths;
470 470
 		return $this;
471 471
 	}
472 472
 
473
-	public function setColAlignment($colIndex,$alignment){
474
-		$this->content["table"]->setColAlignment($colIndex,$alignment);
473
+	public function setColAlignment($colIndex, $alignment) {
474
+		$this->content["table"]->setColAlignment($colIndex, $alignment);
475 475
 		return $this;
476 476
 	}
477 477
 }
Please login to merge, or discard this patch.