@@ -14,6 +14,9 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class HtmlAccordion extends HtmlBsDoubleElement { |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $identifier |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($identifier, $tagName="div") { |
| 18 | 21 | parent::__construct($identifier, $tagName); |
| 19 | 22 | $this->setClass("panel-group"); |
@@ -22,6 +25,9 @@ discard block |
||
| 22 | 25 | $this->content=array (); |
| 23 | 26 | } |
| 24 | 27 | |
| 28 | + /** |
|
| 29 | + * @param string $title |
|
| 30 | + */ |
|
| 25 | 31 | public function addPanel($title, $content) { |
| 26 | 32 | $nb=sizeof($this->content)+1; |
| 27 | 33 | $panel=new HtmlPanel("panel-".$this->identifier."-".$nb); |
@@ -40,7 +46,6 @@ discard block |
||
| 40 | 46 | /** |
| 41 | 47 | * render the content of an existing view : $controller/$action and set the response to a new panel |
| 42 | 48 | * @param string $title The panel title |
| 43 | - * @param Controller $initialController |
|
| 44 | 49 | * @param View $view |
| 45 | 50 | * @param string $controller a Phalcon controller |
| 46 | 51 | * @param string $action a Phalcon action |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $this->setClass("panel-group"); |
| 20 | 20 | $this->setRole("tablist"); |
| 21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
| 22 | - $this->content=array (); |
|
| 22 | + $this->content=array(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addPanel($title, $content) { |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | * @param string $action a Phalcon action |
| 47 | 47 | * @param $params The parameters to pass to the view |
| 48 | 48 | */ |
| 49 | - public function renderContentPanel($title,JsUtils $js,$view, $controller, $action, $params=NULL) { |
|
| 50 | - return $this->addPanel($title, $initialController->jquery->renderContent($view, $controller, $action,$params)); |
|
| 49 | + public function renderContentPanel($title, JsUtils $js, $view, $controller, $action, $params=NULL) { |
|
| 50 | + return $this->addPanel($title, $initialController->jquery->renderContent($view, $controller, $action, $params)); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | * @param string $controller a Phalcon controller |
| 58 | 58 | * @param string $action a Phalcon action |
| 59 | 59 | */ |
| 60 | - public function forwardPanel($title,$initialController,$controller,$action){ |
|
| 60 | + public function forwardPanel($title, $initialController, $controller, $action) { |
|
| 61 | 61 | return $this->addPanel($title, $initialController->jquery->forward($initialController, $controller, $action)); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public function run(JsUtils $js) { |
| 65 | - foreach ( $this->content as $content ) { |
|
| 65 | + foreach ($this->content as $content) { |
|
| 66 | 66 | $content->run($js); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -124,6 +124,10 @@ discard block |
||
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | + /** |
|
| 128 | + * @param string $name |
|
| 129 | + * @param string[] $typeCtrl |
|
| 130 | + */ |
|
| 127 | 131 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | 132 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 129 | 133 | return $name=$value; |
@@ -139,22 +143,35 @@ discard block |
||
| 139 | 143 | return $this; |
| 140 | 144 | } |
| 141 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $name |
|
| 148 | + */ |
|
| 142 | 149 | protected function removePropertyValue($name, $value) { |
| 143 | 150 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 144 | 151 | return $this; |
| 145 | 152 | } |
| 146 | 153 | |
| 154 | + /** |
|
| 155 | + * @param string $name |
|
| 156 | + */ |
|
| 147 | 157 | protected function removePropertyValues($name, $values) { |
| 148 | 158 | $this->removeOldValues($this->properties[$name], $values); |
| 149 | 159 | return $this; |
| 150 | 160 | } |
| 151 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $name |
|
| 164 | + */ |
|
| 152 | 165 | protected function removeProperty($name) { |
| 153 | 166 | if (\array_key_exists($name, $this->properties)) |
| 154 | 167 | unset($this->properties[$name]); |
| 155 | 168 | return $this; |
| 156 | 169 | } |
| 157 | 170 | |
| 171 | + /** |
|
| 172 | + * @param string $name |
|
| 173 | + * @param string[] $typeCtrl |
|
| 174 | + */ |
|
| 158 | 175 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | 176 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 160 | 177 | if (is_array($typeCtrl)) { |
@@ -165,6 +182,9 @@ discard block |
||
| 165 | 182 | return $this; |
| 166 | 183 | } |
| 167 | 184 | |
| 185 | + /** |
|
| 186 | + * @param string $name |
|
| 187 | + */ |
|
| 168 | 188 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | 189 | $name=str_ireplace($value, "", $name) . $separator . $value; |
| 170 | 190 | return $this; |
@@ -179,6 +199,9 @@ discard block |
||
| 179 | 199 | return $this->addToProperty($name, $value); |
| 180 | 200 | } |
| 181 | 201 | |
| 202 | + /** |
|
| 203 | + * @param string $name |
|
| 204 | + */ |
|
| 182 | 205 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 183 | 206 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
| 184 | 207 | } |
@@ -327,14 +350,23 @@ discard block |
||
| 327 | 350 | return $this; |
| 328 | 351 | } |
| 329 | 352 | |
| 353 | + /** |
|
| 354 | + * @param string $event |
|
| 355 | + */ |
|
| 330 | 356 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 331 | 357 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 332 | 358 | } |
| 333 | 359 | |
| 360 | + /** |
|
| 361 | + * @param string $url |
|
| 362 | + */ |
|
| 334 | 363 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 335 | 364 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 336 | 365 | } |
| 337 | 366 | |
| 367 | + /** |
|
| 368 | + * @param string $event |
|
| 369 | + */ |
|
| 338 | 370 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 339 | 371 | $parameters["params"]=$params; |
| 340 | 372 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -344,6 +376,9 @@ discard block |
||
| 344 | 376 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 345 | 377 | } |
| 346 | 378 | |
| 379 | + /** |
|
| 380 | + * @param string $event |
|
| 381 | + */ |
|
| 347 | 382 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 348 | 383 | $parameters["form"]=$form; |
| 349 | 384 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -371,6 +406,10 @@ discard block |
||
| 371 | 406 | return null; |
| 372 | 407 | } |
| 373 | 408 | |
| 409 | + /** |
|
| 410 | + * @param string $propertyName |
|
| 411 | + * @param string $value |
|
| 412 | + */ |
|
| 374 | 413 | protected function getElementByPropertyValue($propertyName,$value, $elements) { |
| 375 | 414 | if (is_array($elements)) { |
| 376 | 415 | $flag=false; |
@@ -411,6 +450,9 @@ discard block |
||
| 411 | 450 | return $value; |
| 412 | 451 | } |
| 413 | 452 | |
| 453 | + /** |
|
| 454 | + * @param string $jqueryCall |
|
| 455 | + */ |
|
| 414 | 456 | public function jsDoJquery($jqueryCall, $param="") { |
| 415 | 457 | return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
| 416 | 458 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | abstract class BaseHtml extends BaseWidget { |
| 17 | 17 | protected $_template; |
| 18 | 18 | protected $tagName; |
| 19 | - protected $properties=array (); |
|
| 20 | - protected $_events=array (); |
|
| 21 | - protected $_wrapBefore=array (); |
|
| 22 | - protected $_wrapAfter=array (); |
|
| 19 | + protected $properties=array(); |
|
| 20 | + protected $_events=array(); |
|
| 21 | + protected $_wrapBefore=array(); |
|
| 22 | + protected $_wrapAfter=array(); |
|
| 23 | 23 | protected $_bsComponent; |
| 24 | 24 | |
| 25 | 25 | public function getBsComponent() { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | protected function getTemplate(JsUtils $js=NULL) { |
| 35 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 35 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getProperties() { |
@@ -56,13 +56,13 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | if (\is_array($value)) { |
| 59 | - foreach ( $value as $v ) { |
|
| 59 | + foreach ($value as $v) { |
|
| 60 | 60 | $this->addToProperty($name, $v, $separator); |
| 61 | 61 | } |
| 62 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 62 | + }else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 63 | 63 | $v=@$this->properties[$name]; |
| 64 | - if (isset($v) && $v !== "") |
|
| 65 | - $v=$v . $separator . $value; |
|
| 64 | + if (isset($v) && $v!=="") |
|
| 65 | + $v=$v.$separator.$value; |
|
| 66 | 66 | else |
| 67 | 67 | $v=$value; |
| 68 | 68 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function compile(JsUtils $js=NULL, $view=NULL) { |
| 80 | 80 | $result=$this->getTemplate($js); |
| 81 | - foreach ( $this as $key => $value ) { |
|
| 82 | - if (JString::startswith($key, "_") === false && $key !== "events") { |
|
| 81 | + foreach ($this as $key => $value) { |
|
| 82 | + if (JString::startswith($key, "_")===false && $key!=="events") { |
|
| 83 | 83 | if (is_array($value)) { |
| 84 | 84 | $v=PropertyWrapper::wrap($value, $js); |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $v=$value; |
| 87 | 87 | } |
| 88 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 88 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | if (isset($js)===true) { |
| 92 | 92 | $this->run($js); |
| 93 | - if (isset($view) === true) { |
|
| 93 | + if (isset($view)===true) { |
|
| 94 | 94 | $js->addViewElement($this->identifier, $result, $view); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | protected function ctrl($name, $value, $typeCtrl) { |
| 101 | 101 | if (is_array($typeCtrl)) { |
| 102 | - if (array_search($value, $typeCtrl) === false) { |
|
| 103 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 102 | + if (array_search($value, $typeCtrl)===false) { |
|
| 103 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 104 | 104 | } |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | if (!$typeCtrl($value)) { |
| 107 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 107 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | return true; |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 122 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 123 | 123 | return $this->setProperty($name, $value); |
| 124 | 124 | return $this; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 129 | 129 | return $name=$value; |
| 130 | 130 | } |
| 131 | 131 | return $this; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 135 | 135 | if (is_array($typeCtrl)) { |
| 136 | 136 | $this->removeOldValues($name, $typeCtrl); |
| 137 | - $name.=$separator . $value; |
|
| 137 | + $name.=$separator.$value; |
|
| 138 | 138 | } |
| 139 | 139 | return $this; |
| 140 | 140 | } |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 159 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 159 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 160 | 160 | if (is_array($typeCtrl)) { |
| 161 | 161 | $this->removeOldValues($name, $typeCtrl); |
| 162 | 162 | } |
| 163 | - $name.=$separator . $value; |
|
| 163 | + $name.=$separator.$value; |
|
| 164 | 164 | } |
| 165 | 165 | return $this; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | protected function addToMember(&$name, $value, $separator=" ") { |
| 169 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 169 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 170 | 170 | return $this; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 187 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 187 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 188 | 188 | return $this->addToProperty($name, $value); |
| 189 | 189 | } |
| 190 | 190 | return $this; |
@@ -212,28 +212,28 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public function fromArray($array) { |
| 215 | - foreach ( $this as $key => $value ) { |
|
| 215 | + foreach ($this as $key => $value) { |
|
| 216 | 216 | if (array_key_exists($key, $array) && !JString::startswith($key, "_")) { |
| 217 | - $setter="set" . ucfirst($key); |
|
| 217 | + $setter="set".ucfirst($key); |
|
| 218 | 218 | $this->$setter($array[$key]); |
| 219 | 219 | unset($array[$key]); |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | - foreach ( $array as $key => $value ) { |
|
| 222 | + foreach ($array as $key => $value) { |
|
| 223 | 223 | if (method_exists($this, $key)) { |
| 224 | 224 | try { |
| 225 | 225 | $this->$key($value); |
| 226 | 226 | unset($array[$key]); |
| 227 | - } catch ( \Exception $e ) { |
|
| 227 | + } catch (\Exception $e) { |
|
| 228 | 228 | // Nothing to do |
| 229 | 229 | } |
| 230 | - } else { |
|
| 231 | - $setter="set" . ucfirst($key); |
|
| 230 | + }else { |
|
| 231 | + $setter="set".ucfirst($key); |
|
| 232 | 232 | if (method_exists($this, $setter)) { |
| 233 | 233 | try { |
| 234 | 234 | $this->$setter($value); |
| 235 | 235 | unset($array[$key]); |
| 236 | - } catch ( \Exception $e ) { |
|
| 236 | + } catch (\Exception $e) { |
|
| 237 | 237 | // Nothing to do |
| 238 | 238 | } |
| 239 | 239 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | public function fromDatabaseObjects($objects, $function) { |
| 246 | 246 | if (isset($objects)) { |
| 247 | - foreach ( $objects as $object ) { |
|
| 247 | + foreach ($objects as $object) { |
|
| 248 | 248 | $this->fromDatabaseObject($object, $function); |
| 249 | 249 | } |
| 250 | 250 | } |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 267 | - if ($stopPropagation === true) { |
|
| 268 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 267 | + if ($stopPropagation===true) { |
|
| 268 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 269 | 269 | } |
| 270 | - if ($preventDefault === true) { |
|
| 271 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 270 | + if ($preventDefault===true) { |
|
| 271 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 272 | 272 | } |
| 273 | 273 | return $this->_addEvent($event, $jsCode); |
| 274 | 274 | } |
@@ -277,10 +277,10 @@ discard block |
||
| 277 | 277 | if (array_key_exists($event, $this->_events)) { |
| 278 | 278 | if (is_array($this->_events[$event])) { |
| 279 | 279 | $this->_events[$event][]=$jsCode; |
| 280 | - } else { |
|
| 281 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 280 | + }else { |
|
| 281 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 282 | 282 | } |
| 283 | - } else { |
|
| 283 | + }else { |
|
| 284 | 284 | $this->_events[$event]=$jsCode; |
| 285 | 285 | } |
| 286 | 286 | return $this; |
@@ -300,15 +300,15 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | public function addEventsOnRun(JsUtils $js) { |
| 302 | 302 | if (isset($this->_bsComponent)) { |
| 303 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 303 | + foreach ($this->_events as $event => $jsCode) { |
|
| 304 | 304 | $code=$jsCode; |
| 305 | 305 | if (is_array($jsCode)) { |
| 306 | 306 | $code=""; |
| 307 | - foreach ( $jsCode as $jsC ) { |
|
| 307 | + foreach ($jsCode as $jsC) { |
|
| 308 | 308 | if ($jsC instanceof AjaxCall) { |
| 309 | - $code.="\n" . $jsC->compile($js); |
|
| 310 | - } else { |
|
| 311 | - $code.="\n" . $jsC; |
|
| 309 | + $code.="\n".$jsC->compile($js); |
|
| 310 | + }else { |
|
| 311 | + $code.="\n".$jsC; |
|
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | $this->_bsComponent->addEvent($event, $code); |
| 318 | 318 | } |
| 319 | - $this->_events=array (); |
|
| 319 | + $this->_events=array(); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 324 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 324 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 325 | 325 | $params=array_merge($params, $parameters); |
| 326 | 326 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 327 | 327 | return $this; |
@@ -357,33 +357,33 @@ discard block |
||
| 357 | 357 | if (is_array($elements)) { |
| 358 | 358 | $flag=false; |
| 359 | 359 | $index=0; |
| 360 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 360 | + while (!$flag && $index<sizeof($elements)) { |
|
| 361 | 361 | if ($elements[$index] instanceof BaseHtml) |
| 362 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 362 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 363 | 363 | $index++; |
| 364 | 364 | } |
| 365 | - if ($flag === true) |
|
| 366 | - return $elements[$index - 1]; |
|
| 365 | + if ($flag===true) |
|
| 366 | + return $elements[$index-1]; |
|
| 367 | 367 | } elseif ($elements instanceof BaseHtml) { |
| 368 | - if ($elements->getIdentifier() === $identifier) |
|
| 368 | + if ($elements->getIdentifier()===$identifier) |
|
| 369 | 369 | return $elements; |
| 370 | 370 | } |
| 371 | 371 | return null; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - protected function getElementByPropertyValue($propertyName,$value, $elements) { |
|
| 374 | + protected function getElementByPropertyValue($propertyName, $value, $elements) { |
|
| 375 | 375 | if (is_array($elements)) { |
| 376 | 376 | $flag=false; |
| 377 | 377 | $index=0; |
| 378 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 378 | + while (!$flag && $index<sizeof($elements)) { |
|
| 379 | 379 | if ($elements[$index] instanceof BaseHtml) |
| 380 | - $flag=($elements[$index]->propertyContains($propertyName, $value) === true); |
|
| 380 | + $flag=($elements[$index]->propertyContains($propertyName, $value)===true); |
|
| 381 | 381 | $index++; |
| 382 | 382 | } |
| 383 | - if ($flag === true) |
|
| 384 | - return $elements[$index - 1]; |
|
| 383 | + if ($flag===true) |
|
| 384 | + return $elements[$index-1]; |
|
| 385 | 385 | } elseif ($elements instanceof BaseHtml) { |
| 386 | - if ($elements->propertyContains($propertyName, $value) === true) |
|
| 386 | + if ($elements->propertyContains($propertyName, $value)===true) |
|
| 387 | 387 | return $elements; |
| 388 | 388 | } |
| 389 | 389 | return null; |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | if (is_array($value)) { |
| 406 | 406 | $value=implode(",", $value); |
| 407 | 407 | } |
| 408 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
| 409 | - $value='"' . $value . '"'; |
|
| 408 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 409 | + $value='"'.$value.'"'; |
|
| 410 | 410 | } |
| 411 | 411 | return $value; |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | public function jsDoJquery($jqueryCall, $param="") { |
| 415 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
| 415 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | public function executeOnRun($jsCode) { |
@@ -55,6 +55,9 @@ discard block |
||
| 55 | 55 | return $this->_semantic; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param JsUtils $jsUtils |
|
| 60 | + */ |
|
| 58 | 61 | public function __construct($params,$jsUtils) { |
| 59 | 62 | $this->params=array(); |
| 60 | 63 | foreach ( $params as $key => $val ) { |
@@ -175,7 +178,7 @@ discard block |
||
| 175 | 178 | * |
| 176 | 179 | * @param string $element |
| 177 | 180 | * @param array $options |
| 178 | - * @return void |
|
| 181 | + * @return string |
|
| 179 | 182 | */ |
| 180 | 183 | public function sortable($element, $options=array()) { |
| 181 | 184 | if (count($options)>0) { |
@@ -306,6 +309,7 @@ discard block |
||
| 306 | 309 | |
| 307 | 310 | /** |
| 308 | 311 | * A wrapper for writing document.ready() |
| 312 | + * @param string $js |
|
| 309 | 313 | * @return string |
| 310 | 314 | */ |
| 311 | 315 | public function _document_ready($js) { |
@@ -353,6 +357,9 @@ discard block |
||
| 353 | 357 | return $value; |
| 354 | 358 | } |
| 355 | 359 | |
| 360 | + /** |
|
| 361 | + * @param string $input |
|
| 362 | + */ |
|
| 356 | 363 | private function minify($input) { |
| 357 | 364 | if(trim($input) === "") return $input; |
| 358 | 365 | return preg_replace( |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | * jQuery Class |
| 18 | 18 | */ |
| 19 | 19 | class Jquery { |
| 20 | - use JqueryEventsTrait,JqueryAjaxTrait,JqueryActionsTrait; |
|
| 20 | + use JqueryEventsTrait, JqueryAjaxTrait, JqueryActionsTrait; |
|
| 21 | 21 | protected $_ui; |
| 22 | 22 | protected $_bootstrap; |
| 23 | 23 | protected $_semantic; |
| 24 | 24 | protected $libraryFile; |
| 25 | 25 | protected $_javascript_folder='js'; |
| 26 | - protected $jquery_code_for_load=array (); |
|
| 27 | - protected $jquery_code_for_compile=array (); |
|
| 26 | + protected $jquery_code_for_load=array(); |
|
| 27 | + protected $jquery_code_for_compile=array(); |
|
| 28 | 28 | protected $jquery_corner_active=FALSE; |
| 29 | 29 | protected $jquery_table_sorter_active=FALSE; |
| 30 | 30 | protected $jquery_table_sorter_pager_active=FALSE; |
| 31 | 31 | protected $jsUtils; |
| 32 | 32 | |
| 33 | - protected $jquery_events=array ( |
|
| 34 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
| 33 | + protected $jquery_events=array( |
|
| 34 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | 37 | public function ui($ui=NULL) { |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | return $this->_semantic; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function __construct($params,$jsUtils) { |
|
| 58 | + public function __construct($params, $jsUtils) { |
|
| 59 | 59 | $this->params=array(); |
| 60 | - foreach ( $params as $key => $val ) { |
|
| 60 | + foreach ($params as $key => $val) { |
|
| 61 | 61 | $this->params[$key]=$params[$key]; |
| 62 | 62 | } |
| 63 | 63 | $this->jsUtils=$jsUtils; |
@@ -125,12 +125,12 @@ discard block |
||
| 125 | 125 | */ |
| 126 | 126 | public function _output($array_js='') { |
| 127 | 127 | if (!is_array($array_js)) { |
| 128 | - $array_js=array ( |
|
| 128 | + $array_js=array( |
|
| 129 | 129 | $array_js |
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - foreach ( $array_js as $js ) { |
|
| 133 | + foreach ($array_js as $js) { |
|
| 134 | 134 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | * @param string $param |
| 143 | 143 | * @param boolean $immediatly delayed if false |
| 144 | 144 | */ |
| 145 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 145 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 146 | 146 | $element=$this->_prep_element($element); |
| 147 | 147 | if (isset($param)) { |
| 148 | 148 | $param=$this->_prep_value($param); |
| 149 | 149 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 150 | - } else |
|
| 150 | + }else |
|
| 151 | 151 | $str="$({$element}).{$jQueryCall}();"; |
| 152 | 152 | if ($immediatly) |
| 153 | 153 | $this->jquery_code_for_compile[]=$str; |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @param boolean $immediatly delayed if false |
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 164 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 165 | 165 | $to=$this->_prep_element($to); |
| 166 | 166 | $element=$this->_prep_element($element); |
| 167 | 167 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function sortable($element, $options=array()) { |
| 181 | 181 | if (count($options)>0) { |
| 182 | - $sort_options=array (); |
|
| 183 | - foreach ( $options as $k => $v ) { |
|
| 182 | + $sort_options=array(); |
|
| 183 | + foreach ($options as $k => $v) { |
|
| 184 | 184 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 185 | 185 | } |
| 186 | 186 | $sort_options=implode(",", $sort_options); |
| 187 | - } else { |
|
| 187 | + }else { |
|
| 188 | 188 | $sort_options=''; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
| 213 | 213 | * @return string |
| 214 | 214 | */ |
| 215 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
| 215 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
| 216 | 216 | if (is_array($js)) { |
| 217 | 217 | $js=implode("\n\t\t", $js); |
| 218 | 218 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
| 227 | 227 | else |
| 228 | 228 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
| 229 | - if($immediatly) |
|
| 229 | + if ($immediatly) |
|
| 230 | 230 | $this->jquery_code_for_compile[]=$event; |
| 231 | 231 | return $event; |
| 232 | 232 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // External references |
| 268 | 268 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 269 | - extract(array ( |
|
| 269 | + extract(array( |
|
| 270 | 270 | 'library_src' => $external_scripts |
| 271 | 271 | )); |
| 272 | 272 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $script.='});'; |
| 282 | 282 | |
| 283 | 283 | $this->jquery_code_for_compile=array(); |
| 284 | - if($this->params["debug"]==false){ |
|
| 284 | + if ($this->params["debug"]==false) { |
|
| 285 | 285 | $script=$this->minify($script); |
| 286 | 286 | } |
| 287 | 287 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @return void |
| 302 | 302 | */ |
| 303 | 303 | public function _clear_compile() { |
| 304 | - $this->jquery_code_for_compile=array (); |
|
| 304 | + $this->jquery_code_for_compile=array(); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | /** |
@@ -310,12 +310,12 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | public function _document_ready($js) { |
| 312 | 312 | if (!is_array($js)) { |
| 313 | - $js=array ( |
|
| 313 | + $js=array( |
|
| 314 | 314 | $js |
| 315 | 315 | ); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - foreach ( $js as $script ) { |
|
| 318 | + foreach ($js as $script) { |
|
| 319 | 319 | $this->jquery_code_for_compile[]=$script; |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @return string |
| 330 | 330 | */ |
| 331 | 331 | public function _prep_element($element) { |
| 332 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
| 332 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
| 333 | 333 | $element='"'.addslashes($element).'"'; |
| 334 | 334 | } |
| 335 | 335 | return $element; |
@@ -347,14 +347,14 @@ discard block |
||
| 347 | 347 | if (is_array($value)) { |
| 348 | 348 | $value=implode(",", $value); |
| 349 | 349 | } |
| 350 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
| 350 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
| 351 | 351 | $value='"'.$value.'"'; |
| 352 | 352 | } |
| 353 | 353 | return $value; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | private function minify($input) { |
| 357 | - if(trim($input) === "") return $input; |
|
| 357 | + if (trim($input)==="") return $input; |
|
| 358 | 358 | return preg_replace( |
| 359 | 359 | array( |
| 360 | 360 | // Remove comment(s) |
@@ -11,6 +11,9 @@ |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $baseClass |
|
| 16 | + */ |
|
| 14 | 17 | public function __construct($identifier, $baseClass,$content=NULL) { |
| 15 | 18 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 19 | $this->content=array(); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | abstract class HtmlAbsractItem extends HtmlSemDoubleElement { |
| 13 | 13 | |
| 14 | - public function __construct($identifier, $baseClass,$content=NULL) { |
|
| 14 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 15 | 15 | parent::__construct($identifier, "div", $baseClass); |
| 16 | 16 | $this->content=array(); |
| 17 | 17 | $this->initContent($content); |
@@ -19,48 +19,48 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | protected abstract function initContent($content); |
| 21 | 21 | |
| 22 | - public function setIcon($icon){ |
|
| 22 | + public function setIcon($icon) { |
|
| 23 | 23 | $this->content["icon"]=new HtmlIcon("icon-".$this->identifier, $icon); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function setImage($image){ |
|
| 26 | + public function setImage($image) { |
|
| 27 | 27 | $image=new HtmlImg("icon-".$this->identifier, $image); |
| 28 | 28 | $image->asAvatar(); |
| 29 | 29 | $this->content["image"]=$image; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - private function createContent(){ |
|
| 33 | - $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier,"div","content"); |
|
| 32 | + private function createContent() { |
|
| 33 | + $this->content["content"]=new HtmlSemDoubleElement("content-".$this->identifier, "div", "content"); |
|
| 34 | 34 | return $this->content["content"]; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setTitle($title,$description=NULL,$baseClass="title"){ |
|
| 38 | - $title=new HtmlSemDoubleElement("","div",$baseClass,$title); |
|
| 39 | - if(\array_key_exists("content", $this->content)===false){ |
|
| 37 | + public function setTitle($title, $description=NULL, $baseClass="title") { |
|
| 38 | + $title=new HtmlSemDoubleElement("", "div", $baseClass, $title); |
|
| 39 | + if (\array_key_exists("content", $this->content)===false) { |
|
| 40 | 40 | $this->createContent(); |
| 41 | 41 | } |
| 42 | 42 | $this->content["content"]->addContent($title); |
| 43 | - if(isset($description)){ |
|
| 44 | - $description=new HtmlSemDoubleElement("","div","description",$description); |
|
| 43 | + if (isset($description)) { |
|
| 44 | + $description=new HtmlSemDoubleElement("", "div", "description", $description); |
|
| 45 | 45 | $this->content["content"]->addContent($description); |
| 46 | 46 | } |
| 47 | 47 | return $this; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function getPart($partName="header"){ |
|
| 51 | - $content=\array_merge($this->content["content"]->getContent(),array(@$this->content["icon"],@$this->content["image"])); |
|
| 50 | + public function getPart($partName="header") { |
|
| 51 | + $content=\array_merge($this->content["content"]->getContent(), array(@$this->content["icon"], @$this->content["image"])); |
|
| 52 | 52 | return $this->getElementByPropertyValue("class", $partName, $content); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function setActive(){ |
|
| 55 | + public function setActive() { |
|
| 56 | 56 | $this->setTagName("div"); |
| 57 | 57 | $this->removeProperty("href"); |
| 58 | 58 | return $this->addToPropertyCtrl("class", "active", array("active")); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function asLink($href=NULL,$part=NULL){ |
|
| 61 | + public function asLink($href=NULL, $part=NULL) { |
|
| 62 | 62 | $this->setTagName("a"); |
| 63 | - if(isset($href)) |
|
| 63 | + if (isset($href)) |
|
| 64 | 64 | $this->setProperty("href", $href); |
| 65 | 65 | return $this; |
| 66 | 66 | } |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 73 | 73 | */ |
| 74 | 74 | public function compile(JsUtils $js=NULL, $view=NULL) { |
| 75 | - if(\is_array($this->content)) |
|
| 76 | - $this->content=JArray::sortAssociative($this->content, [ "icon","image","content" ]); |
|
| 75 | + if (\is_array($this->content)) |
|
| 76 | + $this->content=JArray::sortAssociative($this->content, ["icon", "image", "content"]); |
|
| 77 | 77 | return parent::compile($js, $view); |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | \ No newline at end of file |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * Set the button value |
| 40 | 40 | * @param string $value |
| 41 | - * @return \Ajax\semantic\html\HtmlButton |
|
| 41 | + * @return HtmlButton |
|
| 42 | 42 | */ |
| 43 | 43 | public function setValue($value) { |
| 44 | 44 | $this->content=$value; |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * define the button style |
| 50 | - * @param string|int $cssStyle |
|
| 51 | - * @return \Ajax\semantic\html\HtmlButton default : "" |
|
| 50 | + * @param string $cssStyle |
|
| 51 | + * @return HtmlButton default : "" |
|
| 52 | 52 | */ |
| 53 | 53 | public function setStyle($cssStyle) { |
| 54 | 54 | return $this->addToProperty("class", $cssStyle); |
@@ -98,7 +98,6 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Add and return a button label |
| 101 | - * @param string $caption |
|
| 102 | 101 | * @param string $before |
| 103 | 102 | * @param string $icon |
| 104 | 103 | * @return \Ajax\semantic\html\elements\HtmlLabel |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | 107 | $this->tagName="div"; |
| 108 | 108 | $this->addToProperty("class", "labeled"); |
| 109 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 109 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 110 | 110 | $this->content->setTagName("div"); |
| 111 | - $label=new HtmlLabel("label-" . $this->identifier, $label, "a"); |
|
| 112 | - if(isset($icon)) |
|
| 111 | + $label=new HtmlLabel("label-".$this->identifier, $label, "a"); |
|
| 112 | + if (isset($icon)) |
|
| 113 | 113 | $label->addIcon($icon); |
| 114 | 114 | $label->setBasic(); |
| 115 | 115 | $this->addContent($label, $before); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function fromArray($array) { |
| 124 | 124 | $array=parent::fromArray($array); |
| 125 | - foreach ( $array as $key => $value ) { |
|
| 125 | + foreach ($array as $key => $value) { |
|
| 126 | 126 | $this->setProperty($key, $value); |
| 127 | 127 | } |
| 128 | 128 | return $array; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | public static function social($identifier, $social, $value=NULL) { |
| 188 | - if ($value === NULL) |
|
| 188 | + if ($value===NULL) |
|
| 189 | 189 | $value=\ucfirst($social); |
| 190 | 190 | $return=new HtmlButton($identifier, $value); |
| 191 | 191 | $return->addIcon($social); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public function asLink($href=NULL) { |
| 208 | - $lnk=new HtmlLink("lnk-".$this->identifier,$href,$this->content); |
|
| 208 | + $lnk=new HtmlLink("lnk-".$this->identifier, $href, $this->content); |
|
| 209 | 209 | $this->content=$lnk; |
| 210 | 210 | return $this; |
| 211 | 211 | } |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | use Ajax\semantic\html\base\constants\Side; |
| 5 | 5 | trait AttachedTrait { |
| 6 | 6 | /** |
| 7 | - * @param string $side |
|
| 8 | 7 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
| 9 | 8 | */ |
| 10 | 9 | public function setAttachment($value=Side::BOTH){ |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 25 | 25 | */ |
| 26 | 26 | public function setPointing($value=Direction::NONE) { |
| 27 | - if($value==="left" || $value==="right") |
|
| 27 | + if ($value==="left" || $value==="right") |
|
| 28 | 28 | return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
| 29 | 29 | else |
| 30 | - return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing",true)); |
|
| 30 | + return $this->addToPropertyCtrl("class", "pointing ".$value, Direction::getConstantValues("pointing", true)); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 37 | 37 | */ |
| 38 | 38 | public function toCorner($side="left") { |
| 39 | - return $this->addToPropertyCtrl("class", $side . " corner", array ("right corner","left corner" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setHorizontal(){ |
|
| 43 | - return $this->addToPropertyCtrl("class", "hozizontal",array("horizontal")); |
|
| 42 | + public function setHorizontal() { |
|
| 43 | + return $this->addToPropertyCtrl("class", "hozizontal", array("horizontal")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function setFloating(){ |
|
| 47 | - return $this->addToPropertyCtrl("class", "floating",array("floating")); |
|
| 46 | + public function setFloating() { |
|
| 47 | + return $this->addToPropertyCtrl("class", "floating", array("floating")); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | return $this->addToProperty("class", "tag"); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function setEmpty(){ |
|
| 58 | + public function setEmpty() { |
|
| 59 | 59 | $this->content=NULL; |
| 60 | - return $this->addToPropertyCtrl("class", "empty",array("empty")); |
|
| 60 | + return $this->addToPropertyCtrl("class", "empty", array("empty")); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function setBasic() { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function addEmphasisImage($src, $alt="", $before=true) { |
| 75 | 75 | $this->addToProperty("class", "image"); |
| 76 | - return $this->addImage($src,$alt,$before); |
|
| 76 | + return $this->addImage($src, $alt, $before); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return \Ajax\semantic\html\elements\html5\HtmlImg |
| 85 | 85 | */ |
| 86 | 86 | public function addAvatarImage($src, $alt="", $before=true) { |
| 87 | - $img=$this->addImage($src,$alt,$before); |
|
| 87 | + $img=$this->addImage($src, $alt, $before); |
|
| 88 | 88 | $img->setClass("ui image"); |
| 89 | 89 | $img->asAvatar(); |
| 90 | 90 | return $img; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return \Ajax\semantic\html\elements\html5\HtmlImg |
| 99 | 99 | */ |
| 100 | 100 | public function addImage($src, $alt="", $before=true) { |
| 101 | - $img=new HtmlImg("image-" . $this->identifier, $src, $alt); |
|
| 101 | + $img=new HtmlImg("image-".$this->identifier, $src, $alt); |
|
| 102 | 102 | $img->setClass(""); |
| 103 | 103 | $this->addContent($img, $before); |
| 104 | 104 | return $img; |
@@ -110,21 +110,21 @@ discard block |
||
| 110 | 110 | * @return \Ajax\common\html\HtmlDoubleElement |
| 111 | 111 | */ |
| 112 | 112 | public function addDetail($detail) { |
| 113 | - $div=new HtmlSemDoubleElement("detail-" . $this->identifier, $this->tagName,"detail"); |
|
| 113 | + $div=new HtmlSemDoubleElement("detail-".$this->identifier, $this->tagName, "detail"); |
|
| 114 | 114 | $div->setContent($detail); |
| 115 | 115 | $this->addContent($div); |
| 116 | 116 | return $div; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function asRibbon($direction=Direction::NONE) { |
| 120 | - return $this->addToPropertyCtrl("class", $direction." ribbon", array ("ribbon","right ribbon","left ribbon" )); |
|
| 120 | + return $this->addToPropertyCtrl("class", $direction." ribbon", array("ribbon", "right ribbon", "left ribbon")); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - public function setAttached($side=Side::TOP,$direction=Direction::NONE){ |
|
| 124 | - if($direction!==Direction::NONE) |
|
| 125 | - return $this->addToPropertyCtrl("class", $side." ".$direction." attached",Side::getConstantValues($direction." attached")); |
|
| 123 | + public function setAttached($side=Side::TOP, $direction=Direction::NONE) { |
|
| 124 | + if ($direction!==Direction::NONE) |
|
| 125 | + return $this->addToPropertyCtrl("class", $side." ".$direction." attached", Side::getConstantValues($direction." attached")); |
|
| 126 | 126 | else |
| 127 | - return $this->addToPropertyCtrl("class", $side." attached",Side::getConstantValues("attached")); |
|
| 127 | + return $this->addToPropertyCtrl("class", $side." attached", Side::getConstantValues("attached")); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public static function ribbon($identifier, $caption) { |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | private static $constCacheArray=NULL; |
| 13 | 13 | |
| 14 | 14 | public static function getConstants() { |
| 15 | - if (self::$constCacheArray == NULL) { |
|
| 16 | - self::$constCacheArray=[ ]; |
|
| 15 | + if (self::$constCacheArray==NULL) { |
|
| 16 | + self::$constCacheArray=[]; |
|
| 17 | 17 | } |
| 18 | 18 | $calledClass=get_called_class(); |
| 19 | 19 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | return self::$constCacheArray[$calledClass]; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public static function getConstantValues($postFix="",$prefixBefore=false) { |
|
| 27 | - if ($postFix == "") |
|
| 26 | + public static function getConstantValues($postFix="", $prefixBefore=false) { |
|
| 27 | + if ($postFix=="") |
|
| 28 | 28 | return \array_values(self::getConstants()); |
| 29 | 29 | else { |
| 30 | - if($prefixBefore===false){ |
|
| 31 | - return \array_map(function ($elem) use($postFix) { |
|
| 32 | - return $elem . " " . $postFix; |
|
| 30 | + if ($prefixBefore===false) { |
|
| 31 | + return \array_map(function($elem) use($postFix) { |
|
| 32 | + return $elem." ".$postFix; |
|
| 33 | 33 | }, \array_values(self::getConstants())); |
| 34 | - }else{ |
|
| 35 | - return \array_map(function ($elem) use($postFix) { |
|
| 34 | + }else { |
|
| 35 | + return \array_map(function($elem) use($postFix) { |
|
| 36 | 36 | return $postFix." ".$elem; |
| 37 | 37 | }, \array_values(self::getConstants())); |
| 38 | 38 | } |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | class HtmlInput extends HtmlSingleElement { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 10 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 11 | 11 | parent::__construct($identifier, "input"); |
| 12 | 12 | $this->setProperty("name", $identifier); |
| 13 | 13 | $this->setValue($value); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function setValue($value) { |
| 19 | - if(isset($value)) |
|
| 19 | + if (isset($value)) |
|
| 20 | 20 | $this->setProperty("value", $value); |
| 21 | 21 | return $this; |
| 22 | 22 | } |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | return $this->setProperty("type", $value); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setPlaceholder($value){ |
|
| 29 | - if(JString::isNull($value)){ |
|
| 30 | - if(JString::isNotNull($this->identifier)) |
|
| 28 | + public function setPlaceholder($value) { |
|
| 29 | + if (JString::isNull($value)) { |
|
| 30 | + if (JString::isNotNull($this->identifier)) |
|
| 31 | 31 | $value=\ucfirst($this->identifier); |
| 32 | 32 | } |
| 33 | - if(JString::isNotNull($value)) |
|
| 33 | + if (JString::isNotNull($value)) |
|
| 34 | 34 | $this->setProperty("placeholder", $value); |
| 35 | 35 | return $this; |
| 36 | 36 | } |
@@ -130,12 +130,12 @@ |
||
| 130 | 130 | * @param string $tagName |
| 131 | 131 | * @return HtmlLabel |
| 132 | 132 | */ |
| 133 | - public function htmlLabel($identifier, $content="", $icon=NULL,$tagName="div") { |
|
| 134 | - return $this->addHtmlComponent(new HtmlLabel($identifier, $content,$icon, $tagName)); |
|
| 133 | + public function htmlLabel($identifier, $content="", $icon=NULL, $tagName="div") { |
|
| 134 | + return $this->addHtmlComponent(new HtmlLabel($identifier, $content, $icon, $tagName)); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function htmlLabelGroups($identifier,$labels=array(),$attributes=array()){ |
|
| 138 | - return $this->addHtmlComponent(new HtmlLabelGroups($identifier,$labels,$attributes)); |
|
| 137 | + public function htmlLabelGroups($identifier, $labels=array(), $attributes=array()) { |
|
| 138 | + return $this->addHtmlComponent(new HtmlLabelGroups($identifier, $labels, $attributes)); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |