@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | return $this->getHtmlCk()->attachEvents($events); |
39 | 39 | } |
40 | 40 | |
41 | - public function getField(){ |
|
41 | + public function getField() { |
|
42 | 42 | return $this->content["field"]; |
43 | 43 | } |
44 | 44 | |
45 | - public function getHtmlCk(){ |
|
45 | + public function getHtmlCk() { |
|
46 | 46 | return $this->content["field"]; |
47 | 47 | } |
48 | 48 | |
49 | - public function getDataField(){ |
|
50 | - $field= $this->getField(); |
|
51 | - if($field instanceof AbstractCheckbox) |
|
49 | + public function getDataField() { |
|
50 | + $field=$this->getField(); |
|
51 | + if ($field instanceof AbstractCheckbox) |
|
52 | 52 | $field=$field->getField(); |
53 | 53 | return $field; |
54 | 54 | } |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * @param boolean $value |
59 | 59 | * @return HtmlFormField |
60 | 60 | */ |
61 | - public function setChecked($value=true){ |
|
62 | - if($value===true){ |
|
61 | + public function setChecked($value=true) { |
|
62 | + if ($value===true) { |
|
63 | 63 | $this->getDataField()->setProperty("checked", "checked"); |
64 | - }else{ |
|
64 | + } else { |
|
65 | 65 | $this->getDataField()->removeProperty("checked"); |
66 | 66 | } |
67 | 67 | return $this; |
@@ -8,16 +8,16 @@ |
||
8 | 8 | class HtmlFormInput extends HtmlFormField { |
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
12 | - if(!isset($placeholder) && $type==="text") |
|
11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
12 | + if (!isset($placeholder) && $type==="text") |
|
13 | 13 | $placeholder=$label; |
14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
15 | 15 | $this->_identifier=$identifier; |
16 | 16 | } |
17 | 17 | |
18 | - public function getDataField(){ |
|
19 | - $field= $this->getField(); |
|
20 | - if($field instanceof HtmlInput) |
|
18 | + public function getDataField() { |
|
19 | + $field=$this->getField(); |
|
20 | + if ($field instanceof HtmlInput) |
|
21 | 21 | $field=$field->getDataField(); |
22 | 22 | return $field; |
23 | 23 | } |
@@ -9,16 +9,18 @@ |
||
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
12 | - if(!isset($placeholder) && $type==="text") |
|
13 | - $placeholder=$label; |
|
12 | + if(!isset($placeholder) && $type==="text") { |
|
13 | + $placeholder=$label; |
|
14 | + } |
|
14 | 15 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
15 | 16 | $this->_identifier=$identifier; |
16 | 17 | } |
17 | 18 | |
18 | 19 | public function getDataField(){ |
19 | 20 | $field= $this->getField(); |
20 | - if($field instanceof HtmlInput) |
|
21 | - $field=$field->getDataField(); |
|
21 | + if($field instanceof HtmlInput) { |
|
22 | + $field=$field->getDataField(); |
|
23 | + } |
|
22 | 24 | return $field; |
23 | 25 | } |
24 | 26 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
59 | + if ($value===true) |
|
60 | 60 | $this->setProperty("tabindex", "0"); |
61 | 61 | else { |
62 | 62 | $this->removeProperty("tabindex"); |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | |
67 | 67 | public function setAnimated($content, $animation="") { |
68 | 68 | $this->setTagName("div"); |
69 | - $this->addToProperty("class", "animated " . $animation); |
|
70 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
69 | + $this->addToProperty("class", "animated ".$animation); |
|
70 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
71 | 71 | $visible->setClass("visible content"); |
72 | 72 | $visible->setContent($this->content); |
73 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
73 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
74 | 74 | $hidden->setClass("hidden content"); |
75 | 75 | $hidden->setContent($content); |
76 | - $this->content=array ($visible,$hidden ); |
|
76 | + $this->content=array($visible, $hidden); |
|
77 | 77 | return $hidden; |
78 | 78 | } |
79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function asIcon($icon) { |
86 | 86 | $iconO=$icon; |
87 | 87 | if (\is_string($icon)) { |
88 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
88 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
89 | 89 | } |
90 | 90 | $this->addToProperty("class", "icon"); |
91 | 91 | $this->content=$iconO; |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | * @return HtmlLabel |
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | - $this->tagName="div";$prefix=""; |
|
109 | - if($before) |
|
108 | + $this->tagName="div"; $prefix=""; |
|
109 | + if ($before) |
|
110 | 110 | $prefix="left "; |
111 | 111 | $this->addToProperty("class", $prefix."labeled"); |
112 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
112 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
113 | 113 | $this->content->setTagName("div"); |
114 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
114 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
115 | 115 | $label->setBasic(); |
116 | 116 | $this->addContent($label, $before); |
117 | 117 | return $label; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function fromArray($array) { |
125 | 125 | $array=parent::fromArray($array); |
126 | - foreach ( $array as $key => $value ) { |
|
126 | + foreach ($array as $key => $value) { |
|
127 | 127 | $this->setProperty($key, $value); |
128 | 128 | } |
129 | 129 | return $array; |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | return $this->addToProperty("class", "positive"); |
138 | 138 | } |
139 | 139 | |
140 | - public function setColor($color){ |
|
141 | - if(\is_array($this->content)){ |
|
142 | - foreach ($this->content as $content){ |
|
143 | - if($content instanceof HtmlButton) |
|
140 | + public function setColor($color) { |
|
141 | + if (\is_array($this->content)) { |
|
142 | + foreach ($this->content as $content) { |
|
143 | + if ($content instanceof HtmlButton) |
|
144 | 144 | $content->setColor($color); |
145 | 145 | } |
146 | 146 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return HtmlButton |
199 | 199 | */ |
200 | 200 | public static function social($identifier, $social, $value=NULL) { |
201 | - if ($value === NULL) |
|
201 | + if ($value===NULL) |
|
202 | 202 | $value=\ucfirst($social); |
203 | 203 | $return=new HtmlButton($identifier, $value); |
204 | 204 | $return->addIcon($social); |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | * {@inheritDoc} |
236 | 236 | * @see HtmlSemDoubleElement::asLink() |
237 | 237 | */ |
238 | - public function asLink($href=NULL,$target=NULL) { |
|
239 | - $lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content,$target); |
|
238 | + public function asLink($href=NULL, $target=NULL) { |
|
239 | + $lnk=new HtmlLink("lnk-".$this->identifier, $href, $this->content, $target); |
|
240 | 240 | $this->content=$lnk; |
241 | 241 | return $this; |
242 | 242 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
60 | - $this->setProperty("tabindex", "0"); |
|
61 | - else { |
|
59 | + if ($value === true) { |
|
60 | + $this->setProperty("tabindex", "0"); |
|
61 | + } else { |
|
62 | 62 | $this->removeProperty("tabindex"); |
63 | 63 | } |
64 | 64 | return $this; |
@@ -106,8 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | 108 | $this->tagName="div";$prefix=""; |
109 | - if($before) |
|
110 | - $prefix="left "; |
|
109 | + if($before) { |
|
110 | + $prefix="left "; |
|
111 | + } |
|
111 | 112 | $this->addToProperty("class", $prefix."labeled"); |
112 | 113 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
113 | 114 | $this->content->setTagName("div"); |
@@ -140,12 +141,13 @@ discard block |
||
140 | 141 | public function setColor($color){ |
141 | 142 | if(\is_array($this->content)){ |
142 | 143 | foreach ($this->content as $content){ |
143 | - if($content instanceof HtmlButton) |
|
144 | - $content->setColor($color); |
|
144 | + if($content instanceof HtmlButton) { |
|
145 | + $content->setColor($color); |
|
146 | + } |
|
145 | 147 | } |
148 | + } else { |
|
149 | + parent::setColor($color); |
|
146 | 150 | } |
147 | - else |
|
148 | - parent::setColor($color); |
|
149 | 151 | return $this; |
150 | 152 | } |
151 | 153 | |
@@ -198,8 +200,9 @@ discard block |
||
198 | 200 | * @return HtmlButton |
199 | 201 | */ |
200 | 202 | public static function social($identifier, $social, $value=NULL) { |
201 | - if ($value === NULL) |
|
202 | - $value=\ucfirst($social); |
|
203 | + if ($value === NULL) { |
|
204 | + $value=\ucfirst($social); |
|
205 | + } |
|
203 | 206 | $return=new HtmlButton($identifier, $value); |
204 | 207 | $return->addIcon($social); |
205 | 208 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -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)) |
|
26 | - $field->setPlaceholder($placeholder); |
|
27 | - if (isset($icon)) |
|
28 | - $field->addIcon($icon, Direction::RIGHT); |
|
25 | + if (isset($placeholder)) { |
|
26 | + $field->setPlaceholder($placeholder); |
|
27 | + } |
|
28 | + if (isset($icon)) { |
|
29 | + $field->addIcon($icon, Direction::RIGHT); |
|
30 | + } |
|
29 | 31 | $field->getDataField()->setClass("prompt"); |
30 | 32 | $this->content["field"]=$field; |
31 | 33 | return $field; |
@@ -15,113 +15,113 @@ discard block |
||
15 | 15 | protected $_paramParts=array(); |
16 | 16 | |
17 | 17 | public function __construct($identifier, $header="", $content="", $actions=null) { |
18 | - parent::__construct($identifier, "div","ui modal"); |
|
19 | - if(isset($header)){ |
|
18 | + parent::__construct($identifier, "div", "ui modal"); |
|
19 | + if (isset($header)) { |
|
20 | 20 | $this->setHeader($header); |
21 | 21 | } |
22 | - if(isset($content)){ |
|
22 | + if (isset($content)) { |
|
23 | 23 | $this->setContent($content); |
24 | 24 | } |
25 | - if(isset($actions)){ |
|
25 | + if (isset($actions)) { |
|
26 | 26 | $this->setActions($actions); |
27 | 27 | } |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setHeader($value) { |
31 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
31 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
32 | 32 | return $this; |
33 | 33 | } |
34 | 34 | |
35 | 35 | public function setContent($value) { |
36 | - $this->content["content"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "content", $value); |
|
36 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content", $value); |
|
37 | 37 | return $this; |
38 | 38 | } |
39 | 39 | |
40 | 40 | public function setActions($actions) { |
41 | - $this->content["actions"]=new HtmlSemDoubleElement("content-" . $this->identifier, "div", "actions"); |
|
42 | - if(\is_array($actions)){ |
|
43 | - foreach ($actions as $action){ |
|
41 | + $this->content["actions"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "actions"); |
|
42 | + if (\is_array($actions)) { |
|
43 | + foreach ($actions as $action) { |
|
44 | 44 | $this->addAction($action); |
45 | 45 | } |
46 | 46 | } |
47 | - else{ |
|
47 | + else { |
|
48 | 48 | $this->addAction($actions); |
49 | 49 | } |
50 | 50 | return $this; |
51 | 51 | } |
52 | 52 | |
53 | - public function addAction($action){ |
|
54 | - if(!$action instanceof BaseHtml){ |
|
53 | + public function addAction($action) { |
|
54 | + if (!$action instanceof BaseHtml) { |
|
55 | 55 | $class=""; |
56 | - if(\array_search($action, ["Okay","Yes"])!==false){ |
|
56 | + if (\array_search($action, ["Okay", "Yes"])!==false) { |
|
57 | 57 | $class="approve"; |
58 | 58 | } |
59 | - if(\array_search($action, ["Close","Cancel","No"])!==false){ |
|
59 | + if (\array_search($action, ["Close", "Cancel", "No"])!==false) { |
|
60 | 60 | $class="cancel"; |
61 | 61 | } |
62 | - $action=new HtmlButton("action-".$this->identifier,$action); |
|
63 | - if($class!=="") |
|
62 | + $action=new HtmlButton("action-".$this->identifier, $action); |
|
63 | + if ($class!=="") |
|
64 | 64 | $action->addToProperty("class", $class); |
65 | 65 | } |
66 | 66 | return $this->addElementInPart($action, "actions"); |
67 | 67 | } |
68 | 68 | |
69 | - public function addContent($content,$before=false){ |
|
70 | - $this->content["content"]->addContent($content,$before); |
|
69 | + public function addContent($content, $before=false) { |
|
70 | + $this->content["content"]->addContent($content, $before); |
|
71 | 71 | return $this; |
72 | 72 | } |
73 | 73 | |
74 | - public function addImageContent($image,$description=NULL){ |
|
74 | + public function addImageContent($image, $description=NULL) { |
|
75 | 75 | $content=$this->content["content"]; |
76 | - if(isset($description)){ |
|
77 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
78 | - $content->addContent($description,true); |
|
76 | + if (isset($description)) { |
|
77 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
78 | + $content->addContent($description, true); |
|
79 | 79 | } |
80 | - if($image!==""){ |
|
81 | - $img=new HtmlImage("image-".$this->identifier,$image,"","medium"); |
|
82 | - $content->addContent($img,true); |
|
83 | - $content->addToProperty("class","image"); |
|
80 | + if ($image!=="") { |
|
81 | + $img=new HtmlImage("image-".$this->identifier, $image, "", "medium"); |
|
82 | + $content->addContent($img, true); |
|
83 | + $content->addToProperty("class", "image"); |
|
84 | 84 | } |
85 | 85 | return $this; |
86 | 86 | } |
87 | 87 | |
88 | - public function addIconContent($icon,$description=NULL){ |
|
88 | + public function addIconContent($icon, $description=NULL) { |
|
89 | 89 | $content=$this->content["content"]; |
90 | - if(isset($description)){ |
|
91 | - $description=new HtmlSemDoubleElement("description-".$this->identifier,"div","description",$description); |
|
92 | - $content->addContent($description,true); |
|
90 | + if (isset($description)) { |
|
91 | + $description=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $description); |
|
92 | + $content->addContent($description, true); |
|
93 | 93 | } |
94 | - if($icon!==""){ |
|
95 | - $img=new HtmlIcon("image-".$this->identifier,$icon); |
|
96 | - $content->addContent($img,true); |
|
97 | - $content->addToProperty("class","image"); |
|
94 | + if ($icon!=="") { |
|
95 | + $img=new HtmlIcon("image-".$this->identifier, $icon); |
|
96 | + $content->addContent($img, true); |
|
97 | + $content->addToProperty("class", "image"); |
|
98 | 98 | } |
99 | 99 | return $this; |
100 | 100 | } |
101 | 101 | |
102 | - private function addElementInPart($element,$part) { |
|
102 | + private function addElementInPart($element, $part) { |
|
103 | 103 | $this->content[$part]->addContent($element); |
104 | 104 | return $element; |
105 | 105 | } |
106 | 106 | |
107 | - public function showDimmer($value){ |
|
108 | - $value=$value?"show":"hide"; |
|
107 | + public function showDimmer($value) { |
|
108 | + $value=$value ? "show" : "hide"; |
|
109 | 109 | $this->_paramParts[]=["'".$value." dimmer'"]; |
110 | 110 | return $this; |
111 | 111 | } |
112 | 112 | |
113 | - public function setInverted($recursive=true){ |
|
113 | + public function setInverted($recursive=true) { |
|
114 | 114 | $this->_params["inverted"]=true; |
115 | 115 | return $this; |
116 | 116 | } |
117 | 117 | |
118 | - public function setBasic(){ |
|
118 | + public function setBasic() { |
|
119 | 119 | return $this->addToProperty("class", "basic"); |
120 | 120 | } |
121 | 121 | |
122 | 122 | |
123 | - public function setTransition($value){ |
|
124 | - $this->_paramParts[]=["'setting'","'transition'","'".$value."'"]; |
|
123 | + public function setTransition($value) { |
|
124 | + $this->_paramParts[]=["'setting'", "'transition'", "'".$value."'"]; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param string $viewName |
132 | 132 | * @param $params The parameters to pass to the view |
133 | 133 | */ |
134 | - public function renderView(JsUtils $js,$initialController,$viewName, $params=array()) { |
|
135 | - return $this->setContent($js->renderContent($initialController, $viewName,$params)); |
|
134 | + public function renderView(JsUtils $js, $initialController, $viewName, $params=array()) { |
|
135 | + return $this->setContent($js->renderContent($initialController, $viewName, $params)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | * @param string $actionName the action name |
144 | 144 | * @param array $params |
145 | 145 | */ |
146 | - public function forward(JsUtils $js,$initialControllerInstance,$controllerName,$actionName,$params=NULL){ |
|
147 | - return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName,$params)); |
|
146 | + public function forward(JsUtils $js, $initialControllerInstance, $controllerName, $actionName, $params=NULL) { |
|
147 | + return $this->setContent($js->forward($initialControllerInstance, $controllerName, $actionName, $params)); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
155 | 155 | */ |
156 | 156 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
157 | - $this->content=JArray::sortAssociative($this->content, ["header","content","actions" ]); |
|
157 | + $this->content=JArray::sortAssociative($this->content, ["header", "content", "actions"]); |
|
158 | 158 | return parent::compile($js, $view); |
159 | 159 | } |
160 | 160 | /* |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * @see BaseHtml::run() |
163 | 163 | */ |
164 | 164 | public function run(JsUtils $js) { |
165 | - if(isset($this->_bsComponent)===false) |
|
166 | - $this->_bsComponent=$js->semantic()->modal("#".$this->identifier,$this->_params,$this->_paramParts); |
|
165 | + if (isset($this->_bsComponent)===false) |
|
166 | + $this->_bsComponent=$js->semantic()->modal("#".$this->identifier, $this->_params, $this->_paramParts); |
|
167 | 167 | $this->addEventsOnRun($js); |
168 | 168 | return $this->_bsComponent; |
169 | 169 | } |