Completed
Push — master ( e53430...e06bda )
by Jean-Christophe
03:13
created
Ajax/semantic/html/collections/form/HtmlFormField.php 1 patch
Spacing   +37 added lines, -37 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) && $label!=="")
20
+		$this->_states=[State::ERROR, State::DISABLED];
21
+		if (isset($label) && $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,39 +116,39 @@  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 setRules(array $rules){
144
+	public function setRules(array $rules) {
145 145
 		$this->_validation=null;
146 146
 		return $this->addRules($rules);
147 147
 	}
148 148
 
149
-	public function addIcon($icon,$direction=Direction::LEFT){
149
+	public function addIcon($icon, $direction=Direction::LEFT) {
150 150
 		$field=$this->getField();
151
-		return $field->addIcon($icon,$direction);
151
+		return $field->addIcon($icon, $direction);
152 152
 	}
153 153
 
154 154
 	public function getValidation() {
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/HtmlMessage.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -30,42 +30,42 @@  discard block
 block discarded – undo
30 30
 	 * @param string|HtmlSemDoubleElement $header
31 31
 	 * @return \Ajax\semantic\html\collections\HtmlMessage
32 32
 	 */
33
-	public function addHeader($header){
33
+	public function addHeader($header) {
34 34
 		$headerO=$header;
35
-		if(\is_string($header)){
36
-			$headerO=new HtmlSemDoubleElement("header-".$this->identifier,"div");
35
+		if (\is_string($header)) {
36
+			$headerO=new HtmlSemDoubleElement("header-".$this->identifier, "div");
37 37
 			$headerO->setClass("header");
38 38
 			$headerO->setContent($header);
39 39
 		}
40
-		return $this->addContent($headerO,true);
40
+		return $this->addContent($headerO, true);
41 41
 	}
42 42
 
43
-	public function setHeader($header){
43
+	public function setHeader($header) {
44 44
 		return $this->addHeader($header);
45 45
 	}
46 46
 
47
-	public function addList($elements,$ordered=false){
48
-		$list=new HtmlList("list-".$this->identifier,$elements);
47
+	public function addList($elements, $ordered=false) {
48
+		$list=new HtmlList("list-".$this->identifier, $elements);
49 49
 		$list->setOrdered($ordered);
50 50
 		$list->setClass("ui list");
51 51
 		$this->addContent($list);
52 52
 	}
53 53
 
54
-	public function setIcon($icon){
54
+	public function setIcon($icon) {
55 55
 		$this->addToProperty("class", "icon");
56
-		$this->wrapContent("<div class='content'>","</div>");
56
+		$this->wrapContent("<div class='content'>", "</div>");
57 57
 		$this->icon=new HtmlIcon("icon-".$this->identifier, $icon);
58 58
 		return $this;
59 59
 	}
60 60
 
61
-	public function addLoader($loaderIcon="notched circle"){
61
+	public function addLoader($loaderIcon="notched circle") {
62 62
 		$this->setIcon($loaderIcon);
63 63
 		$this->icon->addToIcon("loading");
64 64
 		return $this;
65 65
 	}
66 66
 
67
-	public function setDismissable($dismiss=true){
68
-		if($dismiss===true)
67
+	public function setDismissable($dismiss=true) {
68
+		if ($dismiss===true)
69 69
 			$this->close=new HtmlIcon("close-".$this->identifier, "close");
70 70
 		else
71 71
 			$this->close=NULL;
@@ -76,38 +76,38 @@  discard block
 block discarded – undo
76 76
 	 * {@inheritDoc}
77 77
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run()
78 78
 	 */
79
-	public function run(JsUtils $js){
79
+	public function run(JsUtils $js) {
80 80
 		parent::run($js);
81
-		if(isset($this->close)){
81
+		if (isset($this->close)) {
82 82
 			$js->execOn("click", "#".$this->identifier." .close", "$(this).closest('.message').transition('fade')");
83 83
 		}
84 84
 	}
85 85
 
86
-	public function setState($visible=true){
87
-		$visible=($visible===true)?"visible":"hidden";
88
-		return $this->addToPropertyCtrl("class", $visible, array("visible","hidden"));
86
+	public function setState($visible=true) {
87
+		$visible=($visible===true) ? "visible" : "hidden";
88
+		return $this->addToPropertyCtrl("class", $visible, array("visible", "hidden"));
89 89
 	}
90 90
 
91
-	public function setVariation($value="floating"){
92
-		return $this->addToPropertyCtrl("class", $value, array("floating","compact"));
91
+	public function setVariation($value="floating") {
92
+		return $this->addToPropertyCtrl("class", $value, array("floating", "compact"));
93 93
 	}
94 94
 
95
-	public function setStyle($style){
95
+	public function setStyle($style) {
96 96
 		return $this->addToPropertyCtrl("class", $style, Style::getConstants());
97 97
 	}
98 98
 
99
-	public function setError(){
99
+	public function setError() {
100 100
 		return $this->setStyle("error");
101 101
 	}
102 102
 
103
-	public function setWarning(){
103
+	public function setWarning() {
104 104
 		return $this->setStyle("warning");
105 105
 	}
106 106
 
107
-	public function setMessage($message){
108
-		if(\is_array($this->content)){
107
+	public function setMessage($message) {
108
+		if (\is_array($this->content)) {
109 109
 			$this->content[\sizeof($this->content)-1]=$message;
110
-		}else
110
+		} else
111 111
 			$this->setContent($message);
112 112
 	}
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/base/FieldAsTrait.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -25,23 +25,23 @@  discard block
 block discarded – undo
25 25
  * @property boolean $_edition
26 26
  * @property mixed _modelInstance
27 27
  */
28
-trait FieldAsTrait{
28
+trait FieldAsTrait {
29 29
 
30
-	abstract protected function _getFieldIdentifier($prefix,$name="");
31
-	abstract public function setValueFunction($index,$callback);
30
+	abstract protected function _getFieldIdentifier($prefix, $name="");
31
+	abstract public function setValueFunction($index, $callback);
32 32
 	abstract protected function _getFieldName($index);
33 33
 	abstract protected function _getFieldCaption($index);
34
-	abstract protected function _buttonAsSubmit(HtmlButton &$button,$event,$url,$responseElement=NULL,$parameters=NULL);
34
+	abstract protected function _buttonAsSubmit(HtmlButton&$button, $event, $url, $responseElement=NULL, $parameters=NULL);
35 35
 
36 36
 	/**
37 37
 	 * @param HtmlFormField $element
38 38
 	 * @param array $attributes
39 39
 	 */
40
-	protected function _applyAttributes($element,&$attributes,$index){
41
-		if(isset($attributes["callback"])){
40
+	protected function _applyAttributes($element, &$attributes, $index) {
41
+		if (isset($attributes["callback"])) {
42 42
 			$callback=$attributes["callback"];
43
-			if(\is_callable($callback)){
44
-				$callback($element,$this->_modelInstance,$index);
43
+			if (\is_callable($callback)) {
44
+				$callback($element, $this->_modelInstance, $index);
45 45
 				unset($attributes["callback"]);
46 46
 			}
47 47
 		}
@@ -51,43 +51,43 @@  discard block
 block discarded – undo
51 51
 		$element->fromArray($attributes);
52 52
 	}
53 53
 
54
-	private function _getLabelField($caption,$icon=NULL){
55
-		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"),$caption,$icon);
54
+	private function _getLabelField($caption, $icon=NULL) {
55
+		$label=new HtmlLabel($this->_getFieldIdentifier("lbl"), $caption, $icon);
56 56
 		return $label;
57 57
 	}
58 58
 
59 59
 
60
-	protected function _addRules($element,&$attributes){
61
-		if(isset($attributes["rules"])){
60
+	protected function _addRules($element, &$attributes) {
61
+		if (isset($attributes["rules"])) {
62 62
 			$rules=$attributes["rules"];
63
-			if(\is_array($rules)){
63
+			if (\is_array($rules)) {
64 64
 				$element->addRules($rules);
65 65
 			}
66
-			else{
66
+			else {
67 67
 				$element->addRule($rules);
68 68
 			}
69 69
 			unset($attributes["rules"]);
70 70
 		}
71 71
 	}
72 72
 
73
-	protected function _prepareFormFields(&$field,$name,&$attributes){
73
+	protected function _prepareFormFields(&$field, $name, &$attributes) {
74 74
 		$field->setName($name);
75 75
 		$this->_addRules($field, $attributes);
76 76
 		return $field;
77 77
 	}
78 78
 
79
-	protected function _fieldAs($elementCallback,&$index,$attributes=NULL,$prefix=null){
80
-		$this->setValueFunction($index,function($value,$instance,$index) use (&$attributes,$elementCallback,$prefix){
79
+	protected function _fieldAs($elementCallback, &$index, $attributes=NULL, $prefix=null) {
80
+		$this->setValueFunction($index, function($value, $instance, $index) use (&$attributes, $elementCallback, $prefix){
81 81
 			$caption=$this->_getFieldCaption($index);
82 82
 			$name=$this->_getFieldName($index);
83
-			$id=$this->_getFieldIdentifier($prefix,$name);
84
-			if(isset($attributes["name"])){
83
+			$id=$this->_getFieldIdentifier($prefix, $name);
84
+			if (isset($attributes["name"])) {
85 85
 				$name=$attributes["name"];
86 86
 				unset($attributes["name"]);
87 87
 			}
88
-			$element=$elementCallback($id,$name,$value,$caption);
89
-			if(\is_array($attributes)){
90
-				$this->_applyAttributes($element, $attributes,$index);
88
+			$element=$elementCallback($id, $name, $value, $caption);
89
+			if (\is_array($attributes)) {
90
+				$this->_applyAttributes($element, $attributes, $index);
91 91
 			}
92 92
 			$element->setDisabled(!$this->_edition);
93 93
 			return $element;
@@ -96,169 +96,169 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 
99
-	public function fieldAsProgress($index,$label=NULL, $attributes=array()){
100
-		$this->setValueFunction($index,function($value) use($label,$attributes){
101
-			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"),$value,$label,$attributes);
99
+	public function fieldAsProgress($index, $label=NULL, $attributes=array()) {
100
+		$this->setValueFunction($index, function($value) use($label, $attributes){
101
+			$pb=new HtmlProgress($this->_getFieldIdentifier("pb"), $value, $label, $attributes);
102 102
 			return $pb;
103 103
 		});
104 104
 			return $this;
105 105
 	}
106 106
 
107
-	public function fieldAsRating($index,$max=5, $icon=""){
108
-		$this->setValueFunction($index,function($value) use($max,$icon){
109
-			$rating=new HtmlRating($this->_getFieldIdentifier("rat"),$value,$max,$icon);
107
+	public function fieldAsRating($index, $max=5, $icon="") {
108
+		$this->setValueFunction($index, function($value) use($max, $icon){
109
+			$rating=new HtmlRating($this->_getFieldIdentifier("rat"), $value, $max, $icon);
110 110
 			return $rating;
111 111
 		});
112 112
 			return $this;
113 113
 	}
114 114
 
115
-	public function fieldAsLabel($index,$icon=NULL){
116
-		$this->setValueFunction($index,function($caption) use($icon){
117
-			$lbl=$this->_getLabelField($caption,$icon);
115
+	public function fieldAsLabel($index, $icon=NULL) {
116
+		$this->setValueFunction($index, function($caption) use($icon){
117
+			$lbl=$this->_getLabelField($caption, $icon);
118 118
 			return $lbl;
119 119
 		});
120 120
 			return $this;
121 121
 	}
122 122
 
123
-	public function fieldAsHeader($index,$niveau=1,$icon=NULL,$attributes=NULL){
124
-		return $this->_fieldAs(function($id,$name,$value) use($niveau,$icon){
125
-			$header=new HtmlHeader($id,$niveau,$value);
126
-			if(isset($icon))
123
+	public function fieldAsHeader($index, $niveau=1, $icon=NULL, $attributes=NULL) {
124
+		return $this->_fieldAs(function($id, $name, $value) use($niveau, $icon){
125
+			$header=new HtmlHeader($id, $niveau, $value);
126
+			if (isset($icon))
127 127
 				$header->asIcon($icon, $value);
128 128
 			return $header;
129
-		}, $index,$attributes,"header");
129
+		}, $index, $attributes, "header");
130 130
 	}
131 131
 
132 132
 
133
-	public function fieldAsImage($index,$size=Size::MINI,$circular=false){
134
-		$this->setValueFunction($index,function($img) use($size,$circular){
135
-			$image=new HtmlImage($this->_getFieldIdentifier("image"),$img);$image->setSize($size);if($circular)$image->setCircular();
133
+	public function fieldAsImage($index, $size=Size::MINI, $circular=false) {
134
+		$this->setValueFunction($index, function($img) use($size, $circular){
135
+			$image=new HtmlImage($this->_getFieldIdentifier("image"), $img); $image->setSize($size); if ($circular)$image->setCircular();
136 136
 			return $image;
137 137
 		});
138 138
 			return $this;
139 139
 	}
140 140
 
141
-	public function fieldAsAvatar($index,$attributes=NULL){
142
-		return $this->_fieldAs(function($id,$name,$value){
143
-			$img=new HtmlImage($id,$value);
141
+	public function fieldAsAvatar($index, $attributes=NULL) {
142
+		return $this->_fieldAs(function($id, $name, $value) {
143
+			$img=new HtmlImage($id, $value);
144 144
 			$img->asAvatar();
145 145
 			return $img;
146
-		}, $index,$attributes,"avatar");
146
+		}, $index, $attributes, "avatar");
147 147
 	}
148 148
 
149
-	public function fieldAsRadio($index,$attributes=NULL){
150
-		return $this->_fieldAs(function($id,$name,$value){
151
-			$input= new HtmlRadio($id,$name,$value,$value);
149
+	public function fieldAsRadio($index, $attributes=NULL) {
150
+		return $this->_fieldAs(function($id, $name, $value) {
151
+			$input=new HtmlRadio($id, $name, $value, $value);
152 152
 			return $input;
153
-		}, $index,$attributes,"radio");
153
+		}, $index, $attributes, "radio");
154 154
 	}
155 155
 
156
-	public function fieldAsRadios($index,$elements=[],$attributes=NULL){
157
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($elements){
158
-			return HtmlFormFields::radios($name,$elements,$caption,$value);
159
-		}, $index,$attributes,"radios");
156
+	public function fieldAsRadios($index, $elements=[], $attributes=NULL) {
157
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($elements){
158
+			return HtmlFormFields::radios($name, $elements, $caption, $value);
159
+		}, $index, $attributes, "radios");
160 160
 	}
161 161
 
162
-	public function fieldAsInput($index,$attributes=NULL){
163
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($attributes){
164
-			$input= new HtmlFormInput($id,$caption,"text",$value);
162
+	public function fieldAsInput($index, $attributes=NULL) {
163
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($attributes){
164
+			$input=new HtmlFormInput($id, $caption, "text", $value);
165 165
 			return $this->_prepareFormFields($input, $name, $attributes);
166
-		}, $index,$attributes,"input");
166
+		}, $index, $attributes, "input");
167 167
 	}
168 168
 
169
-	public function fieldAsTextarea($index,$attributes=NULL){
170
-		return $this->_fieldAs(function($id,$name,$value,$caption){
171
-			$textarea=new HtmlFormTextarea($id,$caption,$value);
169
+	public function fieldAsTextarea($index, $attributes=NULL) {
170
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
171
+			$textarea=new HtmlFormTextarea($id, $caption, $value);
172 172
 			$textarea->setName($name);
173 173
 			return $textarea;
174
-		}, $index,$attributes,"textarea");
174
+		}, $index, $attributes, "textarea");
175 175
 	}
176 176
 
177
-	public function fieldAsHidden($index,$attributes=NULL){
178
-		if(!\is_array($attributes)){
177
+	public function fieldAsHidden($index, $attributes=NULL) {
178
+		if (!\is_array($attributes)) {
179 179
 			$attributes=[];
180 180
 		}
181 181
 		$attributes["imputType"]="hidden";
182
-		return $this->fieldAsInput($index,$attributes);
182
+		return $this->fieldAsInput($index, $attributes);
183 183
 	}
184 184
 
185
-	public function fieldAsCheckbox($index,$attributes=NULL){
186
-		return $this->_fieldAs(function($id,$name,$value,$caption){
187
-			$input=new HtmlFormCheckbox($id,$caption,$this->_instanceViewer->getIdentifier());
185
+	public function fieldAsCheckbox($index, $attributes=NULL) {
186
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
187
+			$input=new HtmlFormCheckbox($id, $caption, $this->_instanceViewer->getIdentifier());
188 188
 			$input->setChecked(JString::isBooleanTrue($value));
189 189
 			$input->setName($name);
190 190
 			return $input;
191
-		}, $index,$attributes,"ck");
191
+		}, $index, $attributes, "ck");
192 192
 	}
193 193
 
194
-	public function fieldAsDropDown($index,$elements=[],$multiple=false,$attributes=NULL){
195
-		return $this->_fieldAs(function($id,$name,$value,$caption) use($elements,$multiple){
196
-			$dd=new HtmlFormDropdown($id,$elements,$caption,$value);
197
-			$dd->asSelect($name,$multiple);
194
+	public function fieldAsDropDown($index, $elements=[], $multiple=false, $attributes=NULL) {
195
+		return $this->_fieldAs(function($id, $name, $value, $caption) use($elements, $multiple){
196
+			$dd=new HtmlFormDropdown($id, $elements, $caption, $value);
197
+			$dd->asSelect($name, $multiple);
198 198
 			return $dd;
199
-		}, $index,$attributes,"dd");
199
+		}, $index, $attributes, "dd");
200 200
 	}
201 201
 
202
-	public function fieldAsMessage($index,$attributes=NULL){
203
-		return $this->_fieldAs(function($id,$name,$value,$caption){
204
-			$mess= new HtmlMessage("message-".$id,$caption);
202
+	public function fieldAsMessage($index, $attributes=NULL) {
203
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
204
+			$mess=new HtmlMessage("message-".$id, $caption);
205 205
 			$mess->addHeader($value);
206 206
 			return $mess;
207
-		}, $index,$attributes,"message");
207
+		}, $index, $attributes, "message");
208 208
 	}
209 209
 
210
-	public function fieldAsLink($index,$attributes=NULL){
211
-		return $this->_fieldAs(function($id,$name,$value,$caption){
212
-			$lnk= new HtmlLink("message-".$id,"#",$caption);
210
+	public function fieldAsLink($index, $attributes=NULL) {
211
+		return $this->_fieldAs(function($id, $name, $value, $caption) {
212
+			$lnk=new HtmlLink("message-".$id, "#", $caption);
213 213
 			return $lnk;
214
-		}, $index,$attributes,"link");
214
+		}, $index, $attributes, "link");
215 215
 	}
216 216
 
217 217
 	/**Change fields type
218 218
 	 * @param array $types an array or associative array $type=>$attributes
219 219
 	 */
220
-	public function fieldsAs(array $types){
220
+	public function fieldsAs(array $types) {
221 221
 		$i=0;
222
-		if(JArray::isAssociative($types)){
223
-			foreach ($types as $type=>$attributes){
224
-				if(\is_int($type))
225
-					$this->fieldAs($i++,$attributes,[]);
226
-				else{
227
-					$type=preg_replace('/\d/', '', $type );
228
-					$this->fieldAs($i++,$type,$attributes);
222
+		if (JArray::isAssociative($types)) {
223
+			foreach ($types as $type=>$attributes) {
224
+				if (\is_int($type))
225
+					$this->fieldAs($i++, $attributes, []);
226
+				else {
227
+					$type=preg_replace('/\d/', '', $type);
228
+					$this->fieldAs($i++, $type, $attributes);
229 229
 				}
230 230
 			}
231
-		}else{
232
-			foreach ($types as $type){
233
-				$this->fieldAs($i++,$type);
231
+		} else {
232
+			foreach ($types as $type) {
233
+				$this->fieldAs($i++, $type);
234 234
 			}
235 235
 		}
236 236
 	}
237 237
 
238
-	public function fieldAs($index,$type,$attributes=NULL){
238
+	public function fieldAs($index, $type, $attributes=NULL) {
239 239
 		$method="fieldAs".\ucfirst($type);
240
-		if(\method_exists($this, $method)){
241
-			if(!\is_array($attributes)){
240
+		if (\method_exists($this, $method)) {
241
+			if (!\is_array($attributes)) {
242 242
 				$attributes=[$index];
243
-			}else{
243
+			} else {
244 244
 				\array_unshift($attributes, $index);
245 245
 			}
246
-			\call_user_func_array([$this,$method], $attributes);
246
+			\call_user_func_array([$this, $method], $attributes);
247 247
 		}
248 248
 	}
249 249
 
250
-	public function fieldAsSubmit($index,$cssStyle=NULL,$url=NULL,$responseElement=NULL,$attributes=NULL){
251
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($url,$responseElement,$cssStyle,$attributes){
252
-			$button=new HtmlButton($id,$caption,$cssStyle);
253
-			$this->_buttonAsSubmit($button,"click",$url,$responseElement,@$attributes["ajax"]);
250
+	public function fieldAsSubmit($index, $cssStyle=NULL, $url=NULL, $responseElement=NULL, $attributes=NULL) {
251
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($url, $responseElement, $cssStyle, $attributes){
252
+			$button=new HtmlButton($id, $caption, $cssStyle);
253
+			$this->_buttonAsSubmit($button, "click", $url, $responseElement, @$attributes["ajax"]);
254 254
 			return $button;
255
-		}, $index,$attributes,"submit");
255
+		}, $index, $attributes, "submit");
256 256
 	}
257 257
 
258
-	public function fieldAsButton($index,$cssStyle=NULL,$attributes=NULL){
259
-		return $this->_fieldAs(function($id,$name,$value,$caption) use ($cssStyle){
260
-			$button=new HtmlButton($id,$value,$cssStyle);
258
+	public function fieldAsButton($index, $cssStyle=NULL, $attributes=NULL) {
259
+		return $this->_fieldAs(function($id, $name, $value, $caption) use ($cssStyle){
260
+			$button=new HtmlButton($id, $value, $cssStyle);
261 261
 			return $button;
262
-		}, $index,$attributes,"button");
262
+		}, $index, $attributes, "button");
263 263
 	}
264 264
 }
265 265
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/widgets/business/user/FormLogin.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -13,41 +13,41 @@
 block discarded – undo
13 13
 	 * @param string $identifier
14 14
 	 * @param object $modelInstance
15 15
 	 */
16
-	public function __construct($identifier,$modelInstance=null,$fieldsOrder=[],$fieldsDefinition=[],$fields=[],$captions=[],$separators=[]) {
17
-		parent::__construct($identifier,$modelInstance,$fieldsOrder,$fieldsDefinition,$fields,$captions,$separators);
16
+	public function __construct($identifier, $modelInstance=null, $fieldsOrder=[], $fieldsDefinition=[], $fields=[], $captions=[], $separators=[]) {
17
+		parent::__construct($identifier, $modelInstance, $fieldsOrder, $fieldsDefinition, $fields, $captions, $separators);
18 18
 	}
19 19
 
20
-	protected function getDefaultModelInstance(){
20
+	protected function getDefaultModelInstance() {
21 21
 		return new UserModel();
22 22
 	}
23 23
 
24
-	public static function regular($identifier,$modelInstance=null){
25
-		return new FormLogin($identifier,$modelInstance,
26
-				["message","login","password","remember","forget","submit"],
27
-				["message"=>["icon"=>"sign in"],"input0"=>["rules"=>"empty"],"input1"=>["inputType"=>"password","rules"=>"empty"],"checkbox","link","submit"=>"green fluid"],
28
-				["Connection","login","password","remember","forget","submit"],
29
-				["Please enter login and password to connect","Login","Password","Remember me.","Forgot your password?","Connection"],
30
-				[0,2,4,5]);
24
+	public static function regular($identifier, $modelInstance=null) {
25
+		return new FormLogin($identifier, $modelInstance,
26
+				["message", "login", "password", "remember", "forget", "submit"],
27
+				["message"=>["icon"=>"sign in"], "input0"=>["rules"=>"empty"], "input1"=>["inputType"=>"password", "rules"=>"empty"], "checkbox", "link", "submit"=>"green fluid"],
28
+				["Connection", "login", "password", "remember", "forget", "submit"],
29
+				["Please enter login and password to connect", "Login", "Password", "Remember me.", "Forgot your password?", "Connection"],
30
+				[0, 2, 4, 5]);
31 31
 	}
32 32
 
33
-	public static function smallInline($identifier,$modelInstance=null){
34
-		$result=new FormLogin($identifier,$modelInstance,
35
-				["login","password","submit"],
36
-				["input0"=>["rules"=>"empty"],"input1"=>["inputType"=>"password","rules"=>"empty"],"submit"=>"green basic"],
37
-				["login","password","submit"],
38
-				["","","Connection"],
33
+	public static function smallInline($identifier, $modelInstance=null) {
34
+		$result=new FormLogin($identifier, $modelInstance,
35
+				["login", "password", "submit"],
36
+				["input0"=>["rules"=>"empty"], "input1"=>["inputType"=>"password", "rules"=>"empty"], "submit"=>"green basic"],
37
+				["login", "password", "submit"],
38
+				["", "", "Connection"],
39 39
 				[2]);
40 40
 			$result->addDividerBefore(0, "Connection");
41 41
 		return $result;
42 42
 	}
43 43
 
44
-	public static function small($identifier,$modelInstance=null){
45
-		$result=new FormLogin($identifier,$modelInstance,
46
-				["login","password","submit"],
47
-				["input0"=>["rules"=>"empty"],"input1"=>["inputType"=>"password","rules"=>"empty"],"submit"=>"green basic"],
48
-				["login","password","submit"],
49
-				["Login","Password","Connection"],
50
-				[1,2]);
44
+	public static function small($identifier, $modelInstance=null) {
45
+		$result=new FormLogin($identifier, $modelInstance,
46
+				["login", "password", "submit"],
47
+				["input0"=>["rules"=>"empty"], "input1"=>["inputType"=>"password", "rules"=>"empty"], "submit"=>"green basic"],
48
+				["login", "password", "submit"],
49
+				["Login", "Password", "Connection"],
50
+				[1, 2]);
51 51
 		$result->addDividerBefore(0, "Connection");
52 52
 		return $result;
53 53
 	}
Please login to merge, or discard this patch.
Ajax/semantic/traits/SemanticWidgetsTrait.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	 * @param array $instances
17 17
 	 * @return DataTable
18 18
 	 */
19
-	public function dataTable($identifier,$model, $instances){
20
-		return $this->addHtmlComponent(new DataTable($identifier,$model,$instances));
19
+	public function dataTable($identifier, $model, $instances) {
20
+		return $this->addHtmlComponent(new DataTable($identifier, $model, $instances));
21 21
 	}
22 22
 
23 23
 	/**
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 	 * @param object $instance
26 26
 	 * @return DataElement
27 27
 	 */
28
-	public function dataElement($identifier, $instance){
29
-		return $this->addHtmlComponent(new DataElement($identifier,$instance));
28
+	public function dataElement($identifier, $instance) {
29
+		return $this->addHtmlComponent(new DataElement($identifier, $instance));
30 30
 	}
31 31
 
32 32
 	/**
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 	 * @param object $instance
35 35
 	 * @return DataForm
36 36
 	 */
37
-	public function dataForm($identifier, $instance){
38
-		return $this->addHtmlComponent(new DataForm($identifier,$instance));
37
+	public function dataForm($identifier, $instance) {
38
+		return $this->addHtmlComponent(new DataForm($identifier, $instance));
39 39
 	}
40 40
 
41
-	public function defaultLogin($identifier,$instance=null){
42
-		return $this->addHtmlComponent(FormLogin::regular($identifier,$instance));
41
+	public function defaultLogin($identifier, $instance=null) {
42
+		return $this->addHtmlComponent(FormLogin::regular($identifier, $instance));
43 43
 	}
44 44
 
45
-	public function smallLogin($identifier,$instance=null){
46
-		return $this->addHtmlComponent(FormLogin::small($identifier,$instance));
45
+	public function smallLogin($identifier, $instance=null) {
46
+		return $this->addHtmlComponent(FormLogin::small($identifier, $instance));
47 47
 	}
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.