Completed
Push — master ( a4feba...3ad5ef )
by Jean-Christophe
03:50
created
Ajax/service/AjaxCall.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	public function compile(JsUtils $js=null) {
17
-		if ($js==null)
18
-			return;
17
+		if ($js==null) {
18
+					return;
19
+		}
19 20
 		$params="{}";
20 21
 		$jsCallback=NULL;
21 22
 		$attr="id";
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@
 block discarded – undo
28 28
 		$method="get";
29 29
 		extract($this->parameters);
30 30
 		$result=$this->_eventPreparing($preventDefault, $stopPropagation);
31
-		switch($this->method) {
31
+		switch ($this->method) {
32 32
 			case "get":
33
-				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr,$jqueryDone,$ajaxTransition);
33
+				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr, $jqueryDone, $ajaxTransition);
34 34
 				break;
35 35
 			case "post":
36
-				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
36
+				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
37 37
 				break;
38 38
 			case "postForm":
39
-				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
39
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
40 40
 				break;
41 41
 			case "json":
42
-				$result.=$js->jsonDeferred($url,$method,$params,$jsCallback);
42
+				$result.=$js->jsonDeferred($url, $method, $params, $jsCallback);
43 43
 				break;
44 44
 			case "jsonArray":
45
-				$result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback);
45
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $params, $jsCallback);
46 46
 				break;
47 47
 		}
48 48
 		return $result;
49 49
 	}
50 50
 
51
-	protected function _eventPreparing($preventDefault,$stopPropagation){
51
+	protected function _eventPreparing($preventDefault, $stopPropagation) {
52 52
 		$result="";
53 53
 		if ($preventDefault===true) {
54 54
 			$result.=Javascript::$preventDefault;
Please login to merge, or discard this patch.
Ajax/common/components/SimpleComponent.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 
20 20
 	public function __construct(JsUtils $js=NULL) {
21 21
 		parent::__construct($js);
22
-		$this->events=array ();
22
+		$this->events=array();
23 23
 	}
24 24
 
25 25
 	protected function compileEvents() {
26
-		foreach ( $this->events as $event => $jsCode ) {
26
+		foreach ($this->events as $event => $jsCode) {
27 27
 			$itemSelector=JString::getValueBetween($event);
28 28
 			//echo $itemSelector.":::".$jsCode."<br>";
29
-			if($event=="execute"){
29
+			if ($event=="execute") {
30 30
 				$this->jquery_code_for_compile []=$jsCode;
31
-			}else if($event=="beforeExecute"){
31
+			} else if ($event=="beforeExecute") {
32 32
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
33
-			}else{
33
+			} else {
34 34
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
35 35
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
36 36
 			}
37 37
 		}
38 38
 	}
39 39
 
40
-	protected function _createSelector($itemSelector,$selector){
41
-		if(!isset($itemSelector))
40
+	protected function _createSelector($itemSelector, $selector) {
41
+		if (!isset($itemSelector))
42 42
 			$itemSelector=$this->itemSelector;
43
-		if(isset($itemSelector) && $itemSelector!=="")
43
+		if (isset($itemSelector) && $itemSelector!=="")
44 44
 			$selector.=" ".$itemSelector;
45 45
 		return $selector;
46 46
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$result=implode("\n", $this->jquery_code_for_compile);
50 50
 		$result=str_ireplace("\"%", "", $result);
51 51
 		$result=str_ireplace("%\"", "", $result);
52
-		$result=str_replace(array (
52
+		$result=str_replace(array(
53 53
 				"\\n",
54 54
 				"\\r",
55 55
 				"\\t"
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 	public function getScript() {
61 61
 		$allParams=$this->params;
62
-		$this->jquery_code_for_compile=array ();
62
+		$this->jquery_code_for_compile=array();
63 63
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");";
64 64
 		$this->compileEvents();
65 65
 		return $this->compileJQueryCode();
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 			//echo $itemSelector.":::".$jsCode."<br>";
29 29
 			if($event=="execute"){
30 30
 				$this->jquery_code_for_compile []=$jsCode;
31
-			}else if($event=="beforeExecute"){
31
+			} else if($event=="beforeExecute"){
32 32
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
33
-			}else{
33
+			} else{
34 34
 				$selector=$this->_createSelector($itemSelector, $this->attachTo);
35 35
 				$this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
36 36
 			}
@@ -38,10 +38,12 @@  discard block
 block discarded – undo
38 38
 	}
39 39
 
40 40
 	protected function _createSelector($itemSelector,$selector){
41
-		if(!isset($itemSelector))
42
-			$itemSelector=$this->itemSelector;
43
-		if(isset($itemSelector) && $itemSelector!=="")
44
-			$selector.=" ".$itemSelector;
41
+		if(!isset($itemSelector)) {
42
+					$itemSelector=$this->itemSelector;
43
+		}
44
+		if(isset($itemSelector) && $itemSelector!=="") {
45
+					$selector.=" ".$itemSelector;
46
+		}
45 47
 		return $selector;
46 48
 	}
47 49
 
@@ -84,8 +86,9 @@  discard block
 block discarded – undo
84 86
 
85 87
 	protected function setParamCtrl($key, $value, $typeCtrl) {
86 88
 		if (\is_array($typeCtrl)) {
87
-			if (array_search($value, $typeCtrl)===false)
88
-				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
89
+			if (array_search($value, $typeCtrl)===false) {
90
+							throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
91
+			}
89 92
 		} else {
90 93
 			if (!$typeCtrl($value)) {
91 94
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
Please login to merge, or discard this patch.
Ajax/service/JString.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -2,63 +2,63 @@
 block discarded – undo
2 2
 namespace Ajax\service;
3 3
 class JString {
4 4
 
5
-	public static function contains($hay,$needle){
6
-		return strpos($hay, $needle) !== false;
5
+	public static function contains($hay, $needle) {
6
+		return strpos($hay, $needle)!==false;
7 7
 	}
8 8
 	public static function startswith($hay, $needle) {
9
-		return substr($hay, 0, strlen($needle)) === $needle;
9
+		return substr($hay, 0, strlen($needle))===$needle;
10 10
 	}
11 11
 
12 12
 	public static function endswith($hay, $needle) {
13
-		return substr($hay, -strlen($needle)) === $needle;
13
+		return substr($hay, -strlen($needle))===$needle;
14 14
 	}
15 15
 
16
-	public static function isNull($s){
16
+	public static function isNull($s) {
17 17
 		return (!isset($s) || NULL===$s || ""===$s);
18 18
 	}
19
-	public static function isNotNull($s){
19
+	public static function isNotNull($s) {
20 20
 		return (isset($s) && NULL!==$s && ""!==$s);
21 21
 	}
22 22
 
23
-	public static function isBoolean($value){
23
+	public static function isBoolean($value) {
24 24
 		return \is_bool($value) || $value==1 || $value==0;
25 25
 	}
26 26
 
27
-	public static function isBooleanTrue($value){
27
+	public static function isBooleanTrue($value) {
28 28
 		return $value==1 || $value;
29 29
 	}
30 30
 
31
-	public static function isBooleanFalse($value){
31
+	public static function isBooleanFalse($value) {
32 32
 		return $value==0 || !$value;
33 33
 	}
34 34
 
35
-	public static function camelCaseToSeparated($input,$separator=" "){
35
+	public static function camelCaseToSeparated($input, $separator=" ") {
36 36
 		return strtolower(preg_replace('/(?<!^)[A-Z]/', $separator.'$0', $input));
37 37
 	}
38 38
 
39
-	public static function replaceAtFirst($subject,$from, $to){
40
-		$from = '/\A'.preg_quote($from, '/').'/';
39
+	public static function replaceAtFirst($subject, $from, $to) {
40
+		$from='/\A'.preg_quote($from, '/').'/';
41 41
 		return \preg_replace($from, $to, $subject, 1);
42 42
 	}
43 43
 
44
-	public static function replaceAtLast($subject,$from, $to){
45
-		$from = '/'.preg_quote($from, '/').'\z/';
44
+	public static function replaceAtLast($subject, $from, $to) {
45
+		$from='/'.preg_quote($from, '/').'\z/';
46 46
 		return \preg_replace($from, $to, $subject, 1);
47 47
 	}
48 48
 
49
-	public static function replaceAtFirstAndLast($subject,$fromFirst,$toFirst,$fromLast,$toLast){
49
+	public static function replaceAtFirstAndLast($subject, $fromFirst, $toFirst, $fromLast, $toLast) {
50 50
 		$s=self::replaceAtFirst($subject, $fromFirst, $toFirst);
51 51
 		return self::replaceAtLast($s, $fromLast, $toLast);
52 52
 	}
53 53
 
54
-	public static function getValueBetween(&$str,$before="{{",$after="}}"){
54
+	public static function getValueBetween(&$str, $before="{{", $after="}}") {
55 55
 		$matches=[];
56 56
 		$result=null;
57 57
 		$_before=\preg_quote($before);
58 58
 		$_after=\preg_quote($after);
59
-		if(\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1){
59
+		if (\preg_match('/'.$_before.'(.*?)'.$_after.'/s', $str, $matches)===1) {
60 60
 			$result=$matches[1];
61
-			$str=\str_replace($before.$result.$after,"", $str);
61
+			$str=\str_replace($before.$result.$after, "", $str);
62 62
 		}
63 63
 		return $result;
64 64
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/HtmlTable.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct($identifier, $rowCount, $colCount) {
29 29
 		parent::__construct($identifier, "table", "ui table");
30
-		$this->content=array ();
30
+		$this->content=array();
31 31
 		$this->setRowCount($rowCount, $colCount);
32
-		$this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ];
33
-		$this->_compileParts=["thead","tbody","tfoot"];
32
+		$this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT];
33
+		$this->_compileParts=["thead", "tbody", "tfoot"];
34 34
 		$this->_afterCompileEvents=[];
35 35
 	}
36 36
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 * @return HtmlTableContent
49 49
 	 */
50 50
 	public function getPart($key) {
51
-		if (\array_key_exists($key, $this->content) === false) {
51
+		if (\array_key_exists($key, $this->content)===false) {
52 52
 			$this->content[$key]=new HtmlTableContent("", $key);
53
-			if ($key !== "tbody") {
53
+			if ($key!=="tbody") {
54 54
 				$this->content[$key]->setRowCount(1, $this->_colCount);
55 55
 			}
56 56
 		}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return boolean
96 96
 	 */
97 97
 	public function hasPart($key) {
98
-		return \array_key_exists($key, $this->content) === true;
98
+		return \array_key_exists($key, $this->content)===true;
99 99
 	}
100 100
 
101 101
 	/**
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
 	private function colAlign($colIndex, $function) {
202 202
 		if (\is_array($colIndex)) {
203
-			foreach ( $colIndex as $cIndex ) {
203
+			foreach ($colIndex as $cIndex) {
204 204
 				$this->colAlign($cIndex, $function);
205 205
 			}
206 206
 		} else {
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
240 240
 	 */
241 241
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
242
-		if(\sizeof($this->_compileParts)<3){
242
+		if (\sizeof($this->_compileParts)<3) {
243 243
 			$this->_template="%content%";
244 244
 			$this->refresh();
245 245
 		}
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 
250 250
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
251 251
 		if ($this->propertyContains("class", "sortable")) {
252
-			$this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));");
252
+			$this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));");
253 253
 		}
254
-		if(isset($this->_activeRowSelector)){
254
+		if (isset($this->_activeRowSelector)) {
255 255
 			$this->_activeRowSelector->compile();
256 256
 		}
257 257
 	}
@@ -265,13 +265,13 @@  discard block
 block discarded – undo
265 265
 	public function fromDatabaseObject($object, $function) {
266 266
 		$result=$function($object);
267 267
 		if (\is_array($result)) {
268
-			$result= $this->addRow($function($object));
268
+			$result=$this->addRow($function($object));
269 269
 		} else {
270
-			$result= $this->getBody()->_addRow($result);
270
+			$result=$this->getBody()->_addRow($result);
271 271
 		}
272
-		if(isset($this->_afterCompileEvents["onNewRow"])){
273
-			if(\is_callable($this->_afterCompileEvents["onNewRow"]))
274
-				$this->_afterCompileEvents["onNewRow"]($result,$object);
272
+		if (isset($this->_afterCompileEvents["onNewRow"])) {
273
+			if (\is_callable($this->_afterCompileEvents["onNewRow"]))
274
+				$this->_afterCompileEvents["onNewRow"]($result, $object);
275 275
 		}
276 276
 		return $result;
277 277
 	}
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 		return $this;
286 286
 	}
287 287
 
288
-	public function refresh(){
288
+	public function refresh() {
289 289
 		$this->_footer=$this->getFooter();
290 290
 		$this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");');
291 291
 	}
292 292
 
293
-	public function run(JsUtils $js){
294
-		$result= parent::run($js);
295
-		if(isset($this->_footer))
293
+	public function run(JsUtils $js) {
294
+		$result=parent::run($js);
295
+		if (isset($this->_footer))
296 296
 			$this->_footer->run($js);
297 297
 		return $result;
298 298
 	}
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 		return $this;
309 309
 	}
310 310
 
311
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
312
-		$this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple);
311
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
312
+		$this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple);
313 313
 		return $this;
314 314
 	}
315 315
 }
316 316
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Ajax\semantic\html\collections\table\traits;
3 3
 
4
-trait TableTrait{
4
+trait TableTrait {
5 5
 	/**
6 6
 	 * @return HtmlTable
7 7
 	 */
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 	abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false);
10 10
 	abstract public function getOn($event, $url, $responseElement="", $parameters=array());
11 11
 
12
-	protected function addToPropertyTable($property,$value){
12
+	protected function addToPropertyTable($property, $value) {
13 13
 		return $this->getTable()->addToProperty($property, $value);
14 14
 	}
15 15
 
@@ -20,15 +20,15 @@  discard block
 block discarded – undo
20 20
 	public function setBasic($very=false) {
21 21
 		$table=$this->getTable();
22 22
 		if ($very)
23
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
24
-		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
23
+			$table->addToPropertyCtrl("class", "very", array("very"));
24
+		return $table->addToPropertyCtrl("class", "basic", array("basic"));
25 25
 	}
26 26
 
27 27
 	public function setCompact($very=false) {
28 28
 		$table=$this->getTable();
29 29
 		if ($very)
30
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
31
-		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
30
+			$table->addToPropertyCtrl("class", "very", array("very"));
31
+		return $table->addToPropertyCtrl("class", "compact", array("compact"));
32 32
 	}
33 33
 
34 34
 	public function setCollapsing() {
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 		return $this->addToPropertyTable("class", "striped");
68 68
 	}
69 69
 
70
-	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){
71
-		$this->onRowClick($jsCode,$stopPropagation,$preventDefault);
70
+	public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) {
71
+		$this->onRowClick($jsCode, $stopPropagation, $preventDefault);
72 72
 	}
73 73
 
74
-	public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){
75
-		$this->getTable()->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault);
74
+	public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
75
+		$this->getTable()->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault);
76 76
 	}
77 77
 
78
-	public function getOnRow($event, $url, $responseElement="", $parameters=array()){
79
-		$parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]);
80
-		return $this->getTable()->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters);
78
+	public function getOnRow($event, $url, $responseElement="", $parameters=array()) {
79
+		$parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]);
80
+		return $this->getTable()->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters);
81 81
 	}
82 82
 }
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/ActiveRow.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @param string $event
22 22
 	 * @param boolean $multiple
23 23
 	 */
24
-	public function __construct($table,$class="active",$event="click",$multiple=false){
24
+	public function __construct($table, $class="active", $event="click", $multiple=false) {
25 25
 		$this->table=$table;
26 26
 		$this->class=$class;
27 27
 		$this->event=$event;
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
 		return $this;
56 56
 	}
57 57
 
58
-	public function compile(){
58
+	public function compile() {
59 59
 		$multiple="";
60
-		if(!$this->multiple){
60
+		if (!$this->multiple) {
61 61
 			$multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');";
62 62
 		}
63
-		$this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false);
63
+		$this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false);
64 64
 	}
65 65
 
66 66
 }
67 67
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  */
25 25
 class DataTable extends Widget {
26
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait;
26
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait;
27 27
 	protected $_searchField;
28 28
 	protected $_urls;
29 29
 	protected $_pagination;
@@ -39,35 +39,35 @@  discard block
 block discarded – undo
39 39
 	protected $_sortable;
40 40
 
41 41
 
42
-	public function __construct($identifier,$model,$modelInstance=NULL) {
43
-		parent::__construct($identifier, $model,$modelInstance);
44
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
42
+	public function __construct($identifier, $model, $modelInstance=NULL) {
43
+		parent::__construct($identifier, $model, $modelInstance);
44
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
45 45
 		$this->_urls=[];
46
-		$this->_emptyMessage=new HtmlMessage("","nothing to display");
46
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
47 47
 		$this->_emptyMessage->setIcon("info circle");
48 48
 	}
49 49
 
50
-	public function run(JsUtils $js){
51
-		if($this->_hasCheckboxes && isset($js)){
50
+	public function run(JsUtils $js) {
51
+		if ($this->_hasCheckboxes && isset($js)) {
52 52
 			$this->_runCheckboxes($js);
53 53
 		}
54
-		if($this->_visibleHover){
55
-			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
56
-			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
54
+		if ($this->_visibleHover) {
55
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]);
56
+			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]);
57 57
 		}
58
-		if(\is_array($this->_deleteBehavior))
59
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
60
-		if(\is_array($this->_editBehavior))
61
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
58
+		if (\is_array($this->_deleteBehavior))
59
+			$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
60
+		if (\is_array($this->_editBehavior))
61
+			$this->_generateBehavior("edit", $this->_editBehavior, $js);
62 62
 		return parent::run($js);
63 63
 	}
64 64
 
65 65
 
66 66
 
67
-	protected function _generateBehavior($op,$params,JsUtils $js){
68
-		if(isset($this->_urls[$op])){
69
-			$params=\array_merge($params,["attr"=>"data-ajax"]);
70
-			$js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector(),$params);
67
+	protected function _generateBehavior($op, $params, JsUtils $js) {
68
+		if (isset($this->_urls[$op])) {
69
+			$params=\array_merge($params, ["attr"=>"data-ajax"]);
70
+			$js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector(), $params);
71 71
 		}
72 72
 	}
73 73
 
@@ -80,137 +80,137 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 
83
-	public function compile(JsUtils $js=NULL,&$view=NULL){
84
-		if(!$this->_generated){
83
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
84
+		if (!$this->_generated) {
85 85
 			$this->_instanceViewer->setInstance($this->_model);
86 86
 			$captions=$this->_instanceViewer->getCaptions();
87 87
 
88 88
 			$table=$this->content["table"];
89 89
 
90
-			if($this->_hasCheckboxes){
90
+			if ($this->_hasCheckboxes) {
91 91
 				$this->_generateMainCheckbox($captions);
92 92
 			}
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
-			if(isset($this->_searchField) && isset($js)){
101
-				if(isset($this->_urls["refresh"]))
102
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
100
+			if (isset($this->_searchField) && isset($js)) {
101
+				if (isset($this->_urls["refresh"]))
102
+					$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
103 103
 			}
104 104
 
105 105
 			$this->_generateContent($table);
106 106
 
107
-			if($this->_hasCheckboxes && $table->hasPart("thead")){
107
+			if ($this->_hasCheckboxes && $table->hasPart("thead")) {
108 108
 					$table->getHeader()->getCell(0, 0)->addClass("no-sort");
109 109
 			}
110 110
 
111
-			if(isset($this->_toolbar)){
111
+			if (isset($this->_toolbar)) {
112 112
 				$this->_setToolbarPosition($table, $captions);
113 113
 			}
114
-			if(isset($this->_pagination) && $this->_pagination->getVisible()){
115
-				$this->_generatePagination($table,$js);
114
+			if (isset($this->_pagination) && $this->_pagination->getVisible()) {
115
+				$this->_generatePagination($table, $js);
116 116
 			}
117 117
 
118
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
118
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
119 119
 			$this->_compileForm();
120 120
 
121 121
 			$this->_generated=true;
122 122
 		}
123
-		return parent::compile($js,$view);
123
+		return parent::compile($js, $view);
124 124
 	}
125 125
 
126
-	protected function _generateHeader(HtmlTable $table,$captions){
126
+	protected function _generateHeader(HtmlTable $table, $captions) {
127 127
 		$table->setHeaderValues($captions);
128
-		if(isset($this->_sortable)){
128
+		if (isset($this->_sortable)) {
129 129
 			$table->setSortable($this->_sortable);
130 130
 		}
131 131
 	}
132 132
 
133 133
 
134 134
 
135
-	protected function _generateContent($table){
135
+	protected function _generateContent($table) {
136 136
 		$objects=$this->_modelInstance;
137
-		if(isset($this->_pagination)){
137
+		if (isset($this->_pagination)) {
138 138
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
139 139
 		}
140 140
 			InstanceViewer::setIndex(0);
141 141
 			$table->fromDatabaseObjects($objects, function($instance) use($table){
142 142
 				return $this->_generateRow($instance, $table);
143 143
 			});
144
-		if($table->getRowCount()==0){
144
+		if ($table->getRowCount()==0) {
145 145
 			$result=$table->addRow();
146 146
 			$result->mergeRow();
147 147
 			$result->setValues([$this->_emptyMessage]);
148 148
 		}
149 149
 	}
150 150
 
151
-	protected function _generateRow($instance,&$table,$checkedClass=null){
151
+	protected function _generateRow($instance, &$table, $checkedClass=null) {
152 152
 		$this->_instanceViewer->setInstance($instance);
153 153
 		InstanceViewer::$index++;
154
-		$values= $this->_instanceViewer->getValues();
154
+		$values=$this->_instanceViewer->getValues();
155 155
 		$id=$this->_instanceViewer->getIdentifier();
156
-		if($this->_hasCheckboxes){
157
-			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id,"");
156
+		if ($this->_hasCheckboxes) {
157
+			$ck=new HtmlCheckbox("ck-".$this->identifier."-".$id, "");
158 158
 			$ck->setOnChange("event.stopPropagation();");
159 159
 			$field=$ck->getField();
160
-			$field->setProperty("value",$id);
160
+			$field->setProperty("value", $id);
161 161
 			$field->setProperty("name", "selection[]");
162
-			if(isset($checkedClass))
162
+			if (isset($checkedClass))
163 163
 				$field->setClass($checkedClass);
164 164
 			\array_unshift($values, $ck);
165 165
 		}
166 166
 		$result=$table->newRow();
167 167
 		$result->setIdentifier($this->identifier."-tr-".$id);
168
-		$result->setProperty("data-ajax",$id);
168
+		$result->setProperty("data-ajax", $id);
169 169
 		$result->setValues($values);
170
-		$result->addToProperty("class",$this->_rowClass);
170
+		$result->addToProperty("class", $this->_rowClass);
171 171
 		return $result;
172 172
 	}
173 173
 
174
-	protected function _generatePagination($table,$js=NULL){
175
-		if(isset($this->_toolbar)){
176
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
174
+	protected function _generatePagination($table, $js=NULL) {
175
+		if (isset($this->_toolbar)) {
176
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
177 177
 				$this->_toolbar->setFloated("left");
178 178
 		}
179 179
 		$footer=$table->getFooter();
180 180
 		$footer->mergeCol();
181
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
181
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
182 182
 		$menu->floatRight();
183 183
 		$menu->setActiveItem($this->_pagination->getPage()-1);
184 184
 		$footer->addValues($menu);
185
-		$this->_associatePaginationBehavior($menu,$js);
185
+		$this->_associatePaginationBehavior($menu, $js);
186 186
 	}
187 187
 
188
-	protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){
189
-		if(isset($this->_urls["refresh"])){
190
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
188
+	protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) {
189
+		if (isset($this->_urls["refresh"])) {
190
+			$menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", $this->getRefreshSelector(), ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
191 191
 		}
192 192
 	}
193 193
 
194
-	protected function _getFieldName($index){
194
+	protected function _getFieldName($index) {
195 195
 		return parent::_getFieldName($index)."[]";
196 196
 	}
197 197
 
198
-	protected function _getFieldCaption($index){
198
+	protected function _getFieldCaption($index) {
199 199
 		return null;
200 200
 	}
201 201
 
202
-	protected function _setToolbarPosition($table,$captions=NULL){
203
-		switch ($this->_toolbarPosition){
202
+	protected function _setToolbarPosition($table, $captions=NULL) {
203
+		switch ($this->_toolbarPosition) {
204 204
 			case PositionInTable::BEFORETABLE:
205 205
 			case PositionInTable::AFTERTABLE:
206
-				if(isset($this->_compileParts)===false){
206
+				if (isset($this->_compileParts)===false) {
207 207
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
208 208
 				}
209 209
 				break;
210 210
 			case PositionInTable::HEADER:
211 211
 			case PositionInTable::FOOTER:
212 212
 			case PositionInTable::BODY:
213
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
213
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
214 214
 				break;
215 215
 		}
216 216
 	}
@@ -222,23 +222,23 @@  discard block
 block discarded – undo
222 222
 	 * @param callable $callback function called after the field compilation
223 223
 	 * @return DataTable
224 224
 	 */
225
-	public function afterCompile($index,$callback){
226
-		$this->_instanceViewer->afterCompile($index,$callback);
225
+	public function afterCompile($index, $callback) {
226
+		$this->_instanceViewer->afterCompile($index, $callback);
227 227
 		return $this;
228 228
 	}
229 229
 
230
-	private function addToolbarRow($part,$table,$captions){
230
+	private function addToolbarRow($part, $table, $captions) {
231 231
 		$hasPart=$table->hasPart($part);
232
-		if($hasPart){
232
+		if ($hasPart) {
233 233
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
234
-		}else{
234
+		} else {
235 235
 			$row=$table->getPart($part)->getRow(0);
236 236
 		}
237 237
 		$row->mergeCol();
238 238
 		$row->setValues([$this->_toolbar]);
239 239
 	}
240 240
 
241
-	public function getHtmlComponent(){
241
+	public function getHtmlComponent() {
242 242
 		return $this->content["table"];
243 243
 	}
244 244
 
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
 	 * @return DataTable
253 253
 	 */
254 254
 	public function setUrls($urls) {
255
-		if(\is_array($urls)){
256
-			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
257
-			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
258
-			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
259
-		}else{
260
-			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
255
+		if (\is_array($urls)) {
256
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
257
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
258
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
259
+		} else {
260
+			$this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls];
261 261
 		}
262 262
 		return $this;
263 263
 	}
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
271 271
 	 * @return DataTable
272 272
 	 */
273
-	public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){
274
-		$this->_pagination=new Pagination($items_per_page,$pages_visibles,$page,$total_rowcount);
273
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
274
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
275 275
 		return $this;
276 276
 	}
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
283 283
 	 * @return DataTable
284 284
 	 */
285
-	public function autoPaginate($page=1,$items_per_page=10,$pages_visibles=4){
286
-		$this->_pagination=new Pagination($items_per_page,$pages_visibles,$page);
285
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
286
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
287 287
 		return $this;
288 288
 	}
289 289
 
@@ -293,20 +293,20 @@  discard block
 block discarded – undo
293 293
 	 * @param array $compileParts
294 294
 	 * @return DataTable
295 295
 	 */
296
-	public function refresh($compileParts=["tbody"]){
296
+	public function refresh($compileParts=["tbody"]) {
297 297
 		$this->_compileParts=$compileParts;
298 298
 		return $this;
299 299
 	}
300 300
 
301 301
 
302
-	public function addSearchInToolbar($position=Direction::RIGHT){
302
+	public function addSearchInToolbar($position=Direction::RIGHT) {
303 303
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
304 304
 	}
305 305
 
306
-	public function getSearchField(){
307
-		if(isset($this->_searchField)===false){
308
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
309
-			$this->_searchField->addIcon("search",Direction::RIGHT);
306
+	public function getSearchField() {
307
+		if (isset($this->_searchField)===false) {
308
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
309
+			$this->_searchField->addIcon("search", Direction::RIGHT);
310 310
 		}
311 311
 		return $this->_searchField;
312 312
 	}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 		return $this;
323 323
 	}
324 324
 
325
-	public function asForm(){
325
+	public function asForm() {
326 326
 		return $this->getForm();
327 327
 	}
328 328
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
 	protected function getTargetSelector() {
332 332
 		$result=$this->_targetSelector;
333
-		if(!isset($result))
333
+		if (!isset($result))
334 334
 			$result="#".$this->identifier;
335 335
 		return $result;
336 336
 	}
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	}
347 347
 
348 348
 	public function getRefreshSelector() {
349
-		if(isset($this->_refreshSelector))
349
+		if (isset($this->_refreshSelector))
350 350
 			return $this->_refreshSelector;
351 351
 		return "#".$this->identifier." tbody";
352 352
 	}
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * {@inheritDoc}
361 361
 	 * @see \Ajax\common\Widget::show()
362 362
 	 */
363
-	public function show($modelInstance){
364
-		if(\is_array($modelInstance)){
365
-			if(\is_array(array_values($modelInstance)[0]))
363
+	public function show($modelInstance) {
364
+		if (\is_array($modelInstance)) {
365
+			if (\is_array(array_values($modelInstance)[0]))
366 366
 				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
367 367
 		}
368 368
 		$this->_modelInstance=$modelInstance;
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 		return $this;
398 398
 	}
399 399
 
400
-	public function setActiveRowSelector($class="active",$event="click",$multiple=false){
401
-		$this->getTable()->setActiveRowSelector($class,$event,$multiple);
400
+	public function setActiveRowSelector($class="active", $event="click", $multiple=false) {
401
+		$this->getTable()->setActiveRowSelector($class, $event, $multiple);
402 402
 		return $this;
403 403
 	}
404 404
 
Please login to merge, or discard this patch.