Completed
Push — master ( 6831db...b65ced )
by Jean-Christophe
03:10
created
Ajax/semantic/widgets/dataelement/DataElement.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,45 +19,45 @@  discard block
 block discarded – undo
19 19
 class DataElement extends Widget {
20 20
 
21 21
 	public function __construct($identifier, $modelInstance=NULL) {
22
-		parent::__construct($identifier, null,$modelInstance);
23
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,2), false);
22
+		parent::__construct($identifier, null, $modelInstance);
23
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 2), false);
24 24
 		$this->content["table"]->setDefinition();
25 25
 	}
26 26
 
27
-	public function compile(JsUtils $js=NULL,&$view=NULL){
28
-		if(!$this->_generated){
27
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
28
+		if (!$this->_generated) {
29 29
 			$this->_instanceViewer->setInstance($this->_modelInstance);
30 30
 
31 31
 			$table=$this->content["table"];
32 32
 			$this->_generateContent($table);
33 33
 
34
-			if(isset($this->_toolbar)){
34
+			if (isset($this->_toolbar)) {
35 35
 				$this->_setToolbarPosition($table);
36 36
 			}
37
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
37
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
38 38
 			$this->_compileForm();
39 39
 			$this->_generated=true;
40 40
 		}
41
-		return parent::compile($js,$view);
41
+		return parent::compile($js, $view);
42 42
 	}
43 43
 
44 44
 	/**
45 45
 	 * @param HtmlTable $table
46 46
 	 */
47
-	protected function _generateContent($table){
47
+	protected function _generateContent($table) {
48 48
 		$captions=$this->_instanceViewer->getCaptions();
49
-		$values= $this->_instanceViewer->getValues();
49
+		$values=$this->_instanceViewer->getValues();
50 50
 		$count=$this->_instanceViewer->count();
51
-		for($i=0;$i<$count;$i++){
52
-			$table->addRow([$captions[$i],$values[$i]]);
51
+		for ($i=0; $i<$count; $i++) {
52
+			$table->addRow([$captions[$i], $values[$i]]);
53 53
 		}
54 54
 	}
55 55
 
56
-	protected function _getFieldName($index){
56
+	protected function _getFieldName($index) {
57 57
 		return $this->_instanceViewer->getFieldName($index);
58 58
 	}
59 59
 
60
-	protected function _getFieldCaption($index){
60
+	protected function _getFieldCaption($index) {
61 61
 		return null;
62 62
 	}
63 63
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		return $this;
90 90
 	}
91 91
 
92
-	public function asForm(){
92
+	public function asForm() {
93 93
 		return $this->getForm();
94 94
 	}
95 95
 }
96 96
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/AttachedTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,6 +16,6 @@
 block discarded – undo
16 16
 		if (isset($toElement)) {
17 17
 			$toElement->setAttached(true);
18 18
 		}
19
-		return $this->addToPropertyCtrl("class", $side . " attached", Side::getConstantValues("attached"));
19
+		return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
20 20
 	}
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/BaseTrait.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
  * @property string $identifier
13 13
  */
14 14
 trait BaseTrait {
15
-	protected $_variations=[ ];
16
-	protected $_states=[ ];
15
+	protected $_variations=[];
16
+	protected $_states=[];
17 17
 	protected $_baseClass;
18 18
 
19 19
 	abstract protected function setPropertyCtrl($name, $value, $typeCtrl);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 	abstract public function setProperty($name, $value);
28 28
 
29
-	abstract public function addContent($content,$before=false);
29
+	abstract public function addContent($content, $before=false);
30 30
 
31 31
 	abstract public function onCreate($jsCode);
32 32
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		$this->setProperty("class", $this->_baseClass);
48 48
 		if (\is_string($variations))
49 49
 			$variations=\explode(" ", $variations);
50
-		foreach ( $variations as $variation ) {
50
+		foreach ($variations as $variation) {
51 51
 			$this->addVariation($variation);
52 52
 		}
53 53
 		return $this;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public function addVariations($variations=array()) {
62 62
 		if (\is_string($variations))
63 63
 			$variations=\explode(" ", $variations);
64
-		foreach ( $variations as $variation ) {
64
+		foreach ($variations as $variation) {
65 65
 			$this->addVariation($variation);
66 66
 		}
67 67
 		return $this;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	public function addStates($states=array()) {
71 71
 		if (\is_string($states))
72 72
 			$states=\explode(" ", $states);
73
-		foreach ( $states as $state ) {
73
+		foreach ($states as $state) {
74 74
 			$this->addState($state);
75 75
 		}
76 76
 		return $this;
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
 		$this->setProperty("class", $this->_baseClass);
81 81
 		if (\is_string($states))
82 82
 			$states=\explode(" ", $states);
83
-		foreach ( $states as $state ) {
83
+		foreach ($states as $state) {
84 84
 			$this->addState($state);
85 85
 		}
86 86
 		return $this;
87 87
 	}
88 88
 
89 89
 	public function addIcon($icon, $before=true) {
90
-		return $this->addContent(new HtmlIcon("icon-" . $this->identifier, $icon), $before);
90
+		return $this->addContent(new HtmlIcon("icon-".$this->identifier, $icon), $before);
91 91
 	}
92 92
 
93
-	public function addSticky($context="body"){
93
+	public function addSticky($context="body") {
94 94
 		$this->onCreate("$('#".$this->identifier."').sticky({ context: '".$context."'});");
95 95
 		return $this;
96 96
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement
112 112
 	 */
113 113
 	public function setDisabled($disable=true) {
114
-		if($disable)
114
+		if ($disable)
115 115
 			$this->addToProperty("class", "disabled");
116 116
 		return $this;
117 117
 	}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
139 139
 	 */
140
-	public function asHeader(){
140
+	public function asHeader() {
141 141
 		return $this->addToProperty("class", "header");
142 142
 	}
143 143
 
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 * show it is currently the active user selection
146 146
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
147 147
 	 */
148
-	public function setActive($value=true){
149
-		if($value)
148
+	public function setActive($value=true) {
149
+		if ($value)
150 150
 			$this->addToProperty("class", "active");
151 151
 		return $this;
152 152
 	}
153 153
 
154
-	public function setAttached($value=true){
155
-		if($value)
156
-			$this->addToPropertyCtrl("class", "attached", array ("attached" ));
154
+	public function setAttached($value=true) {
155
+		if ($value)
156
+			$this->addToPropertyCtrl("class", "attached", array("attached"));
157 157
 		return $this;
158 158
 	}
159 159
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 
171 171
 	public function setFloated($direction="right") {
172
-		return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated"));
172
+		return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated"));
173 173
 	}
174 174
 
175 175
 	public function floatRight() {
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@  discard block
 block discarded – undo
45 45
 
46 46
 	public function setVariations($variations) {
47 47
 		$this->setProperty("class", $this->_baseClass);
48
-		if (\is_string($variations))
49
-			$variations=\explode(" ", $variations);
48
+		if (\is_string($variations)) {
49
+					$variations=\explode(" ", $variations);
50
+		}
50 51
 		foreach ( $variations as $variation ) {
51 52
 			$this->addVariation($variation);
52 53
 		}
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 	}
60 61
 
61 62
 	public function addVariations($variations=array()) {
62
-		if (\is_string($variations))
63
-			$variations=\explode(" ", $variations);
63
+		if (\is_string($variations)) {
64
+					$variations=\explode(" ", $variations);
65
+		}
64 66
 		foreach ( $variations as $variation ) {
65 67
 			$this->addVariation($variation);
66 68
 		}
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 	}
69 71
 
70 72
 	public function addStates($states=array()) {
71
-		if (\is_string($states))
72
-			$states=\explode(" ", $states);
73
+		if (\is_string($states)) {
74
+					$states=\explode(" ", $states);
75
+		}
73 76
 		foreach ( $states as $state ) {
74 77
 			$this->addState($state);
75 78
 		}
@@ -78,8 +81,9 @@  discard block
 block discarded – undo
78 81
 
79 82
 	public function setStates($states) {
80 83
 		$this->setProperty("class", $this->_baseClass);
81
-		if (\is_string($states))
82
-			$states=\explode(" ", $states);
84
+		if (\is_string($states)) {
85
+					$states=\explode(" ", $states);
86
+		}
83 87
 		foreach ( $states as $state ) {
84 88
 			$this->addState($state);
85 89
 		}
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
 	 * @return \Ajax\semantic\html\elements\HtmlSemDoubleElement
112 116
 	 */
113 117
 	public function setDisabled($disable=true) {
114
-		if($disable)
115
-			$this->addToProperty("class", "disabled");
118
+		if($disable) {
119
+					$this->addToProperty("class", "disabled");
120
+		}
116 121
 		return $this;
117 122
 	}
118 123
 
@@ -146,14 +151,16 @@  discard block
 block discarded – undo
146 151
 	 * @return \Ajax\semantic\html\base\HtmlSemDoubleElement
147 152
 	 */
148 153
 	public function setActive($value=true){
149
-		if($value)
150
-			$this->addToProperty("class", "active");
154
+		if($value) {
155
+					$this->addToProperty("class", "active");
156
+		}
151 157
 		return $this;
152 158
 	}
153 159
 
154 160
 	public function setAttached($value=true){
155
-		if($value)
156
-			$this->addToPropertyCtrl("class", "attached", array ("attached" ));
161
+		if($value) {
162
+					$this->addToPropertyCtrl("class", "attached", array ("attached" ));
163
+		}
157 164
 		return $this;
158 165
 	}
159 166
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FormTrait.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function setAttached($value=true){
44 44
 		$form=$this->getForm();
45
-		if($value)
46
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
45
+		if($value) {
46
+					$form->addToPropertyCtrl("class", "attached", array ("attached" ));
47
+		}
47 48
 		return $form;
48 49
 	}
49 50
 
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 		if(isset($url) && isset($responseElement)){
86 87
 			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');");
87 88
 			$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url];
88
-			if(\is_array($parameters))
89
-				$params=\array_merge($params,$parameters);
89
+			if(\is_array($parameters)) {
90
+							$params=\array_merge($params,$parameters);
91
+			}
90 92
 			$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
91 93
 		}
92 94
 		return $button;
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@  discard block
 block discarded – undo
6 6
 use Ajax\service\AjaxCall;
7 7
 use Ajax\JsUtils;
8 8
 
9
-trait FormTrait{
9
+trait FormTrait {
10 10
 
11 11
 	/**
12 12
 	 * @return HtmlForm
13 13
 	 */
14 14
 	abstract protected function getForm();
15 15
 
16
-	protected function addCompoValidation($compo,$field){
16
+	protected function addCompoValidation($compo, $field) {
17 17
 		$validation=$field->getValidation();
18
-		if(isset($validation)){
18
+		if (isset($validation)) {
19 19
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
20 20
 			$compo->addFieldValidation($validation);
21 21
 		}
22 22
 		return $compo;
23 23
 	}
24 24
 
25
-	protected function _runValidationParams(&$compo,JsUtils $js=NULL){
25
+	protected function _runValidationParams(&$compo, JsUtils $js=NULL) {
26 26
 		$form=$this->getForm();
27 27
 		$params=$form->getValidationParams();
28
-		if(isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall){
28
+		if (isset($params["_ajaxSubmit"]) && $params["_ajaxSubmit"] instanceof AjaxCall) {
29 29
 			$compilation=$params["_ajaxSubmit"]->compile($js);
30
-			$compilation=str_ireplace("\"","%quote%", $compilation);
30
+			$compilation=str_ireplace("\"", "%quote%", $compilation);
31 31
 			$this->onSuccess($compilation);
32 32
 			$form->removeValidationParam("_ajaxSubmit");
33 33
 		}
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 		return $this->getForm()->addToProperty("class", "loading");
41 41
 	}
42 42
 
43
-	public function setAttached($value=true){
43
+	public function setAttached($value=true) {
44 44
 		$form=$this->getForm();
45
-		if($value)
46
-			$form->addToPropertyCtrl("class", "attached", array ("attached" ));
45
+		if ($value)
46
+			$form->addToPropertyCtrl("class", "attached", array("attached"));
47 47
 		return $form;
48 48
 	}
49 49
 
50
-	public function addErrorMessage(){
50
+	public function addErrorMessage() {
51 51
 		return $this->getForm()->addContent((new HtmlMessage(""))->setError());
52 52
 	}
53 53
 
@@ -62,38 +62,38 @@  discard block
 block discarded – undo
62 62
 	 * @param string $responseElement
63 63
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
64 64
 	 */
65
-	public function submitOn($event,$identifier,$url,$responseElement){
65
+	public function submitOn($event, $identifier, $url, $responseElement) {
66 66
 		$form=$this->getForm();
67 67
 		$elem=$form->getElementById($identifier, $form->getContent());
68
-		if(isset($elem)){
69
-			$this->_buttonAsSubmit($elem, $event,$url,$responseElement);
68
+		if (isset($elem)) {
69
+			$this->_buttonAsSubmit($elem, $event, $url, $responseElement);
70 70
 		}
71 71
 		return $form;
72 72
 	}
73 73
 
74
-	public function submitOnClick($identifier,$url,$responseElement){
74
+	public function submitOnClick($identifier, $url, $responseElement) {
75 75
 		return $this->submitOn("click", $identifier, $url, $responseElement);
76 76
 	}
77 77
 
78
-	public function addSubmit($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){
79
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
80
-		return $this->_buttonAsSubmit($bt, "click",$url,$responseElement);
78
+	public function addSubmit($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) {
79
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
80
+		return $this->_buttonAsSubmit($bt, "click", $url, $responseElement);
81 81
 	}
82 82
 
83
-	protected function _buttonAsSubmit(&$button,$event,$url,$responseElement=NULL,$parameters=NULL){
83
+	protected function _buttonAsSubmit(&$button, $event, $url, $responseElement=NULL, $parameters=NULL) {
84 84
 		$form=$this->getForm();
85
-		if(isset($url) && isset($responseElement)){
85
+		if (isset($url) && isset($responseElement)) {
86 86
 			$button->addEvent($event, "$('#".$form->getIdentifier()."').form('validate form');");
87
-			$params=["form"=>$form->getIdentifier(),"responseElement"=>$responseElement,"url"=>$url];
88
-			if(\is_array($parameters))
89
-				$params=\array_merge($params,$parameters);
87
+			$params=["form"=>$form->getIdentifier(), "responseElement"=>$responseElement, "url"=>$url];
88
+			if (\is_array($parameters))
89
+				$params=\array_merge($params, $parameters);
90 90
 			$form->addValidationParam("_ajaxSubmit", new AjaxCall("postForm", $params));
91 91
 		}
92 92
 		return $button;
93 93
 	}
94 94
 
95
-	public function addReset($identifier,$value,$cssStyle=NULL){
96
-		$bt=$this->getForm()->addButton($identifier, $value,$cssStyle);
95
+	public function addReset($identifier, $value, $cssStyle=NULL) {
96
+		$bt=$this->getForm()->addButton($identifier, $value, $cssStyle);
97 97
 		$bt->setProperty("type", "reset");
98 98
 		return $bt;
99 99
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @param string $jsCode
104 104
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
105 105
 	 */
106
-	public function onValid($jsCode){
106
+	public function onValid($jsCode) {
107 107
 		$form=$this->getForm();
108 108
 		$form->addValidationParam("onValid", "%function(){".$jsCode."}%");
109 109
 		return $form;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 * @param string $jsCode can use event and fields parameters
115 115
 	 * @return HtmlForm
116 116
 	 */
117
-	public function onSuccess($jsCode){
117
+	public function onSuccess($jsCode) {
118 118
 		$form=$this->getForm();
119 119
 		$form->addValidationParam("onSuccess", "%function(event,fields){console.log(fields);".$jsCode."}%");
120 120
 		return $form;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/table/traits/TableTrait.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  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
 	 */
8 8
 	abstract protected function getTable();
9 9
 
10
-	protected function addToPropertyTable($property,$value){
10
+	protected function addToPropertyTable($property, $value) {
11 11
 		return $this->getTable()->addToProperty($property, $value);
12 12
 	}
13 13
 
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
 	public function setBasic($very=false) {
19 19
 		$table=$this->getTable();
20 20
 		if ($very)
21
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
22
-		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
21
+			$table->addToPropertyCtrl("class", "very", array("very"));
22
+		return $table->addToPropertyCtrl("class", "basic", array("basic"));
23 23
 	}
24 24
 
25 25
 	public function setCompact($very=false) {
26 26
 		$table=$this->getTable();
27 27
 		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
29
-		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
28
+			$table->addToPropertyCtrl("class", "very", array("very"));
29
+		return $table->addToPropertyCtrl("class", "compact", array("compact"));
30 30
 	}
31 31
 
32 32
 	public function setCollapsing() {
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,15 +17,17 @@
 block discarded – undo
17 17
 
18 18
 	public function setBasic($very=false) {
19 19
 		$table=$this->getTable();
20
-		if ($very)
21
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
20
+		if ($very) {
21
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
22
+		}
22 23
 		return $table->addToPropertyCtrl("class", "basic", array ("basic" ));
23 24
 	}
24 25
 
25 26
 	public function setCompact($very=false) {
26 27
 		$table=$this->getTable();
27
-		if ($very)
28
-			$table->addToPropertyCtrl("class", "very", array ("very" ));
28
+		if ($very) {
29
+					$table->addToPropertyCtrl("class", "very", array ("very" ));
30
+		}
29 31
 		return $table->addToPropertyCtrl("class", "compact", array ("compact" ));
30 32
 	}
31 33
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/InstanceViewer.php 2 patches
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -17,183 +17,183 @@  discard block
 block discarded – undo
17 17
 
18 18
 	public static $index=0;
19 19
 
20
-	public function __construct($identifier,$instance=NULL,$captions=NULL){
20
+	public function __construct($identifier, $instance=NULL, $captions=NULL) {
21 21
 		$this->widgetIdentifier=$identifier;
22 22
 		$this->values=[];
23 23
 		$this->afterCompile=[];
24
-		if(isset($instance))
24
+		if (isset($instance))
25 25
 			$this->setInstance($instance);
26 26
 		$this->setCaptions($captions);
27 27
 		$this->captionCallback=NULL;
28
-		$this->defaultValueFunction=function($name,$value){return $value;};
28
+		$this->defaultValueFunction=function($name, $value) {return $value; };
29 29
 	}
30 30
 
31
-	public function getValues(){
31
+	public function getValues() {
32 32
 		$values=[];
33 33
 		$index=0;
34 34
 		$count=$this->count();
35
-		while($index<$count){
35
+		while ($index<$count) {
36 36
 			$values[]=$this->getValue($index++);
37 37
 		}
38 38
 		return $values;
39 39
 	}
40 40
 
41
-	public function getIdentifier($index=NULL){
42
-		if(!isset($index))
41
+	public function getIdentifier($index=NULL) {
42
+		if (!isset($index))
43 43
 			$index=self::$index;
44 44
 		$value=$index;
45
-		if(isset($this->values["identifier"]))
46
-			$value=$this->values["identifier"]($index,$this->instance);
45
+		if (isset($this->values["identifier"]))
46
+			$value=$this->values["identifier"]($index, $this->instance);
47 47
 		return $value;
48 48
 	}
49 49
 
50
-	public function getValue($index){
50
+	public function getValue($index) {
51 51
 		$property=$this->properties[$index];
52 52
 		return $this->_getValue($property, $index);
53 53
 	}
54 54
 
55
-	protected function _beforeAddProperty($index,&$field){
55
+	protected function _beforeAddProperty($index, &$field) {
56 56
 
57 57
 	}
58 58
 
59
-	protected function _getDefaultValue($name,$value,$index){
59
+	protected function _getDefaultValue($name, $value, $index) {
60 60
 		$func=$this->defaultValueFunction;
61
-		return $func($name,$value,$index,$this->instance);
61
+		return $func($name, $value, $index, $this->instance);
62 62
 	}
63 63
 
64
-	protected function _getValue($property,$index){
65
-		if($property instanceof \ReflectionProperty){
64
+	protected function _getValue($property, $index) {
65
+		if ($property instanceof \ReflectionProperty) {
66 66
 			$property->setAccessible(true);
67 67
 			$value=$property->getValue($this->instance);
68
-			if(isset($this->values[$index])){
69
-				$value= $this->values[$index]($value,$this->instance,$index);
70
-			}else{
71
-				$value=$this->_getDefaultValue($property->getName(),$value, $index);
68
+			if (isset($this->values[$index])) {
69
+				$value=$this->values[$index]($value, $this->instance, $index);
70
+			} else {
71
+				$value=$this->_getDefaultValue($property->getName(), $value, $index);
72 72
 			}
73
-		}else{
74
-			if(\is_callable($property))
73
+		} else {
74
+			if (\is_callable($property))
75 75
 				$value=$property($this->instance);
76
-			elseif(\is_array($property)){
77
-				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
76
+			elseif (\is_array($property)) {
77
+				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index); }, $property);
78 78
 				$value=\implode("", $values);
79
-			}else{
80
-				if(isset($this->values[$index])){
81
-					$value= $this->values[$index]($property,$this->instance,$index);
82
-				}elseif(isset($this->instance->{$property})){
79
+			} else {
80
+				if (isset($this->values[$index])) {
81
+					$value=$this->values[$index]($property, $this->instance, $index);
82
+				}elseif (isset($this->instance->{$property})) {
83 83
 					$value=$this->instance->{$property};
84 84
 				}
85
-				else{
85
+				else {
86 86
 					$value=null;
87 87
 				}
88 88
 			}
89 89
 		}
90
-		if(isset($this->afterCompile[$index])){
91
-			if(\is_callable($this->afterCompile[$index])){
92
-				$this->afterCompile[$index]($value,$this->instance,$index);
90
+		if (isset($this->afterCompile[$index])) {
91
+			if (\is_callable($this->afterCompile[$index])) {
92
+				$this->afterCompile[$index]($value, $this->instance, $index);
93 93
 			}
94 94
 		}
95 95
 		return $value;
96 96
 	}
97 97
 
98
-	public function insertField($index,$field){
99
-		array_splice( $this->visibleProperties, $index, 0, $field );
98
+	public function insertField($index, $field) {
99
+		array_splice($this->visibleProperties, $index, 0, $field);
100 100
 		return $this;
101 101
 	}
102 102
 
103
-	public function insertInField($index,$field){
103
+	public function insertInField($index, $field) {
104 104
 		$vb=$this->visibleProperties;
105
-		if(isset($vb[$index])){
106
-			if(\is_array($vb[$index])){
105
+		if (isset($vb[$index])) {
106
+			if (\is_array($vb[$index])) {
107 107
 				$this->visibleProperties[$index][]=$field;
108
-			}else{
109
-				$this->visibleProperties[$index]=[$vb[$index],$field];
108
+			} else {
109
+				$this->visibleProperties[$index]=[$vb[$index], $field];
110 110
 			}
111
-		}else{
111
+		} else {
112 112
 			return $this->insertField($index, $field);
113 113
 		}
114 114
 		return $this;
115 115
 	}
116 116
 
117
-	public function addField($field){
117
+	public function addField($field) {
118 118
 		$this->visibleProperties[]=$field;
119 119
 		return $this;
120 120
 	}
121 121
 
122
-	public function count(){
122
+	public function count() {
123 123
 		return \sizeof($this->properties);
124 124
 	}
125 125
 
126
-	public function visiblePropertiesCount(){
126
+	public function visiblePropertiesCount() {
127 127
 		return \sizeof($this->visibleProperties);
128 128
 	}
129 129
 
130
-	public function getProperty($index){
130
+	public function getProperty($index) {
131 131
 		return $this->properties[$index];
132 132
 	}
133 133
 
134
-	public function getFieldName($index){
134
+	public function getFieldName($index) {
135 135
 		$property=$this->getProperty($index);
136
-		if($property instanceof \ReflectionProperty){
136
+		if ($property instanceof \ReflectionProperty) {
137 137
 			$result=$property->getName();
138
-		}elseif(\is_callable($property)){
138
+		}elseif (\is_callable($property)) {
139 139
 			$result=$this->visibleProperties[$index];
140
-		}else{
140
+		} else {
141 141
 			$result=$property;
142 142
 		}
143 143
 		return $result;
144 144
 	}
145 145
 
146 146
 
147
-	protected function showableProperty(\ReflectionProperty $rProperty){
148
-		return JString::startswith($rProperty->getName(),"_")===false;
147
+	protected function showableProperty(\ReflectionProperty $rProperty) {
148
+		return JString::startswith($rProperty->getName(), "_")===false;
149 149
 	}
150 150
 
151 151
 	public function setInstance($instance) {
152
-		if(\is_string($instance)){
152
+		if (\is_string($instance)) {
153 153
 			$instance=new $instance();
154 154
 		}
155 155
 		$this->instance=$instance;
156 156
 		$this->properties=[];
157 157
 		$this->reflect=new \ReflectionClass($instance);
158
-		if(\sizeof($this->visibleProperties)===0){
158
+		if (\sizeof($this->visibleProperties)===0) {
159 159
 			$this->properties=$this->getDefaultProperties();
160
-		}else{
161
-			foreach ($this->visibleProperties as $property){
160
+		} else {
161
+			foreach ($this->visibleProperties as $property) {
162 162
 				$this->setInstanceProperty($property);
163 163
 			}
164 164
 		}
165 165
 		return $this;
166 166
 	}
167 167
 
168
-	private function setInstanceProperty($property){
169
-		if(\is_callable($property)){
168
+	private function setInstanceProperty($property) {
169
+		if (\is_callable($property)) {
170 170
 			$this->properties[]=$property;
171
-		}elseif(\is_string($property)){
172
-			try{
171
+		}elseif (\is_string($property)) {
172
+			try {
173 173
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
174 174
 				$rProperty=$this->reflect->getProperty($property);
175 175
 				$this->properties[]=$rProperty;
176
-			}catch(\Exception $e){
176
+			}catch (\Exception $e) {
177 177
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
178 178
 				$this->properties[]=$property;
179 179
 			}
180
-		}elseif(\is_int($property)){
180
+		}elseif (\is_int($property)) {
181 181
 			$props=$this->getDefaultProperties();
182
-			if(isset($props[$property]))
182
+			if (isset($props[$property]))
183 183
 				$this->properties[]=$props[$property];
184 184
 				else
185 185
 					$this->properties[]=$property;
186
-		}else{
186
+		} else {
187 187
 			$this->properties[]=$property;
188 188
 		}
189 189
 	}
190 190
 
191
-	protected function getDefaultProperties(){
191
+	protected function getDefaultProperties() {
192 192
 		$result=[];
193 193
 		$properties=$this->reflect->getProperties();
194
-		foreach ($properties as $property){
194
+		foreach ($properties as $property) {
195 195
 			$showable=$this->showableProperty($property);
196
-			if($showable!==false){
196
+			if ($showable!==false) {
197 197
 				$result[]=$property;
198 198
 			}
199 199
 		}
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 		return $this;
206 206
 	}
207 207
 
208
-	public function setValueFunction($index,$callback){
208
+	public function setValueFunction($index, $callback) {
209 209
 		$this->values[$index]=$callback;
210 210
 		return $this;
211 211
 	}
212 212
 
213
-	public function setIdentifierFunction($callback){
213
+	public function setIdentifierFunction($callback) {
214 214
 		$this->values["identifier"]=$callback;
215 215
 		return $this;
216 216
 	}
@@ -223,41 +223,41 @@  discard block
 block discarded – undo
223 223
 		return $this->properties;
224 224
 	}
225 225
 
226
-	public function getCaption($index){
227
-		if(isset($this->captions[$index])){
226
+	public function getCaption($index) {
227
+		if (isset($this->captions[$index])) {
228 228
 			return $this->captions[$index];
229 229
 		}
230
-		if($this->properties[$index] instanceof \ReflectionProperty)
230
+		if ($this->properties[$index] instanceof \ReflectionProperty)
231 231
 			return $this->properties[$index]->getName();
232
-		elseif(\is_callable($this->properties[$index]))
232
+		elseif (\is_callable($this->properties[$index]))
233 233
 			return "";
234 234
 		else
235 235
 			return $this->properties[$index];
236 236
 	}
237 237
 
238
-	public function getCaptions(){
239
-		if(isset($this->captions)){
240
-			$captions= $this->captions;
241
-			for($i=\sizeof($captions);$i<$this->count();$i++){
238
+	public function getCaptions() {
239
+		if (isset($this->captions)) {
240
+			$captions=$this->captions;
241
+			for ($i=\sizeof($captions); $i<$this->count(); $i++) {
242 242
 				$captions[]="";
243 243
 			}
244
-		}else{
244
+		} else {
245 245
 			$captions=[];
246 246
 			$index=0;
247 247
 			$count=$this->count();
248
-			while($index<$count){
248
+			while ($index<$count) {
249 249
 				$captions[]=$this->getCaption($index++);
250 250
 			}
251 251
 		}
252
-		if(isset($this->captionCallback) && \is_callable($this->captionCallback)){
252
+		if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
253 253
 			$callback=$this->captionCallback;
254
-			$callback($captions,$this->instance);
254
+			$callback($captions, $this->instance);
255 255
 		}
256 256
 		return $captions;
257 257
 	}
258 258
 
259
-	public function setCaption($index,$caption){
260
-		if(isset($this->captions)===false)
259
+	public function setCaption($index, $caption) {
260
+		if (isset($this->captions)===false)
261 261
 			$this->captions=[];
262 262
 		$this->captions[$index]=$caption;
263 263
 		return $this;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 * @param callable $callback function called after the field compilation
276 276
 	 * @return \Ajax\semantic\widgets\datatable\InstanceViewer
277 277
 	 */
278
-	public function afterCompile($index,$callback){
278
+	public function afterCompile($index, $callback) {
279 279
 		$this->afterCompile[$index]=$callback;
280 280
 		return $this;
281 281
 	}
Please login to merge, or discard this patch.
Braces   +42 added lines, -37 removed lines patch added patch discarded remove patch
@@ -21,8 +21,9 @@  discard block
 block discarded – undo
21 21
 		$this->widgetIdentifier=$identifier;
22 22
 		$this->values=[];
23 23
 		$this->afterCompile=[];
24
-		if(isset($instance))
25
-			$this->setInstance($instance);
24
+		if(isset($instance)) {
25
+					$this->setInstance($instance);
26
+		}
26 27
 		$this->setCaptions($captions);
27 28
 		$this->captionCallback=NULL;
28 29
 		$this->defaultValueFunction=function($name,$value){return $value;};
@@ -39,11 +40,13 @@  discard block
 block discarded – undo
39 40
 	}
40 41
 
41 42
 	public function getIdentifier($index=NULL){
42
-		if(!isset($index))
43
-			$index=self::$index;
43
+		if(!isset($index)) {
44
+					$index=self::$index;
45
+		}
44 46
 		$value=$index;
45
-		if(isset($this->values["identifier"]))
46
-			$value=$this->values["identifier"]($index,$this->instance);
47
+		if(isset($this->values["identifier"])) {
48
+					$value=$this->values["identifier"]($index,$this->instance);
49
+		}
47 50
 		return $value;
48 51
 	}
49 52
 
@@ -67,22 +70,21 @@  discard block
 block discarded – undo
67 70
 			$value=$property->getValue($this->instance);
68 71
 			if(isset($this->values[$index])){
69 72
 				$value= $this->values[$index]($value,$this->instance,$index);
70
-			}else{
73
+			} else{
71 74
 				$value=$this->_getDefaultValue($property->getName(),$value, $index);
72 75
 			}
73
-		}else{
74
-			if(\is_callable($property))
75
-				$value=$property($this->instance);
76
-			elseif(\is_array($property)){
76
+		} else{
77
+			if(\is_callable($property)) {
78
+							$value=$property($this->instance);
79
+			} elseif(\is_array($property)){
77 80
 				$values=\array_map(function($v) use ($index){return $this->_getValue($v, $index);}, $property);
78 81
 				$value=\implode("", $values);
79
-			}else{
82
+			} else{
80 83
 				if(isset($this->values[$index])){
81 84
 					$value= $this->values[$index]($property,$this->instance,$index);
82
-				}elseif(isset($this->instance->{$property})){
85
+				} elseif(isset($this->instance->{$property})){
83 86
 					$value=$this->instance->{$property};
84
-				}
85
-				else{
87
+				} else{
86 88
 					$value=null;
87 89
 				}
88 90
 			}
@@ -105,10 +107,10 @@  discard block
 block discarded – undo
105 107
 		if(isset($vb[$index])){
106 108
 			if(\is_array($vb[$index])){
107 109
 				$this->visibleProperties[$index][]=$field;
108
-			}else{
110
+			} else{
109 111
 				$this->visibleProperties[$index]=[$vb[$index],$field];
110 112
 			}
111
-		}else{
113
+		} else{
112 114
 			return $this->insertField($index, $field);
113 115
 		}
114 116
 		return $this;
@@ -135,9 +137,9 @@  discard block
 block discarded – undo
135 137
 		$property=$this->getProperty($index);
136 138
 		if($property instanceof \ReflectionProperty){
137 139
 			$result=$property->getName();
138
-		}elseif(\is_callable($property)){
140
+		} elseif(\is_callable($property)){
139 141
 			$result=$this->visibleProperties[$index];
140
-		}else{
142
+		} else{
141 143
 			$result=$property;
142 144
 		}
143 145
 		return $result;
@@ -157,7 +159,7 @@  discard block
 block discarded – undo
157 159
 		$this->reflect=new \ReflectionClass($instance);
158 160
 		if(\sizeof($this->visibleProperties)===0){
159 161
 			$this->properties=$this->getDefaultProperties();
160
-		}else{
162
+		} else{
161 163
 			foreach ($this->visibleProperties as $property){
162 164
 				$this->setInstanceProperty($property);
163 165
 			}
@@ -168,22 +170,23 @@  discard block
 block discarded – undo
168 170
 	private function setInstanceProperty($property){
169 171
 		if(\is_callable($property)){
170 172
 			$this->properties[]=$property;
171
-		}elseif(\is_string($property)){
173
+		} elseif(\is_string($property)){
172 174
 			try{
173 175
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
174 176
 				$rProperty=$this->reflect->getProperty($property);
175 177
 				$this->properties[]=$rProperty;
176
-			}catch(\Exception $e){
178
+			} catch(\Exception $e){
177 179
 				$this->_beforeAddProperty(\sizeof($this->properties), $property);
178 180
 				$this->properties[]=$property;
179 181
 			}
180
-		}elseif(\is_int($property)){
182
+		} elseif(\is_int($property)){
181 183
 			$props=$this->getDefaultProperties();
182
-			if(isset($props[$property]))
183
-				$this->properties[]=$props[$property];
184
-				else
185
-					$this->properties[]=$property;
186
-		}else{
184
+			if(isset($props[$property])) {
185
+							$this->properties[]=$props[$property];
186
+			} else {
187
+									$this->properties[]=$property;
188
+				}
189
+		} else{
187 190
 			$this->properties[]=$property;
188 191
 		}
189 192
 	}
@@ -227,12 +230,13 @@  discard block
 block discarded – undo
227 230
 		if(isset($this->captions[$index])){
228 231
 			return $this->captions[$index];
229 232
 		}
230
-		if($this->properties[$index] instanceof \ReflectionProperty)
231
-			return $this->properties[$index]->getName();
232
-		elseif(\is_callable($this->properties[$index]))
233
-			return "";
234
-		else
235
-			return $this->properties[$index];
233
+		if($this->properties[$index] instanceof \ReflectionProperty) {
234
+					return $this->properties[$index]->getName();
235
+		} elseif(\is_callable($this->properties[$index])) {
236
+					return "";
237
+		} else {
238
+					return $this->properties[$index];
239
+		}
236 240
 	}
237 241
 
238 242
 	public function getCaptions(){
@@ -241,7 +245,7 @@  discard block
 block discarded – undo
241 245
 			for($i=\sizeof($captions);$i<$this->count();$i++){
242 246
 				$captions[]="";
243 247
 			}
244
-		}else{
248
+		} else{
245 249
 			$captions=[];
246 250
 			$index=0;
247 251
 			$count=$this->count();
@@ -257,8 +261,9 @@  discard block
 block discarded – undo
257 261
 	}
258 262
 
259 263
 	public function setCaption($index,$caption){
260
-		if(isset($this->captions)===false)
261
-			$this->captions=[];
264
+		if(isset($this->captions)===false) {
265
+					$this->captions=[];
266
+		}
262 267
 		$this->captions[$index]=$caption;
263 268
 		return $this;
264 269
 	}
Please login to merge, or discard this patch.
Ajax/service/Javascript.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@
 block discarded – undo
6 6
 	public static $preventDefault="\nif(event && event.preventDefault) event.preventDefault();\n";
7 7
 	public static $stopPropagation="\nif(event && event.stopPropagation) event.stopPropagation();\n";
8 8
 
9
-	public static function containsCode($expression){
10
-		return strrpos($expression, 'this')!==false||strrpos($expression, 'event')!==false||strrpos($expression, 'self')!==false;
9
+	public static function containsCode($expression) {
10
+		return strrpos($expression, 'this')!==false || strrpos($expression, 'event')!==false || strrpos($expression, 'self')!==false;
11 11
 	}
12 12
 
13 13
 	/**
Please login to merge, or discard this patch.
Ajax/common/html/HtmlSingleElement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function setClass($classNames) {
16
-		if(\is_array($classNames)){
16
+		if (\is_array($classNames)) {
17 17
 			$classNames=implode(" ", $classNames);
18 18
 		}
19 19
 		$this->setProperty("class", $classNames);
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	}
22 22
 
23 23
 	public function addClass($classNames) {
24
-		if(\is_array($classNames)){
24
+		if (\is_array($classNames)) {
25 25
 			$classNames=implode(" ", $classNames);
26 26
 		}
27 27
 		$this->addToProperty("class", $classNames);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function fromArray($array) {
54 54
 		$array=parent::fromArray($array);
55
-		foreach ( $array as $key => $value ) {
55
+		foreach ($array as $key => $value) {
56 56
 			$this->setProperty($key, $value);
57 57
 		}
58 58
 		return $array;
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 4 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -36,6 +36,10 @@  discard block
 block discarded – undo
36 36
 	protected $_targetSelector;
37 37
 	protected $_checkedMessage;
38 38
 
39
+	/**
40
+	 * @param string $identifier
41
+	 * @param string $model
42
+	 */
39 43
 	public function __construct($identifier,$model,$modelInstance=NULL) {
40 44
 		parent::__construct($identifier, $model,$modelInstance);
41 45
 		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
@@ -75,6 +79,9 @@  discard block
 block discarded – undo
75 79
 				if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$checkedMessageCall);
76 80
 	}
77 81
 
82
+	/**
83
+	 * @param string $op
84
+	 */
78 85
 	protected function _generateBehavior($op,JsUtils $js){
79 86
 		if(isset($this->_urls[$op]))
80 87
 			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
@@ -210,6 +217,9 @@  discard block
 block discarded – undo
210 217
 		return $this;
211 218
 	}
212 219
 
220
+	/**
221
+	 * @param PositionInTable $part
222
+	 */
213 223
 	private function addToolbarRow($part,$table,$captions){
214 224
 		$hasPart=$table->hasPart($part);
215 225
 		if($hasPart){
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
 use Ajax\semantic\html\elements\HtmlInput;
9 9
 use Ajax\semantic\html\collections\menus\HtmlPaginationMenu;
10 10
 use Ajax\semantic\html\modules\checkbox\HtmlCheckbox;
11
-use Ajax\semantic\html\elements\HtmlButton;
12 11
 use Ajax\semantic\html\base\constants\Direction;
13 12
 use Ajax\service\JArray;
14 13
 use Ajax\semantic\widgets\base\InstanceViewer;
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 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;
26
+	use TableTrait, DataTableFieldAsTrait;
27 27
 	protected $_searchField;
28 28
 	protected $_urls;
29 29
 	protected $_pagination;
@@ -36,30 +36,30 @@  discard block
 block discarded – undo
36 36
 	protected $_targetSelector;
37 37
 	protected $_checkedMessage;
38 38
 
39
-	public function __construct($identifier,$model,$modelInstance=NULL) {
40
-		parent::__construct($identifier, $model,$modelInstance);
41
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
39
+	public function __construct($identifier, $model, $modelInstance=NULL) {
40
+		parent::__construct($identifier, $model, $modelInstance);
41
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
42 42
 		$this->_urls=[];
43 43
 	}
44 44
 
45
-	public function run(JsUtils $js){
46
-		if($this->_hasCheckboxes && isset($js)){
45
+	public function run(JsUtils $js) {
46
+		if ($this->_hasCheckboxes && isset($js)) {
47 47
 			$this->_runCheckboxes($js);
48 48
 		}
49
-		if($this->_visibleHover){
50
-			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
51
-			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
49
+		if ($this->_visibleHover) {
50
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]);
51
+			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]);
52 52
 		}
53
-		if($this->_hasDelete)
53
+		if ($this->_hasDelete)
54 54
 			$this->_generateBehavior("delete", $js);
55
-		if($this->_hasEdit)
55
+		if ($this->_hasEdit)
56 56
 			$this->_generateBehavior("edit", $js);
57 57
 		return parent::run($js);
58 58
 	}
59 59
 
60
-	protected function _runCheckboxes(JsUtils $js){
60
+	protected function _runCheckboxes(JsUtils $js) {
61 61
 		$checkedMessageCall="";
62
-		if($this->_hasCheckedMessage){
62
+		if ($this->_hasCheckedMessage) {
63 63
 			$msg=$this->getCheckedMessage();
64 64
 			$checkedMessageFunction="function updateChecked(){var msg='".$msg[0]."',count=\$('#{$this->identifier} [name=\"selection[]\"]:checked').length,all=\$('#{$this->identifier} [name=\"selection[]\"]').length;
65 65
 			if(count==1) msg='".$msg[1]."';
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 						\$('#checked-count-".$this->identifier."').contents().filter(function() {return this.nodeType == 3;}).each(function(){this.textContent = msg.replace('{count}',count);});
68 68
 								\$('#toolbar-{$this->identifier} .visibleOnChecked').toggle(count>0);}\$('#toolbar-".$this->identifier." .visibleOnChecked').hide();";
69 69
 			$checkedMessageCall="updateChecked();";
70
-			$js->exec($checkedMessageFunction,true);
70
+			$js->exec($checkedMessageFunction, true);
71 71
 		}
72 72
 		$js->execOn("change", "#".$this->identifier." [name='selection[]']", "
73 73
 				var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true;
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
 				if(allChecked) {\$parentCheckbox.checkbox('set checked');}else if(allUnchecked){\$parentCheckbox.checkbox('set unchecked');}else{\$parentCheckbox.checkbox('set indeterminate');};".$checkedMessageCall);
76 76
 	}
77 77
 
78
-	protected function _generateBehavior($op,JsUtils $js){
79
-		if(isset($this->_urls[$op]))
80
-			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
78
+	protected function _generateBehavior($op, JsUtils $js) {
79
+		if (isset($this->_urls[$op]))
80
+			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op], $this->getTargetSelector(), ["preventDefault"=>false, "attr"=>"data-ajax"]);
81 81
 	}
82 82
 
83 83
 	/**
@@ -89,70 +89,70 @@  discard block
 block discarded – undo
89 89
 	}
90 90
 
91 91
 
92
-	public function compile(JsUtils $js=NULL,&$view=NULL){
93
-		if(!$this->_generated){
92
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
93
+		if (!$this->_generated) {
94 94
 			$this->_instanceViewer->setInstance($this->_model);
95 95
 			$captions=$this->_instanceViewer->getCaptions();
96 96
 
97 97
 			$table=$this->content["table"];
98 98
 
99
-			if($this->_hasCheckboxes){
99
+			if ($this->_hasCheckboxes) {
100 100
 				$this->_generateMainCheckbox($captions);
101 101
 			}
102 102
 
103 103
 			$table->setRowCount(0, \sizeof($captions));
104 104
 			$table->setHeaderValues($captions);
105
-			if(isset($this->_compileParts))
105
+			if (isset($this->_compileParts))
106 106
 				$table->setCompileParts($this->_compileParts);
107 107
 
108
-			if(isset($this->_searchField) && isset($js)){
109
-				if(isset($this->_urls["refresh"]))
110
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
108
+			if (isset($this->_searchField) && isset($js)) {
109
+				if (isset($this->_urls["refresh"]))
110
+					$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
111 111
 			}
112 112
 
113 113
 			$this->_generateContent($table);
114 114
 
115
-			if($this->_hasCheckboxes && $table->hasPart("thead")){
115
+			if ($this->_hasCheckboxes && $table->hasPart("thead")) {
116 116
 					$table->getHeader()->getCell(0, 0)->addClass("no-sort");
117 117
 			}
118 118
 
119
-			if(isset($this->_pagination) && $this->_pagination->getVisible()){
119
+			if (isset($this->_pagination) && $this->_pagination->getVisible()) {
120 120
 				$this->_generatePagination($table);
121 121
 			}
122
-			if(isset($this->_toolbar)){
122
+			if (isset($this->_toolbar)) {
123 123
 				$this->_setToolbarPosition($table, $captions);
124 124
 			}
125
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
125
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
126 126
 			$this->_compileForm();
127 127
 			$this->_generated=true;
128 128
 		}
129
-		return parent::compile($js,$view);
129
+		return parent::compile($js, $view);
130 130
 	}
131 131
 
132
-	private function _generateMainCheckbox(&$captions){
133
-		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
132
+	private function _generateMainCheckbox(&$captions) {
133
+		$ck=new HtmlCheckbox("main-ck-".$this->identifier, "");
134 134
 		$checkedMessageCall="";
135
-		if($this->_hasCheckedMessage)
135
+		if ($this->_hasCheckedMessage)
136 136
 			$checkedMessageCall="updateChecked();";
137 137
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall);
138 138
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall);
139 139
 		\array_unshift($captions, $ck);
140 140
 	}
141 141
 
142
-	protected function _generateContent($table){
142
+	protected function _generateContent($table) {
143 143
 		$objects=$this->_modelInstance;
144
-		if(isset($this->_pagination)){
144
+		if (isset($this->_pagination)) {
145 145
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
146 146
 		}
147 147
 		InstanceViewer::setIndex(0);
148 148
 		$table->fromDatabaseObjects($objects, function($instance) use($table){
149 149
 			$this->_instanceViewer->setInstance($instance);
150 150
 			InstanceViewer::$index++;
151
-			$values= $this->_instanceViewer->getValues();
152
-			if($this->_hasCheckboxes){
153
-				$ck=new HtmlCheckbox("ck-".$this->identifier,"");
151
+			$values=$this->_instanceViewer->getValues();
152
+			if ($this->_hasCheckboxes) {
153
+				$ck=new HtmlCheckbox("ck-".$this->identifier, "");
154 154
 				$field=$ck->getField();
155
-				$field->setProperty("value",$this->_instanceViewer->getIdentifier());
155
+				$field->setProperty("value", $this->_instanceViewer->getIdentifier());
156 156
 				$field->setProperty("name", "selection[]");
157 157
 				\array_unshift($values, $ck);
158 158
 			}
@@ -163,37 +163,37 @@  discard block
 block discarded – undo
163 163
 		});
164 164
 	}
165 165
 
166
-	private function _generatePagination($table){
166
+	private function _generatePagination($table) {
167 167
 		$footer=$table->getFooter();
168 168
 		$footer->mergeCol();
169
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
169
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
170 170
 		$menu->floatRight();
171 171
 		$menu->setActiveItem($this->_pagination->getPage()-1);
172 172
 		$footer->setValues($menu);
173
-		if(isset($this->_urls["refresh"]))
174
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
173
+		if (isset($this->_urls["refresh"]))
174
+			$menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
175 175
 	}
176 176
 
177
-	protected function _getFieldName($index){
177
+	protected function _getFieldName($index) {
178 178
 		return parent::_getFieldName($index)."[]";
179 179
 	}
180 180
 
181
-	protected function _getFieldCaption($index){
181
+	protected function _getFieldCaption($index) {
182 182
 		return null;
183 183
 	}
184 184
 
185
-	protected function _setToolbarPosition($table,$captions=NULL){
186
-		switch ($this->_toolbarPosition){
185
+	protected function _setToolbarPosition($table, $captions=NULL) {
186
+		switch ($this->_toolbarPosition) {
187 187
 			case PositionInTable::BEFORETABLE:
188 188
 			case PositionInTable::AFTERTABLE:
189
-				if(isset($this->_compileParts)===false){
189
+				if (isset($this->_compileParts)===false) {
190 190
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
191 191
 				}
192 192
 				break;
193 193
 			case PositionInTable::HEADER:
194 194
 			case PositionInTable::FOOTER:
195 195
 			case PositionInTable::BODY:
196
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
196
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
197 197
 				break;
198 198
 		}
199 199
 	}
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 	 * @param callable $callback function called after the field compilation
206 206
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
207 207
 	 */
208
-	public function afterCompile($index,$callback){
209
-		$this->_instanceViewer->afterCompile($index,$callback);
208
+	public function afterCompile($index, $callback) {
209
+		$this->_instanceViewer->afterCompile($index, $callback);
210 210
 		return $this;
211 211
 	}
212 212
 
213
-	private function addToolbarRow($part,$table,$captions){
213
+	private function addToolbarRow($part, $table, $captions) {
214 214
 		$hasPart=$table->hasPart($part);
215
-		if($hasPart){
215
+		if ($hasPart) {
216 216
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
217
-		}else{
217
+		} else {
218 218
 			$row=$table->getPart($part)->getRow(0);
219 219
 		}
220 220
 		$row->mergeCol();
221 221
 		$row->setValues([$this->_toolbar]);
222 222
 	}
223 223
 
224
-	public function getHtmlComponent(){
224
+	public function getHtmlComponent() {
225 225
 		return $this->content["table"];
226 226
 	}
227 227
 
@@ -235,18 +235,18 @@  discard block
 block discarded – undo
235 235
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
236 236
 	 */
237 237
 	public function setUrls($urls) {
238
-		if(\is_array($urls)){
239
-			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
240
-			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
241
-			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
242
-		}else{
243
-			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
238
+		if (\is_array($urls)) {
239
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
240
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
241
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
242
+		} else {
243
+			$this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls];
244 244
 		}
245 245
 		return $this;
246 246
 	}
247 247
 
248
-	public function paginate($items_per_page=10,$page=1){
249
-		$this->_pagination=new Pagination($items_per_page,4,$page);
248
+	public function paginate($items_per_page=10, $page=1) {
249
+		$this->_pagination=new Pagination($items_per_page, 4, $page);
250 250
 	}
251 251
 
252 252
 	public function getHasCheckboxes() {
@@ -258,20 +258,20 @@  discard block
 block discarded – undo
258 258
 		return $this;
259 259
 	}
260 260
 
261
-	public function refresh($compileParts=["tbody"]){
261
+	public function refresh($compileParts=["tbody"]) {
262 262
 		$this->_compileParts=$compileParts;
263 263
 		return $this;
264 264
 	}
265 265
 
266 266
 
267
-	public function addSearchInToolbar($position=Direction::RIGHT){
267
+	public function addSearchInToolbar($position=Direction::RIGHT) {
268 268
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
269 269
 	}
270 270
 
271
-	public function getSearchField(){
272
-		if(isset($this->_searchField)===false){
273
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
274
-			$this->_searchField->addIcon("search",Direction::RIGHT);
271
+	public function getSearchField() {
272
+		if (isset($this->_searchField)===false) {
273
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
274
+			$this->_searchField->addIcon("search", Direction::RIGHT);
275 275
 		}
276 276
 		return $this->_searchField;
277 277
 	}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		return $this;
288 288
 	}
289 289
 
290
-	public function asForm(){
290
+	public function asForm() {
291 291
 		return $this->getForm();
292 292
 	}
293 293
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 	protected function getTargetSelector() {
297 297
 		$result=$this->_targetSelector;
298
-		if(!isset($result))
298
+		if (!isset($result))
299 299
 			$result="#".$this->identifier;
300 300
 		return $result;
301 301
 	}
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	}
312 312
 
313 313
 	protected function getCheckedMessage() {
314
-		$result= $this->_checkedMessage;
315
-		if(!isset($result)){
316
-			$result=[0=>"none selected",1=>"one item selected","other"=>"{count} items selected"];
314
+		$result=$this->_checkedMessage;
315
+		if (!isset($result)) {
316
+			$result=[0=>"none selected", 1=>"one item selected", "other"=>"{count} items selected"];
317 317
 		}
318 318
 		return $result;
319 319
 	}
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 	 * @param array $checkedMessage
334 334
 	 * @param callable $callback
335 335
 	 */
336
-	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
337
-		if(isset($checkedMessage))
336
+	public function addCountCheckedInToolbar(array $checkedMessage=null, $callback=null) {
337
+		if (isset($checkedMessage))
338 338
 			$this->_checkedMessage=$checkedMessage;
339 339
 		$checkedMessage=$this->getCheckedMessage();
340 340
 		$this->_hasCheckboxes=true;
341 341
 		$this->_hasCheckedMessage=true;
342
-		$element=new HtmlLabel("checked-count-".$this->identifier,$checkedMessage[0]);
343
-		$this->addInToolbar($element,$callback);
342
+		$element=new HtmlLabel("checked-count-".$this->identifier, $checkedMessage[0]);
343
+		$this->addInToolbar($element, $callback);
344 344
 	}
345 345
 
346 346
 
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -50,10 +50,12 @@  discard block
 block discarded – undo
50 50
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
51 51
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
52 52
 		}
53
-		if($this->_hasDelete)
54
-			$this->_generateBehavior("delete", $js);
55
-		if($this->_hasEdit)
56
-			$this->_generateBehavior("edit", $js);
53
+		if($this->_hasDelete) {
54
+					$this->_generateBehavior("delete", $js);
55
+		}
56
+		if($this->_hasEdit) {
57
+					$this->_generateBehavior("edit", $js);
58
+		}
57 59
 		return parent::run($js);
58 60
 	}
59 61
 
@@ -76,8 +78,9 @@  discard block
 block discarded – undo
76 78
 	}
77 79
 
78 80
 	protected function _generateBehavior($op,JsUtils $js){
79
-		if(isset($this->_urls[$op]))
80
-			$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
81
+		if(isset($this->_urls[$op])) {
82
+					$js->getOnClick("#".$this->identifier." .".$op, $this->_urls[$op],$this->getTargetSelector(),["preventDefault"=>false,"attr"=>"data-ajax"]);
83
+		}
81 84
 	}
82 85
 
83 86
 	/**
@@ -102,12 +105,14 @@  discard block
 block discarded – undo
102 105
 
103 106
 			$table->setRowCount(0, \sizeof($captions));
104 107
 			$table->setHeaderValues($captions);
105
-			if(isset($this->_compileParts))
106
-				$table->setCompileParts($this->_compileParts);
108
+			if(isset($this->_compileParts)) {
109
+							$table->setCompileParts($this->_compileParts);
110
+			}
107 111
 
108 112
 			if(isset($this->_searchField) && isset($js)){
109
-				if(isset($this->_urls["refresh"]))
110
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
113
+				if(isset($this->_urls["refresh"])) {
114
+									$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
115
+				}
111 116
 			}
112 117
 
113 118
 			$this->_generateContent($table);
@@ -132,8 +137,9 @@  discard block
 block discarded – undo
132 137
 	private function _generateMainCheckbox(&$captions){
133 138
 		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
134 139
 		$checkedMessageCall="";
135
-		if($this->_hasCheckedMessage)
136
-			$checkedMessageCall="updateChecked();";
140
+		if($this->_hasCheckedMessage) {
141
+					$checkedMessageCall="updateChecked();";
142
+		}
137 143
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);".$checkedMessageCall);
138 144
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);".$checkedMessageCall);
139 145
 		\array_unshift($captions, $ck);
@@ -170,8 +176,9 @@  discard block
 block discarded – undo
170 176
 		$menu->floatRight();
171 177
 		$menu->setActiveItem($this->_pagination->getPage()-1);
172 178
 		$footer->setValues($menu);
173
-		if(isset($this->_urls["refresh"]))
174
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
179
+		if(isset($this->_urls["refresh"])) {
180
+					$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
181
+		}
175 182
 	}
176 183
 
177 184
 	protected function _getFieldName($index){
@@ -214,7 +221,7 @@  discard block
 block discarded – undo
214 221
 		$hasPart=$table->hasPart($part);
215 222
 		if($hasPart){
216 223
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
217
-		}else{
224
+		} else{
218 225
 			$row=$table->getPart($part)->getRow(0);
219 226
 		}
220 227
 		$row->mergeCol();
@@ -239,7 +246,7 @@  discard block
 block discarded – undo
239 246
 			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
240 247
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
241 248
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
242
-		}else{
249
+		} else{
243 250
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
244 251
 		}
245 252
 		return $this;
@@ -295,8 +302,9 @@  discard block
 block discarded – undo
295 302
 
296 303
 	protected function getTargetSelector() {
297 304
 		$result=$this->_targetSelector;
298
-		if(!isset($result))
299
-			$result="#".$this->identifier;
305
+		if(!isset($result)) {
306
+					$result="#".$this->identifier;
307
+		}
300 308
 		return $result;
301 309
 	}
302 310
 
@@ -334,8 +342,9 @@  discard block
 block discarded – undo
334 342
 	 * @param callable $callback
335 343
 	 */
336 344
 	public function addCountCheckedInToolbar(array $checkedMessage=null,$callback=null){
337
-		if(isset($checkedMessage))
338
-			$this->_checkedMessage=$checkedMessage;
345
+		if(isset($checkedMessage)) {
346
+					$this->_checkedMessage=$checkedMessage;
347
+		}
339 348
 		$checkedMessage=$this->getCheckedMessage();
340 349
 		$this->_hasCheckboxes=true;
341 350
 		$this->_hasCheckedMessage=true;
Please login to merge, or discard this patch.