Completed
Push — master ( ab06fe...ef9455 )
by Jean-Christophe
02:37
created
Ajax/semantic/html/base/HtmlSemDoubleElement.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	use BaseTrait;
23 23
 	protected $_popup=NULL;
24 24
 	protected $_dimmer=NULL;
25
-	protected $_params=array ();
25
+	protected $_params=array();
26 26
 
27 27
 
28 28
 	public function __construct($identifier, $tagName="p", $baseClass="ui", $content=NULL) {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return HtmlDimmer
79 79
 	 */
80 80
 	public function addDimmer($params=array(), $content=NULL) {
81
-		$dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content);
81
+		$dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content);
82 82
 		$dimmer->setParams($params);
83 83
 		$dimmer->setContainer($this);
84 84
 		$this->addContent($dimmer);
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function addLabel($label, $before=false, $icon=NULL) {
96 96
 		$labelO=$label;
97
-		if (\is_object($label) === false) {
98
-			$labelO=new HtmlLabel("label-" . $this->identifier, $label);
97
+		if (\is_object($label)===false) {
98
+			$labelO=new HtmlLabel("label-".$this->identifier, $label);
99 99
 			if (isset($icon))
100 100
 				$labelO->addIcon($icon);
101 101
 		} else {
102
-			$labelO->addToPropertyCtrl("class", "label", array ("label" ));
102
+			$labelO->addToPropertyCtrl("class", "label", array("label"));
103 103
 		}
104 104
 		$this->addContent($labelO, $before);
105 105
 		return $labelO;
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	 * @param string $icon
114 114
 	 * @return HtmlSemDoubleElement
115 115
 	 */
116
-	public function attachLabel($label,$side=Side::TOP,$direction=Direction::NONE,$icon=NULL){
117
-		$label=$this->addLabel($label,true,$icon);
118
-		$label->setAttached($side,$direction);
116
+	public function attachLabel($label, $side=Side::TOP, $direction=Direction::NONE, $icon=NULL) {
117
+		$label=$this->addLabel($label, true, $icon);
118
+		$label->setAttached($side, $direction);
119 119
 		return $this;
120 120
 	}
121 121
 
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 	 * Transforms the element into a link
124 124
 	 * @return HtmlSemDoubleElement
125 125
 	 */
126
-	public function asLink($href=NULL,$target=NULL) {
126
+	public function asLink($href=NULL, $target=NULL) {
127 127
 		if (isset($href))
128 128
 			$this->setProperty("href", $href);
129
-		if(isset($target))
129
+		if (isset($target))
130 130
 			$this->setProperty("target", $target);
131 131
 		return $this->setTagName("a");
132 132
 	}
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function jsShowDimmer($show=true) {
140 140
 		$status="hide";
141
-		if ($show === true)
141
+		if ($show===true)
142 142
 			$status="show";
143
-		return '$("#.' . $this->identifier . ').dimmer("' . $status . '");';
143
+		return '$("#.'.$this->identifier.').dimmer("'.$status.'");';
144 144
 	}
145 145
 
146 146
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @see HtmlDoubleElement::run()
159 159
 	 */
160 160
 	public function run(JsUtils $js) {
161
-		$this->_bsComponent=$js->semantic()->generic("#" . $this->identifier);
161
+		$this->_bsComponent=$js->semantic()->generic("#".$this->identifier);
162 162
 		parent::run($js);
163 163
 		$this->addEventsOnRun($js);
164 164
 		if (isset($this->_popup)) {
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 		return $this->_bsComponent;
168 168
 	}
169 169
 
170
-	public function addList($items,$ordered=false){
171
-		$list=new HtmlList("list-".$this->identifier,$items);
170
+	public function addList($items, $ordered=false) {
171
+		$list=new HtmlList("list-".$this->identifier, $items);
172 172
 		$list->setOrdered($ordered);
173 173
 		$list->setClass("ui list");
174 174
 		$this->addContent($list);
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlModal.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -15,36 +15,36 @@  discard block
 block discarded – undo
15 15
 	protected $_paramParts=array();
16 16
 
17 17
 	public function __construct($identifier, $header="", $content="", $actions=null) {
18
-		parent::__construct($identifier, "div","ui modal");
19
-		if(isset($header)){
18
+		parent::__construct($identifier, "div", "ui modal");
19
+		if (isset($header)) {
20 20
 			$this->setHeader($header);
21 21
 		}
22
-		if(isset($content)){
22
+		if (isset($content)) {
23 23
 			$this->setContent($content);
24 24
 		}
25
-		if(isset($actions)){
25
+		if (isset($actions)) {
26 26
 			$this->setActions($actions);
27 27
 		}
28 28
 	}
29 29
 
30 30
 	public function setHeader($value) {
31
-		$this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value);
31
+		$this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value);
32 32
 		return $this;
33 33
 	}
34 34
 
35 35
 	public function setContent($value) {
36
-		$this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value);
36
+		$this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value);
37 37
 		return $this;
38 38
 	}
39 39
 
40 40
 	public function setActions($actions) {
41
-		$this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions");
42
-		if(\is_array($actions)){
43
-			foreach ($actions as $action){
41
+		$this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions");
42
+		if (\is_array($actions)) {
43
+			foreach ($actions as $action) {
44 44
 				$this->addAction($action);
45 45
 			}
46 46
 		}
47
-		else{
47
+		else {
48 48
 			$this->addAction($actions);
49 49
 		}
50 50
 		return $this;
@@ -54,17 +54,17 @@  discard block
 block discarded – undo
54 54
 	 * @param string|BaseHtml $action
55 55
 	 * @return HtmlButton
56 56
 	 */
57
-	public function addAction($action){
58
-		if(!$action instanceof BaseHtml){
57
+	public function addAction($action) {
58
+		if (!$action instanceof BaseHtml) {
59 59
 			$class="";
60
-			if(\array_search($action, ["Okay","Yes","Validate"])!==false){
60
+			if (\array_search($action, ["Okay", "Yes", "Validate"])!==false) {
61 61
 				$class="approve";
62 62
 			}
63
-			if(\array_search($action, ["Close","Cancel","No"])!==false){
63
+			if (\array_search($action, ["Close", "Cancel", "No"])!==false) {
64 64
 				$class="cancel";
65 65
 			}
66
-			$action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()),$action);
67
-			if($class!=="")
66
+			$action=new HtmlButton("action-".$this->identifier."-".\sizeof($this->content["actions"]->getContent()), $action);
67
+			if ($class!=="")
68 68
 				$action->addToProperty("class", $class);
69 69
 		}
70 70
 		return $this->addElementInPart($action, "actions");
@@ -74,66 +74,66 @@  discard block
 block discarded – undo
74 74
 	 * @param int $index
75 75
 	 * @return HtmlButton
76 76
 	 */
77
-	public function getAction($index){
77
+	public function getAction($index) {
78 78
 		return $this->content["actions"]->getContent()[$index];
79 79
 	}
80 80
 
81
-	public function addContent($content,$before=false){
82
-		$this->content["content"]->addContent($content,$before);
81
+	public function addContent($content, $before=false) {
82
+		$this->content["content"]->addContent($content, $before);
83 83
 		return $this;
84 84
 	}
85 85
 
86
-	public function addImageContent($image,$description=NULL){
86
+	public function addImageContent($image, $description=NULL) {
87 87
 		$content=$this->content["content"];
88
-		if(isset($description)){
89
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
90
-			$content->addContent($description,true);
88
+		if (isset($description)) {
89
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
90
+			$content->addContent($description, true);
91 91
 		}
92
-		if($image!==""){
93
-			$img=new HtmlImage("image-".$this->identifier,$image,"","medium");
94
-			$content->addContent($img,true);
95
-			$content->addToProperty("class","image");
92
+		if ($image!=="") {
93
+			$img=new HtmlImage("image-".$this->identifier, $image, "", "medium");
94
+			$content->addContent($img, true);
95
+			$content->addToProperty("class", "image");
96 96
 		}
97 97
 		return $this;
98 98
 	}
99 99
 
100
-	public function addIconContent($icon,$description=NULL){
100
+	public function addIconContent($icon, $description=NULL) {
101 101
 		$content=$this->content["content"];
102
-		if(isset($description)){
103
-			$description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description);
104
-			$content->addContent($description,true);
102
+		if (isset($description)) {
103
+			$description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description);
104
+			$content->addContent($description, true);
105 105
 		}
106
-		if($icon!==""){
107
-			$img=new HtmlIcon("image-".$this->identifier,$icon);
108
-			$content->addContent($img,true);
109
-			$content->addToProperty("class","image");
106
+		if ($icon!=="") {
107
+			$img=new HtmlIcon("image-".$this->identifier, $icon);
108
+			$content->addContent($img, true);
109
+			$content->addToProperty("class", "image");
110 110
 		}
111 111
 		return $this;
112 112
 	}
113 113
 
114
-	private function addElementInPart($element,$part) {
114
+	private function addElementInPart($element, $part) {
115 115
 		$this->content[$part]->addContent($element);
116 116
 		return $element;
117 117
 	}
118 118
 
119
-	public function showDimmer($value){
120
-		$value=$value?"show":"hide";
119
+	public function showDimmer($value) {
120
+		$value=$value ? "show" : "hide";
121 121
 		$this->_paramParts[]=["'".$value." dimmer'"];
122 122
 		return $this;
123 123
 	}
124 124
 
125
-	public function setInverted($recursive=true){
125
+	public function setInverted($recursive=true) {
126 126
 		$this->_params["inverted"]=true;
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function setBasic(){
130
+	public function setBasic() {
131 131
 		return $this->addToProperty("class", "basic");
132 132
 	}
133 133
 
134 134
 
135
-	public function setTransition($value){
136
-		$this->_paramParts[]=["'setting'","'transition'","'".$value."'"];
135
+	public function setTransition($value) {
136
+		$this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"];
137 137
 	}
138 138
 
139 139
 	/**
@@ -143,8 +143,8 @@  discard block
 block discarded – undo
143 143
 	 * @param string $viewName
144 144
 	 * @param $params The parameters to pass to the view
145 145
 	 */
146
-	public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) {
147
-		return $this->setContent($js->renderContent($initialController, $viewName,$params));
146
+	public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) {
147
+		return $this->setContent($js->renderContent($initialController, $viewName, $params));
148 148
 	}
149 149
 
150 150
 	/**
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param string $actionName the action name
156 156
 	 * @param array $params
157 157
 	 */
158
-	public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){
159
-		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params));
158
+	public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) {
159
+		return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params));
160 160
 	}
161 161
 
162 162
 	/**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
167 167
 	 */
168 168
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
169
-		$this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]);
169
+		$this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]);
170 170
 		return parent::compile($js, $view);
171 171
 	}
172 172
 	/*
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	 * @see BaseHtml::run()
175 175
 	 */
176 176
 	public function run(JsUtils $js) {
177
-		if(isset($this->_bsComponent)===false)
178
-			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts);
177
+		if (isset($this->_bsComponent)===false)
178
+			$this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts);
179 179
 		$this->addEventsOnRun($js);
180 180
 		return $this->_bsComponent;
181 181
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		return $this->jsDo("hide");
189 189
 	}
190 190
 
191
-	public function onHidden($js){
191
+	public function onHidden($js) {
192 192
 		$this->_params["onHidden"]=$js;
193 193
 	}
194 194
 }
Please login to merge, or discard this patch.
Ajax/common/html/BaseHtml.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
  * @version 1.3
16 16
  */
17 17
 abstract class BaseHtml extends BaseWidget {
18
-	use BaseHtmlEventsTrait,BaseHtmlPropertiesTrait;
18
+	use BaseHtmlEventsTrait, BaseHtmlPropertiesTrait;
19 19
 	protected $_template;
20 20
 	protected $tagName;
21
-	protected $_wrapBefore=array ();
22
-	protected $_wrapAfter=array ();
21
+	protected $_wrapBefore=array();
22
+	protected $_wrapAfter=array();
23 23
 	protected $_bsComponent;
24 24
 	protected $_compiled=false;
25 25
 	protected $_postCompile;
@@ -32,14 +32,14 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	abstract public function run(JsUtils $js);
34 34
 
35
-	private function _callSetter($setter,$key,$value,&$array){
35
+	private function _callSetter($setter, $key, $value, &$array) {
36 36
 		$result=false;
37 37
 		if (method_exists($this, $setter) && !JString::startswith($key, "_")) {
38 38
 			try {
39 39
 				$this->$setter($value);
40 40
 				unset($array[$key]);
41 41
 				$result=true;
42
-			} catch ( \Exception $e ) {
42
+			}catch (\Exception $e) {
43 43
 				$result=false;
44 44
 			}
45 45
 		}
@@ -47,17 +47,17 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	protected function getTemplate(JsUtils $js=NULL) {
50
-		return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js);
50
+		return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js);
51 51
 	}
52 52
 
53 53
 	protected function ctrl($name, $value, $typeCtrl) {
54 54
 		if (\is_array($typeCtrl)) {
55
-			if (array_search($value, $typeCtrl) === false) {
56
-				throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}");
55
+			if (array_search($value, $typeCtrl)===false) {
56
+				throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
57 57
 			}
58 58
 		} else {
59 59
 			if (!$typeCtrl($value)) {
60
-				throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name);
60
+				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name);
61 61
 			}
62 62
 		}
63 63
 		return true;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 
68 68
 	protected function setMemberCtrl(&$name, $value, $typeCtrl) {
69
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
69
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
70 70
 			return $name=$value;
71 71
 		}
72 72
 		return $this;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") {
76 76
 		if (\is_array($typeCtrl)) {
77 77
 			$this->removeOldValues($name, $typeCtrl);
78
-			$name.=$separator . $value;
78
+			$name.=$separator.$value;
79 79
 		}
80 80
 		return $this;
81 81
 	}
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 
84 84
 
85 85
 	protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") {
86
-		if ($this->ctrl($name, $value, $typeCtrl) === true) {
86
+		if ($this->ctrl($name, $value, $typeCtrl)===true) {
87 87
 			if (\is_array($typeCtrl)) {
88 88
 				$this->removeOldValues($name, $typeCtrl);
89 89
 			}
90
-			$name.=$separator . $value;
90
+			$name.=$separator.$value;
91 91
 		}
92 92
 		return $this;
93 93
 	}
94 94
 
95 95
 	protected function addToMember(&$name, $value, $separator=" ") {
96
-		$name=str_ireplace($value, "", $name) . $separator . $value;
96
+		$name=str_ireplace($value, "", $name).$separator.$value;
97 97
 		return $this;
98 98
 	}
99 99
 
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 		$oldValue=trim($oldValue);
105 105
 	}
106 106
 
107
-	protected function _getElementBy($callback,$elements){
107
+	protected function _getElementBy($callback, $elements) {
108 108
 		if (\is_array($elements)) {
109 109
 			$elements=\array_values($elements);
110 110
 			$flag=false;
111 111
 			$index=0;
112
-			while ( !$flag && $index < sizeof($elements) ) {
112
+			while (!$flag && $index<sizeof($elements)) {
113 113
 				if ($elements[$index] instanceof BaseHtml)
114 114
 					$flag=($callback($elements[$index]));
115 115
 					$index++;
116 116
 			}
117
-			if ($flag === true)
118
-				return $elements[$index - 1];
117
+			if ($flag===true)
118
+				return $elements[$index-1];
119 119
 		} elseif ($elements instanceof BaseHtml) {
120 120
 			if ($callback($elements))
121 121
 				return $elements;
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
 	}
144 144
 
145 145
 	public function fromArray($array) {
146
-		foreach ( $this as $key => $value ) {
147
-			if(array_key_exists($key, $array)===true)
148
-				$this->_callSetter("set" . ucfirst($key), $key, $array[$key], $array);
146
+		foreach ($this as $key => $value) {
147
+			if (array_key_exists($key, $array)===true)
148
+				$this->_callSetter("set".ucfirst($key), $key, $array[$key], $array);
149 149
 		}
150
-		foreach ( $array as $key => $value ) {
151
-			if($this->_callSetter($key, $key, $value, $array)===false){
152
-				$this->_callSetter("set" . ucfirst($key), $key, $value, $array);
150
+		foreach ($array as $key => $value) {
151
+			if ($this->_callSetter($key, $key, $value, $array)===false) {
152
+				$this->_callSetter("set".ucfirst($key), $key, $value, $array);
153 153
 			}
154 154
 		}
155 155
 		return $array;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
 	public function fromDatabaseObjects($objects, $function) {
159 159
 		if (isset($objects)) {
160
-			foreach ( $objects as $object ) {
160
+			foreach ($objects as $object) {
161 161
 				$this->fromDatabaseObject($object, $function);
162 162
 			}
163 163
 		}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
 
180 180
 	public function getElementById($identifier, $elements) {
181
-		return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier;}, $elements);
181
+		return $this->_getElementBy(function(BaseWidget $element) use ($identifier){return $element->getIdentifier()===$identifier; }, $elements);
182 182
 	}
183 183
 
184 184
 	public function getBsComponent() {
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
 	}
192 192
 
193 193
 	protected function compile_once(JsUtils $js=NULL, &$view=NULL) {
194
-		if(!$this->_compiled){
195
-			if(isset($js)){
194
+		if (!$this->_compiled) {
195
+			if (isset($js)) {
196 196
 				$beforeCompile=$js->getParam("beforeCompileHtml");
197
-				if(\is_callable($beforeCompile)){
198
-					$beforeCompile($this,$js,$view);
197
+				if (\is_callable($beforeCompile)) {
198
+					$beforeCompile($this, $js, $view);
199 199
 				}
200 200
 			}
201
-			if(\is_callable($this->_preCompile)){
201
+			if (\is_callable($this->_preCompile)) {
202 202
 				$pc=$this->_preCompile;
203 203
 				$pc($this);
204 204
 			}
@@ -208,29 +208,29 @@  discard block
 block discarded – undo
208 208
 	}
209 209
 
210 210
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
211
-		$this->compile_once($js,$view);
211
+		$this->compile_once($js, $view);
212 212
 		$result=$this->getTemplate($js);
213
-		foreach ( $this as $key => $value ) {
214
-			if (JString::startswith($key, "_") === false && $key !== "events") {
213
+		foreach ($this as $key => $value) {
214
+			if (JString::startswith($key, "_")===false && $key!=="events") {
215 215
 				if (\is_array($value)) {
216 216
 					$v=PropertyWrapper::wrap($value, $js);
217 217
 				} else {
218
-					if($value instanceof \stdClass)
219
-						$v=\print_r($value,true);
218
+					if ($value instanceof \stdClass)
219
+						$v=\print_r($value, true);
220 220
 					else
221 221
 						$v=$value;
222 222
 				}
223
-				$result=str_ireplace("%" . $key . "%", $v, $result);
223
+				$result=str_ireplace("%".$key."%", $v, $result);
224 224
 			}
225 225
 		}
226 226
 		if (isset($js)===true) {
227 227
 			$this->run($js);
228
-			if (isset($view) === true) {
228
+			if (isset($view)===true) {
229 229
 				$js->addViewElement($this->_identifier, $result, $view);
230 230
 			}
231 231
 		}
232 232
 
233
-		if(\is_callable($this->_postCompile)){
233
+		if (\is_callable($this->_postCompile)) {
234 234
 			$pc=$this->_postCompile;
235 235
 			$pc($this);
236 236
 		}
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
 		return $this->compile();
242 242
 	}
243 243
 
244
-	public function onPostCompile($callback){
244
+	public function onPostCompile($callback) {
245 245
 		$this->_postCompile=$callback;
246 246
 	}
247 247
 
248
-	public function onPreCompile($callback){
248
+	public function onPreCompile($callback) {
249 249
 		$this->_preCompile=$callback;
250 250
 	}
251 251
 }
Please login to merge, or discard this patch.
Ajax/common/Widget.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 use Ajax\semantic\html\modules\HtmlModal;
21 21
 
22 22
 abstract class Widget extends HtmlDoubleElement {
23
-	use FieldAsTrait,FormTrait;
23
+	use FieldAsTrait, FormTrait;
24 24
 
25 25
 	/**
26 26
 	 * @var string classname
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 	protected $_generated;
54 54
 
55 55
 
56
-	public function __construct($identifier,$model,$modelInstance=NULL) {
56
+	public function __construct($identifier, $model, $modelInstance=NULL) {
57 57
 		parent::__construct($identifier);
58 58
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
59 59
 		$this->setModel($model);
60
-		if(isset($modelInstance)){
60
+		if (isset($modelInstance)) {
61 61
 			$this->show($modelInstance);
62 62
 		}
63 63
 		$this->_generated=false;
64 64
 	}
65 65
 
66
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
66
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
67 67
 		$this->_instanceViewer=$instanceViewer;
68 68
 		$this->content=[$contentKey=>$content];
69 69
 		$this->_self=$content;
@@ -75,31 +75,31 @@  discard block
 block discarded – undo
75 75
 	 * @param int|string $fieldName
76 76
 	 * @return int|string
77 77
 	 */
78
-	protected function _getIndex($fieldName){
78
+	protected function _getIndex($fieldName) {
79 79
 		$index=$fieldName;
80
-		if(\is_string($fieldName)){
80
+		if (\is_string($fieldName)) {
81 81
 			$fields=$this->_instanceViewer->getVisibleProperties();
82 82
 			$index=\array_search($fieldName, $fields);
83 83
 		}
84 84
 		return $index;
85 85
 	}
86 86
 
87
-	protected function _getFieldIdentifier($prefix,$name=""){
87
+	protected function _getFieldIdentifier($prefix, $name="") {
88 88
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
89 89
 	}
90 90
 
91
-	protected function _getFieldName($index){
91
+	protected function _getFieldName($index) {
92 92
 		return $this->_instanceViewer->getFieldName($index);
93 93
 	}
94 94
 
95
-	protected function _getFieldCaption($index){
95
+	protected function _getFieldCaption($index) {
96 96
 		return $this->_instanceViewer->getCaption($index);
97 97
 	}
98 98
 
99
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
99
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
100 100
 
101
-	public function show($modelInstance){
102
-		if(\is_array($modelInstance)){
101
+	public function show($modelInstance) {
102
+		if (\is_array($modelInstance)) {
103 103
 			$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
104 104
 		}
105 105
 		$this->_modelInstance=$modelInstance;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 	abstract public function getHtmlComponent();
127 127
 
128
-	public function setAttached($value=true){
128
+	public function setAttached($value=true) {
129 129
 		return $this->getHtmlComponent()->setAttached($value);
130 130
 	}
131 131
 
@@ -136,59 +136,59 @@  discard block
 block discarded – undo
136 136
 	 * @param callable $callback function called after the field compilation
137 137
 	 * @return Widget
138 138
 	 */
139
-	public function afterCompile($index,$callback){
139
+	public function afterCompile($index, $callback) {
140 140
 		$index=$this->_getIndex($index);
141 141
 		$this->_instanceViewer->afterCompile($index, $callback);
142 142
 		return $this;
143 143
 	}
144 144
 
145
-	public function setColor($color){
145
+	public function setColor($color) {
146 146
 		return $this->getHtmlComponent()->setColor($color);
147 147
 	}
148 148
 
149 149
 
150
-	public function setCaptions($captions){
150
+	public function setCaptions($captions) {
151 151
 		$this->_instanceViewer->setCaptions($captions);
152 152
 		return $this;
153 153
 	}
154 154
 
155
-	public function setCaption($index,$caption){
155
+	public function setCaption($index, $caption) {
156 156
 		$this->_instanceViewer->setCaption($this->_getIndex($index), $caption);
157 157
 		return $this;
158 158
 	}
159 159
 
160
-	public function setFields($fields){
160
+	public function setFields($fields) {
161 161
 		$this->_instanceViewer->setVisibleProperties($fields);
162 162
 		return $this;
163 163
 	}
164 164
 
165
-	public function addField($field){
165
+	public function addField($field) {
166 166
 		$this->_instanceViewer->addField($field);
167 167
 		return $this;
168 168
 	}
169 169
 
170
-	public function addFields($fields){
170
+	public function addFields($fields) {
171 171
 		$this->_instanceViewer->addFields($fields);
172 172
 		return $this;
173 173
 	}
174 174
 
175
-	public function addMessage($attributes=NULL,$fieldName="message"){
175
+	public function addMessage($attributes=NULL, $fieldName="message") {
176 176
 		$this->_instanceViewer->addField($fieldName);
177 177
 		$count=$this->_instanceViewer->visiblePropertiesCount();
178
-		return $this->fieldAsMessage($count-1,$attributes);
178
+		return $this->fieldAsMessage($count-1, $attributes);
179 179
 	}
180 180
 
181
-	public function addErrorMessage(){
182
-		return $this->addMessage(["error"=>true],"message");
181
+	public function addErrorMessage() {
182
+		return $this->addMessage(["error"=>true], "message");
183 183
 	}
184 184
 
185
-	public function insertField($index,$field){
185
+	public function insertField($index, $field) {
186 186
 		$index=$this->_getIndex($index);
187 187
 		$this->_instanceViewer->insertField($index, $field);
188 188
 		return $this;
189 189
 	}
190 190
 
191
-	public function insertInField($index,$field){
191
+	public function insertInField($index, $field) {
192 192
 		$index=$this->_getIndex($index);
193 193
 		$this->_instanceViewer->insertInField($index, $field);
194 194
 		return $this;
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 	 * @param callable $callback function parameters are : $value : the field value ,$index : the field index, $instance : the active instance of model
201 201
 	 * @return Widget
202 202
 	 */
203
-	public function setValueFunction($index,$callback){
203
+	public function setValueFunction($index, $callback) {
204 204
 		$index=$this->_getIndex($index);
205 205
 		$this->_instanceViewer->setValueFunction($index, $callback);
206 206
 		return $this;
207 207
 	}
208 208
 
209
-	public function setIdentifierFunction($callback){
209
+	public function setIdentifierFunction($callback) {
210 210
 		$this->_instanceViewer->setIdentifierFunction($callback);
211 211
 		return $this;
212 212
 	}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	/**
215 215
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
216 216
 	 */
217
-	public function getToolbar(){
218
-		if(isset($this->_toolbar)===false){
217
+	public function getToolbar() {
218
+		if (isset($this->_toolbar)===false) {
219 219
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
220 220
 		}
221 221
 		return $this->_toolbar;
@@ -227,15 +227,15 @@  discard block
 block discarded – undo
227 227
 	 * @param callable $callback function to call on $element
228 228
 	 * @return \Ajax\common\html\HtmlDoubleElement
229 229
 	 */
230
-	public function addInToolbar($element,$callback=NULL){
230
+	public function addInToolbar($element, $callback=NULL) {
231 231
 		$tb=$this->getToolbar();
232
-		if($element instanceof BaseWidget){
233
-			if($element->getIdentifier()===""){
232
+		if ($element instanceof BaseWidget) {
233
+			if ($element->getIdentifier()==="") {
234 234
 				$element->setIdentifier("tb-item-".$this->identifier."-".$tb->count());
235 235
 			}
236 236
 		}
237
-		if(isset($callback)){
238
-			if(\is_callable($callback)){
237
+		if (isset($callback)) {
238
+			if (\is_callable($callback)) {
239 239
 				$callback($element);
240 240
 			}
241 241
 		}
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
 	 * @param callable $callback function($element)
249 249
 	 * @return \Ajax\common\html\HtmlDoubleElement
250 250
 	 */
251
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
252
-		$result=$this->addInToolbar($caption,$callback);
253
-		if(isset($icon))
251
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
252
+		$result=$this->addInToolbar($caption, $callback);
253
+		if (isset($icon))
254 254
 			$result->addIcon($icon);
255 255
 		return $result;
256 256
 	}
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
 	 * @param callable $callback function($element)
261 261
 	 * @return \Ajax\common\Widget
262 262
 	 */
263
-	public function addItemsInToolbar(array $items,$callback=NULL){
264
-		if(JArray::isAssociative($items)){
265
-			foreach ($items as $icon=>$item){
266
-				$this->addItemInToolbar($item,$icon,$callback);
263
+	public function addItemsInToolbar(array $items, $callback=NULL) {
264
+		if (JArray::isAssociative($items)) {
265
+			foreach ($items as $icon=>$item) {
266
+				$this->addItemInToolbar($item, $icon, $callback);
267 267
 			}
268
-		}else{
269
-			foreach ($items as $item){
270
-				$this->addItemInToolbar($item,null,$callback);
268
+		} else {
269
+			foreach ($items as $item) {
270
+				$this->addItemInToolbar($item, null, $callback);
271 271
 			}
272 272
 		}
273 273
 		return $this;
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
 	 * @param callable $callback function($element)
280 280
 	 * @return \Ajax\common\html\HtmlDoubleElement
281 281
 	 */
282
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
282
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
283 283
 		$dd=$value;
284 284
 		if (\is_string($value)) {
285
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
285
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
286 286
 		}
287
-		return $this->addInToolbar($dd,$callback);
287
+		return $this->addInToolbar($dd, $callback);
288 288
 	}
289 289
 
290 290
 	/**
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	 * @param callable $callback function($element)
294 294
 	 * @return \Ajax\common\html\HtmlDoubleElement
295 295
 	 */
296
-	public function addButtonInToolbar($caption,$cssStyle=null,$callback=NULL){
297
-		$bt=new HtmlButton("bt-".$caption,$caption,$cssStyle);
298
-		return $this->addInToolbar($bt,$callback);
296
+	public function addButtonInToolbar($caption, $cssStyle=null, $callback=NULL) {
297
+		$bt=new HtmlButton("bt-".$caption, $caption, $cssStyle);
298
+		return $this->addInToolbar($bt, $callback);
299 299
 	}
300 300
 
301 301
 	/**
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 * @param callable $callback function($element)
305 305
 	 * @return \Ajax\common\html\HtmlDoubleElement
306 306
 	 */
307
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
308
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
309
-		return $this->addInToolbar($bts,$callback);
307
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
308
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
309
+		return $this->addInToolbar($bts, $callback);
310 310
 	}
311 311
 
312 312
 	/**
@@ -316,15 +316,15 @@  discard block
 block discarded – undo
316 316
 	 * @param boolean $labeled
317 317
 	 * @return \Ajax\common\html\HtmlDoubleElement
318 318
 	 */
319
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
320
-		$bt=new HtmlButton("",$caption);
321
-		$bt->addIcon($icon,$before,$labeled);
319
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
320
+		$bt=new HtmlButton("", $caption);
321
+		$bt->addIcon($icon, $before, $labeled);
322 322
 		return $this->addInToolbar($bt);
323 323
 	}
324 324
 
325
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$parameters=NULL){
326
-		$button=new HtmlButton($identifier,$value,$cssStyle);
327
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement,$parameters);
325
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $parameters=NULL) {
326
+		$button=new HtmlButton($identifier, $value, $cssStyle);
327
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement, $parameters);
328 328
 		return $this->addInToolbar($button);
329 329
 	}
330 330
 
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
355 355
 	 * @return \Ajax\common\Widget
356 356
 	 */
357
-	public function setDefaultValueFunction($defaultValueFunction){
357
+	public function setDefaultValueFunction($defaultValueFunction) {
358 358
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
359 359
 		return $this;
360 360
 	}
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 * @param string|boolean $disable
364 364
 	 * @return string
365 365
 	 */
366
-	public function jsDisabled($disable=true){
366
+	public function jsDisabled($disable=true) {
367 367
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
368 368
 	}
369 369
 
@@ -372,12 +372,12 @@  discard block
 block discarded – undo
372 372
 	 * @param callable $callback function($element)
373 373
 	 * @return \Ajax\common\html\HtmlDoubleElement
374 374
 	 */
375
-	public function addEditButtonInToolbar($caption,$callback=NULL){
376
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
375
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
376
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
377 377
 		$bt->setToggle();
378 378
 		$bt->setActive($this->_edition);
379 379
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
380
-		return $this->addInToolbar($bt,$callback);
380
+		return $this->addInToolbar($bt, $callback);
381 381
 	}
382 382
 
383 383
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -391,35 +391,35 @@  discard block
 block discarded – undo
391 391
 	}
392 392
 
393 393
 	public function getForm() {
394
-		if(!isset($this->_form)){
394
+		if (!isset($this->_form)) {
395 395
 			$this->_form=new HtmlForm("frm-".$this->identifier);
396 396
 			$this->setEdition(true);
397 397
 		}
398 398
 		return $this->_form;
399 399
 	}
400 400
 
401
-	public function run(JsUtils $js){
401
+	public function run(JsUtils $js) {
402 402
 		$result=parent::run($js);
403
-		if(isset($this->_form)){
403
+		if (isset($this->_form)) {
404 404
 			$result=$this->runForm($js);
405 405
 		}
406 406
 		return $result;
407 407
 	}
408 408
 
409
-	protected function runForm(JsUtils $js){
409
+	protected function runForm(JsUtils $js) {
410 410
 		$fields=$this->getContentInstances(HtmlFormField::class);
411
-		foreach ($fields as $field){
411
+		foreach ($fields as $field) {
412 412
 			$this->_form->addField($field);
413 413
 		}
414 414
 		return $this->_form->run($js);
415 415
 	}
416 416
 
417
-	protected function _compileForm(){
418
-		if(isset($this->_form)){
417
+	protected function _compileForm() {
418
+		if (isset($this->_form)) {
419 419
 			$noValidate="";
420
-			if(\sizeof($this->_form->getValidationParams())>0)
420
+			if (\sizeof($this->_form->getValidationParams())>0)
421 421
 				$noValidate="novalidate";
422
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">","</form>");
422
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."' ".$noValidate.">", "</form>");
423 423
 		}
424 424
 	}
425 425
 
@@ -428,32 +428,32 @@  discard block
 block discarded – undo
428 428
 		return $this;
429 429
 	}
430 430
 
431
-	public function moveFieldTo($from,$to){
431
+	public function moveFieldTo($from, $to) {
432 432
 		return $this->_instanceViewer->moveFieldTo($from, $to);
433 433
 	}
434 434
 
435
-	public function swapFields($index1,$index2){
435
+	public function swapFields($index1, $index2) {
436 436
 		$index1=$this->_getIndex($index1);
437 437
 		$index2=$this->_getIndex($index2);
438 438
 		return $this->_instanceViewer->swapFields($index1, $index2);
439 439
 	}
440 440
 
441
-	public function removeField($index){
441
+	public function removeField($index) {
442 442
 		$index=$this->_getIndex($index);
443 443
 		$this->_instanceViewer->removeField($index);
444 444
 		return $this;
445 445
 	}
446 446
 
447
-	public function asModal($header=null){
448
-		$modal=new HtmlModal("modal-".$this->identifier,$header);
447
+	public function asModal($header=null) {
448
+		$modal=new HtmlModal("modal-".$this->identifier, $header);
449 449
 		$modal->setContent($this);
450
-		if(isset($this->_form)){
450
+		if (isset($this->_form)) {
451 451
 			$this->_form->onSuccess($modal->jsHide());
452 452
 		}
453 453
 		return $modal;
454 454
 	}
455 455
 
456 456
 	public function addToProperty($name, $value, $separator=" ") {
457
-		return $this->getHtmlComponent()->addToProperty($name,$value,$separator);
457
+		return $this->getHtmlComponent()->addToProperty($name, $value, $separator);
458 458
 	}
459 459
 }
Please login to merge, or discard this patch.
Ajax/ui/components/DialogButton.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 	private function addFunction($jsCode) {
18 18
 		if (!Text::startsWith($jsCode, "function"))
19
-			$jsCode="%function(){" . $jsCode . "}%";
19
+			$jsCode="%function(){".$jsCode."}%";
20 20
 		return $jsCode;
21 21
 	}
22 22
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 * @param array $parameters default : array("params"=>"{}","jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"jqueryDone"=>"html","ajaxTransition"=>null,"jsCondition"=>NULL,"headers"=>null)
52 52
 	 * @return DialogButton
53 53
 	 */
54
-	public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay",$parameters=[]) {
55
-		return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement,$parameters) . ";$( this ).dialog( 'close' );");
54
+	public static function submitButton(JsUtils $js, $url, $form, $responseElement, $caption="Okay", $parameters=[]) {
55
+		return new DialogButton($caption, $js->postFormDeferred($url, $form, $responseElement, $parameters).";$( this ).dialog( 'close' );");
56 56
 	}
57 57
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlIconGroups.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 			$icon=JArray::getValue($value, "icon", 0);
28 28
 			$size=JArray::getValue($value, "size", 1);
29 29
 		}
30
-		$iconO=new HtmlIcon("icon-" . $this->identifier, $icon);
30
+		$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
31 31
 		if (isset($size)) {
32 32
 			$iconO->setSize($size);
33 33
 		}
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	protected function createCondition($value) {
38
-		return ($value instanceof HtmlIcon) === false;
38
+		return ($value instanceof HtmlIcon)===false;
39 39
 	}
40 40
 
41 41
 	public function getIcon($index) {
42 42
 		return $this->content[$index];
43 43
 	}
44 44
 
45
-	public function run(JsUtils $js){
46
-		$result= parent::run($js);
45
+	public function run(JsUtils $js) {
46
+		$result=parent::run($js);
47 47
 		return $result->setItemSelector("i");
48 48
 	}
49 49
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 		return $this;
53 53
 	}
54 54
 
55
-	public static function corner($mainIcon,$cornerIcon,$size="huge"){
56
-		$icons=new HtmlIconGroups("icons",[$mainIcon,$cornerIcon],$size);
55
+	public static function corner($mainIcon, $cornerIcon, $size="huge") {
56
+		$icons=new HtmlIconGroups("icons", [$mainIcon, $cornerIcon], $size);
57 57
 		return $icons->toCorner(1);
58 58
 	}
59 59
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlTab.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
  * @author jc
15 15
  * @version 1.001
16 16
  */
17
-class HtmlTab extends HtmlSemCollection{
17
+class HtmlTab extends HtmlSemCollection {
18 18
 
19 19
 	protected $params=[];
20 20
 
21
-	public function __construct( $identifier, $tabs=array()){
22
-		parent::__construct( $identifier, "div", "");
21
+	public function __construct($identifier, $tabs=array()) {
22
+		parent::__construct($identifier, "div", "");
23 23
 		$menu=new HtmlMenu("menu".$this->identifier);
24
-		$menu->asTab(false)->setAttachment(NULL,Side::TOP);
24
+		$menu->asTab(false)->setAttachment(NULL, Side::TOP);
25 25
 		$this->content["menu"]=$menu;
26 26
 		$this->addItems($tabs);
27 27
 	}
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 * @see \Ajax\common\html\HtmlCollection::createItem()
32 32
 	 * @return HtmlSegment
33 33
 	 */
34
-	protected function createItem($value){
34
+	protected function createItem($value) {
35 35
 		$count=$this->count();
36 36
 		$title=$value;
37 37
 		$content=NULL;
38
-		if(\is_array($value)){
39
-			$title=@$value[0];$content=@$value[1];
38
+		if (\is_array($value)) {
39
+			$title=@$value[0]; $content=@$value[1];
40 40
 		}
41 41
 		$menuItem=$this->content["menu"]->addItem($title);
42 42
 		$menuItem->addToProperty("data-tab", $menuItem->getIdentifier());
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 * @param string $datatab
53 53
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
54 54
 	 */
55
-	private function createSegment($count,$content,$datatab){
55
+	private function createSegment($count, $content, $datatab) {
56 56
 		$segment=new HtmlSegment("item-".$this->identifier."-".$count, $content);
57
-		$segment->setAttachment(NULL,Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab",$datatab);
57
+		$segment->setAttachment(NULL, Side::BOTTOM)->addToProperty("class", "tab")->addToProperty("data-tab", $datatab);
58 58
 		return $segment;
59 59
 	}
60 60
 
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 * @param String $content new content
65 65
 	 * @return \Ajax\semantic\html\modules\HtmlTab
66 66
 	 */
67
-	public function setTabContent($index,$content){
67
+	public function setTabContent($index, $content) {
68 68
 		$menu=$this->content["menu"];
69
-		if($index<$menu->count()){
70
-			if(isset($this->content[$index])===false){
69
+		if ($index<$menu->count()) {
70
+			if (isset($this->content[$index])===false) {
71 71
 				$this->content[$index]=$this->createSegment($index, $content, $menu->getItem($index)->getIdentifier());
72
-			}else
72
+			} else
73 73
 				$this->content[$index]->setContent($content);
74 74
 		}
75 75
 		return $this;
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @param array $contents
81 81
 	 * @return \Ajax\semantic\html\modules\HtmlTab
82 82
 	 */
83
-	public function setTabsContent($contents){
83
+	public function setTabsContent($contents) {
84 84
 		$size=\sizeof($contents);
85
-		for($i=0;$i<$size;$i++){
85
+		for ($i=0; $i<$size; $i++) {
86 86
 			$this->setTabContent($i, $contents[$i]);
87 87
 		}
88 88
 		return $this;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param int $index
94 94
 	 * @return \Ajax\semantic\html\modules\HtmlTab
95 95
 	 */
96
-	public function activate($index){
96
+	public function activate($index) {
97 97
 		$this->content["menu"]->getItem($index)->setActive(true);
98 98
 		$this->content[$index]->setActive(true);
99 99
 		return $this;
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 * @param string $content
106 106
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
107 107
 	 */
108
-	public function addTab($title,$content){
109
-		return $this->addItem([$title,$content]);
108
+	public function addTab($title, $content) {
109
+		return $this->addItem([$title, $content]);
110 110
 	}
111 111
 
112 112
 	/**
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 * @param array $params
121 121
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
122 122
 	 */
123
-	public function forwardTab($index,JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
124
-		if(\array_key_exists($index, $this->content)){
125
-			$this->content[$index]=$js->forward($initialController, $controller, $action,$params);
123
+	public function forwardTab($index, JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
124
+		if (\array_key_exists($index, $this->content)) {
125
+			$this->content[$index]=$js->forward($initialController, $controller, $action, $params);
126 126
 			return $this->content[$index];
127 127
 		}
128 128
 
129
-		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action,$params);
129
+		return $this->addAndForwardTab($js, $title, $initialController, $controller, $action, $params);
130 130
 	}
131 131
 
132 132
 	/**
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	 * @param $params The parameters to pass to the view
140 140
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
141 141
 	 */
142
-	public function renderViewTab($index,JsUtils $js,$title,$initialController, $viewName, $params=array()) {
143
-		if(\array_key_exists($index, $this->content)){
144
-			$this->content[$index]=$js->renderContent($initialController, $viewName,$params);
142
+	public function renderViewTab($index, JsUtils $js, $title, $initialController, $viewName, $params=array()) {
143
+		if (\array_key_exists($index, $this->content)) {
144
+			$this->content[$index]=$js->renderContent($initialController, $viewName, $params);
145 145
 			return $this->content[$index];
146 146
 		}
147
-		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName,$params);
147
+		return $this->addAndRenderViewTab($js, $title, $initialController, $viewName, $params);
148 148
 	}
149 149
 
150 150
 
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param array $params
159 159
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
160 160
 	 */
161
-	public function addAndForwardTab(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){
162
-		return $this->addTab($title, $js->forward($initialController, $controller, $action,$params));
161
+	public function addAndForwardTab(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) {
162
+		return $this->addTab($title, $js->forward($initialController, $controller, $action, $params));
163 163
 	}
164 164
 
165 165
 	/**
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param $params The parameters to pass to the view
172 172
 	 * @return \Ajax\semantic\html\elements\HtmlSegment
173 173
 	 */
174
-	public function addAndRenderViewTab(JsUtils $js,$title,$initialController, $viewName, $params=array()) {
175
-		return $this->addTab($title, $js->renderContent($initialController, $viewName,$params));
174
+	public function addAndRenderViewTab(JsUtils $js, $title, $initialController, $viewName, $params=array()) {
175
+		return $this->addTab($title, $js->renderContent($initialController, $viewName, $params));
176 176
 	}
177 177
 
178 178
 	public function setPointing($value=Direction::NONE) {
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 * @param int $index
189 189
 	 * @return Ajax\semantic\html\content\HtmlMenuItem
190 190
 	 */
191
-	public function getMenuTab($index){
191
+	public function getMenuTab($index) {
192 192
 		return $this->content["menu"]->getItem($index);
193 193
 	}
194 194
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param int $index
198 198
 	 * @return HtmlSegment
199 199
 	 */
200
-	public function getTab($index){
200
+	public function getTab($index) {
201 201
 		return $this->content[$index];
202 202
 	}
203 203
 
@@ -206,22 +206,22 @@  discard block
 block discarded – undo
206 206
 	 * @param HtmlMenu $menu
207 207
 	 * @return \Ajax\semantic\html\modules\HtmlTab
208 208
 	 */
209
-	public function setMenu($menu){
209
+	public function setMenu($menu) {
210 210
 		$contentSize=\sizeof($this->content);
211
-		for($i=0;$i<$contentSize;$i++){
212
-			if($menu->getItem($i)!==NULL){
213
-				if(isset($this->content[$i])){
214
-					$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
211
+		for ($i=0; $i<$contentSize; $i++) {
212
+			if ($menu->getItem($i)!==NULL) {
213
+				if (isset($this->content[$i])) {
214
+					$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
215 215
 				}
216 216
 			}
217 217
 		}
218 218
 		$menuSize=$menu->count();
219
-		for($i=0;$i<$menuSize;$i++){
219
+		for ($i=0; $i<$menuSize; $i++) {
220 220
 			$menu->getItem($i)->removeProperty("href");
221
-			if(isset($this->content[$i])===false){
221
+			if (isset($this->content[$i])===false) {
222 222
 				$this->content[$i]=$this->createSegment($i, "New content", $menu->getItem($i)->getIdentifier());
223 223
 			}
224
-			$menu->getItem($i)->addToProperty("data-tab",$this->content[$i]->getProperty("data-tab"));
224
+			$menu->getItem($i)->addToProperty("data-tab", $this->content[$i]->getProperty("data-tab"));
225 225
 		}
226 226
 
227 227
 		$this->content["menu"]=$menu;
@@ -233,15 +233,15 @@  discard block
 block discarded – undo
233 233
 	 * @see BaseHtml::run()
234 234
 	 */
235 235
 	public function run(JsUtils $js) {
236
-		if(isset($this->_bsComponent)===false)
237
-			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item",$this->params);
236
+		if (isset($this->_bsComponent)===false)
237
+			$this->_bsComponent=$js->semantic()->tab("#".$this->identifier." .item", $this->params);
238 238
 			$this->addEventsOnRun($js);
239 239
 			return $this->_bsComponent;
240 240
 	}
241 241
 
242 242
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
243
-		if($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
243
+		if ($this->content["menu"]->count()>0 && \sizeof($this->content)>1)
244 244
 			$this->activate(0);
245
-		return parent::compile($js,$view);
245
+		return parent::compile($js, $view);
246 246
 	}
247 247
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldsTrait.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -20,46 +20,46 @@  discard block
 block discarded – undo
20 20
  * @property string $identifier
21 21
  */
22 22
 trait FieldsTrait {
23
-	abstract public function addFields($fields=NULL,$label=NULL);
23
+	abstract public function addFields($fields=NULL, $label=NULL);
24 24
 	abstract public function addItem($item);
25 25
 
26
-	protected function createItem($value){
27
-		if(\is_array($value)){
28
-			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null)));
26
+	protected function createItem($value) {
27
+		if (\is_array($value)) {
28
+			$itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null)));
29 29
 			return $itemO;
30
-		}elseif(\is_object($value)){
30
+		}elseif (\is_object($value)) {
31 31
 			$itemO=new HtmlFormField("field-".$this->identifier, $value);
32 32
 			return $itemO;
33
-		}else
33
+		} else
34 34
 			return new HtmlFormInput($value);
35 35
 	}
36 36
 
37
-	protected function createCondition($value){
37
+	protected function createCondition($value) {
38 38
 		return \is_object($value)===false || $value instanceof \Ajax\semantic\html\elements\HtmlInput;
39 39
 	}
40 40
 
41
-	public function addInputs($inputs,$fieldslabel=null){
41
+	public function addInputs($inputs, $fieldslabel=null) {
42 42
 		$fields=array();
43
-		foreach ($inputs as $input){
43
+		foreach ($inputs as $input) {
44 44
 			\extract($input);
45
-			$f=new HtmlFormInput("","");
45
+			$f=new HtmlFormInput("", "");
46 46
 			$f->fromArray($input);
47 47
 			$fields[]=$f;
48 48
 		}
49
-		return $this->addFields($fields,$fieldslabel);
49
+		return $this->addFields($fields, $fieldslabel);
50 50
 	}
51 51
 
52
-	public function addFieldRule($index,$type,$prompt=NULL,$value=NULL){
52
+	public function addFieldRule($index, $type, $prompt=NULL, $value=NULL) {
53 53
 		$field=$this->getItem($index);
54
-		if(isset($field)){
55
-			$field->addRule($type,$prompt,$value);
54
+		if (isset($field)) {
55
+			$field->addRule($type, $prompt, $value);
56 56
 		}
57 57
 		return $this;
58 58
 	}
59 59
 
60
-	public function addFieldRules($index,$rules){
60
+	public function addFieldRules($index, $rules) {
61 61
 		$field=$this->getItem($index);
62
-		if(isset($field)){
62
+		if (isset($field)) {
63 63
 			$field->addRules($rules);
64 64
 		}
65 65
 		return $this;
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @param boolean $multiple
75 75
 	 * @return HtmlFormDropdown
76 76
 	 */
77
-	public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){
78
-		return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple));
77
+	public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) {
78
+		return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple));
79 79
 	}
80 80
 
81 81
 	/**
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @param boolean $asIcons
86 86
 	 * @return HtmlButtonGroups
87 87
 	 */
88
-	public function addButtonGroups($identifier,$elements=[],$asIcons=false){
89
-		return $this->addItem(new HtmlButtonGroups($identifier,$elements,$asIcons));
88
+	public function addButtonGroups($identifier, $elements=[], $asIcons=false) {
89
+		return $this->addItem(new HtmlButtonGroups($identifier, $elements, $asIcons));
90 90
 	}
91 91
 
92 92
 	/**
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @param string $icon
99 99
 	 * @return HtmlButtonGroups
100 100
 	 */
101
-	public function addDropdownButton($identifier,$value,$items=[],$asCombo=false,$icon=null){
102
-		return $this->addItem(HtmlButton::dropdown($identifier, $value,$items,$asCombo,$icon));
101
+	public function addDropdownButton($identifier, $value, $items=[], $asCombo=false, $icon=null) {
102
+		return $this->addItem(HtmlButton::dropdown($identifier, $value, $items, $asCombo, $icon));
103 103
 	}
104 104
 
105 105
 	/**
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	 * @param string $placeholder
111 111
 	 * @return HtmlFormInput
112 112
 	 */
113
-	public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){
114
-		return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder));
113
+	public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
114
+		return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder));
115 115
 	}
116 116
 
117 117
 	/**
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param int $rows
123 123
 	 * @return HtmlTextarea
124 124
 	 */
125
-	public function addTextarea($identifier, $label,$value=NULL,$placeholder=NULL,$rows=5){
126
-		return $this->addItem(new HtmlFormTextarea($identifier,$label,$value,$placeholder,$rows));
125
+	public function addTextarea($identifier, $label, $value=NULL, $placeholder=NULL, $rows=5) {
126
+		return $this->addItem(new HtmlFormTextarea($identifier, $label, $value, $placeholder, $rows));
127 127
 	}
128 128
 
129
-	public function addPassword($identifier, $label=NULL){
130
-		return $this->addItem(new HtmlFormInput($identifier,$label,"password","",""));
129
+	public function addPassword($identifier, $label=NULL) {
130
+		return $this->addItem(new HtmlFormInput($identifier, $label, "password", "", ""));
131 131
 	}
132 132
 
133
-	public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){
134
-		return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick));
133
+	public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) {
134
+		return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick));
135 135
 	}
136 136
 
137 137
 	/**
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 * @param string $type
142 142
 	 * @return HtmlFormCheckbox
143 143
 	 */
144
-	public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){
145
-		return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type));
144
+	public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) {
145
+		return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type));
146 146
 	}
147 147
 
148
-	public function addRadio($identifier, $name,$label=NULL,$value=NULL){
149
-		return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value));
148
+	public function addRadio($identifier, $name, $label=NULL, $value=NULL) {
149
+		return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value));
150 150
 	}
151 151
 
152
-	public function addElement($identifier,$content,$label,$tagName="div",$baseClass=""){
153
-		$div=new HtmlSemDoubleElement($identifier,$tagName,$baseClass,$content);
154
-		return $this->addItem(new HtmlFormField("field-".$identifier, $div,$label));
152
+	public function addElement($identifier, $content, $label, $tagName="div", $baseClass="") {
153
+		$div=new HtmlSemDoubleElement($identifier, $tagName, $baseClass, $content);
154
+		return $this->addItem(new HtmlFormField("field-".$identifier, $div, $label));
155 155
 	}
156 156
 }
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormDropdown.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,29 +7,29 @@  discard block
 block discarded – undo
7 7
 
8 8
 class HtmlFormDropdown extends HtmlFormField {
9 9
 
10
-	public function __construct($identifier,$items=array(), $label=NULL,$value="",$multiple=false,$associative=true) {
11
-		parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label);
10
+	public function __construct($identifier, $items=array(), $label=NULL, $value="", $multiple=false, $associative=true) {
11
+		parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label);
12 12
 		$this->_identifier=$identifier;
13 13
 	}
14 14
 
15
-	public function setItems($items){
15
+	public function setItems($items) {
16 16
 		return $this->getField()->setItems($items);
17 17
 	}
18
-	public function addItem($item,$value=NULL,$image=NULL){
19
-		return $this->getField()->addItem($item,$value,$image);
18
+	public function addItem($item, $value=NULL, $image=NULL) {
19
+		return $this->getField()->addItem($item, $value, $image);
20 20
 	}
21
-	public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value="",$associative=true){
22
-		return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative);
21
+	public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value="", $associative=true) {
22
+		return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative);
23 23
 	}
24 24
 
25 25
 	/**
26 26
 	 * @return HtmlDropdown
27 27
 	 */
28
-	public function getDataField(){
28
+	public function getDataField() {
29 29
 		return $this->getField()->getInput();
30 30
 	}
31
-	public function asSelect($name=NULL,$multiple=false,$selection=true){
32
-		$this->getField()->asSelect($name,$multiple,$selection);
31
+	public function asSelect($name=NULL, $multiple=false, $selection=true) {
32
+		$this->getField()->asSelect($name, $multiple, $selection);
33 33
 		return $this;
34 34
 	}
35 35
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param boolean $floating
38 38
 	 * @return HtmlDropdown
39 39
 	 */
40
-	public function asButton($floating=false){
40
+	public function asButton($floating=false) {
41 41
 		$field=$this->content["field"];
42 42
 		$label=$this->content["label"];
43 43
 		$field->addContent($label);
Please login to merge, or discard this patch.