@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | public function fromDatabaseObjects($objects, $function) { |
8 | 8 | if (isset($objects)) { |
9 | - foreach ( $objects as $object ) { |
|
9 | + foreach ($objects as $object) { |
|
10 | 10 | $this->fromDatabaseObject($object, $function); |
11 | 11 | } |
12 | 12 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function __construct($id=NULL, $title=NULL, $description=NULL, $image=NULL, $price=NULL) { |
13 | 13 | if (\is_array($id)) { |
14 | 14 | $this->fromArray($id); |
15 | - } else { |
|
15 | + }else { |
|
16 | 16 | $this->id=$id; |
17 | 17 | $this->title=$title; |
18 | 18 | $this->description=$description; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | public function fromArray($array) { |
70 | - foreach ( $array as $key => $value ) { |
|
70 | + foreach ($array as $key => $value) { |
|
71 | 71 | $this->{$key}=$value; |
72 | 72 | } |
73 | 73 | return $this; |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | |
76 | 76 | public function JsonSerialize() { |
77 | 77 | $vars=get_object_vars($this); |
78 | - $result=array (); |
|
79 | - foreach ( $vars as $k => $v ) { |
|
78 | + $result=array(); |
|
79 | + foreach ($vars as $k => $v) { |
|
80 | 80 | if (isset($v)) |
81 | 81 | $result[$k]=$v; |
82 | 82 | } |
@@ -77,8 +77,9 @@ |
||
77 | 77 | $vars=get_object_vars($this); |
78 | 78 | $result=array (); |
79 | 79 | foreach ( $vars as $k => $v ) { |
80 | - if (isset($v)) |
|
81 | - $result[$k]=$v; |
|
80 | + if (isset($v)) { |
|
81 | + $result[$k]=$v; |
|
82 | + } |
|
82 | 83 | } |
83 | 84 | return $result; |
84 | 85 | } |
@@ -8,13 +8,13 @@ discard block |
||
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 | private $_local=false; |
15 | 15 | |
16 | 16 | public function __construct($identifier, $placeholder=NULL, $icon=NULL) { |
17 | - parent::__construct("search-" . $identifier, "div", "ui search", array ()); |
|
17 | + parent::__construct("search-".$identifier, "div", "ui search", array()); |
|
18 | 18 | $this->createField($placeholder, $icon); |
19 | 19 | $this->createResult(); |
20 | 20 | $this->_params["type"]="standard"; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
24 | 24 | $field=new HtmlInput($this->identifier); |
25 | - if (isset($placeholder) === true) |
|
25 | + if (isset($placeholder)===true) |
|
26 | 26 | $field->setPlaceholder($placeholder); |
27 | - if (isset($icon) === true) |
|
27 | + if (isset($icon)===true) |
|
28 | 28 | $field->addIcon($icon, Direction::RIGHT); |
29 | 29 | $field->getField()->setClass("prompt"); |
30 | 30 | $this->content["field"]=$field; |
@@ -32,7 +32,7 @@ discard block |
||
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 |
||
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 | |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | public function run(JsUtils $js) { |
75 | 75 | $searchFields=\json_encode($this->_searchFields); |
76 | 76 | $searchFields=str_ireplace("\"", "%quote%", $searchFields); |
77 | - $this->_params["searchFields"]="%" . $searchFields . "%"; |
|
78 | - if ($this->_local === true) { |
|
77 | + $this->_params["searchFields"]="%".$searchFields."%"; |
|
78 | + if ($this->_local===true) { |
|
79 | 79 | $this->_params["source"]="%content%"; |
80 | - $this->addEvent("beforeExecute", "var content=" . $this->resultsToJson() . ";"); |
|
80 | + $this->addEvent("beforeExecute", "var content=".$this->resultsToJson().";"); |
|
81 | 81 | } |
82 | - if (isset($this->_bsComponent) === false) { |
|
83 | - $this->_bsComponent=$js->semantic()->search("#" . $this->identifier, $this->_params); |
|
82 | + if (isset($this->_bsComponent)===false) { |
|
83 | + $this->_bsComponent=$js->semantic()->search("#".$this->identifier, $this->_params); |
|
84 | 84 | } |
85 | 85 | $this->addEventsOnRun($js); |
86 | 86 | return $this->_bsComponent; |
@@ -22,10 +22,12 @@ |
||
22 | 22 | |
23 | 23 | private function createField($placeholder=NULL, $icon=NULL) { |
24 | 24 | $field=new HtmlInput($this->identifier); |
25 | - if (isset($placeholder) === true) |
|
26 | - $field->setPlaceholder($placeholder); |
|
27 | - if (isset($icon) === true) |
|
28 | - $field->addIcon($icon, Direction::RIGHT); |
|
25 | + if (isset($placeholder) === true) { |
|
26 | + $field->setPlaceholder($placeholder); |
|
27 | + } |
|
28 | + if (isset($icon) === true) { |
|
29 | + $field->addIcon($icon, Direction::RIGHT); |
|
30 | + } |
|
29 | 31 | $field->getField()->setClass("prompt"); |
30 | 32 | $this->content["field"]=$field; |
31 | 33 | return $field; |