Completed
Push — master ( c6c18d...79b035 )
by Jean-Christophe
03:25
created
Ajax/semantic/html/base/constants/State.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 use Ajax\common\BaseEnum;
6 6
 
7 7
 abstract class State extends BaseEnum {
8
-	const ACTIVE="active",DISABLED="disabled",ERROR="error",FOCUS="focus",LOADING="loading",SUCCESS="success",WARNING="warning";
8
+	const ACTIVE="active", DISABLED="disabled", ERROR="error", FOCUS="focus", LOADING="loading", SUCCESS="success", WARNING="warning";
9 9
 }
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormRadio.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
  */
11 11
 class HtmlFormRadio extends AbstractHtmlFormRadioCheckbox {
12 12
 
13
-	public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) {
14
-		parent::__construct($identifier, $name,$label,$value);
13
+	public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL) {
14
+		parent::__construct($identifier, $name, $label, $value);
15 15
 		$this->_input->getField()->setProperty("type", "radio");
16 16
 		$this->_input->setClass("ui radio checkbox");
17
-		if(isset($name))
17
+		if (isset($name))
18 18
 			$this->_input->getField()->setProperty("name", $name);
19 19
 	}
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,8 @@
 block discarded – undo
14 14
 		parent::__construct($identifier, $name,$label,$value);
15 15
 		$this->_input->getField()->setProperty("type", "radio");
16 16
 		$this->_input->setClass("ui radio checkbox");
17
-		if(isset($name))
18
-			$this->_input->getField()->setProperty("name", $name);
17
+		if(isset($name)) {
18
+					$this->_input->getField()->setProperty("name", $name);
19
+		}
19 20
 	}
20 21
 }
21 22
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormCheckbox.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,14 +10,14 @@
 block discarded – undo
10 10
  * @version 1.001
11 11
  */
12 12
 class HtmlFormCheckbox extends AbstractHtmlFormRadioCheckbox {
13
-	public function __construct($identifier, $label=NULL,$value=NULL,$type=NULL) {
14
-		parent::__construct($identifier, NULL,$label,$value);
13
+	public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) {
14
+		parent::__construct($identifier, NULL, $label, $value);
15 15
 		$this->_input->setClass("ui checkbox");
16
-		if(isset($type))
16
+		if (isset($type))
17 17
 			$this->setType($type);
18 18
 	}
19 19
 
20
-	public function setType($checkboxType){
20
+	public function setType($checkboxType) {
21 21
 		return $this->_input->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants());
22 22
 	}
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormInput.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 class HtmlFormInput extends HtmlFormField {
8 8
 	use TextFieldsTrait;
9 9
 
10
-	public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) {
11
-		if(!isset($placeholder) && $type==="text")
10
+	public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
11
+		if (!isset($placeholder) && $type==="text")
12 12
 			$placeholder=$label;
13
-		parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label);
13
+		parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label);
14 14
 	}
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@
 block discarded – undo
8 8
 	use TextFieldsTrait;
9 9
 
10 10
 	public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) {
11
-		if(!isset($placeholder) && $type==="text")
12
-			$placeholder=$label;
11
+		if(!isset($placeholder) && $type==="text") {
12
+					$placeholder=$label;
13
+		}
13 14
 		parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label);
14 15
 	}
15 16
 }
16 17
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormField.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,26 +7,26 @@  discard block
 block discarded – undo
7 7
 use Ajax\semantic\html\base\constants\State;
8 8
 
9 9
 class HtmlFormField extends HtmlSemDoubleElement {
10
-	public function __construct($identifier, $field,$label=NULL) {
11
-		parent::__construct($identifier, "div","field");
10
+	public function __construct($identifier, $field, $label=NULL) {
11
+		parent::__construct($identifier, "div", "field");
12 12
 		$this->content=array();
13
-		$this->_states=[State::ERROR,State::DISABLED];
14
-		if(isset($label))
13
+		$this->_states=[State::ERROR, State::DISABLED];
14
+		if (isset($label))
15 15
 			$this->setLabel($label);
16 16
 		$this->setField($field);
17 17
 	}
18 18
 
19
-	public function setLabel($label){
19
+	public function setLabel($label) {
20 20
 		$labelO=$label;
21
-		if(\is_string($label)){
22
-			$labelO=new HtmlSemDoubleElement("","label");
21
+		if (\is_string($label)) {
22
+			$labelO=new HtmlSemDoubleElement("", "label");
23 23
 			$labelO->setContent($label);
24
-			$labelO->setProperty("for", \str_replace("field-", "",$this->identifier));
24
+			$labelO->setProperty("for", \str_replace("field-", "", $this->identifier));
25 25
 		}
26 26
 		$this->content["label"]=$labelO;
27 27
 	}
28 28
 
29
-	public function setField($field){
29
+	public function setField($field) {
30 30
 		$this->content["field"]=$field;
31 31
 	}
32 32
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * Returns the label or null
35 35
 	 * @return mixed
36 36
 	 */
37
-	public function getLabel(){
38
-		if(\array_key_exists("label", $this->content))
37
+	public function getLabel() {
38
+		if (\array_key_exists("label", $this->content))
39 39
 			return $this->content["label"];
40 40
 	}
41 41
 
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
 	 * Return the field
44 44
 	 * @return mixed
45 45
 	 */
46
-	public function getField(){
46
+	public function getField() {
47 47
 		return $this->content["field"];
48 48
 	}
49 49
 
50 50
 	/**
51 51
 	 * puts the label before or behind
52 52
 	 */
53
-	public function swapLabel(){
53
+	public function swapLabel() {
54 54
 		$label=$this->getLabel();
55 55
 		unset($this->content["label"]);
56 56
 		$this->content["label"]=$label;
@@ -61,23 +61,23 @@  discard block
 block discarded – undo
61 61
 	 * @param int $width
62 62
 	 * @return \Ajax\semantic\html\collections\form\HtmlFormField
63 63
 	 */
64
-	public function setWidth($width){
65
-		if(\is_int($width)){
64
+	public function setWidth($width) {
65
+		if (\is_int($width)) {
66 66
 			$width=Wide::getConstants()["W".$width];
67 67
 		}
68 68
 		$this->addToPropertyCtrl("class", $width, Wide::getConstants());
69
-		return $this->addToPropertyCtrl("class", "wide",array("wide"));
69
+		return $this->addToPropertyCtrl("class", "wide", array("wide"));
70 70
 	}
71 71
 
72 72
 	/**
73 73
 	 * Field displays an error state
74 74
 	 * @return \Ajax\semantic\html\collections\form\HtmlFormField
75 75
 	 */
76
-	public function setError(){
76
+	public function setError() {
77 77
 		return $this->addToProperty("class", "error");
78 78
 	}
79 79
 
80
-	public function jsState($state){
81
-		return $this->jsDoJquery("addClass",$state);
80
+	public function jsState($state) {
81
+		return $this->jsDoJquery("addClass", $state);
82 82
 	}
83 83
 }
84 84
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@  discard block
 block discarded – undo
13 13
  * @author jc
14 14
  * @version 1.001
15 15
  */
16
-class HtmlForm extends HtmlSemCollection{
16
+class HtmlForm extends HtmlSemCollection {
17 17
 
18 18
 	use FieldsTrait;
19 19
 
20 20
 	protected $_fields;
21 21
 
22
-	public function __construct( $identifier, $elements=array()){
23
-		parent::__construct( $identifier, "form", "ui form");
24
-		$this->_states=[State::ERROR,State::SUCCESS,State::WARNING,State::DISABLED];
22
+	public function __construct($identifier, $elements=array()) {
23
+		parent::__construct($identifier, "form", "ui form");
24
+		$this->_states=[State::ERROR, State::SUCCESS, State::WARNING, State::DISABLED];
25 25
 		$this->setProperty("name", $this->identifier);
26 26
 		$this->_fields=array();
27 27
 		$this->addItems($elements);
28 28
 	}
29 29
 
30
-	public function addHeader($title,$niveau=1,$dividing=true){
31
-		$header=new HtmlHeader("",$niveau,$title);
32
-		if($dividing)
30
+	public function addHeader($title, $niveau=1, $dividing=true) {
31
+		$header=new HtmlHeader("", $niveau, $title);
32
+		if ($dividing)
33 33
 			$header->setDividing();
34 34
 		return $this->addItem($header);
35 35
 	}
36 36
 
37
-	public function addFields($fields,$label=NULL){
38
-		if(!$fields instanceof HtmlFormFields){
39
-			if(\is_array($fields)===false){
40
-				$fields = \func_get_args();
37
+	public function addFields($fields, $label=NULL) {
38
+		if (!$fields instanceof HtmlFormFields) {
39
+			if (\is_array($fields)===false) {
40
+				$fields=\func_get_args();
41 41
 				$end=\end($fields);
42
-				if(\is_string($end)){
42
+				if (\is_string($end)) {
43 43
 					$label=$end;
44 44
 					\array_pop($fields);
45 45
 				}else $label=NULL;
46 46
 			}
47
-			$this->_fields=\array_merge($this->_fields,$fields);
48
-			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields);
47
+			$this->_fields=\array_merge($this->_fields, $fields);
48
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
49 49
 		}
50
-		if(isset($label))
51
-		 $fields=new HtmlFormField("", $fields,$label);
50
+		if (isset($label))
51
+		 $fields=new HtmlFormField("", $fields, $label);
52 52
 		$this->addItem($fields);
53 53
 		return $fields;
54 54
 	}
55 55
 
56
-	public function addItem($item){
56
+	public function addItem($item) {
57 57
 		$item=parent::addItem($item);
58
-		if(\is_subclass_of($item, HtmlFormField::class)===true){
58
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
59 59
 			$this->_fields[]=$item;
60 60
 		}
61 61
 		return $item;
62 62
 	}
63 63
 
64
-	public function getField($index){
65
-		if(\is_string($index)){
64
+	public function getField($index) {
65
+		if (\is_string($index)) {
66 66
 			$field=$this->getElementById($index, $this->_fields);
67
-		}else{
67
+		}else {
68 68
 			$field=$this->_fields[$index];
69 69
 		}
70 70
 		return $field;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * automatically divide fields to be equal width
75 75
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
76 76
 	 */
77
-	public function setEqualWidth(){
77
+	public function setEqualWidth() {
78 78
 		return $this->addToProperty("class", "equal width");
79 79
 	}
80 80
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * @param HtmlFormField $field
84 84
 	 * @return \Ajax\common\html\HtmlDoubleElement
85 85
 	 */
86
-	public function addField($field){
86
+	public function addField($field) {
87 87
 		return $this->addItem($field);
88 88
 	}
89 89
 
@@ -95,49 +95,49 @@  discard block
 block discarded – undo
95 95
 	 * @param string $type
96 96
 	 * @return \Ajax\semantic\html\collections\HtmlMessage
97 97
 	 */
98
-	public function addMessage($identifier,$content,$header=NULL,$icon=NULL,$type=NULL){
99
-		$message=new HtmlMessage($identifier,$content);
100
-		if(isset($header))
98
+	public function addMessage($identifier, $content, $header=NULL, $icon=NULL, $type=NULL) {
99
+		$message=new HtmlMessage($identifier, $content);
100
+		if (isset($header))
101 101
 			$message->addHeader($header);
102
-		if(isset($icon))
102
+		if (isset($icon))
103 103
 			$message->setIcon($icon);
104
-		if(isset($type))
104
+		if (isset($type))
105 105
 			$message->setStyle($type);
106 106
 		return $this->addItem($message);
107 107
 	}
108 108
 
109
-	public function addInputs($inputs,$fieldslabel=null){
109
+	public function addInputs($inputs, $fieldslabel=null) {
110 110
 		$fields=array();
111
-		foreach ($inputs as $input){
111
+		foreach ($inputs as $input) {
112 112
 			\extract($input);
113
-			$f=new HtmlFormInput("","");
113
+			$f=new HtmlFormInput("", "");
114 114
 			$f->fromArray($input);
115 115
 			$fields[]=$f;
116 116
 		}
117
-		return $this->addFields($fields,$fieldslabel);
117
+		return $this->addFields($fields, $fieldslabel);
118 118
 	}
119 119
 
120
-	public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){
121
-		return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple));
120
+	public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) {
121
+		return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple));
122 122
 	}
123 123
 
124
-	public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){
125
-		return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder));
124
+	public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) {
125
+		return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder));
126 126
 	}
127 127
 
128
-	public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){
129
-		return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick));
128
+	public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) {
129
+		return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick));
130 130
 	}
131 131
 
132
-	public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){
133
-		return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type));
132
+	public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) {
133
+		return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type));
134 134
 	}
135 135
 
136
-	public function setLoading(){
136
+	public function setLoading() {
137 137
 		return $this->addToProperty("class", "loading");
138 138
 	}
139 139
 
140
-	public function jsState($state){
141
-		return $this->jsDoJquery("addClass",$state);
140
+	public function jsState($state) {
141
+		return $this->jsDoJquery("addClass", $state);
142 142
 	}
143 143
 }
144 144
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function addHeader($title,$niveau=1,$dividing=true){
31 31
 		$header=new HtmlHeader("",$niveau,$title);
32
-		if($dividing)
33
-			$header->setDividing();
32
+		if($dividing) {
33
+					$header->setDividing();
34
+		}
34 35
 		return $this->addItem($header);
35 36
 	}
36 37
 
@@ -42,13 +43,16 @@  discard block
 block discarded – undo
42 43
 				if(\is_string($end)){
43 44
 					$label=$end;
44 45
 					\array_pop($fields);
45
-				}else $label=NULL;
46
+				} else {
47
+					$label=NULL;
48
+				}
46 49
 			}
47 50
 			$this->_fields=\array_merge($this->_fields,$fields);
48 51
 			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields);
49 52
 		}
50
-		if(isset($label))
51
-		 $fields=new HtmlFormField("", $fields,$label);
53
+		if(isset($label)) {
54
+				 $fields=new HtmlFormField("", $fields,$label);
55
+		}
52 56
 		$this->addItem($fields);
53 57
 		return $fields;
54 58
 	}
@@ -64,7 +68,7 @@  discard block
 block discarded – undo
64 68
 	public function getField($index){
65 69
 		if(\is_string($index)){
66 70
 			$field=$this->getElementById($index, $this->_fields);
67
-		}else{
71
+		} else{
68 72
 			$field=$this->_fields[$index];
69 73
 		}
70 74
 		return $field;
@@ -97,12 +101,15 @@  discard block
 block discarded – undo
97 101
 	 */
98 102
 	public function addMessage($identifier,$content,$header=NULL,$icon=NULL,$type=NULL){
99 103
 		$message=new HtmlMessage($identifier,$content);
100
-		if(isset($header))
101
-			$message->addHeader($header);
102
-		if(isset($icon))
103
-			$message->setIcon($icon);
104
-		if(isset($type))
105
-			$message->setStyle($type);
104
+		if(isset($header)) {
105
+					$message->addHeader($header);
106
+		}
107
+		if(isset($icon)) {
108
+					$message->setIcon($icon);
109
+		}
110
+		if(isset($type)) {
111
+					$message->setStyle($type);
112
+		}
106 113
 		return $this->addItem($message);
107 114
 	}
108 115
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/AbstractHtmlFormRadioCheckbox.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
 abstract class AbstractHtmlFormRadioCheckbox extends HtmlFormField {
12 12
 	protected $_input;
13 13
 
14
-	public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) {
15
-		$input=new HtmlFormInput($identifier,$label,"checkbox",$value);
14
+	public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL) {
15
+		$input=new HtmlFormInput($identifier, $label, "checkbox", $value);
16 16
 		parent::__construct("rField-".$identifier, $input);
17
-		if(isset($label)){
17
+		if (isset($label)) {
18 18
 			$input->swapLabel();
19 19
 			$label=$input->getLabel();
20 20
 			$label->setClass="hidden";
21
-			$label->setProperty("tabindex",0);
21
+			$label->setProperty("tabindex", 0);
22 22
 		}
23 23
 		$this->_input=$input;
24 24
 	}
Please login to merge, or discard this patch.