Completed
Push — master ( 2bc7fe...701cf4 )
by Jean-Christophe
03:09
created
Ajax/semantic/html/modules/HtmlSearch.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 use Ajax\semantic\html\base\constants\Direction;
9 9
 
10 10
 class HtmlSearch extends HtmlSemDoubleElement {
11
-	private $_elements=array ();
12
-	private $_searchFields=array ("title" );
11
+	private $_elements=array();
12
+	private $_searchFields=array("title");
13 13
 	private $_local=false;
14 14
 
15 15
 	public function __construct($identifier, $placeholder=NULL, $icon=NULL) {
16
-		parent::__construct("search-" . $identifier, "div", "ui search", array ());
16
+		parent::__construct("search-".$identifier, "div", "ui search", array());
17 17
 		$this->createField($placeholder, $icon);
18 18
 		$this->createResult();
19 19
 		$this->_params["type"]="standard";
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	private function createResult() {
35
-		$this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results");
35
+		$this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results");
36 36
 		return $this->content["result"];
37 37
 	}
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	}
50 50
 
51 51
 	public function setUrl($url) {
52
-		$this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%";
52
+		$this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%";
53 53
 		return $this;
54 54
 	}
55 55
 
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
 	}
73 73
 
74 74
 	public function run(JsUtils $js) {
75
-		$this->_params["onSelect"]='%function(result,response){$(%quote%#' . $this->identifier . '%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%';
75
+		$this->_params["onSelect"]='%function(result,response){$(%quote%#'.$this->identifier.'%quote%).trigger(%quote%onSelect%quote%, {%quote%result%quote%: result, %quote%response%quote%:response} );}%';
76 76
 		$searchFields=\json_encode($this->_searchFields);
77 77
 		$searchFields=str_ireplace("\"", "%quote%", $searchFields);
78
-		$this->_params["searchFields"]="%" . $searchFields . "%";
79
-		if ($this->_local === true) {
78
+		$this->_params["searchFields"]="%".$searchFields."%";
79
+		if ($this->_local===true) {
80 80
 			$this->_params["source"]="%content%";
81
-			$this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
81
+			$this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";");
82 82
 		}
83
-		if (isset($this->_bsComponent) === false) {
84
-			$this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params);
83
+		if (isset($this->_bsComponent)===false) {
84
+			$this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params);
85 85
 		}
86 86
 		$this->addEventsOnRun($js);
87 87
 		return $this->_bsComponent;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,10 +21,12 @@
 block discarded – undo
21 21
 
22 22
 	private function createField($placeholder=NULL, $icon=NULL) {
23 23
 		$field=new HtmlInput($this->identifier);
24
-		if (isset($placeholder))
25
-			$field->setPlaceholder($placeholder);
26
-		if (isset($icon))
27
-			$field->addIcon($icon, Direction::RIGHT);
24
+		if (isset($placeholder)) {
25
+					$field->setPlaceholder($placeholder);
26
+		}
27
+		if (isset($icon)) {
28
+					$field->addIcon($icon, Direction::RIGHT);
29
+		}
28 30
 		//TODO check getField
29 31
 		$field->getDataField()->setClass("prompt");
30 32
 		$this->content["field"]=$field;
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlProgress.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,11 +12,13 @@  discard block
 block discarded – undo
12 12
 
13 13
 	public function __construct($identifier, $value=NULL, $label=NULL, $attributes=array()) {
14 14
 		parent::__construct($identifier, "div", "ui progress");
15
-		if (isset($value))
16
-			$this->setProperty("data-percent", $value);
15
+		if (isset($value)) {
16
+					$this->setProperty("data-percent", $value);
17
+		}
17 18
 		$this->createBar();
18
-		if (isset($label))
19
-			$this->setLabel($label);
19
+		if (isset($label)) {
20
+					$this->setLabel($label);
21
+		}
20 22
 		$this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ];
21 23
 		$this->addToProperty("class", $attributes);
22 24
 	}
@@ -111,8 +113,9 @@  discard block
 block discarded – undo
111 113
 	 * @see BaseHtml::run()
112 114
 	 */
113 115
 	public function run(JsUtils $js) {
114
-		if (isset($this->_bsComponent) === false)
115
-			$this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params);
116
+		if (isset($this->_bsComponent) === false) {
117
+					$this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params);
118
+		}
116 119
 		$this->addEventsOnRun($js);
117 120
 		return $this->_bsComponent;
118 121
 	}
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 		$this->createBar();
18 18
 		if (isset($label))
19 19
 			$this->setLabel($label);
20
-		$this->_states=[ State::SUCCESS,State::WARNING,State::ERROR,State::ACTIVE,State::DISABLED ];
20
+		$this->_states=[State::SUCCESS, State::WARNING, State::ERROR, State::ACTIVE, State::DISABLED];
21 21
 		$this->addToProperty("class", $attributes);
22 22
 	}
23 23
 
24 24
 	public function setLabel($label) {
25
-		$this->content["label"]=new HtmlSemDoubleElement("lbl-" . $this->identifier, "div", "label", $label);
25
+		$this->content["label"]=new HtmlSemDoubleElement("lbl-".$this->identifier, "div", "label", $label);
26 26
 		return $this;
27 27
 	}
28 28
 
29 29
 	private function createBar() {
30
-		$bar=new HtmlSemDoubleElement("bar-" . $this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-" . $this->identifier, "div", "progress"));
30
+		$bar=new HtmlSemDoubleElement("bar-".$this->identifier, "div", "bar", new HtmlSemDoubleElement("progress-".$this->identifier, "div", "progress"));
31 31
 		$this->content["bar"]=$bar;
32 32
 		return $this;
33 33
 	}
@@ -63,20 +63,20 @@  discard block
 block discarded – undo
63 63
 	 * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile()
64 64
 	 */
65 65
 	public function compile(JsUtils $js=NULL, &$view=NULL) {
66
-		$this->content=JArray::sortAssociative($this->content, [ "bar","label" ]);
66
+		$this->content=JArray::sortAssociative($this->content, ["bar", "label"]);
67 67
 		return parent::compile($js, $view);
68 68
 	}
69 69
 
70 70
 	public function jsSetValue($value) {
71
-		return '$("#' . $this->identifier . '").progress({value:' . $value . '});';
71
+		return '$("#'.$this->identifier.'").progress({value:'.$value.'});';
72 72
 	}
73 73
 
74 74
 	public function jsIncValue() {
75
-		return '$("#' . $this->identifier . '").progress("increment");';
75
+		return '$("#'.$this->identifier.'").progress("increment");';
76 76
 	}
77 77
 
78 78
 	public function jsDecValue() {
79
-		return '$("#' . $this->identifier . '").progress("decrement");';
79
+		return '$("#'.$this->identifier.'").progress("decrement");';
80 80
 	}
81 81
 
82 82
 	/**
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 			$percent=JArray::getDefaultValue($array, "percent", $percent);
99 99
 			$ratio=JArray::getDefaultValue($array, "ratio", $ratio);
100 100
 		}
101
-		$this->_params["text"]="%{active  : " . \var_export($active, true) . ",error: " . \var_export($error, true) . ",success : " . \var_export($success, true) . ",warning : " . \var_export($warning, true) . ",percent : " . \var_export($percent, true) . ",ratio   : " . \var_export($ratio, true) . "}%";
101
+		$this->_params["text"]="%{active  : ".\var_export($active, true).",error: ".\var_export($error, true).",success : ".\var_export($success, true).",warning : ".\var_export($warning, true).",percent : ".\var_export($percent, true).",ratio   : ".\var_export($ratio, true)."}%";
102 102
 		return $this;
103 103
 	}
104 104
 
105 105
 	public function onChange($jsCode) {
106
-		return $this->_params["onChange"]="%function(percent, value, total){" . $jsCode . "}%";
106
+		return $this->_params["onChange"]="%function(percent, value, total){".$jsCode."}%";
107 107
 	}
108 108
 
109 109
 	/*
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 * @see BaseHtml::run()
112 112
 	 */
113 113
 	public function run(JsUtils $js) {
114
-		if (isset($this->_bsComponent) === false)
115
-			$this->_bsComponent=$js->semantic()->progress("#" . $this->identifier, $this->_params);
114
+		if (isset($this->_bsComponent)===false)
115
+			$this->_bsComponent=$js->semantic()->progress("#".$this->identifier, $this->_params);
116 116
 		$this->addEventsOnRun($js);
117 117
 		return $this->_bsComponent;
118 118
 	}
Please login to merge, or discard this patch.
Ajax/common/traits/JqueryEventsTrait.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 trait JqueryEventsTrait {
13
-	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true);
13
+	abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true);
14 14
 
15 15
 	/**
16 16
 	 * Blur
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function _click($element='this', $js=array(), $ret_false=TRUE) {
54 54
 		if (!is_array($js)) {
55
-			$js=array (
55
+			$js=array(
56 56
 					$js
57 57
 			);
58 58
 		}
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/IconTrait.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,18 +15,18 @@  discard block
 block discarded – undo
15 15
 	private $_hasIcon=false;
16 16
 
17 17
 	abstract protected function addToPropertyCtrl($name, $value, $typeCtrl);
18
-	abstract public function addContent($content,$before=false);
18
+	abstract public function addContent($content, $before=false);
19 19
 
20
-	public function addIcon($icon,$direction=Direction::LEFT){
21
-		if($this->_hasIcon===false){
20
+	public function addIcon($icon, $direction=Direction::LEFT) {
21
+		if ($this->_hasIcon===false) {
22 22
 			$iconO=$icon;
23
-			if(\is_string($icon)){
23
+			if (\is_string($icon)) {
24 24
 				$iconO=new HtmlIcon("icon-".$this->identifier, $icon);
25 25
 			}
26 26
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
27
-			$this->addContent($iconO,$direction===Direction::LEFT);
27
+			$this->addContent($iconO, $direction===Direction::LEFT);
28 28
 			$this->_hasIcon=true;
29
-		}else{
29
+		} else {
30 30
 			$iconO=$this->getIcon();
31 31
 			$iconO->setIcon($icon);
32 32
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 		return $iconO;
35 35
 	}
36 36
 
37
-	public function getIcon(){
38
-		if(\is_array($this->content)){
39
-			foreach ($this->content as $item){
40
-				if($item instanceof HtmlIcon)
37
+	public function getIcon() {
38
+		if (\is_array($this->content)) {
39
+			foreach ($this->content as $item) {
40
+				if ($item instanceof HtmlIcon)
41 41
 					return $item;
42 42
 			}
43 43
 		}
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
27 27
 			$this->addContent($iconO,$direction===Direction::LEFT);
28 28
 			$this->_hasIcon=true;
29
-		}else{
29
+		} else{
30 30
 			$iconO=$this->getIcon();
31 31
 			$iconO->setIcon($icon);
32 32
 			$this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon"));
@@ -37,8 +37,9 @@  discard block
 block discarded – undo
37 37
 	public function getIcon(){
38 38
 		if(\is_array($this->content)){
39 39
 			foreach ($this->content as $item){
40
-				if($item instanceof HtmlIcon)
41
-					return $item;
40
+				if($item instanceof HtmlIcon) {
41
+									return $item;
42
+				}
42 43
 			}
43 44
 		}
44 45
 	}
Please login to merge, or discard this patch.
Ajax/semantic/html/base/traits/TableElementTrait.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	public function setDisabled($disable=true) {
28
-		if($disable)
28
+		if ($disable)
29 29
 			$this->addState(State::DISABLED);
30 30
 		return $this;
31 31
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@
 block discarded – undo
25 25
 	}
26 26
 
27 27
 	public function setDisabled($disable=true) {
28
-		if($disable)
29
-			$this->addState(State::DISABLED);
28
+		if($disable) {
29
+					$this->addState(State::DISABLED);
30
+		}
30 31
 		return $this;
31 32
 	}
32 33
 }
33 34
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/Widget.php 3 patches
Doc Comments   +15 added lines patch added patch discarded remove patch
@@ -44,6 +44,11 @@  discard block
 block discarded – undo
44 44
 			$this->show($modelInstance);
45 45
 	}
46 46
 
47
+	/**
48
+	 * @param InstanceViewer $instanceViewer
49
+	 * @param string $contentKey
50
+	 * @param boolean $edition
51
+	 */
47 52
 	protected function _init($instanceViewer,$contentKey,$content,$edition){
48 53
 		$this->_instanceViewer=$instanceViewer;
49 54
 		$this->content=[$contentKey=>$content];
@@ -96,16 +101,26 @@  discard block
 block discarded – undo
96 101
 		return $this;
97 102
 	}
98 103
 
104
+	/**
105
+	 * @param \Closure $field
106
+	 */
99 107
 	public function addField($field){
100 108
 		$this->_instanceViewer->addField($field);
101 109
 		return $this;
102 110
 	}
103 111
 
112
+	/**
113
+	 * @param integer $index
114
+	 * @param \Closure $field
115
+	 */
104 116
 	public function insertField($index,$field){
105 117
 		$this->_instanceViewer->insertField($index, $field);
106 118
 		return $this;
107 119
 	}
108 120
 
121
+	/**
122
+	 * @param \Closure $field
123
+	 */
109 124
 	public function insertInField($index,$field){
110 125
 		$this->_instanceViewer->insertInField($index, $field);
111 126
 		return $this;
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -157,8 +157,9 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
159 159
 		$result=$this->addInToolbar($caption,$callback);
160
-		if(isset($icon))
161
-			$result->addIcon($icon);
160
+		if(isset($icon)) {
161
+					$result->addIcon($icon);
162
+		}
162 163
 		return $result;
163 164
 	}
164 165
 
@@ -172,7 +173,7 @@  discard block
 block discarded – undo
172 173
 			foreach ($items as $icon=>$item){
173 174
 				$this->addItemInToolbar($item,$icon,$callback);
174 175
 			}
175
-		}else{
176
+		} else{
176 177
 			foreach ($items as $item){
177 178
 				$this->addItemInToolbar($item,null,$callback);
178 179
 			}
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use Ajax\semantic\html\collections\form\traits\FormTrait;
19 19
 
20 20
 abstract class Widget extends HtmlDoubleElement {
21
-	use FieldAsTrait,FormTrait;
21
+	use FieldAsTrait, FormTrait;
22 22
 
23 23
 	/**
24 24
 	 * @var string classname
@@ -49,36 +49,36 @@  discard block
 block discarded – undo
49 49
 	protected $_form;
50 50
 
51 51
 
52
-	public function __construct($identifier,$model,$modelInstance=NULL) {
52
+	public function __construct($identifier, $model, $modelInstance=NULL) {
53 53
 		parent::__construct($identifier);
54 54
 		$this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
55 55
 		$this->setModel($model);
56
-		if(isset($modelInstance));
56
+		if (isset($modelInstance));
57 57
 			$this->show($modelInstance);
58 58
 	}
59 59
 
60
-	protected function _init($instanceViewer,$contentKey,$content,$edition){
60
+	protected function _init($instanceViewer, $contentKey, $content, $edition) {
61 61
 		$this->_instanceViewer=$instanceViewer;
62 62
 		$this->content=[$contentKey=>$content];
63 63
 		$this->_toolbarPosition=PositionInTable::BEFORETABLE;
64 64
 		$this->_edition=$edition;
65 65
 	}
66 66
 
67
-	protected function _getFieldIdentifier($prefix,$name=""){
67
+	protected function _getFieldIdentifier($prefix, $name="") {
68 68
 		return $this->identifier."-{$prefix}-".$this->_instanceViewer->getIdentifier();
69 69
 	}
70 70
 
71
-	protected function _getFieldName($index){
71
+	protected function _getFieldName($index) {
72 72
 		return $this->_instanceViewer->getFieldName($index);
73 73
 	}
74 74
 
75
-	protected function _getFieldCaption($index){
75
+	protected function _getFieldCaption($index) {
76 76
 		return $this->_instanceViewer->getCaption($index);
77 77
 	}
78 78
 
79
-	abstract protected  function _setToolbarPosition($table,$captions=NULL);
79
+	abstract protected  function _setToolbarPosition($table, $captions=NULL);
80 80
 
81
-	public function show($modelInstance){
81
+	public function show($modelInstance) {
82 82
 		$this->_modelInstance=$modelInstance;
83 83
 	}
84 84
 
@@ -102,42 +102,42 @@  discard block
 block discarded – undo
102 102
 
103 103
 	abstract public function getHtmlComponent();
104 104
 
105
-	public function setColor($color){
105
+	public function setColor($color) {
106 106
 		return $this->getHtmlComponent()->setColor($color);
107 107
 	}
108 108
 
109 109
 
110
-	public function setCaptions($captions){
110
+	public function setCaptions($captions) {
111 111
 		$this->_instanceViewer->setCaptions($captions);
112 112
 		return $this;
113 113
 	}
114 114
 
115
-	public function setFields($fields){
115
+	public function setFields($fields) {
116 116
 		$this->_instanceViewer->setVisibleProperties($fields);
117 117
 		return $this;
118 118
 	}
119 119
 
120
-	public function addField($field){
120
+	public function addField($field) {
121 121
 		$this->_instanceViewer->addField($field);
122 122
 		return $this;
123 123
 	}
124 124
 
125
-	public function insertField($index,$field){
125
+	public function insertField($index, $field) {
126 126
 		$this->_instanceViewer->insertField($index, $field);
127 127
 		return $this;
128 128
 	}
129 129
 
130
-	public function insertInField($index,$field){
130
+	public function insertInField($index, $field) {
131 131
 		$this->_instanceViewer->insertInField($index, $field);
132 132
 		return $this;
133 133
 	}
134 134
 
135
-	public function setValueFunction($index,$callback){
135
+	public function setValueFunction($index, $callback) {
136 136
 		$this->_instanceViewer->setValueFunction($index, $callback);
137 137
 		return $this;
138 138
 	}
139 139
 
140
-	public function setIdentifierFunction($callback){
140
+	public function setIdentifierFunction($callback) {
141 141
 		$this->_instanceViewer->setIdentifierFunction($callback);
142 142
 		return $this;
143 143
 	}
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 	/**
146 146
 	 * @return \Ajax\semantic\html\collections\menus\HtmlMenu
147 147
 	 */
148
-	public function getToolbar(){
149
-		if(isset($this->_toolbar)===false){
148
+	public function getToolbar() {
149
+		if (isset($this->_toolbar)===false) {
150 150
 			$this->_toolbar=new HtmlMenu("toolbar-".$this->identifier);
151 151
 		}
152 152
 		return $this->_toolbar;
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
 	 * @param callable $callback function to call on $element
159 159
 	 * @return \Ajax\common\html\HtmlDoubleElement
160 160
 	 */
161
-	public function addInToolbar($element,$callback=NULL){
161
+	public function addInToolbar($element, $callback=NULL) {
162 162
 		$tb=$this->getToolbar();
163
-		if(isset($callback)){
164
-			if(\is_callable($callback)){
163
+		if (isset($callback)) {
164
+			if (\is_callable($callback)) {
165 165
 				$callback($element);
166 166
 			}
167 167
 		}
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	 * @param callable $callback function($element)
175 175
 	 * @return \Ajax\common\html\HtmlDoubleElement
176 176
 	 */
177
-	public function addItemInToolbar($caption,$icon=NULL,$callback=NULL){
178
-		$result=$this->addInToolbar($caption,$callback);
179
-		if(isset($icon))
177
+	public function addItemInToolbar($caption, $icon=NULL, $callback=NULL) {
178
+		$result=$this->addInToolbar($caption, $callback);
179
+		if (isset($icon))
180 180
 			$result->addIcon($icon);
181 181
 		return $result;
182 182
 	}
@@ -186,14 +186,14 @@  discard block
 block discarded – undo
186 186
 	 * @param callable $callback function($element)
187 187
 	 * @return \Ajax\common\Widget
188 188
 	 */
189
-	public function addItemsInToolbar(array $items,$callback=NULL){
190
-		if(JArray::isAssociative($items)){
191
-			foreach ($items as $icon=>$item){
192
-				$this->addItemInToolbar($item,$icon,$callback);
189
+	public function addItemsInToolbar(array $items, $callback=NULL) {
190
+		if (JArray::isAssociative($items)) {
191
+			foreach ($items as $icon=>$item) {
192
+				$this->addItemInToolbar($item, $icon, $callback);
193 193
 			}
194
-		}else{
195
-			foreach ($items as $item){
196
-				$this->addItemInToolbar($item,null,$callback);
194
+		} else {
195
+			foreach ($items as $item) {
196
+				$this->addItemInToolbar($item, null, $callback);
197 197
 			}
198 198
 		}
199 199
 		return $this;
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
 	 * @param callable $callback function($element)
206 206
 	 * @return \Ajax\common\html\HtmlDoubleElement
207 207
 	 */
208
-	public function addDropdownInToolbar($value,$items,$callback=NULL){
208
+	public function addDropdownInToolbar($value, $items, $callback=NULL) {
209 209
 		$dd=$value;
210 210
 		if (\is_string($value)) {
211
-			$dd=new HtmlDropdown("dropdown-". $this->identifier."-".$value, $value, $items);
211
+			$dd=new HtmlDropdown("dropdown-".$this->identifier."-".$value, $value, $items);
212 212
 		}
213
-		return $this->addInToolbar($dd,$callback);
213
+		return $this->addInToolbar($dd, $callback);
214 214
 	}
215 215
 
216 216
 	/**
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param callable $callback function($element)
219 219
 	 * @return \Ajax\common\html\HtmlDoubleElement
220 220
 	 */
221
-	public function addButtonInToolbar($caption,$callback=NULL){
222
-		$bt=new HtmlButton("bt-".$caption,$caption);
223
-		return $this->addInToolbar($bt,$callback);
221
+	public function addButtonInToolbar($caption, $callback=NULL) {
222
+		$bt=new HtmlButton("bt-".$caption, $caption);
223
+		return $this->addInToolbar($bt, $callback);
224 224
 	}
225 225
 
226 226
 	/**
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @param callable $callback function($element)
230 230
 	 * @return \Ajax\common\html\HtmlDoubleElement
231 231
 	 */
232
-	public function addButtonsInToolbar(array $captions,$asIcon=false,$callback=NULL){
233
-		$bts=new HtmlButtonGroups("",$captions,$asIcon);
234
-		return $this->addInToolbar($bts,$callback);
232
+	public function addButtonsInToolbar(array $captions, $asIcon=false, $callback=NULL) {
233
+		$bts=new HtmlButtonGroups("", $captions, $asIcon);
234
+		return $this->addInToolbar($bts, $callback);
235 235
 	}
236 236
 
237 237
 	/**
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
 	 * @param boolean $labeled
242 242
 	 * @return \Ajax\common\html\HtmlDoubleElement
243 243
 	 */
244
-	public function addLabelledIconButtonInToolbar($caption,$icon,$before=true,$labeled=false){
245
-		$bt=new HtmlButton("",$caption);
246
-		$bt->addIcon($icon,$before,$labeled);
244
+	public function addLabelledIconButtonInToolbar($caption, $icon, $before=true, $labeled=false) {
245
+		$bt=new HtmlButton("", $caption);
246
+		$bt->addIcon($icon, $before, $labeled);
247 247
 		return $this->addInToolbar($bt);
248 248
 	}
249 249
 
250
-	public function addSubmitInToolbar($identifier,$value,$cssStyle=NULL,$url=NULL,$responseElement=NULL){
251
-		$button=new HtmlButton($identifier,$value,$cssStyle);
252
-		$this->_buttonAsSubmit($button,"click",$url,$responseElement);
250
+	public function addSubmitInToolbar($identifier, $value, $cssStyle=NULL, $url=NULL, $responseElement=NULL) {
251
+		$button=new HtmlButton($identifier, $value, $cssStyle);
252
+		$this->_buttonAsSubmit($button, "click", $url, $responseElement);
253 253
 		return $this->addInToolbar($button);
254 254
 	}
255 255
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @param callable $defaultValueFunction function parameters are : $name : the field name, $value : the field value ,$index : the field index, $instance : the active instance of model
280 280
 	 * @return \Ajax\common\Widget
281 281
 	 */
282
-	public function setDefaultValueFunction($defaultValueFunction){
282
+	public function setDefaultValueFunction($defaultValueFunction) {
283 283
 		$this->_instanceViewer->setDefaultValueFunction($defaultValueFunction);
284 284
 		return $this;
285 285
 	}
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 * @param string|boolean $disable
289 289
 	 * @return string
290 290
 	 */
291
-	public function jsDisabled($disable=true){
291
+	public function jsDisabled($disable=true) {
292 292
 		return "$('#".$this->identifier." .ui.input,#".$this->identifier." .ui.dropdown,#".$this->identifier." .ui.checkbox').toggleClass('disabled',".$disable.");";
293 293
 	}
294 294
 
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 	 * @param callable $callback function($element)
298 298
 	 * @return \Ajax\common\html\HtmlDoubleElement
299 299
 	 */
300
-	public function addEditButtonInToolbar($caption,$callback=NULL){
301
-		$bt=new HtmlButton($this->identifier."-editBtn",$caption);
300
+	public function addEditButtonInToolbar($caption, $callback=NULL) {
301
+		$bt=new HtmlButton($this->identifier."-editBtn", $caption);
302 302
 		$bt->setToggle();
303 303
 		$bt->setActive($this->_edition);
304 304
 		$bt->onClick($this->jsDisabled(Javascript::prep_value("!$(event.target).hasClass('active')")));
305
-		return $this->addInToolbar($bt,$callback);
305
+		return $this->addInToolbar($bt, $callback);
306 306
 	}
307 307
 
308 308
 	public function setToolbar(HtmlMenu $_toolbar) {
@@ -316,32 +316,32 @@  discard block
 block discarded – undo
316 316
 	}
317 317
 
318 318
 	public function getForm() {
319
-		if(!isset($this->_form)){
319
+		if (!isset($this->_form)) {
320 320
 			$this->_form=new HtmlForm("frm-".$this->identifier);
321 321
 			$this->setEdition(true);
322 322
 		}
323 323
 		return $this->_form;
324 324
 	}
325 325
 
326
-	public function run(JsUtils $js=NULL){
326
+	public function run(JsUtils $js=NULL) {
327 327
 		$result=parent::run($js);
328
-		if(isset($this->_form)){
328
+		if (isset($this->_form)) {
329 329
 			$this->runForm($js);
330 330
 		}
331 331
 		return $result;
332 332
 	}
333 333
 
334
-	protected function runForm(JsUtils $js){
334
+	protected function runForm(JsUtils $js) {
335 335
 		$fields=$this->getContentInstances(HtmlFormField::class);
336
-		foreach ($fields as $field){
336
+		foreach ($fields as $field) {
337 337
 			$this->_form->addField($field);
338 338
 		}
339 339
 		return $this->_form->run($js);
340 340
 	}
341 341
 
342
-	protected function _compileForm(JsUtils $js=NULL,&$view=NULL){
343
-		if(isset($this->_form)){
344
-			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."'>","</form>");
342
+	protected function _compileForm(JsUtils $js=NULL, &$view=NULL) {
343
+		if (isset($this->_form)) {
344
+			$this->wrapContent("<form class='ui form' id='frm-".$this->identifier."' name='frm-".$this->identifier."'>", "</form>");
345 345
 		}
346 346
 	}
347 347
 }
348 348
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/semantic/html/content/HtmlListItem.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 	protected $image;
10 10
 
11 11
 	public function __construct($identifier, $content=NULL) {
12
-		parent::__construct($identifier,"item",$content);
12
+		parent::__construct($identifier, "item", $content);
13 13
 	}
14
-	protected function initContent($content){
15
-		if(\is_array($content)){
16
-			if(JArray::isAssociative($content)===false){
14
+	protected function initContent($content) {
15
+		if (\is_array($content)) {
16
+			if (JArray::isAssociative($content)===false) {
17 17
 				$icon=@$content[0];
18 18
 				$title=@$content[1];
19 19
 				$desc=@$content[2];
20
-			}else{
20
+			} else {
21 21
 				$icon=@$content["icon"];
22 22
 				$image=@$content["image"];
23 23
 				$title=@$content["title"];
@@ -25,21 +25,21 @@  discard block
 block discarded – undo
25 25
 				$desc=@$content["description"];
26 26
 				$items=@$content["items"];
27 27
 			}
28
-			if(isset($icon)){
28
+			if (isset($icon)) {
29 29
 				$this->setIcon($icon);
30 30
 			}
31
-			if(isset($image)){
31
+			if (isset($image)) {
32 32
 				$this->setImage($image);
33 33
 			}
34
-			if(isset($title)){
35
-				$this->setTitle($title,$desc);
36
-			}elseif (isset($header)){
37
-				$this->setTitle($header,$desc,"header");
34
+			if (isset($title)) {
35
+				$this->setTitle($title, $desc);
36
+			}elseif (isset($header)) {
37
+				$this->setTitle($header, $desc, "header");
38 38
 			}
39
-			if(isset($items)){
39
+			if (isset($items)) {
40 40
 				$this->addList($items);
41 41
 			}
42
-		}else{
42
+		} else {
43 43
 			$this->setContent($content);
44 44
 		}
45 45
 	}
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 		return $list;
51 51
 	}
52 52
 
53
-	public function getList(){
53
+	public function getList() {
54 54
 		return $this->content["list"];
55 55
 	}
56 56
 
57
-	public function getItem($index){
57
+	public function getItem($index) {
58 58
 		return $this->getList()->getItem($index);
59 59
 	}
60 60
 }
61 61
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 				$icon=@$content[0];
18 18
 				$title=@$content[1];
19 19
 				$desc=@$content[2];
20
-			}else{
20
+			} else{
21 21
 				$icon=@$content["icon"];
22 22
 				$image=@$content["image"];
23 23
 				$title=@$content["title"];
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
 			}
34 34
 			if(isset($title)){
35 35
 				$this->setTitle($title,$desc);
36
-			}elseif (isset($header)){
36
+			} elseif (isset($header)){
37 37
 				$this->setTitle($header,$desc,"header");
38 38
 			}
39 39
 			if(isset($items)){
40 40
 				$this->addList($items);
41 41
 			}
42
-		}else{
42
+		} else{
43 43
 			$this->setContent($content);
44 44
 		}
45 45
 	}
Please login to merge, or discard this patch.
Ajax/common/html/PropertyWrapper.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
 			$output=$input;
13 13
 		}
14 14
 		if (\is_array($input)) {
15
-			if (sizeof($input) > 0) {
16
-				if (self::containsElement($input) === false) {
15
+			if (sizeof($input)>0) {
16
+				if (self::containsElement($input)===false) {
17 17
 					$output=self::wrapStrings($input, $js, $separator=' ', $valueQuote='"');
18 18
 				} else {
19 19
 					$output=self::wrapObjects($input, $js, $separator, $valueQuote);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	private static function containsElement($input) {
27
-		foreach ( $input as $v ) {
27
+		foreach ($input as $v) {
28 28
 			if (\is_object($v) || \is_array($v))
29 29
 				return true;
30 30
 		}
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	}
33 33
 
34 34
 	public static function wrapStrings($input, $js, $separator=' ', $valueQuote='"') {
35
-		if (JArray::isAssociative($input) === true) {
36
-			$result=implode($separator, array_map(function ($v, $k) use($valueQuote) {
37
-				return $k . '=' . $valueQuote . $v . $valueQuote;
35
+		if (JArray::isAssociative($input)===true) {
36
+			$result=implode($separator, array_map(function($v, $k) use($valueQuote) {
37
+				return $k.'='.$valueQuote.$v.$valueQuote;
38 38
 			}, $input, array_keys($input)));
39 39
 		} else {
40 40
 			$result=implode($separator, array_values($input));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	}
44 44
 
45 45
 	public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') {
46
-		return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) {
46
+		return implode($separator, array_map(function($v) use($js, $separator, $valueQuote) {
47 47
 			if (is_object($v))
48 48
 				return $v->compile($js);
49 49
 			elseif (\is_array($v)) {
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -25,8 +25,9 @@  discard block
 block discarded – undo
25 25
 
26 26
 	private static function containsElement($input) {
27 27
 		foreach ( $input as $v ) {
28
-			if (\is_object($v) || \is_array($v))
29
-				return true;
28
+			if (\is_object($v) || \is_array($v)) {
29
+							return true;
30
+			}
30 31
 		}
31 32
 		return false;
32 33
 	}
@@ -44,12 +45,13 @@  discard block
 block discarded – undo
44 45
 
45 46
 	public static function wrapObjects($input, $js=NULL, $separator=' ', $valueQuote='"') {
46 47
 		return implode($separator, array_map(function ($v) use($js, $separator, $valueQuote) {
47
-			if (is_object($v))
48
-				return $v->compile($js);
49
-			elseif (\is_array($v)) {
48
+			if (is_object($v)) {
49
+							return $v->compile($js);
50
+			} elseif (\is_array($v)) {
50 51
 				return self::wrap($v, $js, $separator, $valueQuote);
51
-			} else
52
-				return $v;
52
+			} else {
53
+							return $v;
54
+			}
53 55
 		}, $input));
54 56
 	}
55 57
 }
56 58
\ No newline at end of file
Please login to merge, or discard this patch.
Ajax/common/html/HtmlSingleElement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	public function setClass($classNames) {
16
-		if(\is_array($classNames)){
16
+		if (\is_array($classNames)) {
17 17
 			$classNames=implode(" ", $classNames);
18 18
 		}
19 19
 		$this->setProperty("class", $classNames);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function fromArray($array) {
46 46
 		$array=parent::fromArray($array);
47
-		foreach ( $array as $key => $value ) {
47
+		foreach ($array as $key => $value) {
48 48
 			$this->setProperty($key, $value);
49 49
 		}
50 50
 		return $array;
Please login to merge, or discard this patch.