Completed
Push — master ( 751bb4...735cac )
by Jean-Christophe
04:44
created
Ajax/semantic/traits/SemanticComponentsTrait.php 1 patch
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -57,6 +57,9 @@  discard block
 block discarded – undo
57 57
 		return $this->addComponent(new Accordion($this->js), $attachTo, $params);
58 58
 	}
59 59
 
60
+	/**
61
+	 * @param string $attachTo
62
+	 */
60 63
 	public function sticky($attachTo=NULL, $params=NULL) {
61 64
 		return $this->addComponent(new Sticky($this->js), $attachTo, $params);
62 65
 	}
@@ -65,14 +68,23 @@  discard block
 block discarded – undo
65 68
 		return $this->addComponent(new Checkbox($this->js), $attachTo, $params);
66 69
 	}
67 70
 
71
+	/**
72
+	 * @param string $attachTo
73
+	 */
68 74
 	public function rating($attachTo=NULL, $params=NULL) {
69 75
 		return $this->addComponent(new Rating($this->js), $attachTo, $params);
70 76
 	}
71 77
 
78
+	/**
79
+	 * @param string $attachTo
80
+	 */
72 81
 	public function progress($attachTo=NULL, $params=NULL) {
73 82
 		return $this->addComponent(new Progress($this->js), $attachTo, $params);
74 83
 	}
75 84
 
85
+	/**
86
+	 * @param string $attachTo
87
+	 */
76 88
 	public function search($attachTo=NULL, $params=NULL) {
77 89
 		return $this->addComponent(new Search($this->js), $attachTo, $params);
78 90
 	}
Please login to merge, or discard this patch.
Ajax/common/components/SimpleComponent.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 
17 17
 	public function __construct(JsUtils $js) {
18 18
 		parent::__construct($js);
19
-		$this->events=array ();
19
+		$this->events=array();
20 20
 	}
21 21
 
22 22
 	protected function compileEvents() {
23
-		foreach ( $this->events as $event => $jsCode ) {
24
-			if($event=="execute"){
23
+		foreach ($this->events as $event => $jsCode) {
24
+			if ($event=="execute") {
25 25
 				$this->jquery_code_for_compile []=$jsCode;
26
-			}else if($event=="beforeExecute"){
26
+			}else if ($event=="beforeExecute") {
27 27
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
28 28
 			}else
29 29
 				$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		$result=implode("\n", $this->jquery_code_for_compile);
35 35
 		$result=str_ireplace("\"%", "", $result);
36 36
 		$result=str_ireplace("%\"", "", $result);
37
-		$result=str_replace(array (
37
+		$result=str_replace(array(
38 38
 				"\\n",
39 39
 				"\\r",
40 40
 				"\\t"
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public function getScript() {
46 46
 		$allParams=$this->params;
47
-		$this->jquery_code_for_compile=array ();
47
+		$this->jquery_code_for_compile=array();
48 48
 		$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");";
49 49
 		$this->compileEvents();
50 50
 		return $this->compileJQueryCode();
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		if (is_array($typeCtrl)) {
72 72
 			if (array_search($value, $typeCtrl)===false)
73 73
 				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
74
-		} else {
74
+		}else {
75 75
 			if (!$typeCtrl($value)) {
76 76
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
77 77
 			}
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -23,10 +23,11 @@  discard block
 block discarded – undo
23 23
 		foreach ( $this->events as $event => $jsCode ) {
24 24
 			if($event=="execute"){
25 25
 				$this->jquery_code_for_compile []=$jsCode;
26
-			}else if($event=="beforeExecute"){
26
+			} else if($event=="beforeExecute"){
27 27
 				\array_unshift($this->jquery_code_for_compile, $jsCode);
28
-			}else
29
-				$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
28
+			} else {
29
+							$this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});";
30
+			}
30 31
 		}
31 32
 	}
32 33
 
@@ -69,8 +70,9 @@  discard block
 block discarded – undo
69 70
 
70 71
 	protected function setParamCtrl($key, $value, $typeCtrl) {
71 72
 		if (is_array($typeCtrl)) {
72
-			if (array_search($value, $typeCtrl)===false)
73
-				throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
73
+			if (array_search($value, $typeCtrl)===false) {
74
+							throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}");
75
+			}
74 76
 		} else {
75 77
 			if (!$typeCtrl($value)) {
76 78
 				throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName);
Please login to merge, or discard this patch.
Ajax/semantic/components/search/SearchResults.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
 	private $elements;
9 9
 
10 10
 	public function __construct($objects=NULL) {
11
-		$this->elements=array ();
11
+		$this->elements=array();
12 12
 		if (isset($objects)) {
13 13
 			if (\is_array($objects)) {
14 14
 				$this->addResults($objects);
15
-			} else {
15
+			}else {
16 16
 				$this->addResult($objects);
17 17
 			}
18 18
 		}
@@ -24,33 +24,33 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	public function addResults($objects) {
27
-		if (JArray::dimension($objects) === 1) {
28
-			foreach ( $objects as $object ) {
29
-				$this->addResult([ "title" => $object ]);
27
+		if (JArray::dimension($objects)===1) {
28
+			foreach ($objects as $object) {
29
+				$this->addResult(["title" => $object]);
30 30
 			}
31
-		} else
31
+		}else
32 32
 			$this->elements=\array_merge($this->elements, $objects);
33 33
 		return $this;
34 34
 	}
35 35
 
36 36
 	public function search($query, $field="title") {
37
-		$result=array ();
38
-		foreach ( $this->elements as $element ) {
37
+		$result=array();
38
+		foreach ($this->elements as $element) {
39 39
 			if (\array_key_exists($field, $element)) {
40 40
 				$value=$element[$field];
41
-				if (\stripos($value, $query) !== false) {
41
+				if (\stripos($value, $query)!==false) {
42 42
 					$result[]=$element;
43 43
 				}
44 44
 			}
45 45
 		}
46
-		if (\sizeof($result) > 0) {
46
+		if (\sizeof($result)>0) {
47 47
 			return $result;
48 48
 		}
49 49
 		return false;
50 50
 	}
51 51
 
52 52
 	public function __toString() {
53
-		$result="\"results\": " . \json_encode($this->elements);
53
+		$result="\"results\": ".\json_encode($this->elements);
54 54
 		return $result;
55 55
 	}
56 56
 
@@ -59,6 +59,6 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 
61 61
 	public function getStandard() {
62
-		return "{" . $this . "}";
62
+		return "{".$this."}";
63 63
 	}
64 64
 }
65 65
\ 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
@@ -28,8 +28,9 @@
 block discarded – undo
28 28
 			foreach ( $objects as $object ) {
29 29
 				$this->addResult([ "title" => $object ]);
30 30
 			}
31
-		} else
32
-			$this->elements=\array_merge($this->elements, $objects);
31
+		} else {
32
+					$this->elements=\array_merge($this->elements, $objects);
33
+		}
33 34
 		return $this;
34 35
 	}
35 36
 
Please login to merge, or discard this patch.
Ajax/semantic/components/search/SearchCategories.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@  discard block
 block discarded – undo
6 6
 	private $categories;
7 7
 
8 8
 	public function __construct() {
9
-		$this->categories=array ();
9
+		$this->categories=array();
10 10
 	}
11 11
 
12 12
 	public function add($results, $category) {
13 13
 		$count=\sizeof($this->categories);
14
-		$category=new SearchCategory("category" . $count, $category, $results);
14
+		$category=new SearchCategory("category".$count, $category, $results);
15 15
 		$this->categories[]=$category;
16 16
 		return $this;
17 17
 	}
18 18
 
19 19
 	public function search($query, $field="title") {
20
-		$result=array ();
21
-		foreach ( $this->categories as $category ) {
20
+		$result=array();
21
+		foreach ($this->categories as $category) {
22 22
 			$r=$category->search($query, $field);
23
-			if ($r !== false)
23
+			if ($r!==false)
24 24
 				$result[]=$r;
25 25
 		}
26 26
 		$this->categories=$result;
@@ -28,6 +28,6 @@  discard block
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	public function __toString() {
31
-		return "{\"results\":{" . \implode(",", $this->categories) . "}}";
31
+		return "{\"results\":{".\implode(",", $this->categories)."}}";
32 32
 	}
33 33
 }
34 34
\ 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
@@ -20,8 +20,9 @@
 block discarded – undo
20 20
 		$result=array ();
21 21
 		foreach ( $this->categories as $category ) {
22 22
 			$r=$category->search($query, $field);
23
-			if ($r !== false)
24
-				$result[]=$r;
23
+			if ($r !== false) {
24
+							$result[]=$r;
25
+			}
25 26
 		}
26 27
 		$this->categories=$result;
27 28
 		return $this;
Please login to merge, or discard this patch.
Ajax/semantic/components/search/SearchCategory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	public function __toString() {
27
-		$result="\"" . $this->id . "\": { \"name\": \"" . $this->name . "\"," . $this->results . "}";
27
+		$result="\"".$this->id."\": { \"name\": \"".$this->name."\",".$this->results."}";
28 28
 		return $result;
29 29
 	}
30 30
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 	public function search($query, $field="title") {
59 59
 		$result=$this->results->search($query, $field);
60
-		if ($result !== false) {
60
+		if ($result!==false) {
61 61
 			return new SearchCategory($this->id, $this->name, $result);
62 62
 		}
63 63
 		return false;
Please login to merge, or discard this patch.
Ajax/semantic/html/elements/HtmlInput.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	use IconTrait;
13 13
 
14 14
 	public function __construct($identifier, $type="text", $value="", $placeholder="") {
15
-		parent::__construct("div-" . $identifier, "div", "ui input");
16
-		$this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ];
17
-		$this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ];
18
-		$this->_variations=[ Variation::TRANSPARENT ];
15
+		parent::__construct("div-".$identifier, "div", "ui input");
16
+		$this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)];
17
+		$this->_states=[State::DISABLED, State::FOCUS, State::ERROR];
18
+		$this->_variations=[Variation::TRANSPARENT];
19 19
 	}
20 20
 
21 21
 	public function setFocus() {
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 
25 25
 	public function addLoading() {
26
-		if ($this->_hasIcon === false) {
26
+		if ($this->_hasIcon===false) {
27 27
 			throw new \Exception("Input must have an icon for showing a loader, use addIcon before");
28 28
 		}
29 29
 		return $this->addToProperty("class", State::LOADING);
@@ -31,31 +31,31 @@  discard block
 block discarded – undo
31 31
 
32 32
 	public function labeled($label, $direction=Direction::LEFT, $icon=NULL) {
33 33
 		$labelO=$label;
34
-		if (\is_object($label) === false) {
35
-			$labelO=new HtmlLabel("label-" . $this->identifier, $label);
34
+		if (\is_object($label)===false) {
35
+			$labelO=new HtmlLabel("label-".$this->identifier, $label);
36 36
 			if (isset($icon))
37 37
 				$labelO->addIcon($icon);
38
-		} else {
39
-			$labelO->addToPropertyCtrl("class", "label", array ("label" ));
38
+		}else {
39
+			$labelO->addToPropertyCtrl("class", "label", array("label"));
40 40
 		}
41
-		$this->addToProperty("class", $direction . " labeled");
42
-		$this->addContent($labelO, \strstr($direction, Direction::LEFT) !== false);
41
+		$this->addToProperty("class", $direction." labeled");
42
+		$this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false);
43 43
 		return $labelO;
44 44
 	}
45 45
 
46 46
 	public function labeledToCorner($label, $direction=Direction::LEFT, $icon=NULL) {
47
-		return $this->labeled($label, $direction . " corner", $icon)->toCorner($direction);
47
+		return $this->labeled($label, $direction." corner", $icon)->toCorner($direction);
48 48
 	}
49 49
 
50 50
 	public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) {
51 51
 		$actionO=$action;
52
-		if (\is_object($action) === false) {
53
-			$actionO=new HtmlButton("action-" . $this->identifier, $action);
52
+		if (\is_object($action)===false) {
53
+			$actionO=new HtmlButton("action-".$this->identifier, $action);
54 54
 			if (isset($icon))
55 55
 				$actionO->addIcon($icon, true, $labeled);
56 56
 		}
57
-		$this->addToProperty("class", $direction . " action");
58
-		$this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false);
57
+		$this->addToProperty("class", $direction." action");
58
+		$this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false);
59 59
 		return $actionO;
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
Ajax/semantic/html/modules/HtmlSearch.php 2 patches
Spacing   +13 added lines, -13 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 $_params=array ();
13
-	private $_searchFields=array ("title" );
11
+	private $_elements=array();
12
+	private $_params=array();
13
+	private $_searchFields=array("title");
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";
@@ -21,9 +21,9 @@  discard block
 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) === true)
24
+		if (isset($placeholder)===true)
25 25
 			$field->setPlaceholder($placeholder);
26
-		if (isset($icon) === true)
26
+		if (isset($icon)===true)
27 27
 			$field->addIcon($icon, Direction::RIGHT);
28 28
 		$field->getField()->setClass("prompt");
29 29
 		$this->content["field"]=$field;
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 
33 33
 	private function createResult() {
34
-		$this->content["result"]=new HtmlSemDoubleElement("results-" . $this->identifier, "div", "results");
34
+		$this->content["result"]=new HtmlSemDoubleElement("results-".$this->identifier, "div", "results");
35 35
 		return $this->content["result"];
36 36
 	}
37 37
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	public function setUrl($url) {
49
-		$this->_params["apiSettings"]="%{url: %quote%" . $url . "%quote%}%";
49
+		$this->_params["apiSettings"]="%{url: %quote%".$url."%quote%}%";
50 50
 		return $this;
51 51
 	}
52 52
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	public function run(JsUtils $js) {
68 68
 		$searchFields=\json_encode($this->_searchFields);
69 69
 		$searchFields=str_ireplace("\"", "%quote%", $searchFields);
70
-		$this->_params["searchFields"]="%" . $searchFields . "%";
71
-		if ($this->getType() === "standard")
70
+		$this->_params["searchFields"]="%".$searchFields."%";
71
+		if ($this->getType()==="standard")
72 72
 			$this->_params["source"]="%content%";
73
-		$this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
74
-		if (isset($this->_bsComponent) === false) {
75
-			$this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params);
73
+		$this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";");
74
+		if (isset($this->_bsComponent)===false) {
75
+			$this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params);
76 76
 		}
77 77
 		$this->addEventsOnRun($js);
78 78
 		return $this->_bsComponent;
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,12 @@  discard block
 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) === true)
25
-			$field->setPlaceholder($placeholder);
26
-		if (isset($icon) === true)
27
-			$field->addIcon($icon, Direction::RIGHT);
24
+		if (isset($placeholder) === true) {
25
+					$field->setPlaceholder($placeholder);
26
+		}
27
+		if (isset($icon) === true) {
28
+					$field->addIcon($icon, Direction::RIGHT);
29
+		}
28 30
 		$field->getField()->setClass("prompt");
29 31
 		$this->content["field"]=$field;
30 32
 		return $field;
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 		$searchFields=\json_encode($this->_searchFields);
69 71
 		$searchFields=str_ireplace("\"", "%quote%", $searchFields);
70 72
 		$this->_params["searchFields"]="%" . $searchFields . "%";
71
-		if ($this->getType() === "standard")
72
-			$this->_params["source"]="%content%";
73
+		if ($this->getType() === "standard") {
74
+					$this->_params["source"]="%content%";
75
+		}
73 76
 		$this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";");
74 77
 		if (isset($this->_bsComponent) === false) {
75 78
 			$this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params);
Please login to merge, or discard this patch.