Completed
Push — master ( a07245...010ee5 )
by Jean-Christophe
03:13
created
Ajax/semantic/html/content/HtmlMenuItem.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,27 +9,27 @@
 block discarded – undo
9 9
 class HtmlMenuItem extends HtmlSemDoubleElement {
10 10
 	use MenuItemTrait;
11 11
 	public function __construct($identifier, $content) {
12
-		parent::__construct($identifier,"div","item",$content);
12
+		parent::__construct($identifier, "div", "item", $content);
13 13
 	}
14 14
 
15
-	protected function initContent($content){
16
-		if(\is_array($content)){
17
-			if(JArray::isAssociative($content)===false){
15
+	protected function initContent($content) {
16
+		if (\is_array($content)) {
17
+			if (JArray::isAssociative($content)===false) {
18 18
 				$icon=@$content[0];
19 19
 				$title=@$content[1];
20 20
 				$desc=@$content[2];
21
-			}else{
21
+			} else {
22 22
 				$icon=@$content["icon"];
23 23
 				$title=@$content["title"];
24 24
 				$desc=@$content["description"];
25 25
 			}
26
-			if(isset($icon)){
26
+			if (isset($icon)) {
27 27
 				$this->addIcon($icon);
28 28
 			}
29
-			if(isset($title)){
30
-				$this->setTitle($title,$desc);
29
+			if (isset($title)) {
30
+				$this->setTitle($title, $desc);
31 31
 			}
32
-		}else{
32
+		} else {
33 33
 			$this->setContent($content);
34 34
 		}
35 35
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlListItem.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 	protected $image;
10 10
 
11 11
 	public function __construct($identifier, $content=NULL) {
12
-		parent::__construct($identifier,"item",$content);
12
+		parent::__construct($identifier, "item", $content);
13 13
 	}
14
-	protected function initContent($content){
15
-		if(\is_array($content)){
16
-			if(JArray::isAssociative($content)===false){
14
+	protected function initContent($content) {
15
+		if (\is_array($content)) {
16
+			if (JArray::isAssociative($content)===false) {
17 17
 				$icon=@$content[0];
18 18
 				$title=@$content[1];
19 19
 				$desc=@$content[2];
20
-			}else{
20
+			} else {
21 21
 				$icon=@$content["icon"];
22 22
 				$image=@$content["image"];
23 23
 				$title=@$content["title"];
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 				$desc=@$content["description"];
26 26
 				$items=@$content["items"];
27 27
 			}
28
-			if(isset($icon)){
28
+			if (isset($icon)) {
29 29
 				$this->setIcon($icon);
30 30
 			}
31
-			if(isset($image)){
31
+			if (isset($image)) {
32 32
 				$this->setImage($image);
33 33
 			}
34
-			if(isset($title)){
35
-				$this->setTitle($title,$desc);
36
-			}elseif (isset($header)===true){
37
-				$this->setTitle($header,$desc,"header");
34
+			if (isset($title)) {
35
+				$this->setTitle($title, $desc);
36
+			}elseif (isset($header)===true) {
37
+				$this->setTitle($header, $desc, "header");
38 38
 			}
39
-			if(isset($items)){
39
+			if (isset($items)) {
40 40
 				$this->addList($items);
41 41
 			}
42
-		}else{
42
+		} else {
43 43
 			$this->setContent($content);
44 44
 		}
45 45
 	}
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 		return $list;
51 51
 	}
52 52
 
53
-	public function getList(){
53
+	public function getList() {
54 54
 		return $this->content["list"];
55 55
 	}
56 56
 
57
-	public function getItem($index){
57
+	public function getItem($index) {
58 58
 		return $this->getList()->getItem($index);
59 59
 	}
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormField.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,34 +14,34 @@  discard block
 block discarded – undo
14 14
 	use FieldTrait;
15 15
 	protected $_container;
16 16
 	protected $_validation;
17
-	public function __construct($identifier, $field,$label=NULL) {
18
-		parent::__construct($identifier, "div","field");
17
+	public function __construct($identifier, $field, $label=NULL) {
18
+		parent::__construct($identifier, "div", "field");
19 19
 		$this->content=array();
20
-		$this->_states=[State::ERROR,State::DISABLED];
21
-		if(isset($label))
20
+		$this->_states=[State::ERROR, State::DISABLED];
21
+		if (isset($label))
22 22
 			$this->setLabel($label);
23 23
 		$this->setField($field);
24 24
 		$this->_validation=NULL;
25 25
 	}
26 26
 
27
-	public function addPointingLabel($label,$pointing=Direction::NONE){
28
-		$labelO=new HtmlLabel("",$label);
27
+	public function addPointingLabel($label, $pointing=Direction::NONE) {
28
+		$labelO=new HtmlLabel("", $label);
29 29
 		$labelO->setPointing($pointing);
30
-		$this->addContent($labelO,$pointing==="below" || $pointing==="right");
30
+		$this->addContent($labelO, $pointing==="below" || $pointing==="right");
31 31
 		return $labelO;
32 32
 	}
33 33
 
34
-	public function setLabel($label){
34
+	public function setLabel($label) {
35 35
 		$labelO=$label;
36
-		if(\is_string($label)){
37
-			$labelO=new HtmlSemDoubleElement("","label","");
36
+		if (\is_string($label)) {
37
+			$labelO=new HtmlSemDoubleElement("", "label", "");
38 38
 			$labelO->setContent($label);
39
-			$labelO->setProperty("for", \str_replace("field-", "",$this->identifier));
39
+			$labelO->setProperty("for", \str_replace("field-", "", $this->identifier));
40 40
 		}
41 41
 		$this->content["label"]=$labelO;
42 42
 	}
43 43
 
44
-	public function setField($field){
44
+	public function setField($field) {
45 45
 		$this->content["field"]=$field;
46 46
 	}
47 47
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 	 * Returns the label or null
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function getLabel(){
53
-		if(\array_key_exists("label", $this->content))
52
+	public function getLabel() {
53
+		if (\array_key_exists("label", $this->content))
54 54
 			return $this->content["label"];
55 55
 	}
56 56
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * Return the field
59 59
 	 * @return mixed
60 60
 	 */
61
-	public function getField(){
61
+	public function getField() {
62 62
 		return $this->content["field"];
63 63
 	}
64 64
 
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	 * Return the field with data
67 67
 	 * @return mixed
68 68
 	 */
69
-	public function getDataField(){
69
+	public function getDataField() {
70 70
 		return $this->content["field"];
71 71
 	}
72 72
 
73 73
 	/**
74 74
 	 * puts the label before or behind
75 75
 	 */
76
-	public function swapLabel(){
76
+	public function swapLabel() {
77 77
 		$label=$this->getLabel();
78 78
 		unset($this->content["label"]);
79 79
 		$this->content["label"]=$label;
@@ -84,31 +84,31 @@  discard block
 block discarded – undo
84 84
 	 * @param int $width
85 85
 	 * @return \Ajax\semantic\html\collections\form\HtmlFormField
86 86
 	 */
87
-	public function setWidth($width){
88
-		if(\is_int($width)){
87
+	public function setWidth($width) {
88
+		if (\is_int($width)) {
89 89
 			$width=Wide::getConstants()["W".$width];
90 90
 		}
91 91
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
92
-		if(isset($this->_container)){
92
+		if (isset($this->_container)) {
93 93
 			$this->_container->setEqualWidth(false);
94 94
 		}
95
-		return $this->addToPropertyCtrl("class", "wide",array("wide"));
95
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
96 96
 	}
97 97
 
98 98
 	/**
99 99
 	 * Field displays an error state
100 100
 	 * @return \Ajax\semantic\html\collections\form\HtmlFormField
101 101
 	 */
102
-	public function setError(){
102
+	public function setError() {
103 103
 		return $this->addToProperty("class", "error");
104 104
 	}
105 105
 
106
-	public function setInline(){
106
+	public function setInline() {
107 107
 		return $this->addToProperty("class", "inline");
108 108
 	}
109 109
 
110
-	public function jsState($state){
111
-		return $this->jsDoJquery("addClass",$state);
110
+	public function jsState($state) {
111
+		return $this->jsDoJquery("addClass", $state);
112 112
 	}
113 113
 
114 114
 	public function setContainer($_container) {
@@ -116,26 +116,26 @@  discard block
 block discarded – undo
116 116
 		return $this;
117 117
 	}
118 118
 
119
-	public function setReadonly(){
119
+	public function setReadonly() {
120 120
 		$this->getField()->setProperty("readonly", "");
121 121
 	}
122 122
 
123
-	public function addRule($type,$prompt=NULL,$value=NULL){
123
+	public function addRule($type, $prompt=NULL, $value=NULL) {
124 124
 		$field=$this->getDataField();
125
-		if(isset($field)){
126
-			if(!isset($this->_validation)){
125
+		if (isset($field)) {
126
+			if (!isset($this->_validation)) {
127 127
 				$this->_validation=new FieldValidation($field->getIdentifier());
128 128
 			}
129
-			if($type==="empty"){
130
-				$this->addToProperty("class","required");
129
+			if ($type==="empty") {
130
+				$this->addToProperty("class", "required");
131 131
 			}
132
-			$this->_validation->addRule($type,$prompt,$value);
132
+			$this->_validation->addRule($type, $prompt, $value);
133 133
 		}
134 134
 		return $this;
135 135
 	}
136 136
 
137
-	public function addRules(array $rules){
138
-		foreach ($rules as $rule){
137
+	public function addRules(array $rules) {
138
+		foreach ($rules as $rule) {
139 139
 			$this->addRule($rule);
140 140
 		}
141 141
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/menus/HtmlMenu.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -39,20 +39,20 @@  discard block
 block discarded – undo
39 39
 	 * @return \Ajax\semantic\html\collections\HtmlMenu
40 40
 	 */
41 41
 	public function setType($type="") {
42
-		return $this->addToPropertyCtrl("class", $type, array ("","item","text" ));
42
+		return $this->addToPropertyCtrl("class", $type, array("", "item", "text"));
43 43
 	}
44 44
 
45 45
 	public function setActiveItem($index) {
46 46
 		$item=$this->getItem($index);
47
-		if ($item !== null) {
47
+		if ($item!==null) {
48 48
 			$item->addToProperty("class", "active");
49 49
 		}
50 50
 		return $this;
51 51
 	}
52 52
 
53 53
 	private function getItemToInsert($item) {
54
-		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton ) {
55
-			$itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item);
54
+		if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton) {
55
+			$itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item);
56 56
 			$item=$itemO;
57 57
 		}
58 58
 		return $item;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 	private function afterInsert($item) {
62 62
 		if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false)
63
-			$item->addToPropertyCtrl("class", "item", array ("item" ));
63
+			$item->addToPropertyCtrl("class", "item", array("item"));
64 64
 		else {
65 65
 			$this->setSecondary();
66 66
 		}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function addItem($item) {
77 77
 		$number=$item;
78 78
 		$item=parent::addItem($this->getItemToInsert($item));
79
-		if(\is_int($number))
79
+		if (\is_int($number))
80 80
 			$item->setProperty("data-page", $number);
81 81
 		return $this->afterInsert($item);
82 82
 	}
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
 
95 95
 	public function generateMenuAsItem($menu, $header=null) {
96 96
 		$count=$this->count();
97
-		$item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div");
97
+		$item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div");
98 98
 		if (isset($header)) {
99
-			$headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header");
99
+			$headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header");
100 100
 			$headerItem->setContent($header);
101 101
 			$item->addContent($headerItem);
102 102
 			$this->_itemHeader=$headerItem;
103 103
 		}
104
-		if(\is_array($menu)){
105
-			$menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu);
104
+		if (\is_array($menu)) {
105
+			$menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu);
106 106
 		}
107 107
 		$menu->setClass("menu");
108 108
 		$item->addContent($menu);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		$value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value);
118 118
 		$value->addContent(new HtmlIcon("", "dropdown"));
119 119
 		$value=$this->addItem($value);
120
-		$popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content);
120
+		$popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content);
121 121
 		$popup->setFlowing()->setPosition("bottom left")->setOn("click");
122 122
 		$this->wrap("", $popup);
123 123
 		return $popup;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	public function addDropdownAsItem($value, $items=NULL) {
127 127
 		$dd=$value;
128 128
 		if (\is_string($value)) {
129
-			$dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items);
129
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items);
130 130
 		}
131 131
 		$this->addItem($dd);
132 132
 		return $dd;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 * @see \Ajax\common\html\html5\HtmlCollection::createItem()
140 140
 	 */
141 141
 	protected function createItem($value) {
142
-		$itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),"");
142
+		$itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), "");
143 143
 		$itemO->setTagName("a");
144 144
 		$itemO->setContent($value);
145 145
 		return $itemO;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	}
151 151
 
152 152
 	public function setSecondary($value=true) {
153
-		if($value)
153
+		if ($value)
154 154
 			$this->addToProperty("class", "secondary");
155 155
 		else
156 156
 			$this->removePropertyValue("class", "secondary");
@@ -158,28 +158,28 @@  discard block
 block discarded – undo
158 158
 	}
159 159
 
160 160
 	public function setVertical() {
161
-		return $this->addToPropertyCtrl("class", "vertical", array ("vertical" ));
161
+		return $this->addToPropertyCtrl("class", "vertical", array("vertical"));
162 162
 	}
163 163
 
164 164
 	public function setPosition($value="right") {
165
-		return $this->addToPropertyCtrl("class", $value, array ("right","left" ));
165
+		return $this->addToPropertyCtrl("class", $value, array("right", "left"));
166 166
 	}
167 167
 
168 168
 	public function setPointing($value=Direction::NONE) {
169
-		return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing"));
169
+		return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing"));
170 170
 	}
171 171
 
172 172
 	public function asTab($vertical=false) {
173
-		$this->apply(function (HtmlDoubleElement &$item) {
173
+		$this->apply(function(HtmlDoubleElement&$item) {
174 174
 			$item->setTagName("a");
175 175
 		});
176
-		if ($vertical === true)
176
+		if ($vertical===true)
177 177
 			$this->setVertical();
178 178
 		return $this->addToProperty("class", "tabular");
179 179
 	}
180 180
 
181 181
 	public function asPagination() {
182
-		$this->apply(function (HtmlDoubleElement &$item) {
182
+		$this->apply(function(HtmlDoubleElement&$item) {
183 183
 			$item->setTagName("a");
184 184
 		});
185 185
 		return $this->addToProperty("class", "pagination");
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function setWidth($width) {
218 218
 		if (\is_int($width)) {
219
-			$width=Wide::getConstants()["W" . $width];
219
+			$width=Wide::getConstants()["W".$width];
220 220
 		}
221 221
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
222
-		return $this->addToPropertyCtrl("class", "item", array ("item" ));
222
+		return $this->addToPropertyCtrl("class", "item", array("item"));
223 223
 	}
224 224
 
225 225
 	public function addImage($identifier, $src="", $alt="") {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 		return $this->_itemHeader;
235 235
 	}
236 236
 
237
-	public function run(JsUtils $js){
238
-		$result= parent::run($js);
237
+	public function run(JsUtils $js) {
238
+		$result=parent::run($js);
239 239
 		return $result->setItemSelector(".item");
240 240
 	}
241 241
 }
242 242
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -16,121 +16,121 @@
 block discarded – undo
16 16
  * @property InstanceViewer $_instanceViewer
17 17
  */
18 18
 
19
-trait FieldAsTrait{
19
+trait FieldAsTrait {
20 20
 
21 21
 	abstract protected function _getFieldIdentifier($prefix);
22
-	abstract public function setValueFunction($index,$callback);
22
+	abstract public function setValueFunction($index, $callback);
23 23
 
24
-	private function _getLabelField($caption,$icon=NULL){
25
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
24
+	private function _getLabelField($caption, $icon=NULL) {
25
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
26 26
 		return $label;
27 27
 	}
28 28
 
29
-	protected function _addRules($element,&$attributes){}
29
+	protected function _addRules($element, &$attributes) {}
30 30
 
31
-	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$prefix=null){
32
-		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback,$prefix){
31
+	protected function _fieldAs($elementCallback, $index, $attributes=NULL, $prefix=null) {
32
+		$this->setValueFunction($index, function($value) use ($index, &$attributes, $elementCallback, $prefix){
33 33
 			$name=$this->_instanceViewer->getCaption($index)."[]";
34
-			if(isset($attributes["name"])){
34
+			if (isset($attributes["name"])) {
35 35
 				$name=$attributes["name"];
36 36
 			}
37
-			$element=$elementCallback($this->_getFieldIdentifier($prefix),$name,$value,"");
38
-			if(\is_array($attributes))
39
-				$this->_applyAttributes($element, $attributes,$index);
37
+			$element=$elementCallback($this->_getFieldIdentifier($prefix), $name, $value, "");
38
+			if (\is_array($attributes))
39
+				$this->_applyAttributes($element, $attributes, $index);
40 40
 			return $element;
41 41
 		});
42 42
 			return $this;
43 43
 	}
44 44
 
45 45
 
46
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
47
-		$this->setValueFunction($index,function($value) use($label,$attributes){
48
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
46
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
47
+		$this->setValueFunction($index, function($value) use($label, $attributes){
48
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
49 49
 			return $pb;
50 50
 		});
51 51
 			return $this;
52 52
 	}
53 53
 
54
-	public function fieldAsRating($index,$max=5, $icon=""){
55
-		$this->setValueFunction($index,function($value) use($max,$icon){
56
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
54
+	public function fieldAsRating($index, $max=5, $icon="") {
55
+		$this->setValueFunction($index, function($value) use($max, $icon){
56
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
57 57
 			return $rating;
58 58
 		});
59 59
 			return $this;
60 60
 	}
61 61
 
62
-	public function fieldAsLabel($index,$icon=NULL){
63
-		$this->setValueFunction($index,function($caption) use($icon){
64
-			$lbl=$this->_getLabelField($caption,$icon);
62
+	public function fieldAsLabel($index, $icon=NULL) {
63
+		$this->setValueFunction($index, function($caption) use($icon){
64
+			$lbl=$this->_getLabelField($caption, $icon);
65 65
 			return $lbl;
66 66
 		});
67 67
 			return $this;
68 68
 	}
69 69
 
70
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
71
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
72
-			$header=new HtmlHeader($id,$niveau,$value);
73
-			if(isset($icon))
70
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
71
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
72
+			$header=new HtmlHeader($id, $niveau, $value);
73
+			if (isset($icon))
74 74
 				$header->asIcon($icon, $value);
75 75
 			return $header;
76
-		}, $index,$attributes,"header");
76
+		}, $index, $attributes, "header");
77 77
 	}
78 78
 
79 79
 
80
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
81
-		$this->setValueFunction($index,function($img) use($size,$circular){
82
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
80
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
81
+		$this->setValueFunction($index, function($img) use($size, $circular){
82
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
83 83
 			return $image;
84 84
 		});
85 85
 			return $this;
86 86
 	}
87 87
 
88
-	public function fieldAsAvatar($index,$attributes=NULL){
89
-		return $this->_fieldAs(function($id,$name,$value){
90
-			$img=new HtmlImage($id,$value);
88
+	public function fieldAsAvatar($index, $attributes=NULL) {
89
+		return $this->_fieldAs(function($id, $name, $value) {
90
+			$img=new HtmlImage($id, $value);
91 91
 			$img->asAvatar();
92 92
 			return $img;
93
-		}, $index,$attributes,"avatar");
93
+		}, $index, $attributes, "avatar");
94 94
 	}
95 95
 
96
-	public function fieldAsRadio($index,$attributes=NULL){
97
-		return $this->_fieldAs(function($id,$name,$value){
98
-			$input= new HtmlRadio($id,$name,$value,$value);
96
+	public function fieldAsRadio($index, $attributes=NULL) {
97
+		return $this->_fieldAs(function($id, $name, $value) {
98
+			$input=new HtmlRadio($id, $name, $value, $value);
99 99
 			return $input;
100
-		}, $index,$attributes,"radio");
100
+		}, $index, $attributes, "radio");
101 101
 	}
102 102
 
103
-	public function fieldAsInput($index,$attributes=NULL){
104
-		return $this->_fieldAs(function($id,$name,$value){
105
-			$input= new HtmlInput($id,"text",$value);
103
+	public function fieldAsInput($index, $attributes=NULL) {
104
+		return $this->_fieldAs(function($id, $name, $value) {
105
+			$input=new HtmlInput($id, "text", $value);
106 106
 			//TODO check getField
107 107
 			$input->setName($name);
108 108
 			return $input;
109
-		}, $index,$attributes,"input");
109
+		}, $index, $attributes, "input");
110 110
 	}
111 111
 
112
-	public function fieldAsHidden($index,$attributes=NULL){
113
-		if(\is_array($attributes)===false){
112
+	public function fieldAsHidden($index, $attributes=NULL) {
113
+		if (\is_array($attributes)===false) {
114 114
 			$attributes=[];
115 115
 		}
116 116
 		$attributes["imputType"]="hidden";
117
-		return $this->fieldAsInput($index,$attributes);
117
+		return $this->fieldAsInput($index, $attributes);
118 118
 	}
119 119
 
120
-	public function fieldAsCheckbox($index,$attributes=NULL){
121
-		return $this->_fieldAs(function($id,$name,$value){
122
-			$input=new HtmlCheckbox($id,"",$this->_instanceViewer->getIdentifier());
120
+	public function fieldAsCheckbox($index, $attributes=NULL) {
121
+		return $this->_fieldAs(function($id, $name, $value) {
122
+			$input=new HtmlCheckbox($id, "", $this->_instanceViewer->getIdentifier());
123 123
 			$input->setChecked(JString::isBooleanTrue($value));
124 124
 			$input->getField()->setProperty("name", $name);
125 125
 			return $input;
126
-		}, $index,$attributes,"ck");
126
+		}, $index, $attributes, "ck");
127 127
 	}
128 128
 
129
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
130
-		return $this->_fieldAs(function($id,$name,$value) use($elements,$multiple){
131
-			$dd=new HtmlDropdown($id,$value,$elements);
132
-			$dd->asSelect($name,$multiple);
129
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
130
+		return $this->_fieldAs(function($id, $name, $value) use($elements, $multiple){
131
+			$dd=new HtmlDropdown($id, $value, $elements);
132
+			$dd->asSelect($name, $multiple);
133 133
 			return $dd;
134
-		}, $index,$attributes,"dd");
134
+		}, $index, $attributes, "dd");
135 135
 	}
136 136
 }
137 137
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/Jquery.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
  * @license Apache 2 http://www.apache.org/licenses/
16 16
  **/
17 17
 class Jquery {
18
-	use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait;
18
+	use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait;
19 19
 	protected $_ui;
20 20
 	protected $_bootstrap;
21 21
 	protected $_semantic;
22
-	protected $jquery_code_for_compile=array ();
22
+	protected $jquery_code_for_compile=array();
23 23
 	protected $jsUtils;
24 24
 	protected $params;
25 25
 
26
-	protected $jquery_events=array (
27
-			"bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload"
26
+	protected $jquery_events=array(
27
+			"bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload"
28 28
 	);
29 29
 
30 30
 	public function ui($ui=NULL) {
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 		return $this->_semantic;
49 49
 	}
50 50
 
51
-	public function __construct($params,$jsUtils) {
51
+	public function __construct($params, $jsUtils) {
52 52
 		$this->params=array();
53
-		foreach ( $params as $key => $val ) {
53
+		foreach ($params as $key => $val) {
54 54
 				$this->params[$key]=$params[$key];
55 55
 		}
56 56
 		$this->jsUtils=$jsUtils;
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function _output($array_js='') {
116 116
 		if (!is_array($array_js)) {
117
-			$array_js=array (
117
+			$array_js=array(
118 118
 					$array_js
119 119
 			);
120 120
 		}
121 121
 
122
-		foreach ( $array_js as $js ) {
122
+		foreach ($array_js as $js) {
123 123
 			$this->jquery_code_for_compile[]="\t$js\n";
124 124
 		}
125 125
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param string $param
132 132
 	 * @param boolean $immediatly delayed if false
133 133
 	 */
134
-	public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) {
134
+	public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) {
135 135
 		$element=Javascript::prep_element($element);
136 136
 		if (isset($param)) {
137 137
 			$param=Javascript::prep_value($param);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param boolean $immediatly delayed if false
151 151
 	 * @return string
152 152
 	 */
153
-	public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) {
153
+	public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) {
154 154
 		$to=Javascript::prep_element($to);
155 155
 		$element=Javascript::prep_element($element);
156 156
 		$str="$({$to}).{$jQueryCall}({$element});";
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	public function sortable($element, $options=array()) {
170 170
 		if (count($options)>0) {
171
-			$sort_options=array ();
172
-			foreach ( $options as $k => $v ) {
171
+			$sort_options=array();
172
+			foreach ($options as $k => $v) {
173 173
 				$sort_options[]="\n\t\t".$k.': '.$v."";
174 174
 			}
175 175
 			$sort_options=implode(",", $sort_options);
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
202 202
 	 * @return string
203 203
 	 */
204
-	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) {
204
+	public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) {
205 205
 		if (is_array($js)) {
206 206
 			$js=implode("\n\t\t", $js);
207 207
 		}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 			$event="\n\t$(".Javascript::prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n";
216 216
 		else
217 217
 			$event="\n\t$(".Javascript::prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n";
218
-		if($immediatly)
218
+		if ($immediatly)
219 219
 			$this->jquery_code_for_compile[]=$event;
220 220
 		return $event;
221 221
 	}
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
 		$script.='});';
248 248
 
249 249
 		$this->jquery_code_for_compile=array();
250
-		if($this->params["debug"]==false){
250
+		if ($this->params["debug"]==false) {
251 251
 			$script=$this->minify($script);
252 252
 		}
253 253
 		$output=($script_tags===FALSE) ? $script : $this->inline($script);
254 254
 
255
-		if ($view!==NULL){
256
-			$this->jsUtils->createScriptVariable($view,$view_var, $output);
255
+		if ($view!==NULL) {
256
+			$this->jsUtils->createScriptVariable($view, $view_var, $output);
257 257
 		}
258 258
 		return $output;
259 259
 	}
260 260
 
261
-	private function _compileLibrary($library){
261
+	private function _compileLibrary($library) {
262 262
 		if ($library!=NULL) {
263 263
 			if ($library->isAutoCompile()) {
264 264
 				$library->compile(true);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 * @return void
277 277
 	 */
278 278
 	public function _clear_compile() {
279
-		$this->jquery_code_for_compile=array ();
279
+		$this->jquery_code_for_compile=array();
280 280
 	}
281 281
 
282 282
 	/**
@@ -285,18 +285,18 @@  discard block
 block discarded – undo
285 285
 	 */
286 286
 	public function _document_ready($js) {
287 287
 		if (!is_array($js)) {
288
-			$js=array (
288
+			$js=array(
289 289
 					$js
290 290
 			);
291 291
 		}
292 292
 
293
-		foreach ( $js as $script ) {
293
+		foreach ($js as $script) {
294 294
 			$this->jquery_code_for_compile[]=$script;
295 295
 		}
296 296
 	}
297 297
 
298 298
 	private function minify($input) {
299
-	if(trim($input) === "") return $input;
299
+	if (trim($input)==="") return $input;
300 300
 	return preg_replace(
301 301
 			array(
302 302
 					// Remove comment(s)
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  */
21 21
 class HtmlForm extends HtmlSemCollection {
22 22
 
23
-	use FieldsTrait,FormTrait;
23
+	use FieldsTrait, FormTrait;
24 24
 	/**
25 25
 	 * @var array
26 26
 	 */
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct($identifier, $elements=array()) {
35 35
 		parent::__construct($identifier, "form", "ui form");
36
-		$this->_states=[ State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED ];
36
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
37 37
 		$this->setProperty("name", $this->identifier);
38
-		$this->_fields=array ();
38
+		$this->_fields=array();
39 39
 		$this->_validationParams=[];
40 40
 		$this->addItems($elements);
41 41
 	}
42 42
 
43
-	protected function getForm(){
43
+	protected function getForm() {
44 44
 		return $this;
45 45
 	}
46 46
 
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 	 * @param string $caption
62 62
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
63 63
 	 */
64
-	public function addDivider($caption=NULL){
65
-		return $this->addContent(new HtmlDivider("",$caption));
64
+	public function addDivider($caption=NULL) {
65
+		return $this->addContent(new HtmlDivider("", $caption));
66 66
 	}
67 67
 
68 68
 	public function addFields($fields=NULL, $label=NULL) {
69 69
 		if (isset($fields)) {
70 70
 			if (!$fields instanceof HtmlFormFields) {
71
-				if (\is_array($fields) === false) {
71
+				if (\is_array($fields)===false) {
72 72
 					$fields=\func_get_args();
73 73
 					$end=\end($fields);
74 74
 					if (\is_string($end)) {
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
 						$label=NULL;
79 79
 				}
80 80
 				$this->_fields=\array_merge($this->_fields, $fields);
81
-				$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count(), $fields);
81
+				$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
82 82
 			}
83 83
 			if (isset($label))
84 84
 				$fields=new HtmlFormField("", $fields, $label);
85 85
 		} else {
86
-			$fields=new HtmlFormFields("fields-" . $this->identifier . "-" . $this->count());
86
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count());
87 87
 		}
88 88
 		$this->addItem($fields);
89 89
 		return $fields;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	public function addItem($item) {
93 93
 		$item=parent::addItem($item);
94
-		if (\is_subclass_of($item, HtmlFormField::class) === true) {
94
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
95 95
 			$this->_fields[]=$item;
96 96
 		}
97 97
 		return $item;
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 		return $this->addItem($message);
144 144
 	}
145 145
 
146
-	private function addCompoValidation($js,$compo,$field){
146
+	private function addCompoValidation($js, $compo, $field) {
147 147
 		$validation=$field->getValidation();
148
-		if(isset($validation)){
149
-			if(isset($compo)===false){
148
+		if (isset($validation)) {
149
+			if (isset($compo)===false) {
150 150
 				$compo=$js->semantic()->form("#".$this->identifier);
151 151
 			}
152 152
 			$validation->setIdentifier($field->getDataField()->getIdentifier());
@@ -155,38 +155,38 @@  discard block
 block discarded – undo
155 155
 		return $compo;
156 156
 	}
157 157
 
158
-	public function compile(JsUtils $js=NULL,&$view=NULL){
159
-		if(\sizeof($this->_validationParams)>0)
158
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
159
+		if (\sizeof($this->_validationParams)>0)
160 160
 			$this->setProperty("novalidate", "");
161
-		return parent::compile($js,$view);
161
+		return parent::compile($js, $view);
162 162
 	}
163 163
 
164 164
 	public function run(JsUtils $js) {
165 165
 		$compo=NULL;
166
-		foreach ($this->_fields as $field){
167
-			if($field instanceof HtmlFormField)
166
+		foreach ($this->_fields as $field) {
167
+			if ($field instanceof HtmlFormField)
168 168
 				$compo=$this->addCompoValidation($js, $compo, $field);
169 169
 		}
170
-		foreach ($this->content as $field){
171
-			if($field instanceof HtmlFormFields){
170
+		foreach ($this->content as $field) {
171
+			if ($field instanceof HtmlFormFields) {
172 172
 				$items=$field->getItems();
173
-				foreach ($items as $_field){
174
-					if($_field instanceof HtmlFormField)
173
+				foreach ($items as $_field) {
174
+					if ($_field instanceof HtmlFormField)
175 175
 						$compo=$this->addCompoValidation($js, $compo, $_field);
176 176
 				}
177 177
 			}
178 178
 		}
179
-		if(isset($compo)===false){
179
+		if (isset($compo)===false) {
180 180
 			return parent::run($js);
181 181
 		}
182
-		$this->_runValidationParams($compo,$js);
182
+		$this->_runValidationParams($compo, $js);
183 183
 		return $this->_bsComponent;
184 184
 	}
185 185
 
186
-	private function _runValidationParams(&$compo,JsUtils $js=NULL){
187
-		if(isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall){
186
+	private function _runValidationParams(&$compo, JsUtils $js=NULL) {
187
+		if (isset($this->_validationParams["_ajaxSubmit"]) && $this->_validationParams["_ajaxSubmit"] instanceof AjaxCall) {
188 188
 			$compilation=$this->_validationParams["_ajaxSubmit"]->compile($js);
189
-			$compilation=str_ireplace("\"","%quote%", $compilation);
189
+			$compilation=str_ireplace("\"", "%quote%", $compilation);
190 190
 			$this->onSuccess($compilation);
191 191
 			unset($this->_validationParams["_ajaxSubmit"]);
192 192
 		}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		$this->addEventsOnRun($js);
196 196
 	}
197 197
 
198
-	public function addValidationParam($paramName,$paramValue){
198
+	public function addValidationParam($paramName, $paramValue) {
199 199
 		$this->_validationParams[$paramName]=$paramValue;
200 200
 		return $this;
201 201
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	protected $_hasCheckboxes;
31 31
 	protected $_compileParts;
32 32
 
33
-	public function run(JsUtils $js){
34
-		if($this->_hasCheckboxes && isset($js)){
33
+	public function run(JsUtils $js) {
34
+		if ($this->_hasCheckboxes && isset($js)) {
35 35
 			$js->execOn("change", "#".$this->identifier." [name='selection[]']", "
36 36
 		var \$parentCheckbox=\$('#ck-main-ck-{$this->identifier}'),\$checkbox=\$('#{$this->identifier} [name=\"selection[]\"]'),allChecked=true,allUnchecked=true;
37 37
 		\$checkbox.each(function() {if($(this).prop('checked')){allUnchecked = false;}else{allChecked = false;}});
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		parent::run($js);
41 41
 	}
42 42
 
43
-	public function __construct($identifier,$model,$modelInstance=NULL) {
44
-		parent::__construct($identifier, $model,$modelInstance);
43
+	public function __construct($identifier, $model, $modelInstance=NULL) {
44
+		parent::__construct($identifier, $model, $modelInstance);
45 45
 		$this->_instanceViewer=new InstanceViewer($identifier);
46
-		$this->content=["table"=>new HtmlTable($identifier, 0,0)];
46
+		$this->content=["table"=>new HtmlTable($identifier, 0, 0)];
47 47
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
48 48
 	}
49 49
 
@@ -56,61 +56,61 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 
59
-	public function compile(JsUtils $js=NULL,&$view=NULL){
59
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
60 60
 		$this->_instanceViewer->setInstance($this->_model);
61 61
 		$captions=$this->_instanceViewer->getCaptions();
62 62
 
63 63
 		$table=$this->content["table"];
64 64
 
65
-		if($this->_hasCheckboxes){
65
+		if ($this->_hasCheckboxes) {
66 66
 			$this->_generateMainCheckbox($captions);
67 67
 		}
68 68
 
69 69
 		$table->setRowCount(0, \sizeof($captions));
70 70
 		$table->setHeaderValues($captions);
71
-		if(isset($this->_compileParts))
71
+		if (isset($this->_compileParts))
72 72
 			$table->setCompileParts($this->_compileParts);
73
-		if(isset($this->_searchField) && isset($js)){
74
-			$this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","-#".$this->identifier." tbody",["preventDefault"=>false]);
73
+		if (isset($this->_searchField) && isset($js)) {
74
+			$this->_searchField->postOn("change", $this->_urls, "{'s':$(this).val()}", "-#".$this->identifier." tbody", ["preventDefault"=>false]);
75 75
 		}
76 76
 
77 77
 		$this->_generateContent($table);
78 78
 
79
-		if($this->_hasCheckboxes && $table->hasPart("thead")){
80
-				$table->getHeader()->getCell(0, 0)->addToProperty("class","no-sort");
79
+		if ($this->_hasCheckboxes && $table->hasPart("thead")) {
80
+				$table->getHeader()->getCell(0, 0)->addToProperty("class", "no-sort");
81 81
 		}
82 82
 
83
-		if(isset($this->_pagination) && $this->_pagination->getVisible()){
83
+		if (isset($this->_pagination) && $this->_pagination->getVisible()) {
84 84
 			$this->_generatePagination($table);
85 85
 		}
86
-		if(isset($this->_toolbar)){
86
+		if (isset($this->_toolbar)) {
87 87
 			$this->_setToolbarPosition($table, $captions);
88 88
 		}
89
-		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
90
-		return parent::compile($js,$view);
89
+		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
90
+		return parent::compile($js, $view);
91 91
 	}
92 92
 
93
-	private function _generateMainCheckbox(&$captions){
94
-		$ck=new HtmlCheckbox("main-ck-".$this->identifier,"");
93
+	private function _generateMainCheckbox(&$captions) {
94
+		$ck=new HtmlCheckbox("main-ck-".$this->identifier, "");
95 95
 		$ck->setOnChecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',true);");
96 96
 		$ck->setOnUnchecked("$('#".$this->identifier." [name=%quote%selection[]%quote%]').prop('checked',false);");
97 97
 		\array_unshift($captions, $ck);
98 98
 	}
99 99
 
100
-	protected function _generateContent($table){
100
+	protected function _generateContent($table) {
101 101
 		$objects=$this->_modelInstance;
102
-		if(isset($this->_pagination)){
102
+		if (isset($this->_pagination)) {
103 103
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
104 104
 		}
105 105
 		InstanceViewer::setIndex(0);
106
-		$table->fromDatabaseObjects($objects, function($instance){
106
+		$table->fromDatabaseObjects($objects, function($instance) {
107 107
 			$this->_instanceViewer->setInstance($instance);
108 108
 			InstanceViewer::$index++;
109
-			$result= $this->_instanceViewer->getValues();
110
-			if($this->_hasCheckboxes){
111
-				$ck=new HtmlCheckbox("ck-".$this->identifier,"");
109
+			$result=$this->_instanceViewer->getValues();
110
+			if ($this->_hasCheckboxes) {
111
+				$ck=new HtmlCheckbox("ck-".$this->identifier, "");
112 112
 				$field=$ck->getField();
113
-				$field->setProperty("value",$this->_instanceViewer->getIdentifier());
113
+				$field->setProperty("value", $this->_instanceViewer->getIdentifier());
114 114
 				$field->setProperty("name", "selection[]");
115 115
 				\array_unshift($result, $ck);
116 116
 			}
@@ -118,25 +118,25 @@  discard block
 block discarded – undo
118 118
 		});
119 119
 	}
120 120
 
121
-	private function _generatePagination($table){
121
+	private function _generatePagination($table) {
122 122
 		$footer=$table->getFooter();
123 123
 		$footer->mergeCol();
124
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
124
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
125 125
 		$menu->floatRight();
126 126
 		$menu->setActiveItem($this->_pagination->getPage()-1);
127 127
 		$footer->setValues($menu);
128
-		$menu->postOnClick($this->_urls,"{'p':$(this).attr('data-page')}","-#".$this->identifier." tbody",["preventDefault"=>false]);
128
+		$menu->postOnClick($this->_urls, "{'p':$(this).attr('data-page')}", "-#".$this->identifier." tbody", ["preventDefault"=>false]);
129 129
 	}
130 130
 
131
-	protected function _setToolbarPosition($table,$captions=NULL){
132
-		switch ($this->_toolbarPosition){
131
+	protected function _setToolbarPosition($table, $captions=NULL) {
132
+		switch ($this->_toolbarPosition) {
133 133
 			case PositionInTable::BEFORETABLE:case PositionInTable::AFTERTABLE:
134
-				if(isset($this->_compileParts)===false){
134
+				if (isset($this->_compileParts)===false) {
135 135
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
136 136
 				}
137 137
 				break;
138 138
 			case PositionInTable::HEADER:case PositionInTable::FOOTER: case PositionInTable::BODY:
139
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
139
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
140 140
 				break;
141 141
 		}
142 142
 	}
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 	 * @param callable $callback function called after the field compilation
149 149
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
150 150
 	 */
151
-	public function afterCompile($index,$callback){
152
-		$this->_instanceViewer->afterCompile($index,$callback);
151
+	public function afterCompile($index, $callback) {
152
+		$this->_instanceViewer->afterCompile($index, $callback);
153 153
 		return $this;
154 154
 	}
155 155
 
156
-	private function addToolbarRow($part,$table,$captions){
156
+	private function addToolbarRow($part, $table, $captions) {
157 157
 		$row=$table->getPart($part)->addRow(\sizeof($captions));
158 158
 		$row->mergeCol();
159 159
 		$row->setValues([$this->_toolbar]);
160 160
 	}
161 161
 
162
-	public function getHtmlComponent(){
162
+	public function getHtmlComponent() {
163 163
 		return $this->content["table"];
164 164
 	}
165 165
 
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 		return $this;
173 173
 	}
174 174
 
175
-	public function paginate($items_per_page=10,$page=1){
176
-		$this->_pagination=new Pagination($items_per_page,4,$page);
175
+	public function paginate($items_per_page=10, $page=1) {
176
+		$this->_pagination=new Pagination($items_per_page, 4, $page);
177 177
 	}
178 178
 
179 179
 	public function getHasCheckboxes() {
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		return $this;
186 186
 	}
187 187
 
188
-	public function refresh($compileParts=["tbody"]){
188
+	public function refresh($compileParts=["tbody"]) {
189 189
 		$this->_compileParts=$compileParts;
190 190
 		return $this;
191 191
 	}
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	 * @param callable $callback
195 195
 	 * @return callable
196 196
 	 */
197
-	private function getFieldButtonCallable($caption,$callback=null){
198
-		return $this->getCallable("getFieldButton",[$caption],$callback);
197
+	private function getFieldButtonCallable($caption, $callback=null) {
198
+		return $this->getCallable("getFieldButton", [$caption], $callback);
199 199
 	}
200 200
 
201 201
 	/**
@@ -203,16 +203,16 @@  discard block
 block discarded – undo
203 203
 	 * @param callable $callback
204 204
 	 * @return callable
205 205
 	 */
206
-	private function getCallable($thisCallback,$parameters,$callback=null){
207
-		$result=function($instance) use($thisCallback,$parameters,$callback){
208
-			$object=call_user_func_array(array($this,$thisCallback), $parameters);
209
-			if(isset($callback)){
210
-				if(\is_callable($callback)){
211
-					$callback($object,$instance);
206
+	private function getCallable($thisCallback, $parameters, $callback=null) {
207
+		$result=function($instance) use($thisCallback, $parameters, $callback){
208
+			$object=call_user_func_array(array($this, $thisCallback), $parameters);
209
+			if (isset($callback)) {
210
+				if (\is_callable($callback)) {
211
+					$callback($object, $instance);
212 212
 				}
213 213
 			}
214
-			if($object instanceof HtmlSemDoubleElement){
215
-				$object->setProperty("data-ajax",$this->_instanceViewer->getIdentifier());
214
+			if ($object instanceof HtmlSemDoubleElement) {
215
+				$object->setProperty("data-ajax", $this->_instanceViewer->getIdentifier());
216 216
 			}
217 217
 			return $object;
218 218
 		};
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 	 * @param string $caption
224 224
 	 * @return HtmlButton
225 225
 	 */
226
-	private function getFieldButton($caption){
227
-		return new HtmlButton("",$caption);
226
+	private function getFieldButton($caption) {
227
+		return new HtmlButton("", $caption);
228 228
 	}
229 229
 
230 230
 	/**
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param callable $callback
234 234
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
235 235
 	 */
236
-	public function addFieldButton($caption,$callback=null){
237
-		$this->addField($this->getCallable("getFieldButton",[$caption],$callback));
236
+	public function addFieldButton($caption, $callback=null) {
237
+		$this->addField($this->getCallable("getFieldButton", [$caption], $callback));
238 238
 		return $this;
239 239
 	}
240 240
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @param callable $callback
246 246
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
247 247
 	 */
248
-	public function insertFieldButton($index,$caption,$callback=null){
249
-		$this->insertField($index, $this->getFieldButtonCallable($caption,$callback));
248
+	public function insertFieldButton($index, $caption, $callback=null) {
249
+		$this->insertField($index, $this->getFieldButtonCallable($caption, $callback));
250 250
 		return $this;
251 251
 	}
252 252
 
@@ -257,60 +257,60 @@  discard block
 block discarded – undo
257 257
 	 * @param callable $callback
258 258
 	 * @return \Ajax\semantic\widgets\datatable\DataTable
259 259
 	 */
260
-	public function insertInFieldButton($index,$caption,$callback=null){
261
-		$this->insertInField($index, $this->getFieldButtonCallable($caption,$callback));
260
+	public function insertInFieldButton($index, $caption, $callback=null) {
261
+		$this->insertInField($index, $this->getFieldButtonCallable($caption, $callback));
262 262
 		return $this;
263 263
 	}
264 264
 
265
-	private function addDefaultButton($icon,$class=null,$callback=null){
266
-		$this->addField($this->getCallable("getDefaultButton",[$icon,$class],$callback));
265
+	private function addDefaultButton($icon, $class=null, $callback=null) {
266
+		$this->addField($this->getCallable("getDefaultButton", [$icon, $class], $callback));
267 267
 		return $this;
268 268
 	}
269 269
 
270
-	private function insertDefaultButtonIn($index,$icon,$class=null,$callback=null){
271
-		$this->insertInField($index,$this->getCallable("getDefaultButton",[$icon,$class],$callback));
270
+	private function insertDefaultButtonIn($index, $icon, $class=null, $callback=null) {
271
+		$this->insertInField($index, $this->getCallable("getDefaultButton", [$icon, $class], $callback));
272 272
 		return $this;
273 273
 	}
274 274
 
275
-	private function getDefaultButton($icon,$class=null){
275
+	private function getDefaultButton($icon, $class=null) {
276 276
 		$bt=$this->getFieldButton("");
277 277
 		$bt->asIcon($icon);
278
-		if(isset($class))
278
+		if (isset($class))
279 279
 			$bt->addToProperty("class", $class);
280 280
 		return $bt;
281 281
 	}
282 282
 
283
-	public function addDeleteButton($callback=null){
284
-		return $this->addDefaultButton("remove","delete red basic",$callback);
283
+	public function addDeleteButton($callback=null) {
284
+		return $this->addDefaultButton("remove", "delete red basic", $callback);
285 285
 	}
286 286
 
287
-	public function addEditButton($callback=null){
288
-		return $this->addDefaultButton("edit","edit basic",$callback);
287
+	public function addEditButton($callback=null) {
288
+		return $this->addDefaultButton("edit", "edit basic", $callback);
289 289
 	}
290 290
 
291
-	public function addEditDeleteButtons($callbackEdit=null,$callbackDelete=null){
291
+	public function addEditDeleteButtons($callbackEdit=null, $callbackDelete=null) {
292 292
 		$this->addEditButton($callbackEdit);
293 293
 		$index=$this->_instanceViewer->visiblePropertiesCount()-1;
294
-		$this->insertDeleteButtonIn($index,$callbackDelete);
294
+		$this->insertDeleteButtonIn($index, $callbackDelete);
295 295
 		return $this;
296 296
 	}
297 297
 
298
-	public function insertDeleteButtonIn($index,$callback=null){
299
-		return $this->insertDefaultButtonIn($index,"remove","delete red basic",$callback);
298
+	public function insertDeleteButtonIn($index, $callback=null) {
299
+		return $this->insertDefaultButtonIn($index, "remove", "delete red basic", $callback);
300 300
 	}
301 301
 
302
-	public function insertEditButtonIn($index,$callback=null){
303
-		return $this->insertDefaultButtonIn($index,"edit","edit basic",$callback);
302
+	public function insertEditButtonIn($index, $callback=null) {
303
+		return $this->insertDefaultButtonIn($index, "edit", "edit basic", $callback);
304 304
 	}
305 305
 
306
-	public function addSearchInToolbar($position=Direction::RIGHT){
306
+	public function addSearchInToolbar($position=Direction::RIGHT) {
307 307
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
308 308
 	}
309 309
 
310
-	public function getSearchField(){
311
-		if(isset($this->_searchField)===false){
312
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
313
-			$this->_searchField->addIcon("search",Direction::RIGHT);
310
+	public function getSearchField() {
311
+		if (isset($this->_searchField)===false) {
312
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
313
+			$this->_searchField->addIcon("search", Direction::RIGHT);
314 314
 		}
315 315
 		return $this->_searchField;
316 316
 	}
Please login to merge, or discard this patch.
Ajax/common/html/traits/BaseHtmlEventsTrait.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
  * @property SimpleExtComponent $_bsComponent
11 11
  * @property string identifier
12 12
  */
13
-trait BaseHtmlEventsTrait{
13
+trait BaseHtmlEventsTrait {
14 14
 
15
-	protected $_events=array ();
15
+	protected $_events=array();
16 16
 
17 17
 	public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) {
18
-		if ($stopPropagation === true) {
19
-			$jsCode="event.stopPropagation();" . $jsCode;
18
+		if ($stopPropagation===true) {
19
+			$jsCode="event.stopPropagation();".$jsCode;
20 20
 		}
21
-		if ($preventDefault === true) {
22
-			$jsCode="event.preventDefault();" . $jsCode;
21
+		if ($preventDefault===true) {
22
+			$jsCode="event.preventDefault();".$jsCode;
23 23
 		}
24 24
 		return $this->_addEvent($event, $jsCode);
25 25
 	}
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			if (is_array($this->_events[$event])) {
30 30
 				$this->_events[$event][]=$jsCode;
31 31
 			} else {
32
-				$this->_events[$event]=array ($this->_events[$event],$jsCode );
32
+				$this->_events[$event]=array($this->_events[$event], $jsCode);
33 33
 			}
34 34
 		} else {
35 35
 			$this->_events[$event]=$jsCode;
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 		return $this->onClick($jsCode);
50 50
 	}
51 51
 
52
-	public function onCreate($jsCode){
53
-		if(isset($this->_events["_create"])){
52
+	public function onCreate($jsCode) {
53
+		if (isset($this->_events["_create"])) {
54 54
 			$this->_events["_create"][]=$jsCode;
55
-		}else{
55
+		} else {
56 56
 			$this->_events["_create"]=[$jsCode];
57 57
 		}
58 58
 		return $this;
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 	public function addEventsOnRun(JsUtils $js=NULL) {
62 62
 		$this->_eventsOnCreate($js);
63 63
 		if (isset($this->_bsComponent)) {
64
-			foreach ( $this->_events as $event => $jsCode ) {
64
+			foreach ($this->_events as $event => $jsCode) {
65 65
 				$code=$jsCode;
66 66
 				if (is_array($jsCode)) {
67 67
 					$code="";
68
-					foreach ( $jsCode as $jsC ) {
68
+					foreach ($jsCode as $jsC) {
69 69
 						if ($jsC instanceof AjaxCall) {
70
-							$code.="\n" . $jsC->compile($js);
70
+							$code.="\n".$jsC->compile($js);
71 71
 						} else {
72
-							$code.="\n" . $jsC;
72
+							$code.="\n".$jsC;
73 73
 						}
74 74
 					}
75 75
 				} elseif ($jsCode instanceof AjaxCall) {
@@ -77,24 +77,24 @@  discard block
 block discarded – undo
77 77
 				}
78 78
 				$this->_bsComponent->addEvent($event, $code);
79 79
 			}
80
-			$this->_events=array ();
80
+			$this->_events=array();
81 81
 		}
82 82
 	}
83 83
 
84
-	protected function _eventsOnCreate(JsUtils $js=NULL){
85
-		if(isset($this->_events["_create"])){
84
+	protected function _eventsOnCreate(JsUtils $js=NULL) {
85
+		if (isset($this->_events["_create"])) {
86 86
 			$create=$this->_events["_create"];
87
-			if(\is_array($create)){
87
+			if (\is_array($create)) {
88 88
 				$create=\implode("", $create);
89 89
 			}
90
-			if(isset($js) && $create!=="")
91
-				$js->exec($create,true);
90
+			if (isset($js) && $create!=="")
91
+				$js->exec($create, true);
92 92
 			unset($this->_events["_create"]);
93 93
 		}
94 94
 	}
95 95
 
96 96
 	public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) {
97
-		$params=array ("url" => $url,"responseElement" => $responseElement );
97
+		$params=array("url" => $url, "responseElement" => $responseElement);
98 98
 		$params=array_merge($params, $parameters);
99 99
 		$this->_addEvent($event, new AjaxCall($operation, $params));
100 100
 		return $this;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	}
128 128
 
129 129
 	public function jsDoJquery($jqueryCall, $param="") {
130
-		return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");";
130
+		return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");";
131 131
 	}
132 132
 
133 133
 	public function executeOnRun($jsCode) {
Please login to merge, or discard this patch.