Completed
Push — master ( c0f044...c6c18d )
by Jean-Christophe
03:25
created
Ajax/semantic/html/collections/form/HtmlFormRadio.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
  */
12 12
 class HtmlFormRadio extends HtmlFormInput {
13 13
 
14
-	public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) {
14
+	public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL) {
15 15
 		parent::__construct($identifier, $label, "radio", $value=NULL);
16
-		if(isset($name))
16
+		if (isset($name))
17 17
 			$this->getField()->setProperty("name", $name);
18
-		if(isset($label)){
18
+		if (isset($label)) {
19 19
 			$this->swapLabel();
20 20
 			$label=$this->getLabel();
21 21
 			$label->setClass="hidden";
22
-			$label->setProperty("tabindex",0);
22
+			$label->setProperty("tabindex", 0);
23 23
 		}
24 24
 		$this->setClass("ui radio checkbox");
25
-		$this->wrap("<div class='field'>","</div>");
25
+		$this->wrap("<div class='field'>", "</div>");
26 26
 	}
27 27
 }
28 28
\ 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
@@ -13,8 +13,9 @@
 block discarded – undo
13 13
 
14 14
 	public function __construct($identifier, $name=NULL,$label=NULL,$value=NULL) {
15 15
 		parent::__construct($identifier, $label, "radio", $value=NULL);
16
-		if(isset($name))
17
-			$this->getField()->setProperty("name", $name);
16
+		if(isset($name)) {
17
+					$this->getField()->setProperty("name", $name);
18
+		}
18 19
 		if(isset($label)){
19 20
 			$this->swapLabel();
20 21
 			$label=$this->getLabel();
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlFormTextarea.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,17 +8,17 @@
 block discarded – undo
8 8
 class HtmlFormTextarea extends HtmlFormField {
9 9
 	use TextFieldsTrait;
10 10
 
11
-	public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) {
12
-		if(!isset($placeholder))
11
+	public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) {
12
+		if (!isset($placeholder))
13 13
 			$placeholder=$label;
14
-		parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label);
14
+		parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label);
15 15
 	}
16 16
 
17 17
 	/**
18 18
 	 * Defines the textarea row count
19 19
 	 * @param int $count
20 20
 	 */
21
-	public function setRows($count){
21
+	public function setRows($count) {
22 22
 		$this->getField()->setRows($count);
23 23
 	}
24 24
 }
25 25
\ 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
 class HtmlFormInput extends HtmlFormField {
9 9
 
10 10
 	public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) {
11
-		if(!isset($placeholder))
12
-			$placeholder=$label;
11
+		if(!isset($placeholder)) {
12
+					$placeholder=$label;
13
+		}
13 14
 		parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label);
14 15
 	}
15 16
 
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/TextFieldsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@
 block discarded – undo
3 3
 namespace Ajax\semantic\html\collections\form;
4 4
 
5 5
 trait TextFieldsTrait {
6
-	public function setPlaceholder($value){
6
+	public function setPlaceholder($value) {
7 7
 		return $this->getField()->setPlaceholder($value);
8 8
 	}
9 9
 
10
-	public function setValue($value){
10
+	public function setValue($value) {
11 11
 		return $this->getField()->setValue($value);
12 12
 	}
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/collections/form/HtmlForm.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -11,57 +11,57 @@  discard block
 block discarded – undo
11 11
  * @author jc
12 12
  * @version 1.001
13 13
  */
14
-class HtmlForm extends HtmlSemCollection{
14
+class HtmlForm extends HtmlSemCollection {
15 15
 
16 16
 	use FieldsTrait;
17 17
 
18 18
 	protected $_fields;
19 19
 
20
-	public function __construct( $identifier, $elements=array()){
21
-		parent::__construct( $identifier, "form", "ui form");
20
+	public function __construct($identifier, $elements=array()) {
21
+		parent::__construct($identifier, "form", "ui form");
22 22
 		$this->setProperty("name", $this->identifier);
23 23
 		$this->_fields=array();
24 24
 		$this->addItems($elements);
25 25
 	}
26 26
 
27
-	public function addHeader($title,$niveau=1,$dividing=true){
28
-		$header=new HtmlHeader("",$niveau,$title);
29
-		if($dividing)
27
+	public function addHeader($title, $niveau=1, $dividing=true) {
28
+		$header=new HtmlHeader("", $niveau, $title);
29
+		if ($dividing)
30 30
 			$header->setDividing();
31 31
 		return $this->addItem($header);
32 32
 	}
33 33
 
34
-	public function addFields($fields,$label=NULL){
35
-		if(!$fields instanceof HtmlFormFields){
36
-			if(\is_array($fields)===false){
37
-				$fields = \func_get_args();
34
+	public function addFields($fields, $label=NULL) {
35
+		if (!$fields instanceof HtmlFormFields) {
36
+			if (\is_array($fields)===false) {
37
+				$fields=\func_get_args();
38 38
 				$end=\end($fields);
39
-				if(\is_string($end)){
39
+				if (\is_string($end)) {
40 40
 					$label=$end;
41 41
 					\array_pop($fields);
42 42
 				}else $label=NULL;
43 43
 			}
44
-			$this->_fields=\array_merge($this->_fields,$fields);
45
-			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields);
44
+			$this->_fields=\array_merge($this->_fields, $fields);
45
+			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(), $fields);
46 46
 		}
47
-		if(isset($label))
48
-		 $fields=new HtmlFormField("", $fields,$label);
47
+		if (isset($label))
48
+		 $fields=new HtmlFormField("", $fields, $label);
49 49
 		$this->addItem($fields);
50 50
 		return $fields;
51 51
 	}
52 52
 
53
-	public function addItem($item){
53
+	public function addItem($item) {
54 54
 		$item=parent::addItem($item);
55
-		if(\is_subclass_of($item, HtmlFormField::class)===true){
55
+		if (\is_subclass_of($item, HtmlFormField::class)===true) {
56 56
 			$this->_fields[]=$item;
57 57
 		}
58 58
 		return $item;
59 59
 	}
60 60
 
61
-	public function getField($index){
62
-		if(\is_string($index)){
61
+	public function getField($index) {
62
+		if (\is_string($index)) {
63 63
 			$field=$this->getElementById($index, $this->_fields);
64
-		}else{
64
+		}else {
65 65
 			$field=$this->_fields[$index];
66 66
 		}
67 67
 		return $field;
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * automatically divide fields to be equal width
72 72
 	 * @return \Ajax\semantic\html\collections\form\HtmlForm
73 73
 	 */
74
-	public function setEqualWidth(){
74
+	public function setEqualWidth() {
75 75
 		return $this->addToProperty("class", "equal width");
76 76
 	}
77 77
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param HtmlFormField $field
81 81
 	 * @return \Ajax\common\html\HtmlDoubleElement
82 82
 	 */
83
-	public function addField($field){
83
+	public function addField($field) {
84 84
 		return $this->addItem($field);
85 85
 	}
86 86
 
@@ -91,23 +91,23 @@  discard block
 block discarded – undo
91 91
 	 * @param string $icon
92 92
 	 * @return \Ajax\semantic\html\collections\HtmlMessage
93 93
 	 */
94
-	public function addMessage($identifier,$content,$header=NULL,$icon=NULL){
95
-		$message=new HtmlMessage($identifier,$content);
96
-		if(isset($header))
94
+	public function addMessage($identifier, $content, $header=NULL, $icon=NULL) {
95
+		$message=new HtmlMessage($identifier, $content);
96
+		if (isset($header))
97 97
 			$message->addHeader($header);
98
-		if(isset($icon))
98
+		if (isset($icon))
99 99
 			$message->setIcon($icon);
100 100
 		return $this->addItem($message);
101 101
 	}
102 102
 
103
-	public function addInputs($inputs,$fieldslabel=null){
103
+	public function addInputs($inputs, $fieldslabel=null) {
104 104
 		$fields=array();
105
-		foreach ($inputs as $input){
105
+		foreach ($inputs as $input) {
106 106
 			\extract($input);
107
-			$f=new HtmlFormInput("","");
107
+			$f=new HtmlFormInput("", "");
108 108
 			$f->fromArray($input);
109 109
 			$fields[]=$f;
110 110
 		}
111
-		return $this->addFields($fields,$fieldslabel);
111
+		return $this->addFields($fields, $fieldslabel);
112 112
 	}
113 113
 }
114 114
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +16 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,8 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function addHeader($title,$niveau=1,$dividing=true){
28 28
 		$header=new HtmlHeader("",$niveau,$title);
29
-		if($dividing)
30
-			$header->setDividing();
29
+		if($dividing) {
30
+					$header->setDividing();
31
+		}
31 32
 		return $this->addItem($header);
32 33
 	}
33 34
 
@@ -39,13 +40,16 @@  discard block
 block discarded – undo
39 40
 				if(\is_string($end)){
40 41
 					$label=$end;
41 42
 					\array_pop($fields);
42
-				}else $label=NULL;
43
+				} else {
44
+					$label=NULL;
45
+				}
43 46
 			}
44 47
 			$this->_fields=\array_merge($this->_fields,$fields);
45 48
 			$fields=new HtmlFormFields("fields-".$this->identifier."-".$this->count(),$fields);
46 49
 		}
47
-		if(isset($label))
48
-		 $fields=new HtmlFormField("", $fields,$label);
50
+		if(isset($label)) {
51
+				 $fields=new HtmlFormField("", $fields,$label);
52
+		}
49 53
 		$this->addItem($fields);
50 54
 		return $fields;
51 55
 	}
@@ -61,7 +65,7 @@  discard block
 block discarded – undo
61 65
 	public function getField($index){
62 66
 		if(\is_string($index)){
63 67
 			$field=$this->getElementById($index, $this->_fields);
64
-		}else{
68
+		} else{
65 69
 			$field=$this->_fields[$index];
66 70
 		}
67 71
 		return $field;
@@ -93,10 +97,12 @@  discard block
 block discarded – undo
93 97
 	 */
94 98
 	public function addMessage($identifier,$content,$header=NULL,$icon=NULL){
95 99
 		$message=new HtmlMessage($identifier,$content);
96
-		if(isset($header))
97
-			$message->addHeader($header);
98
-		if(isset($icon))
99
-			$message->setIcon($icon);
100
+		if(isset($header)) {
101
+					$message->addHeader($header);
102
+		}
103
+		if(isset($icon)) {
104
+					$message->setIcon($icon);
105
+		}
100 106
 		return $this->addItem($message);
101 107
 	}
102 108
 
Please login to merge, or discard this patch.