@@ -8,11 +8,11 @@ discard block |
||
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 | } |
@@ -23,42 +23,42 @@ discard block |
||
23 | 23 | $this->elements[]=$object; |
24 | 24 | return $this; |
25 | 25 | } |
26 | - if (\is_array($object) === false) { |
|
27 | - $object=[ "title" => $object ]; |
|
26 | + if (\is_array($object)===false) { |
|
27 | + $object=["title" => $object]; |
|
28 | 28 | } |
29 | 29 | $this->elements[]=new SearchResult($object); |
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | 33 | public function addResults($objects) { |
34 | - if (\is_array($objects) === false) { |
|
34 | + if (\is_array($objects)===false) { |
|
35 | 35 | return $this->addResult($objects); |
36 | 36 | } |
37 | - if (JArray::dimension($objects) === 1) { |
|
38 | - foreach ( $objects as $object ) { |
|
39 | - $this->addResult([ "title" => $object ]); |
|
37 | + if (JArray::dimension($objects)===1) { |
|
38 | + foreach ($objects as $object) { |
|
39 | + $this->addResult(["title" => $object]); |
|
40 | 40 | } |
41 | - } else |
|
41 | + }else |
|
42 | 42 | $this->elements=\array_merge($this->elements, $objects); |
43 | 43 | return $this; |
44 | 44 | } |
45 | 45 | |
46 | 46 | public function _search($query, $field="title") { |
47 | - $result=array (); |
|
48 | - foreach ( $this->elements as $element ) { |
|
47 | + $result=array(); |
|
48 | + foreach ($this->elements as $element) { |
|
49 | 49 | if ($element instanceof SearchResult) { |
50 | - if ($element->search($query, $field) !== false) |
|
50 | + if ($element->search($query, $field)!==false) |
|
51 | 51 | $result[]=$element->asArray(); |
52 | - } else { |
|
52 | + }else { |
|
53 | 53 | if (\array_key_exists($field, $element)) { |
54 | 54 | $value=$element[$field]; |
55 | - if (\stripos($value, $query) !== false) { |
|
55 | + if (\stripos($value, $query)!==false) { |
|
56 | 56 | $result[]=$element; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | - if (\sizeof($result) > 0) { |
|
61 | + if (\sizeof($result)>0) { |
|
62 | 62 | return $result; |
63 | 63 | } |
64 | 64 | return false; |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | public function search($query, $field="title") { |
68 | 68 | $result=$this->_search($query, $field); |
69 | - if ($result === false) |
|
69 | + if ($result===false) |
|
70 | 70 | $result=NULL; |
71 | 71 | return new SearchResults($result); |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function __toString() { |
75 | - $result="\"results\": " . \json_encode($this->elements); |
|
75 | + $result="\"results\": ".\json_encode($this->elements); |
|
76 | 76 | return $result; |
77 | 77 | } |
78 | 78 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | public function getResponse() { |
84 | - return "{" . $this . "}"; |
|
84 | + return "{".$this."}"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | foreach ( $objects as $object ) { |
39 | 39 | $this->addResult([ "title" => $object ]); |
40 | 40 | } |
41 | - } else |
|
42 | - $this->elements=\array_merge($this->elements, $objects); |
|
41 | + } else { |
|
42 | + $this->elements=\array_merge($this->elements, $objects); |
|
43 | + } |
|
43 | 44 | return $this; |
44 | 45 | } |
45 | 46 | |
@@ -47,8 +48,9 @@ discard block |
||
47 | 48 | $result=array (); |
48 | 49 | foreach ( $this->elements as $element ) { |
49 | 50 | if ($element instanceof SearchResult) { |
50 | - if ($element->search($query, $field) !== false) |
|
51 | - $result[]=$element->asArray(); |
|
51 | + if ($element->search($query, $field) !== false) { |
|
52 | + $result[]=$element->asArray(); |
|
53 | + } |
|
52 | 54 | } else { |
53 | 55 | if (\array_key_exists($field, $element)) { |
54 | 56 | $value=$element[$field]; |
@@ -66,8 +68,9 @@ discard block |
||
66 | 68 | |
67 | 69 | public function search($query, $field="title") { |
68 | 70 | $result=$this->_search($query, $field); |
69 | - if ($result === false) |
|
70 | - $result=NULL; |
|
71 | + if ($result === false) { |
|
72 | + $result=NULL; |
|
73 | + } |
|
71 | 74 | return new SearchResults($result); |
72 | 75 | } |
73 | 76 |
@@ -58,6 +58,9 @@ discard block |
||
58 | 58 | return $this->addComponent(new Accordion($this->js), $attachTo, $params); |
59 | 59 | } |
60 | 60 | |
61 | + /** |
|
62 | + * @param string $attachTo |
|
63 | + */ |
|
61 | 64 | public function sticky($attachTo=NULL, $params=NULL) { |
62 | 65 | return $this->addComponent(new Sticky($this->js), $attachTo, $params); |
63 | 66 | } |
@@ -66,18 +69,30 @@ discard block |
||
66 | 69 | return $this->addComponent(new Checkbox($this->js), $attachTo, $params); |
67 | 70 | } |
68 | 71 | |
72 | + /** |
|
73 | + * @param string $attachTo |
|
74 | + */ |
|
69 | 75 | public function rating($attachTo=NULL, $params=NULL) { |
70 | 76 | return $this->addComponent(new Rating($this->js), $attachTo, $params); |
71 | 77 | } |
72 | 78 | |
79 | + /** |
|
80 | + * @param string $attachTo |
|
81 | + */ |
|
73 | 82 | public function progress($attachTo=NULL, $params=NULL) { |
74 | 83 | return $this->addComponent(new Progress($this->js), $attachTo, $params); |
75 | 84 | } |
76 | 85 | |
86 | + /** |
|
87 | + * @param string $attachTo |
|
88 | + */ |
|
77 | 89 | public function search($attachTo=NULL, $params=NULL) { |
78 | 90 | return $this->addComponent(new Search($this->js), $attachTo, $params); |
79 | 91 | } |
80 | 92 | |
93 | + /** |
|
94 | + * @param string $attachTo |
|
95 | + */ |
|
81 | 96 | public function dimmer($attachTo=NULL, $params=NULL) { |
82 | 97 | return $this->addComponent(new Dimmer($this->js), $attachTo, $params); |
83 | 98 | } |
@@ -100,11 +100,11 @@ |
||
100 | 100 | public function htmlIconGroups($identifier, $size="", $icons=array()) { |
101 | 101 | $group=new HtmlIconGroups($identifier, $size); |
102 | 102 | if (JArray::isAssociative($icons)) { |
103 | - foreach ( $icons as $icon => $size ) { |
|
103 | + foreach ($icons as $icon => $size) { |
|
104 | 104 | $group->add($icon, $size); |
105 | 105 | } |
106 | - } else { |
|
107 | - foreach ( $icons as $icon ) { |
|
106 | + }else { |
|
107 | + foreach ($icons as $icon) { |
|
108 | 108 | $group->add($icon); |
109 | 109 | } |
110 | 110 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | class HtmlDimmer extends HtmlSemDoubleElement { |
11 | 11 | private $_container; |
12 | - private $_params=array (); |
|
12 | + private $_params=array(); |
|
13 | 13 | private $_inverted; |
14 | 14 | |
15 | 15 | public function __construct($identifier, $content=NULL) { |
@@ -19,14 +19,14 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | public function setContent($content) { |
22 | - $this->content=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
22 | + $this->content=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", new HtmlSemDoubleElement("", "div", "center", $content)); |
|
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
27 | - $header=new HtmlHeader("header-" . $this->identifier); |
|
27 | + $header=new HtmlHeader("header-".$this->identifier); |
|
28 | 28 | $header->asIcon($icon, $title, $subHeader); |
29 | - if ($this->_inverted === false) |
|
29 | + if ($this->_inverted===false) |
|
30 | 30 | $header->setInverted(); |
31 | 31 | return $this->setContent($header); |
32 | 32 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | public function run(JsUtils $js) { |
45 | 45 | if ($this->_container instanceof HtmlSingleElement) |
46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
46 | + $this->_bsComponent=$js->semantic()->dimmer("#".$this->_container->getIdentifier(), $this->_params); |
|
47 | 47 | return parent::run($js); |
48 | 48 | } |
49 | 49 | |
50 | 50 | public function jsShow() { |
51 | - if (isset($this->_container) === true) |
|
52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
51 | + if (isset($this->_container)===true) |
|
52 | + return '$("#.'.$this->_container->getIdentifier().').dimmer("show");'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function setBlurring() { |
@@ -26,8 +26,9 @@ discard block |
||
26 | 26 | public function asIcon($icon, $title, $subHeader=NULL) { |
27 | 27 | $header=new HtmlHeader("header-" . $this->identifier); |
28 | 28 | $header->asIcon($icon, $title, $subHeader); |
29 | - if ($this->_inverted === false) |
|
30 | - $header->setInverted(); |
|
29 | + if ($this->_inverted === false) { |
|
30 | + $header->setInverted(); |
|
31 | + } |
|
31 | 32 | return $this->setContent($header); |
32 | 33 | } |
33 | 34 | |
@@ -42,14 +43,16 @@ discard block |
||
42 | 43 | } |
43 | 44 | |
44 | 45 | public function run(JsUtils $js) { |
45 | - if ($this->_container instanceof HtmlSingleElement) |
|
46 | - $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
46 | + if ($this->_container instanceof HtmlSingleElement) { |
|
47 | + $this->_bsComponent=$js->semantic()->dimmer("#" . $this->_container->getIdentifier(), $this->_params); |
|
48 | + } |
|
47 | 49 | return parent::run($js); |
48 | 50 | } |
49 | 51 | |
50 | 52 | public function jsShow() { |
51 | - if (isset($this->_container) === true) |
|
52 | - return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
53 | + if (isset($this->_container) === true) { |
|
54 | + return '$("#.' . $this->_container->getIdentifier() . ').dimmer("show");'; |
|
55 | + } |
|
53 | 56 | } |
54 | 57 | |
55 | 58 | public function setBlurring() { |
@@ -46,16 +46,16 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | public function addDimmer($content=NULL) { |
49 | - $dimmer=new HtmlDimmer("dimmer-" . $this->identifier, $content); |
|
49 | + $dimmer=new HtmlDimmer("dimmer-".$this->identifier, $content); |
|
50 | 50 | $this->addContent($dimmer); |
51 | 51 | return $dimmer; |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function jsShowDimmer($show=true) { |
55 | 55 | $status="hide"; |
56 | - if ($show === true) |
|
56 | + if ($show===true) |
|
57 | 57 | $status="show"; |
58 | - return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
|
58 | + return '$("#.'.$this->identifier.').dimmer("'.$status.'");'; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | public function run(JsUtils $js) { |
68 | - $this->_bsComponent=$js->semantic()->generic("#" . $this->identifier); |
|
68 | + $this->_bsComponent=$js->semantic()->generic("#".$this->identifier); |
|
69 | 69 | parent::run($js); |
70 | 70 | $this->addEventsOnRun($js); |
71 | 71 | if (isset($this->_popup)) { |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | } |
30 | 30 | |
31 | 31 | public function setPopupAttributes($variation=NULL, $popupEvent=NULL) { |
32 | - if (isset($this->_popup)) |
|
33 | - $this->_popup->setAttributes($variation, $popupEvent); |
|
32 | + if (isset($this->_popup)) { |
|
33 | + $this->_popup->setAttributes($variation, $popupEvent); |
|
34 | + } |
|
34 | 35 | } |
35 | 36 | |
36 | 37 | public function addPopup($title="", $content="", $variation=NULL, $params=array()) { |
@@ -53,14 +54,16 @@ discard block |
||
53 | 54 | |
54 | 55 | public function jsShowDimmer($show=true) { |
55 | 56 | $status="hide"; |
56 | - if ($show === true) |
|
57 | - $status="show"; |
|
57 | + if ($show === true) { |
|
58 | + $status="show"; |
|
59 | + } |
|
58 | 60 | return '$("#.' . $this->identifier . ').dimmer("' . $status . '");'; |
59 | 61 | } |
60 | 62 | |
61 | 63 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
62 | - if (isset($this->_popup)) |
|
63 | - $this->_popup->compile(); |
|
64 | + if (isset($this->_popup)) { |
|
65 | + $this->_popup->compile(); |
|
66 | + } |
|
64 | 67 | return parent::compile($js, $view); |
65 | 68 | } |
66 | 69 |
@@ -109,8 +109,9 @@ discard block |
||
109 | 109 | |
110 | 110 | public function setCircular($inverted=false) { |
111 | 111 | $invertedStr=""; |
112 | - if ($inverted !== false) |
|
113 | - $invertedStr=" inverted"; |
|
112 | + if ($inverted !== false) { |
|
113 | + $invertedStr=" inverted"; |
|
114 | + } |
|
114 | 115 | return $this->addToMember($this->attributes, "circular" . $invertedStr); |
115 | 116 | } |
116 | 117 | |
@@ -133,8 +134,9 @@ discard block |
||
133 | 134 | */ |
134 | 135 | public function setBordered($inverted=false) { |
135 | 136 | $invertedStr=""; |
136 | - if ($inverted !== false) |
|
137 | - $invertedStr=" inverted"; |
|
137 | + if ($inverted !== false) { |
|
138 | + $invertedStr=" inverted"; |
|
139 | + } |
|
138 | 140 | return $this->addToMember($this->attributes, "bordered" . $invertedStr); |
139 | 141 | } |
140 | 142 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return \Ajax\semantic\html\HtmlIcon |
86 | 86 | */ |
87 | 87 | public function setFlipped($sens="horizontally") { |
88 | - return $this->addToMember($this->attributes, "flipped " . $sens); |
|
88 | + return $this->addToMember($this->attributes, "flipped ".$sens); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | * @return \Ajax\semantic\html\HtmlIcon |
95 | 95 | */ |
96 | 96 | public function setRotated($sens="clockwise") { |
97 | - return $this->addToMember($this->attributes, "rotated " . $sens); |
|
97 | + return $this->addToMember($this->attributes, "rotated ".$sens); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | public function setFloated($direction="right") { |
101 | - return $this->addToMemberCtrl($this->attributes, $direction . " floated", Direction::getConstantValues("floated")); |
|
101 | + return $this->addToMemberCtrl($this->attributes, $direction." floated", Direction::getConstantValues("floated")); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -107,16 +107,16 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function asLink($href=NULL) { |
109 | 109 | if (isset($href)) { |
110 | - $this->wrap("<a href='" . $href . "'>", "</a>"); |
|
110 | + $this->wrap("<a href='".$href."'>", "</a>"); |
|
111 | 111 | } |
112 | 112 | return $this->addToMember($this->attributes, "link"); |
113 | 113 | } |
114 | 114 | |
115 | 115 | public function setCircular($inverted=false) { |
116 | 116 | $invertedStr=""; |
117 | - if ($inverted !== false) |
|
117 | + if ($inverted!==false) |
|
118 | 118 | $invertedStr=" inverted"; |
119 | - return $this->addToMember($this->attributes, "circular" . $invertedStr); |
|
119 | + return $this->addToMember($this->attributes, "circular".$invertedStr); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function setBordered($inverted=false) { |
140 | 140 | $invertedStr=""; |
141 | - if ($inverted !== false) |
|
141 | + if ($inverted!==false) |
|
142 | 142 | $invertedStr=" inverted"; |
143 | - return $this->addToMember($this->attributes, "bordered" . $invertedStr); |
|
143 | + return $this->addToMember($this->attributes, "bordered".$invertedStr); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -11,8 +11,9 @@ discard block |
||
11 | 11 | public function __construct($identifier, $src="", $alt="", $size=NULL) { |
12 | 12 | $image=new HtmlImg("img-", $src, $alt); |
13 | 13 | parent::__construct($identifier, "div", "ui image", $image); |
14 | - if (isset($size)) |
|
15 | - $this->setSize($size); |
|
14 | + if (isset($size)) { |
|
15 | + $this->setSize($size); |
|
16 | + } |
|
16 | 17 | } |
17 | 18 | |
18 | 19 | public function setCircular() { |
@@ -20,8 +21,9 @@ discard block |
||
20 | 21 | } |
21 | 22 | |
22 | 23 | public function asAvatar($caption=NULL) { |
23 | - if (isset($caption)) |
|
24 | - $this->wrap("", $caption); |
|
24 | + if (isset($caption)) { |
|
25 | + $this->wrap("", $caption); |
|
26 | + } |
|
25 | 27 | return $this->addToProperty("class", "avatar"); |
26 | 28 | } |
27 | 29 |
@@ -12,10 +12,10 @@ discard block |
||
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 | - } else { |
|
18 | + }else { |
|
19 | 19 | $output=self::wrapObjects($input, $js, $separator, $valueQuote); |
20 | 20 | } |
21 | 21 | } |
@@ -24,31 +24,31 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | - foreach ( $input as $v ) { |
|
28 | - if (\is_object($v) === true || \is_array($v)) |
|
27 | + foreach ($input as $v) { |
|
28 | + if (\is_object($v)===true || \is_array($v)) |
|
29 | 29 | return true; |
30 | 30 | } |
31 | 31 | return false; |
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 | - } else { |
|
39 | + }else { |
|
40 | 40 | $result=implode($separator, array_values($input)); |
41 | 41 | } |
42 | 42 | return $result; |
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)) { |
50 | 50 | return self::wrap($v, $js, $separator, $valueQuote); |
51 | - } else |
|
51 | + }else |
|
52 | 52 | return $v; |
53 | 53 | }, $input)); |
54 | 54 | } |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | private static function containsElement($input) { |
27 | 27 | foreach ( $input as $v ) { |
28 | - if (\is_object($v) === true || \is_array($v)) |
|
29 | - return true; |
|
28 | + if (\is_object($v) === true || \is_array($v)) { |
|
29 | + return true; |
|
30 | + } |
|
30 | 31 | } |
31 | 32 | return false; |
32 | 33 | } |
@@ -44,12 +45,13 @@ discard block |
||
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 |
@@ -24,8 +24,8 @@ |
||
24 | 24 | use Ajax\semantic\traits\SemanticHtmlViewsTrait; |
25 | 25 | |
26 | 26 | class Semantic extends BaseGui { |
27 | - use SemanticComponentsTrait,SemanticHtmlElementsTrait,SemanticHtmlCollectionsTrait, |
|
28 | - SemanticHtmlModulesTrait,SemanticHtmlViewsTrait; |
|
27 | + use SemanticComponentsTrait, SemanticHtmlElementsTrait, SemanticHtmlCollectionsTrait, |
|
28 | + SemanticHtmlModulesTrait, SemanticHtmlViewsTrait; |
|
29 | 29 | |
30 | 30 | public function __construct($autoCompile=true) { |
31 | 31 | parent::__construct($autoCompile=true); |