Completed
Push — master ( b1701b...fcfed5 )
by Jean-Christophe
03:28
created
Ajax/semantic/html/elements/HtmlLabel.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 use Ajax\semantic\html\base\traits\HasTimeoutTrait;
11 11
 
12 12
 class HtmlLabel extends HtmlSemDoubleElement {
13
-	use LabeledIconTrait,HasTimeoutTrait;
13
+	use LabeledIconTrait, HasTimeoutTrait;
14 14
 
15 15
 	public function __construct($identifier, $caption="", $icon=NULL, $tagName="div") {
16 16
 		parent::__construct($identifier, $tagName, "ui label");
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	 * @return \Ajax\semantic\html\elements\HtmlLabel
26 26
 	 */
27 27
 	public function setPointing($value=Direction::NONE) {
28
-		if($value==="left" || $value==="right")
28
+		if ($value==="left" || $value==="right")
29 29
 			return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
30 30
 		else
31
-			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true));
31
+			return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing", true));
32 32
 	}
33 33
 
34 34
 	/**
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 	 * @return \Ajax\semantic\html\elements\HtmlLabel
38 38
 	 */
39 39
 	public function toCorner($side="left") {
40
-		return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" ));
40
+		return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner"));
41 41
 	}
42 42
 
43
-	public function setHorizontal(){
44
-		return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal"));
43
+	public function setHorizontal() {
44
+		return $this->addToPropertyCtrl("class", "hozizontal", array("horizontal"));
45 45
 	}
46 46
 
47
-	public function setFloating(){
48
-		return $this->addToPropertyCtrl("class", "floating",array("floating"));
47
+	public function setFloating() {
48
+		return $this->addToPropertyCtrl("class", "floating", array("floating"));
49 49
 	}
50 50
 
51 51
 	/**
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		return $this->addToProperty("class", "tag");
57 57
 	}
58 58
 
59
-	public function setEmpty(){
59
+	public function setEmpty() {
60 60
 		$this->content=NULL;
61
-		return $this->addToPropertyCtrl("class", "empty",array("empty"));
61
+		return $this->addToPropertyCtrl("class", "empty", array("empty"));
62 62
 	}
63 63
 
64 64
 	public function setBasic() {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	public function addEmphasisImage($src, $alt="", $before=true) {
76 76
 		$this->addToProperty("class", "image");
77
-		return $this->addImage($src,$alt,$before);
77
+		return $this->addImage($src, $alt, $before);
78 78
 	}
79 79
 
80 80
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * @return \Ajax\semantic\html\elements\html5\HtmlImg
86 86
 	 */
87 87
 	public function addAvatarImage($src, $alt="", $before=true) {
88
-		$img=$this->addImage($src,$alt,$before);
88
+		$img=$this->addImage($src, $alt, $before);
89 89
 		$img->setClass("ui image");
90 90
 		$img->asAvatar();
91 91
 		return $img;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	* @return \Ajax\semantic\html\elements\html5\HtmlImg
100 100
 	*/
101 101
 	public function addImage($src, $alt="", $before=true) {
102
-		$img=new HtmlImg("image-" . $this->identifier, $src, $alt);
102
+		$img=new HtmlImg("image-".$this->identifier, $src, $alt);
103 103
 		$img->setClass("");
104 104
 		$this->addContent($img, $before);
105 105
 		return $img;
@@ -111,21 +111,21 @@  discard block
 block discarded – undo
111 111
 	 * @return \Ajax\common\html\HtmlDoubleElement
112 112
 	 */
113 113
 	public function addDetail($detail) {
114
-		$div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail");
114
+		$div=new HtmlSemDoubleElement("detail-".$this->identifier, $this->tagName, "detail");
115 115
 		$div->setContent($detail);
116 116
 		$this->addContent($div);
117 117
 		return $div;
118 118
 	}
119 119
 
120 120
 	public function asRibbon($direction=Direction::NONE) {
121
-		return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" ));
121
+		return $this->addToPropertyCtrl("class", $direction." ribbon", array("ribbon", "right ribbon", "left ribbon"));
122 122
 	}
123 123
 
124
-	public function setAttached($side=Side::TOP,$direction=Direction::NONE){
125
-		if($direction!==Direction::NONE)
126
-			return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached"));
124
+	public function setAttached($side=Side::TOP, $direction=Direction::NONE) {
125
+		if ($direction!==Direction::NONE)
126
+			return $this->addToPropertyCtrl("class", $side." ".$direction." attached", Side::getConstantValues($direction." attached"));
127 127
 		else
128
-			return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached"));
128
+			return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached"));
129 129
 	}
130 130
 
131 131
 	public static function ribbon($identifier, $caption) {
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/HasTimeoutTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@
 block discarded – undo
17 17
 	 * {@inheritDoc}
18 18
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
19 19
 	 */
20
-	public function run(JsUtils $js){
21
-		if(!isset($this->_bsComponent)){
22
-			if(isset($this->_timeout)){
23
-				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});",true);
20
+	public function run(JsUtils $js) {
21
+		if (!isset($this->_bsComponent)) {
22
+			if (isset($this->_timeout)) {
23
+				$js->exec("setTimeout(function() { $('#{$this->identifier}').transition({$this->_closeTransition}); }, {$this->_timeout});", true);
24 24
 			}
25 25
 		}
26 26
 		return parent::run($js);
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/JsonDataTable.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,24 +23,24 @@  discard block
 block discarded – undo
23 23
 		$this->_rowClass="_json";
24 24
 	}
25 25
 
26
-	protected function _generateContent($table){
26
+	protected function _generateContent($table) {
27 27
 		$this->_addRowModel($table);
28 28
 		parent::_generateContent($table);
29 29
 	}
30 30
 
31
-	protected function _addRowModel($table){
31
+	protected function _addRowModel($table) {
32 32
 		$row=$this->_createRow($table, $this->_modelClass);
33
-		$row->addToProperty("style","display:none;");
33
+		$row->addToProperty("style", "display:none;");
34 34
 		$table->getBody()->_addRow($row);
35 35
 	}
36 36
 
37
-	protected function _createRow($table,$rowClass){
37
+	protected function _createRow($table, $rowClass) {
38 38
 		$object=JReflection::jsonObject($this->_model);
39
-		if(isset($this->_rowModelCallback)){
39
+		if (isset($this->_rowModelCallback)) {
40 40
 			$callback=$this->_rowModelCallback;
41 41
 			$callback($object);
42 42
 		}
43
-		$row=$this->_generateRow($object, $table,"_jsonArrayChecked");
43
+		$row=$this->_generateRow($object, $table, "_jsonArrayChecked");
44 44
 		$row->setClass($rowClass);
45 45
 		return $row;
46 46
 	}
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
 	 * {@inheritDoc}
50 50
 	 * @see DataTable::_associatePaginationBehavior()
51 51
 	 */
52
-	protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){
52
+	protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) {
53 53
 		$callback=null;
54
-		if(isset($js)){
54
+		if (isset($js)) {
55 55
 			$id=$this->identifier;
56 56
 			$offset=$js->scriptCount();
57 57
 			$this->run($js);
58 58
 			$callback=$js->getScript($offset);
59
-			$callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js));
59
+			$callback.=$js->trigger("#".$id." [name='selection[]']", "change", false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js));
60 60
 			$callback.=";var page=parseInt($(self).attr('data-page'));
61 61
 			$('#pagination-{$id} .item').removeClass('active');
62 62
 			$('#pagination-{$id} [data-page='+page+']:not(.no-active)').addClass('active');
63 63
 			$('#pagination-{$id} ._firstPage').attr('data-page',Math.max(1,page-1));
64 64
 			var lastPage=$('#pagination-{$id} ._lastPage');lastPage.attr('data-page',Math.min(lastPage.attr('data-max'),page+1));";
65 65
 		}
66
-		if(isset($this->_urls["refresh"]))
67
-			$this->jsonArrayOnClick($menu, $this->_urls["refresh"],"post","{'p':$(this).attr('data-page')}",$callback);
66
+		if (isset($this->_urls["refresh"]))
67
+			$this->jsonArrayOnClick($menu, $this->_urls["refresh"], "post", "{'p':$(this).attr('data-page')}", $callback);
68 68
 	}
69 69
 
70 70
 	/**
@@ -75,29 +75,29 @@  discard block
 block discarded – undo
75 75
 	 * @param string $jsCallback
76 76
 	 * @return AjaxCall
77 77
 	 */
78
-	public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){
79
-		$parameters=\array_merge($parameters,["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass,"url"=>$url,"method"=>$method,"params"=>$params,"jsCallback"=>$jsCallback]);
78
+	public function jsJsonArray($url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) {
79
+		$parameters=\array_merge($parameters, ["modelSelector"=>"#".$this->_identifier." tr.".$this->_modelClass, "url"=>$url, "method"=>$method, "params"=>$params, "jsCallback"=>$jsCallback]);
80 80
 		return new AjaxCall("jsonArray", $parameters);
81 81
 	}
82 82
 
83
-	public function jsClear(){
83
+	public function jsClear() {
84 84
 		return "$('#{$this->identifier} tbody').find('._json').remove();";
85 85
 	}
86 86
 
87
-	public function clearOn(BaseHtml $element,$event, $stopPropagation=false, $preventDefault=false){
88
-		return $element->addEvent($event, $this->jsClear(),$stopPropagation,$preventDefault);
87
+	public function clearOn(BaseHtml $element, $event, $stopPropagation=false, $preventDefault=false) {
88
+		return $element->addEvent($event, $this->jsClear(), $stopPropagation, $preventDefault);
89 89
 	}
90 90
 
91
-	public function clearOnClick(BaseHtml $element,$stopPropagation=false, $preventDefault=false){
92
-		return $this->clearOn($element, "click",$stopPropagation,$preventDefault);
91
+	public function clearOnClick(BaseHtml $element, $stopPropagation=false, $preventDefault=false) {
92
+		return $this->clearOn($element, "click", $stopPropagation, $preventDefault);
93 93
 	}
94 94
 
95
-	public function jsonArrayOn(BaseHtml $element,$event,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){
96
-		return $element->_addEvent($event, $this->jsJsonArray($url,$method,$params,$jsCallback,$parameters));
95
+	public function jsonArrayOn(BaseHtml $element, $event, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) {
96
+		return $element->_addEvent($event, $this->jsJsonArray($url, $method, $params, $jsCallback, $parameters));
97 97
 	}
98 98
 
99
-	public function jsonArrayOnClick(BaseHtml $element,$url, $method="get", $params="{}", $jsCallback=NULL,$parameters=[]){
100
-		return $this->jsonArrayOn($element, "click", $url,$method,$params,$jsCallback,$parameters);
99
+	public function jsonArrayOnClick(BaseHtml $element, $url, $method="get", $params="{}", $jsCallback=NULL, $parameters=[]) {
100
+		return $this->jsonArrayOn($element, "click", $url, $method, $params, $jsCallback, $parameters);
101 101
 	}
102 102
 
103 103
 	/**
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
109 109
 	 * @return DataTable
110 110
 	 */
111
-	public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){
112
-		return parent::paginate($page, $total_rowcount,$items_per_page,null);
111
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
112
+		return parent::paginate($page, $total_rowcount, $items_per_page, null);
113 113
 	}
114 114
 
115 115
 	public function setRowModelCallback($_rowModelCallback) {
Please login to merge, or discard this patch.
Ajax/common/html/HtmlCollection.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -14,44 +14,44 @@  discard block
 block discarded – undo
14 14
  */
15 15
 abstract class HtmlCollection extends HtmlDoubleElement {
16 16
 
17
-	public function __construct($identifier,$tagName="div"){
18
-		parent::__construct($identifier,$tagName);
17
+	public function __construct($identifier, $tagName="div") {
18
+		parent::__construct($identifier, $tagName);
19 19
 		$this->content=array();
20 20
 	}
21 21
 
22
-	public function addItems($items){
23
-		if(JArray::isAssociative($items)){
24
-			foreach ($items as $k=>$v){
25
-				$this->addItem([$k,$v]);
22
+	public function addItems($items) {
23
+		if (JArray::isAssociative($items)) {
24
+			foreach ($items as $k=>$v) {
25
+				$this->addItem([$k, $v]);
26 26
 			}
27
-		}else{
28
-			foreach ($items as $item){
27
+		} else {
28
+			foreach ($items as $item) {
29 29
 				$this->addItem($item);
30 30
 			}
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function setItems($items){
35
+	public function setItems($items) {
36 36
 		$this->content=$items;
37 37
 		return $this;
38 38
 	}
39 39
 
40
-	public function getItems(){
40
+	public function getItems() {
41 41
 		return $this->content;
42 42
 	}
43 43
 
44
-	protected function getItemToAdd($item){
44
+	protected function getItemToAdd($item) {
45 45
 		$itemO=$item;
46
-		if($this->createCondition($item)===true){
46
+		if ($this->createCondition($item)===true) {
47 47
 			$itemO=$this->createItem($item);
48 48
 		}
49 49
 		return $itemO;
50 50
 	}
51 51
 
52
-	protected function setItemIdentifier($item,$classname,$index){
53
-		if($item instanceof BaseWidget){
54
-			if($item->getIdentifier()===""){
52
+	protected function setItemIdentifier($item, $classname, $index) {
53
+		if ($item instanceof BaseWidget) {
54
+			if ($item->getIdentifier()==="") {
55 55
 				$item->setIdentifier($classname."-".$this->identifier."-".$index);
56 56
 			}
57 57
 		}
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param HtmlDoubleElement|string|array $item
63 63
 	 * @return \Ajax\common\html\HtmlDoubleElement
64 64
 	 */
65
-	public function addItem($item){
65
+	public function addItem($item) {
66 66
 		$itemO=$this->getItemToAdd($item);
67 67
 		$this->addContent($itemO);
68 68
 		return $itemO;
69 69
 	}
70 70
 
71
-	public function insertItem($item,$position=0){
71
+	public function insertItem($item, $position=0) {
72 72
 		$itemO=$this->getItemToAdd($item);
73
-		\array_splice( $this->content, $position, 0, array($itemO));
73
+		\array_splice($this->content, $position, 0, array($itemO));
74 74
 		return $itemO;
75 75
 	}
76 76
 
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 		return $this;
94 94
 	}
95 95
 
96
-	public function removeItem($index){
96
+	public function removeItem($index) {
97 97
 		return array_splice($this->content, $index, 1);
98 98
 	}
99 99
 
100
-	public function count(){
100
+	public function count() {
101 101
 		return \sizeof($this->content);
102 102
 	}
103 103
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 		return $this->addItem($function($object));
109 109
 	}
110 110
 
111
-	public function apply($callBack){
112
-		foreach ($this->content as $item){
111
+	public function apply($callBack) {
112
+		foreach ($this->content as $item) {
113 113
 			$callBack($item);
114 114
 		}
115 115
 		return $this;
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	abstract protected function createItem($value);
131 131
 
132
-	protected function createCondition($value){
132
+	protected function createCondition($value) {
133 133
 		return \is_object($value)===false;
134 134
 	}
135 135
 
136
-	protected function contentAs($tagName){
137
-		foreach ($this->content as $item){
136
+	protected function contentAs($tagName) {
137
+		foreach ($this->content as $item) {
138 138
 			$item->setTagName($tagName);
139 139
 		}
140 140
 		return $this;
141 141
 	}
142 142
 
143
-	public function setProperties($properties){
143
+	public function setProperties($properties) {
144 144
 		$i=0;
145
-		foreach ($properties as $k=>$v){
145
+		foreach ($properties as $k=>$v) {
146 146
 			$c=$this->content[$i++];
147
-			if(isset($c))
148
-				$c->setProperty($k,$v);
147
+			if (isset($c))
148
+				$c->setProperty($k, $v);
149 149
 			else
150 150
 				return $this;
151 151
 		}
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 	 * @param array $values
159 159
 	 * @return HtmlCollection
160 160
 	 */
161
-	public function setPropertyValues($property,$values){
161
+	public function setPropertyValues($property, $values) {
162 162
 		$i=0;
163
-		if(\is_array($values)===false){
164
-			$values=\array_fill(0, $this->count(),$values);
163
+		if (\is_array($values)===false) {
164
+			$values=\array_fill(0, $this->count(), $values);
165 165
 		}
166
-		foreach ($values as $value){
166
+		foreach ($values as $value) {
167 167
 			$c=$this->content[$i++];
168
-			if(isset($c)){
169
-				$c->setProperty($property,$value);
168
+			if (isset($c)) {
169
+				$c->setProperty($property, $value);
170 170
 			}
171
-			else{
171
+			else {
172 172
 				return $this;
173 173
 			}
174 174
 		}
@@ -178,13 +178,13 @@  discard block
 block discarded – undo
178 178
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
179 179
 		$index=0;
180 180
 		$classname=\strtolower(JReflection::shortClassName($this));
181
-		foreach ($this->content as $item){
182
-			$this->setItemIdentifier($item,$classname,$index++);
181
+		foreach ($this->content as $item) {
182
+			$this->setItemIdentifier($item, $classname, $index++);
183 183
 		}
184
-		return parent::compile($js,$view);
184
+		return parent::compile($js, $view);
185 185
 	}
186 186
 
187
-	public function getItemById($identifier){
187
+	public function getItemById($identifier) {
188 188
 		return $this->getElementById($identifier, $this->content);
189 189
 	}
190 190
 }
191 191
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	protected $ajaxTransition;
18 18
 	protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>';
19 19
 
20
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
20
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
21 21
 	protected function addLoading(&$retour, $responseElement) {
22 22
 		$loading_notifier='<div class="ajax-loader">';
23 23
 		if ($this->ajaxLoader=='') {
@@ -30,66 +30,66 @@  discard block
 block discarded – undo
30 30
 		$retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n";
31 31
 	}
32 32
 
33
-	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
34
-		return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
33
+	public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
34
+		return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
35 35
 	}
36
-	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
37
-		return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$jqueryDone,$ajaxTransition,$immediatly);
36
+	public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
37
+		return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, $immediatly);
38 38
 	}
39 39
 
40
-	protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
41
-		if(JString::isNull($params)){$params="{}";}
40
+	protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
41
+		if (JString::isNull($params)) {$params="{}"; }
42 42
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
43 43
 		$retour=$this->_getAjaxUrl($url, $attr);
44 44
 		$responseElement=$this->_getResponseElement($responseElement);
45 45
 		$retour.="var self=this;\n";
46
-		if($hasLoader===true){
46
+		if ($hasLoader===true) {
47 47
 			$this->addLoading($retour, $responseElement);
48 48
 		}
49 49
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
50
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
50
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
51 51
 		if ($immediatly)
52 52
 			$this->jquery_code_for_compile[]=$retour;
53 53
 		return $retour;
54 54
 	}
55 55
 
56
-	protected function setAjaxDataCall($params){
56
+	protected function setAjaxDataCall($params) {
57 57
 		$result=null;
58
-		if(!\is_callable($params)){
59
-			$result=function ($responseElement,$jqueryDone="html") use($params){
60
-				return AjaxTransition::{$params}($responseElement,$jqueryDone);
58
+		if (!\is_callable($params)) {
59
+			$result=function($responseElement, $jqueryDone="html") use($params){
60
+				return AjaxTransition::{$params}($responseElement, $jqueryDone);
61 61
 			};
62 62
 		}
63 63
 		return $result;
64 64
 	}
65 65
 
66
-	protected function _getAjaxUrl($url,$attr){
66
+	protected function _getAjaxUrl($url, $attr) {
67 67
 		$url=$this->_correctAjaxUrl($url);
68 68
 		$retour="url='".$url."';";
69 69
 		$slash="/";
70
-		if(JString::endswith($url, "/")===true)
70
+		if (JString::endswith($url, "/")===true)
71 71
 			$slash="";
72
-		if(JString::isNotNull($attr)){
72
+		if (JString::isNotNull($attr)) {
73 73
 			if ($attr==="value")
74 74
 				$retour.="url=url+'".$slash."'+$(this).val();\n";
75 75
 			elseif ($attr==="html")
76 76
 			$retour.="url=url+'".$slash."'+$(this).html();\n";
77
-			elseif($attr!=null && $attr!=="")
77
+			elseif ($attr!=null && $attr!=="")
78 78
 					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
79 79
 		}
80 80
 		return $retour;
81 81
 	}
82 82
 
83
-	protected function _getOnAjaxDone($responseElement,$jqueryDone,$ajaxTransition,$jsCallback){
84
-		$retour="";$call=null;
83
+	protected function _getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback) {
84
+		$retour=""; $call=null;
85 85
 		if ($responseElement!=="") {
86
-			if(isset($ajaxTransition)){
86
+			if (isset($ajaxTransition)) {
87 87
 				$call=$this->setAjaxDataCall($ajaxTransition);
88
-			}elseif(isset($this->ajaxTransition)){
88
+			}elseif (isset($this->ajaxTransition)) {
89 89
 				$call=$this->ajaxTransition;
90 90
 			}
91
-			if(\is_callable($call))
92
-				$retour="\t".$call($responseElement,$jqueryDone).";\n";
91
+			if (\is_callable($call))
92
+				$retour="\t".$call($responseElement, $jqueryDone).";\n";
93 93
 			else
94 94
 				$retour="\t$({$responseElement}).{$jqueryDone}( data );\n";
95 95
 		}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		return $retour;
98 98
 	}
99 99
 
100
-	protected function _getResponseElement($responseElement){
100
+	protected function _getResponseElement($responseElement) {
101 101
 		if ($responseElement!=="") {
102 102
 			$responseElement=Javascript::prep_value($responseElement);
103 103
 		}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	protected function _correctAjaxUrl($url) {
108 108
 		if ($url!=="/" && JString::endsWith($url, "/")===true)
109 109
 			$url=substr($url, 0, strlen($url)-1);
110
-		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
110
+		if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) {
111 111
 			$url=$this->jsUtils->getUrl($url);
112 112
 		}
113 113
 		return $url;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @param string $jsCallback javascript code to execute after the request
122 122
 	 * @param boolean $immediatly
123 123
 	 */
124
-	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
124
+	public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
125 125
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
126 126
 		$retour=$this->_getAjaxUrl($url, $attr);
127 127
 		$retour.="$.{$method}(url,".$params.").done(function( data ) {\n";
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	 * @param string $url the request address
143 143
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
144 144
 	 */
145
-	public function _jsonOn($event,$element, $url,$parameters=array()) {
145
+	public function _jsonOn($event, $element, $url, $parameters=array()) {
146 146
 		$preventDefault=true;
147 147
 		$stopPropagation=true;
148 148
 		$jsCallback=null;
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		$params="{}";
153 153
 		$immediatly=true;
154 154
 		extract($parameters);
155
-		return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly);
155
+		return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
156 156
 	}
157 157
 
158 158
 	/**
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
 	 * @param string $rowClass the css class for the new element
166 166
 	 * @param boolean $immediatly
167 167
 	 */
168
-	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$rowClass="_json",$immediatly=false) {
168
+	public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $rowClass="_json", $immediatly=false) {
169 169
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
170 170
 		$retour=$this->_getAjaxUrl($url, $attr);
171
-		if($context===null){
171
+		if ($context===null) {
172 172
 			$parent="$('".$maskSelector."').parent()";
173
-			$newElm = "$('#'+newId)";
174
-		}else{
173
+			$newElm="$('#'+newId)";
174
+		} else {
175 175
 			$parent=$context;
176
-			$newElm = $context.".find('#'+newId)";
176
+			$newElm=$context.".find('#'+newId)";
177 177
 		}
178 178
 		$appendTo="\t\tnewElm.appendTo(".$parent.");\n";
179 179
 		$retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n";
180 180
 		$retour.=$parent.".find('._json').remove();";
181 181
 		$retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();
182 182
 				newElm.attr('id',newId);\n;newElm.addClass('{$rowClass}').removeClass('_jsonArrayModel');\nnewElm.find('[id]').each(function(){ var newId=$(this).attr('id')+'-'+index;$(this).attr('id',newId).removeClass('_jsonArrayChecked');});\n";
183
-		$retour.= $appendTo;
183
+		$retour.=$appendTo;
184 184
 		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('__'+key+'__')>-1){\n"."\t\t\t\tcontent=$(html.split('__'+key+'__').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
185 185
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
186 186
 		$retour.="\t".$jsCallback."\n"."});\n";
@@ -195,30 +195,30 @@  discard block
 block discarded – undo
195 195
 	 * @param string $url the request address
196 196
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null)
197 197
 	 */
198
-	public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) {
198
+	public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
199 199
 		$preventDefault=true;
200 200
 		$stopPropagation=true;
201 201
 		$jsCallback=null;
202 202
 		$attr="id";
203 203
 		$method="get";
204
-		$context = null;
204
+		$context=null;
205 205
 		$params="{}";
206 206
 		$immediatly=true;
207 207
 		extract($parameters);
208
-		return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly);
208
+		return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly);
209 209
 	}
210 210
 
211
-	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$jqueryDone="html",$ajaxTransition=null,$immediatly=false) {
211
+	public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null, $immediatly=false) {
212 212
 		$jsCallback=isset($jsCallback) ? $jsCallback : "";
213 213
 		$retour=$this->_getAjaxUrl($url, $attr);
214 214
 		$retour.="\nvar params=$('#".$form."').serialize();\n";
215 215
 		$responseElement=$this->_getResponseElement($responseElement);
216 216
 		$retour.="var self=this;\n";
217
-		if($hasLoader===true){
217
+		if ($hasLoader===true) {
218 218
 			$this->addLoading($retour, $responseElement);
219 219
 		}
220 220
 		$retour.="$.post(url,params).done(function( data ) {\n";
221
-		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
221
+		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone, $ajaxTransition, $jsCallback)."});\n";
222 222
 
223 223
 		if ($validation) {
224 224
 			$retour="$('#".$form."').validate({submitHandler: function(form) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @param string $responseElement
242 242
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"jqueryDone"=>"html")
243 243
 	 */
244
-	public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
244
+	public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
245 245
 		$preventDefault=true;
246 246
 		$stopPropagation=true;
247 247
 		$jsCallback=null;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 		$jqueryDone="html";
252 252
 		$ajaxTransition=null;
253 253
 		extract($parameters);
254
-		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
254
+		return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @param string $responseElement
265 265
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null)
266 266
 	 */
267
-	public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) {
267
+	public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
268 268
 		$preventDefault=true;
269 269
 		$stopPropagation=true;
270 270
 		$jsCallback=null;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		$jqueryDone="html";
275 275
 		$ajaxTransition=null;
276 276
 		extract($parameters);
277
-		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
277
+		return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
278 278
 	}
279 279
 
280 280
 	/**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @param string $responseElement
288 288
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"ajaxTransition"=>null,"immediatly"=>true)
289 289
 	 */
290
-	public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) {
290
+	public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
291 291
 		$preventDefault=true;
292 292
 		$stopPropagation=true;
293 293
 		$validation=false;
@@ -298,6 +298,6 @@  discard block
 block discarded – undo
298 298
 		$jqueryDone="html";
299 299
 		$ajaxTransition=null;
300 300
 		extract($parameters);
301
-		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition), $event, $preventDefault, $stopPropagation,$immediatly);
301
+		return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition), $event, $preventDefault, $stopPropagation, $immediatly);
302 302
 	}
303 303
 }
304 304
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/traits/JsUtilsAjaxTrait.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
26 26
 	 * @param string|callable $ajaxTransition
27 27
 	 */
28
-	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
29
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
28
+	public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
29
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
30 30
 	}
31 31
 
32 32
 	/**
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 * @param string $jsCallback javascript code to execute after the request
38 38
 	 * @param boolean $immediatly
39 39
 	 */
40
-	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) {
41
-		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly);
40
+	public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) {
41
+		return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly);
42 42
 	}
43 43
 
44 44
 	/**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 * @param string $url the request address
49 49
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true)
50 50
 	 */
51
-	public function jsonOn($event,$element, $url,$parameters=array()) {
52
-		return $this->js->_jsonOn($event, $element, $url,$parameters);
51
+	public function jsonOn($event, $element, $url, $parameters=array()) {
52
+		return $this->js->_jsonOn($event, $element, $url, $parameters);
53 53
 	}
54 54
 
55 55
 	/**
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 * @param string $jsCallback javascript code to execute after the request
72 72
 	 * @param string $rowClass the css class for the new element
73 73
 	 */
74
-	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") {
75
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL,$rowClass,true);
74
+	public function jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") {
75
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, true);
76 76
 	}
77 77
 
78 78
 	/**
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @param string $jsCallback javascript code to execute after the request
85 85
 	 * @param string $rowClass the css class for the new element
86 86
 	 */
87
-	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL,$rowClass="_json") {
88
-		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback,"id", NULL, $rowClass,false);
87
+	public function jsonArrayDeferred($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $rowClass="_json") {
88
+		return $this->js->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, "id", NULL, $rowClass, false);
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 	 * @param string $url the request url
96 96
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","rowClass"=>"_json","immediatly"=>true)
97 97
 	 */
98
-	public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) {
99
-		return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters);
98
+	public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) {
99
+		return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters);
100 100
 	}
101 101
 
102 102
 	/**
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
111 111
 	 * @param string|callable $ajaxTransition
112 112
 	 */
113
-	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id",$jqueryDone="html",$ajaxTransition=null) {
114
-		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false,$jqueryDone,$ajaxTransition);
113
+	public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $jqueryDone="html", $ajaxTransition=null) {
114
+		return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false, $jqueryDone, $ajaxTransition);
115 115
 	}
116 116
 
117 117
 	/**
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
151 151
 	 * @param string|callable $ajaxTransition
152 152
 	 */
153
-	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
154
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
153
+	public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
154
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
155 155
 	}
156 156
 
157 157
 	/**
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
167 167
 	 * @param string|callable $ajaxTransition
168 168
 	 */
169
-	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
170
-		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
169
+	public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
170
+		return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
171 171
 	}
172 172
 
173 173
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
182 182
 	 */
183 183
 	public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) {
184
-		return $this->js->_postOn($event, $element,  $url, $params, $responseElement, $parameters);
184
+		return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters);
185 185
 	}
186 186
 
187 187
 	/**
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
208 208
 	 * @param string|callable $ajaxTransition
209 209
 	 */
210
-	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
211
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,$jqueryDone,$ajaxTransition,true);
210
+	public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
211
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, $jqueryDone, $ajaxTransition, true);
212 212
 	}
213 213
 
214 214
 	/**
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 * @param string $jqueryDone the jquery function call on ajax data. default:html
224 224
 	 * @param string|callable $ajaxTransition
225 225
 	 */
226
-	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true,$jqueryDone="html",$ajaxTransition=null) {
227
-		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,$jqueryDone,$ajaxTransition,false);
226
+	public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $jqueryDone="html", $ajaxTransition=null) {
227
+		return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition, false);
228 228
 	}
229 229
 
230 230
 	/**
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true,"jqueryDone"=>"html","ajaxTransition"=>null)
239 239
 	 */
240 240
 	public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) {
241
-		return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters);
241
+		return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters);
242 242
 	}
243 243
 
244 244
 	/**
Please login to merge, or discard this patch.
Ajax/service/AjaxCall.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,27 +29,27 @@
 block discarded – undo
29 29
 		$rowClass="_json";
30 30
 		extract($this->parameters);
31 31
 		$result=$this->_eventPreparing($preventDefault, $stopPropagation);
32
-		switch($this->method) {
32
+		switch ($this->method) {
33 33
 			case "get":
34
-				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr,$jqueryDone,$ajaxTransition);
34
+				$result.=$js->getDeferred($url, $responseElement, $params, $jsCallback, $attr, $jqueryDone, $ajaxTransition);
35 35
 				break;
36 36
 			case "post":
37
-				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
37
+				$result.=$js->postDeferred($url, $responseElement, $params, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
38 38
 				break;
39 39
 			case "postForm":
40
-				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader,$jqueryDone,$ajaxTransition);
40
+				$result.=$js->postFormDeferred($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, $jqueryDone, $ajaxTransition);
41 41
 				break;
42 42
 			case "json":
43
-				$result.=$js->jsonDeferred($url,$method,$params,$jsCallback);
43
+				$result.=$js->jsonDeferred($url, $method, $params, $jsCallback);
44 44
 				break;
45 45
 			case "jsonArray":
46
-				$result.=$js->jsonArrayDeferred($modelSelector, $url,$method,$params,$jsCallback,$rowClass);
46
+				$result.=$js->jsonArrayDeferred($modelSelector, $url, $method, $params, $jsCallback, $rowClass);
47 47
 				break;
48 48
 		}
49 49
 		return $result;
50 50
 	}
51 51
 
52
-	protected function _eventPreparing($preventDefault,$stopPropagation){
52
+	protected function _eventPreparing($preventDefault, $stopPropagation) {
53 53
 		$result="";
54 54
 		if ($preventDefault===true) {
55 55
 			$result.=Javascript::$preventDefault;
Please login to merge, or discard this patch.
Ajax/semantic/html/content/table/HtmlTR.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 
21 21
 	public function __construct($identifier) {
22 22
 		parent::__construct($identifier, "tr", "");
23
-		$this->_states=[ State::ACTIVE,State::POSITIVE,State::NEGATIVE,State::WARNING,State::ERROR,State::DISABLED ];
23
+		$this->_states=[State::ACTIVE, State::POSITIVE, State::NEGATIVE, State::WARNING, State::ERROR, State::DISABLED];
24 24
 	}
25 25
 
26 26
 	public function setColCount($colCount) {
27 27
 		$count=$this->count();
28
-		for($i=$count; $i < $colCount; $i++) {
28
+		for ($i=$count; $i<$colCount; $i++) {
29 29
 			$item=$this->addItem(NULL);
30 30
 			$item->setTagName($this->_tdTagName);
31 31
 		}
32 32
 		return $this;
33 33
 	}
34 34
 
35
-	public function getColCount(){
35
+	public function getColCount() {
36 36
 		return $this->count();
37 37
 	}
38 38
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param mixed $values
69 69
 	 */
70 70
 	public function setValues($values=array()) {
71
-		return $this->_addOrSetValues($values, function(&$cell,$value){$cell->setValue($value);});
71
+		return $this->_addOrSetValues($values, function(&$cell, $value) {$cell->setValue($value); });
72 72
 	}
73 73
 
74 74
 	/**
@@ -76,27 +76,27 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $values
77 77
 	 */
78 78
 	public function addValues($values=array()) {
79
-		return $this->_addOrSetValues($values, function(&$cell,$value){$cell->addValue($value);});
79
+		return $this->_addOrSetValues($values, function(&$cell, $value) {$cell->addValue($value); });
80 80
 	}
81 81
 
82 82
 	/**
83 83
 	 * Sets or adds values to the row cols
84 84
 	 * @param mixed $values
85 85
 	 */
86
-	protected function _addOrSetValues($values,$callback) {
86
+	protected function _addOrSetValues($values, $callback) {
87 87
 		$count=$this->count();
88 88
 		if (!\is_array($values)) {
89 89
 			$values=\array_fill(0, $count, $values);
90 90
 		} else {
91
-			if (JArray::isAssociative($values) === true) {
91
+			if (JArray::isAssociative($values)===true) {
92 92
 				$values=\array_values($values);
93 93
 			}
94 94
 		}
95 95
 		$count=\min(\sizeof($values), $count);
96 96
 
97
-		for($i=0; $i < $count; $i++) {
97
+		for ($i=0; $i<$count; $i++) {
98 98
 			$cell=$this->content[$i];
99
-			$callback($cell,$values[$i]);
99
+			$callback($cell, $values[$i]);
100 100
 		}
101 101
 		return $this;
102 102
 	}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	public function getColPosition($colIndex) {
123 123
 		$pos=0;
124 124
 		$rows=$this->_container->getContent();
125
-		for($i=0; $i < $this->_row; $i++) {
125
+		for ($i=0; $i<$this->_row; $i++) {
126 126
 			$max=\min($colIndex, $rows[$i]->count());
127
-			for($j=0; $j < $max; $j++) {
127
+			for ($j=0; $j<$max; $j++) {
128 128
 				$rowspan=$rows[$i]->getItem($j)->getRowspan();
129
-				if ($rowspan + $i > $this->_row)
129
+				if ($rowspan+$i>$this->_row)
130 130
 					$pos++;
131 131
 			}
132 132
 		}
133
-		if ($pos > $colIndex)
133
+		if ($pos>$colIndex)
134 134
 			return NULL;
135 135
 		$count=$this->count();
136
-		for($i=0; $i < $count; $i++) {
136
+		for ($i=0; $i<$count; $i++) {
137 137
 			$pos+=$this->content[$i]->getColspan();
138
-			if ($pos >= $colIndex + 1)
138
+			if ($pos>=$colIndex+1)
139 139
 				return $i;
140 140
 		}
141 141
 		return null;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 	public function conditionalCellFormat($callback, $format) {
145 145
 		$cells=$this->content;
146
-		foreach ( $cells as $cell ) {
146
+		foreach ($cells as $cell) {
147 147
 			$cell->conditionalCellFormat($callback, $format);
148 148
 		}
149 149
 		return $this;
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 
159 159
 	public function containsStr($needle) {
160 160
 		$cells=$this->content;
161
-		foreach ( $cells as $cell ) {
162
-			if (\strpos($cell->getContent(), $needle) !== false)
161
+		foreach ($cells as $cell) {
162
+			if (\strpos($cell->getContent(), $needle)!==false)
163 163
 				return true;
164 164
 		}
165 165
 		return false;
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 	public function applyCells($callback) {
174 174
 		$cells=$this->content;
175
-		foreach ( $cells as $cell ) {
175
+		foreach ($cells as $cell) {
176 176
 			$cell->apply($callback);
177 177
 		}
178 178
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlList.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
 
19 19
 	protected function createItem($value) {
20 20
 		$count=$this->count();
21
-		$item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value);
21
+		$item=new HtmlListItem("item-".$this->identifier."-".$count, $value);
22 22
 		return $item;
23 23
 	}
24 24
 
25 25
 	public function addHeader($niveau, $content) {
26
-		$header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page");
26
+		$header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page");
27 27
 		$this->wrap($header);
28 28
 		return $header;
29 29
 	}
30 30
 
31
-	public function getItemPart($index,$partName="header"){
31
+	public function getItemPart($index, $partName="header") {
32 32
 		return $this->getItem($index)->getPart($partName);
33 33
 	}
34 34
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	public function asLink() {
40
-		$this->addToPropertyCtrl("class", "link", array ("link" ));
40
+		$this->addToPropertyCtrl("class", "link", array("link"));
41 41
 		return $this->contentAs("a");
42 42
 	}
43 43
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	}
61 61
 
62 62
 	public function run(JsUtils $js) {
63
-		if ($this->_hasCheckedList === true) {
64
-			$jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php';
65
-			$jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode);
63
+		if ($this->_hasCheckedList===true) {
64
+			$jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php';
65
+			$jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode);
66 66
 			$this->executeOnRun($jsCode);
67 67
 		}
68 68
 		return parent::run($js);
@@ -86,24 +86,24 @@  discard block
 block discarded – undo
86 86
 
87 87
 	public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) {
88 88
 		$count=$this->count();
89
-		$identifier=$this->identifier . "-" . $count;
89
+		$identifier=$this->identifier."-".$count;
90 90
 		if (isset($masterItem)) {
91
-			$masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem);
91
+			$masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem);
92 92
 			$masterO->getHtmlCk()->addToProperty("class", "master");
93 93
 			$masterO->setClass("item");
94 94
 			$this->addItem($masterO);
95 95
 		}
96
-		$fields=array ();
96
+		$fields=array();
97 97
 		$i=0;
98
-		foreach ( $items as $val => $caption ) {
99
-			$itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child");
100
-			if (\array_search($val, $values) !== false) {
98
+		foreach ($items as $val => $caption) {
99
+			$itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child");
100
+			if (\array_search($val, $values)!==false) {
101 101
 				$itemO->getField()->setProperty("checked", "");
102 102
 			}
103 103
 			$itemO->setClass("item");
104 104
 			$fields[]=$itemO;
105 105
 		}
106
-		if (isset($masterO) === true) {
106
+		if (isset($masterO)===true) {
107 107
 			$list=new HtmlList("", $fields);
108 108
 			$list->setClass("list");
109 109
 			$masterO->addContent($list);
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 		return $this;
115 115
 	}
116 116
 
117
-	public function setIcons($icons){
118
-		if(!\is_array($icons)){
117
+	public function setIcons($icons) {
118
+		if (!\is_array($icons)) {
119 119
 			$icons=\array_fill(0, \sizeof($this->content), $icons);
120 120
 		}
121
-		$max=\min(\sizeof($icons),\sizeof($this->content));
122
-		for($i=0;$i<$max;$i++){
121
+		$max=\min(\sizeof($icons), \sizeof($this->content));
122
+		for ($i=0; $i<$max; $i++) {
123 123
 			$this->content[$i]->addIcon($icons[$i]);
124 124
 		}
125 125
 		return $this;
Please login to merge, or discard this patch.