Completed
Push — master ( d6d0c3...7ff1b8 )
by Jean-Christophe
03:01
created
Ajax/php/yii/JsUtils.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@  discard block
 block discarded – undo
4 4
 
5 5
 use yii\helpers\Url;
6 6
 
7
-class JsUtils extends \Ajax\JsUtils{
8
-	public function getUrl($url){
9
-		if($url==="")
7
+class JsUtils extends \Ajax\JsUtils {
8
+	public function getUrl($url) {
9
+		if ($url==="")
10 10
 			$url="/";
11 11
 		return Url::toRoute($url);
12 12
 	}
13 13
 
14
-	public function addViewElement($identifier,$content,&$view){
14
+	public function addViewElement($identifier, $content, &$view) {
15 15
 		$params=$view->params;
16 16
 		if (\array_key_exists("q", $params)===false) {
17 17
 			$view->params["q"]=array();
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 		$view->params["q"][$identifier]=$content;
20 20
 	}
21 21
 
22
-	public function createScriptVariable(&$view,$view_var, $output){
22
+	public function createScriptVariable(&$view, $view_var, $output) {
23 23
 		$view->params[$view_var]=$output;
24 24
 	}
25 25
 
26
-	public function forward($initialControllerInstance,$controllerName,$actionName,$params=array()){
26
+	public function forward($initialControllerInstance, $controllerName, $actionName, $params=array()) {
27 27
 		\ob_start();
28 28
 		$ctrInfo=\yii::$app->createController($controllerName."/".$actionName);
29 29
 		$ctrInfo[0]->{$ctrInfo[1]}($params);
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 		return $result;
33 33
 	}
34 34
 
35
-	public function renderContent($initialControllerInstance,$viewName, $params=NULL) {
36
-		return \yii::$app->view->render($viewName,$params);
35
+	public function renderContent($initialControllerInstance, $viewName, $params=NULL) {
36
+		return \yii::$app->view->render($viewName, $params);
37 37
 	}
38 38
 
39
-	public function fromDispatcher($dispatcher){
39
+	public function fromDispatcher($dispatcher) {
40 40
 		$uri=new \Ajax\php\yii\URI();
41 41
 		return $uri->segment_array();
42 42
 	}
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/DataForm.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -18,46 +18,46 @@  discard block
 block discarded – undo
18 18
  * @property FormInstanceViewer $_instanceViewer
19 19
  */
20 20
 class DataForm extends Widget {
21
-	use FormFieldAsTrait,FormTrait;
21
+	use FormFieldAsTrait, FormTrait;
22 22
 
23 23
 	public function __construct($identifier, $modelInstance=NULL) {
24
-		parent::__construct($identifier, null,$modelInstance);
24
+		parent::__construct($identifier, null, $modelInstance);
25 25
 		$this->_init(new FormInstanceViewer($identifier), "form", new HtmlForm($identifier), true);
26 26
 	}
27 27
 
28
-	public function compile(JsUtils $js=NULL,&$view=NULL){
28
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
29 29
 		$this->_instanceViewer->setInstance($this->_modelInstance);
30 30
 
31 31
 		$form=$this->content["form"];
32 32
 		$this->_generateContent($form);
33 33
 
34
-		if(isset($this->_toolbar)){
34
+		if (isset($this->_toolbar)) {
35 35
 			$this->_setToolbarPosition($form);
36 36
 		}
37
-		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"form",PositionInTable::AFTERTABLE]);
38
-		return parent::compile($js,$view);
37
+		$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "form", PositionInTable::AFTERTABLE]);
38
+		return parent::compile($js, $view);
39 39
 	}
40 40
 
41 41
 	/**
42 42
 	 * @param HtmlForm $form
43 43
 	 */
44
-	protected function _generateContent($form){
45
-		$values= $this->_instanceViewer->getValues();
44
+	protected function _generateContent($form) {
45
+		$values=$this->_instanceViewer->getValues();
46 46
 		$count=$this->_instanceViewer->count();
47 47
 
48 48
 		$separators=$this->_instanceViewer->getSeparators();
49 49
 		$size=\sizeof($separators);
50
-		if($size===1){
51
-			foreach ($values as $v){
50
+		if ($size===1) {
51
+			foreach ($values as $v) {
52 52
 				$form->addField($v);
53 53
 			}
54
-		}else{
54
+		} else {
55 55
 			$separators[]=$count;
56
-			for($i=0;$i<$size;$i++){
57
-				$fields=\array_slice($values, $separators[$i]+1,$separators[$i+1]-$separators[$i]);
58
-				if(\sizeof($fields)===1){
56
+			for ($i=0; $i<$size; $i++) {
57
+				$fields=\array_slice($values, $separators[$i]+1, $separators[$i+1]-$separators[$i]);
58
+				if (\sizeof($fields)===1) {
59 59
 					$form->addField($fields[0]);
60
-				}else
60
+				} else
61 61
 					$form->addFields($fields);
62 62
 			}
63 63
 		}
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	/**
67 67
 	 * @return HtmlForm
68 68
 	 */
69
-	protected function getForm(){
69
+	protected function getForm() {
70 70
 		return $this->content["form"];
71 71
 	}
72 72
 
73
-	public function addSeparatorAfter($fieldNum){
73
+	public function addSeparatorAfter($fieldNum) {
74 74
 		$this->_instanceViewer->addSeparatorAfter($fieldNum);
75 75
 		return $this;
76 76
 	}
@@ -84,26 +84,26 @@  discard block
 block discarded – undo
84 84
 		return $this;
85 85
 	}
86 86
 
87
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){
88
-		$button=new HtmlButton($identifier,$value,$cssStyle);
89
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement);
87
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) {
88
+		$button=new HtmlButton($identifier, $value, $cssStyle);
89
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement);
90 90
 		return $this->addInToolbar($button);
91 91
 	}
92 92
 
93
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
94
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle){
95
-			$button=new HtmlButton($id,$value,$cssStyle);
96
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement);
93
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
94
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle){
95
+			$button=new HtmlButton($id, $value, $cssStyle);
96
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement);
97 97
 			return $button;
98
-		}, $index,$attributes);
98
+		}, $index, $attributes);
99 99
 	}
100 100
 
101
-	public function fieldAsReset($index,$cssStyle=NULL,$attributes=NULL){
102
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
103
-			$button=new HtmlButton($id,$value,$cssStyle);
101
+	public function fieldAsReset($index, $cssStyle=NULL, $attributes=NULL) {
102
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
103
+			$button=new HtmlButton($id, $value, $cssStyle);
104 104
 			$button->setProperty("type", "reset");
105 105
 			return $button;
106
-		}, $index,$attributes);
106
+		}, $index, $attributes);
107 107
 	}
108 108
 
109 109
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/widgets/dataform/FormFieldAsTrait.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@  discard block
 block discarded – undo
15 15
  * @property object $_modelInstance
16 16
  */
17 17
 
18
-trait FormFieldAsTrait{
18
+trait FormFieldAsTrait {
19 19
 
20 20
 	abstract protected function _getFieldIdentifier($prefix);
21
-	abstract public function setValueFunction($index,$callback);
22
-	abstract protected function _applyAttributes($element,&$attributes,$index);
21
+	abstract public function setValueFunction($index, $callback);
22
+	abstract protected function _applyAttributes($element, &$attributes, $index);
23 23
 	abstract public function getIdentifier();
24 24
 
25
-	private function _getLabelField($caption,$icon=NULL){
26
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
25
+	private function _getLabelField($caption, $icon=NULL) {
26
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
27 27
 		return $label;
28 28
 	}
29 29
 
30
-	protected function _addRules($element,&$attributes){
31
-		if(isset($attributes["rules"])){
30
+	protected function _addRules($element, &$attributes) {
31
+		if (isset($attributes["rules"])) {
32 32
 			$rules=$attributes["rules"];
33
-			if(\is_array($rules)){
33
+			if (\is_array($rules)) {
34 34
 				$element->addRules($rules);
35 35
 			}
36 36
 			else
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 		}
40 40
 	}
41 41
 
42
-	protected function _fieldAs($elementCallback,$index,$attributes=NULL,$identifier=null){
43
-		$this->setValueFunction($index,function($value) use ($index,&$attributes,$elementCallback){
42
+	protected function _fieldAs($elementCallback, $index, $attributes=NULL, $identifier=null) {
43
+		$this->setValueFunction($index, function($value) use ($index, &$attributes, $elementCallback){
44 44
 			$caption=$this->_instanceViewer->getCaption($index);
45 45
 			$name=$this->_instanceViewer->getFieldName($index);
46
-			$element=$elementCallback($this->getIdentifier()."-".$name,$name,$value,$caption);
47
-			if(\is_array($attributes)){
48
-				$this->_applyAttributes($element, $attributes,$index);
46
+			$element=$elementCallback($this->getIdentifier()."-".$name, $name, $value, $caption);
47
+			if (\is_array($attributes)) {
48
+				$this->_applyAttributes($element, $attributes, $index);
49 49
 			}
50 50
 			return $element;
51 51
 		});
@@ -53,53 +53,53 @@  discard block
 block discarded – undo
53 53
 	}
54 54
 
55 55
 
56
-	public function fieldAsRadio($index,$attributes=NULL){
57
-		return $this->_fieldAs(function($id,$name,$value,$caption){
58
-			return new HtmlFormRadio($id,$name,$caption,$value);
59
-		}, $index,$attributes);
56
+	public function fieldAsRadio($index, $attributes=NULL) {
57
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
58
+			return new HtmlFormRadio($id, $name, $caption, $value);
59
+		}, $index, $attributes);
60 60
 	}
61 61
 
62
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
63
-		return $this->_fieldAs(function($id,$name,$value,$caption,$elements){
64
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
65
-		}, $index,$attributes);
62
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
63
+		return $this->_fieldAs(function($id, $name, $value, $caption, $elements) {
64
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
65
+		}, $index, $attributes);
66 66
 	}
67 67
 
68
-	public function fieldAsTextarea($index,$attributes=NULL){
69
-		return $this->_fieldAs(function($id,$name,$value,$caption){
70
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
68
+	public function fieldAsTextarea($index, $attributes=NULL) {
69
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
70
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
71 71
 			$textarea->setName($name);
72 72
 			return $textarea;
73
-		}, $index,$attributes);
73
+		}, $index, $attributes);
74 74
 	}
75 75
 
76
-	public function fieldAsInput($index,$attributes=NULL){
77
-		return $this->_fieldAs(function($id,$name,$value,$caption){
78
-			$input= new HtmlFormInput($id,$caption,"text",$value);
76
+	public function fieldAsInput($index, $attributes=NULL) {
77
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
78
+			$input=new HtmlFormInput($id, $caption, "text", $value);
79 79
 			$input->setName($name);
80 80
 			return $input;
81
-		}, $index,$attributes);
81
+		}, $index, $attributes);
82 82
 	}
83 83
 
84
-	public function fieldAsCheckbox($index,$attributes=NULL){
85
-		return $this->_fieldAs(function($id,$name,$value,$caption){
86
-			return new HtmlFormCheckbox($id,$caption,$value);
87
-		}, $index,$attributes);
84
+	public function fieldAsCheckbox($index, $attributes=NULL) {
85
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
86
+			return new HtmlFormCheckbox($id, $caption, $value);
87
+		}, $index, $attributes);
88 88
 	}
89 89
 
90
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
91
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements,$multiple){
92
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value,$multiple);
90
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
91
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements, $multiple){
92
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value, $multiple);
93 93
 			$dd->setName($name);
94 94
 			return $dd;
95
-		}, $index,$attributes);
95
+		}, $index, $attributes);
96 96
 	}
97 97
 
98
-	public function fieldAsMessage($index,$attributes=NULL){
99
-		return $this->_fieldAs(function($id,$name,$value,$caption){
100
-			$mess= new HtmlMessage("message-".$id,$value);
98
+	public function fieldAsMessage($index, $attributes=NULL) {
99
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
100
+			$mess=new HtmlMessage("message-".$id, $value);
101 101
 			$mess->addHeader($caption);
102 102
 			return $mess;
103
-		}, $index,$attributes,"message");
103
+		}, $index, $attributes, "message");
104 104
 	}
105 105
 }
106 106
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/traits/SemanticHtmlElementsTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @param string $tagName
159 159
 	 * @return HtmlLabel
160 160
 	 */
161
-	public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") {
162
-		return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName));
161
+	public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") {
162
+		return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName));
163 163
 	}
164 164
 
165 165
 	/**
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @param array $attributes
169 169
 	 * @return HtmlLabelGroups
170 170
 	 */
171
-	public function htmlLabelGroups($identifier,$labels=array(),$attributes=array()){
172
-		return $this->addHtmlComponent(new HtmlLabelGroups($identifier,$labels,$attributes));
171
+	public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) {
172
+		return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes));
173 173
 	}
174 174
 
175 175
 	/**
Please login to merge, or discard this patch.
Ajax/semantic/html/views/HtmlCard.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,19 +17,19 @@  discard block
 block discarded – undo
17 17
 class HtmlCard extends HtmlSemDoubleElement {
18 18
 
19 19
 	public function __construct($identifier) {
20
-		parent::__construct($identifier, "div", "ui card", array ());
20
+		parent::__construct($identifier, "div", "ui card", array());
21 21
 	}
22 22
 
23 23
 	private function createContent($content, $baseClass="content") {
24 24
 		$count=\sizeof($this->content);
25
-		$result=new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content);
25
+		$result=new HtmlCardContent("content-".$count."-".$this->identifier, $content);
26 26
 		$result->setClass($baseClass);
27 27
 		return $result;
28 28
 	}
29 29
 
30 30
 	private function addElementInContent($key, $element) {
31
-		if (\array_key_exists($key, $this->content) === false) {
32
-			$this->content[$key]=array ();
31
+		if (\array_key_exists($key, $this->content)===false) {
32
+			$this->content[$key]=array();
33 33
 		}
34 34
 		$this->content[$key][]=$element;
35 35
 		return $element;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
 	public function addHeader($header, $niveau=4, $type="page") {
48 48
 		if (!$header instanceof HtmlHeader) {
49
-			$header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type);
49
+			$header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type);
50 50
 		}
51 51
 		$this->content["header"]=$this->createContent($header);
52 52
 	}
53 53
 
54 54
 	public function addImage($image, $title="") {
55 55
 		if (!$image instanceof HtmlImage) {
56
-			$image=new HtmlImage("image-" . $this->identifier, $image, $title);
56
+			$image=new HtmlImage("image-".$this->identifier, $image, $title);
57 57
 		}
58 58
 		$image->setClass("image");
59 59
 		return $this->addElementInContent("content", $image);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) {
63 63
 		$reveal=$visibleContent;
64 64
 		if (!$visibleContent instanceof HtmlReveal) {
65
-			$reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType);
65
+			$reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType);
66 66
 		}
67 67
 		return $this->addElementInContent("content", $reveal);
68 68
 	}
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 * @param boolean $asIcons
92 92
 	 * @return \Ajax\semantic\html\elements\HtmlButtonGroups
93 93
 	 */
94
-	public function addButtons($elements=array(), $asIcons=false){
95
-		$buttons=new HtmlButtonGroups("buttons-".$this->identifier,$elements,$asIcons);
94
+	public function addButtons($elements=array(), $asIcons=false) {
95
+		$buttons=new HtmlButtonGroups("buttons-".$this->identifier, $elements, $asIcons);
96 96
 		$this->addElementInContent("content", $buttons);
97 97
 		return $buttons;
98 98
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 
102 102
 	public function addCardHeaderContent($header, $metas=array(), $description=NULL) {
103 103
 		$count=\sizeof($this->content);
104
-		return $this->addElementInContent("content", new HtmlCardHeaderContent("content-" . $count . "-" . $this->identifier, $header, $metas, $description));
104
+		return $this->addElementInContent("content", new HtmlCardHeaderContent("content-".$count."-".$this->identifier, $header, $metas, $description));
105 105
 	}
106 106
 
107 107
 	public function addCardContent($content=array()) {
108 108
 		$count=\sizeof($this->content);
109
-		return $this->addElementInContent("content", new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content));
109
+		return $this->addElementInContent("content", new HtmlCardContent("content-".$count."-".$this->identifier, $content));
110 110
 	}
111 111
 
112 112
 	public function getCardContent($index=NULL) {
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
133 133
 	 */
134 134
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
135
-		$this->content=JArray::sortAssociative($this->content, [ "header","image","content","extra-content" ]);
135
+		$this->content=JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]);
136 136
 		return parent::compile($js, $view);
137 137
 	}
138 138
 
139 139
 	public function asLink($href="") {
140 140
 		$this->addToProperty("class", "link");
141
-		if ($href !== "") {
141
+		if ($href!=="") {
142 142
 			$this->setProperty("href", $href);
143 143
 		}
144 144
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormFields.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		}
36 36
 		if (isset($label))
37 37
 			$this->setLabel($label);
38
-		foreach ( $fields as $field ) {
38
+		foreach ($fields as $field) {
39 39
 			$this->addItem($field);
40 40
 		}
41 41
 		return $this;
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function addItem($item) {
59 59
 		$item=parent::addItem($item);
60
-		if($item instanceof HtmlFormField)
60
+		if ($item instanceof HtmlFormField)
61 61
 			$item->setContainer($this);
62 62
 		return $item;
63 63
 	}
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
 
100 100
 	public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) {
101
-		$fields=array ();
101
+		$fields=array();
102 102
 		$i=0;
103
-		foreach ( $items as $val => $caption ) {
103
+		foreach ($items as $val => $caption) {
104 104
 			$itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type);
105 105
 			if ($val===$value) {
106 106
 				$itemO->getField()->setProperty("checked", "");
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	}
115 115
 
116 116
 	public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) {
117
-		$fields=array ();
117
+		$fields=array();
118 118
 		$i=0;
119
-		foreach ( $items as $val => $caption ) {
119
+		foreach ($items as $val => $caption) {
120 120
 			$itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type);
121 121
 			if (\array_search($val, $values)!==false) {
122 122
 				//TODO check getField
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/FieldTrait.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 	abstract public function addToProperty($name, $value, $separator=" ");
18 18
 	abstract public function addLabel($caption, $style="label-default", $leftSeparator="&nbsp;");
19
-	abstract public function addContent($content,$before=false);
19
+	abstract public function addContent($content, $before=false);
20 20
 	abstract public function getField();
21 21
 	abstract public function getDataField();
22 22
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	public function addLoading() {
28
-		if ($this->_hasIcon === false) {
28
+		if ($this->_hasIcon===false) {
29 29
 			throw new \Exception("Input must have an icon for showing a loader, use addIcon before");
30 30
 		}
31 31
 		return $this->addToProperty("class", State::LOADING);
@@ -33,56 +33,56 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function labeled($label, $direction=Direction::LEFT, $icon=NULL) {
35 35
 		$field=$this->getField();
36
-		$labelO=$field->addLabel($label,$direction===Direction::LEFT,$icon);
37
-		$field->addToProperty("class", $direction . " labeled");
36
+		$labelO=$field->addLabel($label, $direction===Direction::LEFT, $icon);
37
+		$field->addToProperty("class", $direction." labeled");
38 38
 		return $labelO;
39 39
 	}
40 40
 
41 41
 	public function labeledToCorner($icon, $direction=Direction::LEFT) {
42
-		return $this->labeled("", $direction . " corner", $icon)->toCorner($direction);
42
+		return $this->labeled("", $direction." corner", $icon)->toCorner($direction);
43 43
 	}
44 44
 
45 45
 	public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) {
46 46
 		$field=$this->getField();
47 47
 		$actionO=$action;
48
-		if (\is_object($action) === false) {
49
-			$actionO=new HtmlButton("action-" . $this->identifier, $action);
48
+		if (\is_object($action)===false) {
49
+			$actionO=new HtmlButton("action-".$this->identifier, $action);
50 50
 			if (isset($icon))
51 51
 				$actionO->addIcon($icon, true, $labeled);
52 52
 		}
53
-		$field->addToProperty("class", $direction . " action");
54
-		$field->addContent($actionO, \strstr($direction, Direction::LEFT) !== false);
53
+		$field->addToProperty("class", $direction." action");
54
+		$field->addContent($actionO, \strstr($direction, Direction::LEFT)!==false);
55 55
 		return $actionO;
56 56
 	}
57 57
 
58
-	public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){
59
-		$labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items);
60
-		$labelO->asSelect("select-".$this->identifier,false,true);
61
-		return $this->labeled($labelO,$direction);
58
+	public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) {
59
+		$labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items);
60
+		$labelO->asSelect("select-".$this->identifier, false, true);
61
+		return $this->labeled($labelO, $direction);
62 62
 	}
63 63
 
64 64
 	public function setTransparent() {
65 65
 		return $this->getField()->addToProperty("class", "transparent");
66 66
 	}
67 67
 
68
-	public function setReadonly(){
68
+	public function setReadonly() {
69 69
 		$this->getDataField()->setProperty("readonly", "");
70 70
 		return $this;
71 71
 	}
72 72
 
73
-	public function setName($name){
74
-		$this->getDataField()->setProperty("name",$name);
73
+	public function setName($name) {
74
+		$this->getDataField()->setProperty("name", $name);
75 75
 		return $this;
76 76
 	}
77 77
 
78
-	public function setFluid(){
79
-		$this->getField()->addToProperty("class","fluid");
78
+	public function setFluid() {
79
+		$this->getField()->addToProperty("class", "fluid");
80 80
 		return $this;
81 81
 	}
82 82
 
83 83
 	public function setDisabled($disable=true) {
84 84
 		$field=$this->getField();
85
-		if($disable)
85
+		if ($disable)
86 86
 			$field->addToProperty("class", "disabled");
87 87
 		return $this;
88 88
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/traits/CheckboxTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 		return $this->getHtmlCk()->attachEvents($events);
39 39
 	}
40 40
 
41
-	public function getField(){
41
+	public function getField() {
42 42
 		//TODO check getField() ?
43 43
 		return $this->content["field"];
44 44
 	}
45 45
 
46
-	public function getHtmlCk(){
46
+	public function getHtmlCk() {
47 47
 		return $this->content["field"];
48 48
 	}
49 49
 
50
-	public function getDataField(){
51
-		$field= $this->getField();
52
-		if($field instanceof AbstractCheckbox)
50
+	public function getDataField() {
51
+		$field=$this->getField();
52
+		if ($field instanceof AbstractCheckbox)
53 53
 			$field=$field->getField();
54 54
 		return $field;
55 55
 	}
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 * @param boolean $value
60 60
 	 * @return HtmlFormField
61 61
 	 */
62
-	public function setChecked($value=true){
63
-		if($value===true){
62
+	public function setChecked($value=true) {
63
+		if ($value===true) {
64 64
 			$this->getDataField()->setProperty("checked", "checked");
65
-		}else{
65
+		} else {
66 66
 			$this->getDataField()->removeProperty("checked");
67 67
 		}
68 68
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormField.php 1 patch
Spacing   +36 added lines, -36 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,34 +116,34 @@  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;
142 142
 	}
143 143
 
144
-	public function addIcon($icon,$direction=Direction::LEFT){
144
+	public function addIcon($icon, $direction=Direction::LEFT) {
145 145
 		$field=$this->getField();
146
-		return $field->addIcon($icon,$direction);
146
+		return $field->addIcon($icon, $direction);
147 147
 	}
148 148
 
149 149
 	public function getValidation() {
Please login to merge, or discard this patch.