@@ -145,16 +145,26 @@ discard block |
||
| 145 | 145 | return $this; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | + /** |
|
| 149 | + * @param string $name |
|
| 150 | + * @param string $value |
|
| 151 | + */ |
|
| 148 | 152 | protected function removePropertyValue($name, $value) { |
| 149 | 153 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 150 | 154 | return $this; |
| 151 | 155 | } |
| 152 | 156 | |
| 157 | + /** |
|
| 158 | + * @param string $name |
|
| 159 | + */ |
|
| 153 | 160 | protected function removePropertyValues($name, $values) { |
| 154 | 161 | $this->removeOldValues($this->properties[$name], $values); |
| 155 | 162 | return $this; |
| 156 | 163 | } |
| 157 | 164 | |
| 165 | + /** |
|
| 166 | + * @param string $name |
|
| 167 | + */ |
|
| 158 | 168 | protected function removeProperty($name) { |
| 159 | 169 | if (\array_key_exists($name, $this->properties)) |
| 160 | 170 | unset($this->properties[$name]); |
@@ -185,6 +195,9 @@ discard block |
||
| 185 | 195 | return $this->addToProperty($name, $value); |
| 186 | 196 | } |
| 187 | 197 | |
| 198 | + /** |
|
| 199 | + * @param string $name |
|
| 200 | + */ |
|
| 188 | 201 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 189 | 202 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
| 190 | 203 | } |
@@ -333,14 +346,23 @@ discard block |
||
| 333 | 346 | return $this; |
| 334 | 347 | } |
| 335 | 348 | |
| 349 | + /** |
|
| 350 | + * @param string $event |
|
| 351 | + */ |
|
| 336 | 352 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 337 | 353 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 338 | 354 | } |
| 339 | 355 | |
| 356 | + /** |
|
| 357 | + * @param string $url |
|
| 358 | + */ |
|
| 340 | 359 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 341 | 360 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 342 | 361 | } |
| 343 | 362 | |
| 363 | + /** |
|
| 364 | + * @param string $event |
|
| 365 | + */ |
|
| 344 | 366 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 345 | 367 | $parameters["params"]=$params; |
| 346 | 368 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -350,6 +372,9 @@ discard block |
||
| 350 | 372 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 351 | 373 | } |
| 352 | 374 | |
| 375 | + /** |
|
| 376 | + * @param string $event |
|
| 377 | + */ |
|
| 353 | 378 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 354 | 379 | $parameters["form"]=$form; |
| 355 | 380 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -399,6 +424,9 @@ discard block |
||
| 399 | 424 | return $value; |
| 400 | 425 | } |
| 401 | 426 | |
| 427 | + /** |
|
| 428 | + * @param string $jqueryCall |
|
| 429 | + */ |
|
| 402 | 430 | public function jsDoJquery($jqueryCall, $param="") { |
| 403 | 431 | return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
| 404 | 432 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | abstract class BaseHtml extends BaseWidget { |
| 18 | 18 | protected $_template; |
| 19 | 19 | protected $tagName; |
| 20 | - protected $properties=array (); |
|
| 21 | - protected $_events=array (); |
|
| 22 | - protected $_wrapBefore=array (); |
|
| 23 | - protected $_wrapAfter=array (); |
|
| 20 | + protected $properties=array(); |
|
| 21 | + protected $_events=array(); |
|
| 22 | + protected $_wrapBefore=array(); |
|
| 23 | + protected $_wrapAfter=array(); |
|
| 24 | 24 | protected $_bsComponent; |
| 25 | 25 | |
| 26 | 26 | public function getBsComponent() { |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | protected function getTemplate(JsUtils $js=NULL) { |
| 36 | - return PropertyWrapper::wrap($this->_wrapBefore, $js) . $this->_template . PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 36 | + return PropertyWrapper::wrap($this->_wrapBefore, $js).$this->_template.PropertyWrapper::wrap($this->_wrapAfter, $js); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function getProperties() { |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function addToProperty($name, $value, $separator=" ") { |
| 59 | 59 | if (\is_array($value)) { |
| 60 | - foreach ( $value as $v ) { |
|
| 60 | + foreach ($value as $v) { |
|
| 61 | 61 | $this->addToProperty($name, $v, $separator); |
| 62 | 62 | } |
| 63 | - } else if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 63 | + }else if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 64 | 64 | $v=@$this->properties[$name]; |
| 65 | - if (isset($v) && $v !== "") |
|
| 66 | - $v=$v . $separator . $value; |
|
| 65 | + if (isset($v) && $v!=="") |
|
| 66 | + $v=$v.$separator.$value; |
|
| 67 | 67 | else |
| 68 | 68 | $v=$value; |
| 69 | 69 | |
@@ -79,23 +79,23 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 81 | 81 | $result=$this->getTemplate($js); |
| 82 | - foreach ( $this as $key => $value ) { |
|
| 83 | - if (PhalconUtils::startsWith($key, "_") === false && $key !== "events") { |
|
| 82 | + foreach ($this as $key => $value) { |
|
| 83 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
| 84 | 84 | if (is_array($value)) { |
| 85 | 85 | $v=PropertyWrapper::wrap($value, $js); |
| 86 | - } else { |
|
| 86 | + }else { |
|
| 87 | 87 | $v=$value; |
| 88 | 88 | } |
| 89 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 89 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | if (isset($js)) { |
| 93 | 93 | $this->run($js); |
| 94 | 94 | } |
| 95 | - if (isset($view) === true) { |
|
| 95 | + if (isset($view)===true) { |
|
| 96 | 96 | $controls=$view->getVar("q"); |
| 97 | - if (isset($controls) === false) { |
|
| 98 | - $controls=array (); |
|
| 97 | + if (isset($controls)===false) { |
|
| 98 | + $controls=array(); |
|
| 99 | 99 | } |
| 100 | 100 | $controls[$this->identifier]=$result; |
| 101 | 101 | $view->setVar("q", $controls); |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | protected function ctrl($name, $value, $typeCtrl) { |
| 107 | 107 | if (is_array($typeCtrl)) { |
| 108 | - if (array_search($value, $typeCtrl) === false) { |
|
| 109 | - throw new \Exception("La valeur passée `" . $value . "` à la propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 108 | + if (array_search($value, $typeCtrl)===false) { |
|
| 109 | + throw new \Exception("La valeur passée `".$value."` à la propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 110 | 110 | } |
| 111 | - } else { |
|
| 111 | + }else { |
|
| 112 | 112 | if (!$typeCtrl($value)) { |
| 113 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 113 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | return true; |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 128 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 128 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 129 | 129 | return $this->setProperty($name, $value); |
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 134 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 134 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 135 | 135 | return $name=$value; |
| 136 | 136 | } |
| 137 | 137 | return $this; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 141 | 141 | if (is_array($typeCtrl)) { |
| 142 | 142 | $this->removeOldValues($name, $typeCtrl); |
| 143 | - $name.=$separator . $value; |
|
| 143 | + $name.=$separator.$value; |
|
| 144 | 144 | } |
| 145 | 145 | return $this; |
| 146 | 146 | } |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 165 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 165 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 166 | 166 | if (is_array($typeCtrl)) { |
| 167 | 167 | $this->removeOldValues($name, $typeCtrl); |
| 168 | 168 | } |
| 169 | - $name.=$separator . $value; |
|
| 169 | + $name.=$separator.$value; |
|
| 170 | 170 | } |
| 171 | 171 | return $this; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | protected function addToMember(&$name, $value, $separator=" ") { |
| 175 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 175 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 176 | 176 | return $this; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 193 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 193 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 194 | 194 | return $this->addToProperty($name, $value); |
| 195 | 195 | } |
| 196 | 196 | return $this; |
@@ -218,28 +218,28 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | public function fromArray($array) { |
| 221 | - foreach ( $this as $key => $value ) { |
|
| 221 | + foreach ($this as $key => $value) { |
|
| 222 | 222 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
| 223 | - $setter="set" . ucfirst($key); |
|
| 223 | + $setter="set".ucfirst($key); |
|
| 224 | 224 | $this->$setter($array[$key]); |
| 225 | 225 | unset($array[$key]); |
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | - foreach ( $array as $key => $value ) { |
|
| 228 | + foreach ($array as $key => $value) { |
|
| 229 | 229 | if (method_exists($this, $key)) { |
| 230 | 230 | try { |
| 231 | 231 | $this->$key($value); |
| 232 | 232 | unset($array[$key]); |
| 233 | - } catch ( \Exception $e ) { |
|
| 233 | + } catch (\Exception $e) { |
|
| 234 | 234 | // Nothing to do |
| 235 | 235 | } |
| 236 | - } else { |
|
| 237 | - $setter="set" . ucfirst($key); |
|
| 236 | + }else { |
|
| 237 | + $setter="set".ucfirst($key); |
|
| 238 | 238 | if (method_exists($this, $setter)) { |
| 239 | 239 | try { |
| 240 | 240 | $this->$setter($value); |
| 241 | 241 | unset($array[$key]); |
| 242 | - } catch ( \Exception $e ) { |
|
| 242 | + } catch (\Exception $e) { |
|
| 243 | 243 | // Nothing to do |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | public function fromDatabaseObjects($objects, $function) { |
| 252 | 252 | if (isset($objects)) { |
| 253 | - foreach ( $objects as $object ) { |
|
| 253 | + foreach ($objects as $object) { |
|
| 254 | 254 | $this->fromDatabaseObject($object, $function); |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -270,11 +270,11 @@ discard block |
||
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 273 | - if ($stopPropagation === true) { |
|
| 274 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 273 | + if ($stopPropagation===true) { |
|
| 274 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 275 | 275 | } |
| 276 | - if ($preventDefault === true) { |
|
| 277 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 276 | + if ($preventDefault===true) { |
|
| 277 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 278 | 278 | } |
| 279 | 279 | return $this->_addEvent($event, $jsCode); |
| 280 | 280 | } |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | if (array_key_exists($event, $this->_events)) { |
| 284 | 284 | if (is_array($this->_events[$event])) { |
| 285 | 285 | $this->_events[$event][]=$jsCode; |
| 286 | - } else { |
|
| 287 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 286 | + }else { |
|
| 287 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 288 | 288 | } |
| 289 | - } else { |
|
| 289 | + }else { |
|
| 290 | 290 | $this->_events[$event]=$jsCode; |
| 291 | 291 | } |
| 292 | 292 | return $this; |
@@ -306,15 +306,15 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | public function addEventsOnRun(JsUtils $js) { |
| 308 | 308 | if (isset($this->_bsComponent)) { |
| 309 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 309 | + foreach ($this->_events as $event => $jsCode) { |
|
| 310 | 310 | $code=$jsCode; |
| 311 | 311 | if (is_array($jsCode)) { |
| 312 | 312 | $code=""; |
| 313 | - foreach ( $jsCode as $jsC ) { |
|
| 313 | + foreach ($jsCode as $jsC) { |
|
| 314 | 314 | if ($jsC instanceof AjaxCall) { |
| 315 | - $code.="\n" . $jsC->compile($js); |
|
| 316 | - } else { |
|
| 317 | - $code.="\n" . $jsC; |
|
| 315 | + $code.="\n".$jsC->compile($js); |
|
| 316 | + }else { |
|
| 317 | + $code.="\n".$jsC; |
|
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | $this->_bsComponent->addEvent($event, $code); |
| 324 | 324 | } |
| 325 | - $this->_events=array (); |
|
| 325 | + $this->_events=array(); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 330 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 330 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 331 | 331 | $params=array_merge($params, $parameters); |
| 332 | 332 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 333 | 333 | return $this; |
@@ -363,15 +363,15 @@ discard block |
||
| 363 | 363 | if (is_array($elements)) { |
| 364 | 364 | $flag=false; |
| 365 | 365 | $index=0; |
| 366 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 366 | + while (!$flag && $index<sizeof($elements)) { |
|
| 367 | 367 | if ($elements[$index] instanceof BaseHtml) |
| 368 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 368 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 369 | 369 | $index++; |
| 370 | 370 | } |
| 371 | - if ($flag === true) |
|
| 372 | - return $elements[$index - 1]; |
|
| 371 | + if ($flag===true) |
|
| 372 | + return $elements[$index-1]; |
|
| 373 | 373 | } elseif ($elements instanceof BaseHtml) { |
| 374 | - if ($elements->getIdentifier() === $identifier) |
|
| 374 | + if ($elements->getIdentifier()===$identifier) |
|
| 375 | 375 | return $elements; |
| 376 | 376 | } |
| 377 | 377 | return null; |
@@ -393,14 +393,14 @@ discard block |
||
| 393 | 393 | if (is_array($value)) { |
| 394 | 394 | $value=implode(",", $value); |
| 395 | 395 | } |
| 396 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
| 397 | - $value='"' . $value . '"'; |
|
| 396 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 397 | + $value='"'.$value.'"'; |
|
| 398 | 398 | } |
| 399 | 399 | return $value; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | public function jsDoJquery($jqueryCall, $param="") { |
| 403 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
| 403 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | public function executeOnRun($jsCode) { |
@@ -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)) { |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function getConstantValues($postFix="") { |
| 27 | - if ($postFix == "") |
|
| 27 | + if ($postFix=="") |
|
| 28 | 28 | return \array_values(self::getConstants()); |
| 29 | 29 | else { |
| 30 | - return \array_map(function ($elem) use($postFix) { |
|
| 31 | - return $elem . " " . $postFix; |
|
| 30 | + return \array_map(function($elem) use($postFix) { |
|
| 31 | + return $elem." ".$postFix; |
|
| 32 | 32 | }, \array_values(self::getConstants())); |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -24,9 +24,9 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function getConstantValues($postFix="") { |
| 27 | - if ($postFix == "") |
|
| 28 | - return \array_values(self::getConstants()); |
|
| 29 | - else { |
|
| 27 | + if ($postFix == "") { |
|
| 28 | + return \array_values(self::getConstants()); |
|
| 29 | + } else { |
|
| 30 | 30 | return \array_map(function ($elem) use($postFix) { |
| 31 | 31 | return $elem . " " . $postFix; |
| 32 | 32 | }, \array_values(self::getConstants())); |
@@ -13,13 +13,13 @@ |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | protected function createItem($value) { |
| 16 | - $result=new HtmlCard("card-" . $this->count()); |
|
| 16 | + $result=new HtmlCard("card-".$this->count()); |
|
| 17 | 17 | if (\is_array($value)) { |
| 18 | 18 | $header=JArray::getValue($value, "header", 0); |
| 19 | 19 | $metas=JArray::getValue($value, "metas", 1); |
| 20 | 20 | $description=JArray::getValue($value, "description", 2); |
| 21 | 21 | $result->addCardHeaderContent($header, $metas, $description); |
| 22 | - } else |
|
| 22 | + }else |
|
| 23 | 23 | $result->addCardContent($value); |
| 24 | 24 | return $result; |
| 25 | 25 | } |
@@ -19,8 +19,9 @@ |
||
| 19 | 19 | $metas=JArray::getValue($value, "metas", 1); |
| 20 | 20 | $description=JArray::getValue($value, "description", 2); |
| 21 | 21 | $result->addCardHeaderContent($header, $metas, $description); |
| 22 | - } else |
|
| 23 | - $result->addCardContent($value); |
|
| 22 | + } else { |
|
| 23 | + $result->addCardContent($value); |
|
| 24 | + } |
|
| 24 | 25 | return $result; |
| 25 | 26 | } |
| 26 | 27 | |
@@ -16,19 +16,19 @@ discard block |
||
| 16 | 16 | class HtmlCard extends HtmlSemDoubleElement { |
| 17 | 17 | |
| 18 | 18 | public function __construct($identifier) { |
| 19 | - parent::__construct($identifier, "div", "ui card", array ()); |
|
| 19 | + parent::__construct($identifier, "div", "ui card", array()); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | private function createContent($content, $baseClass="content") { |
| 23 | 23 | $count=\sizeof($this->content); |
| 24 | - $result=new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 24 | + $result=new HtmlCardContent("content-".$count."-".$this->identifier, $content); |
|
| 25 | 25 | $result->setClass($baseClass); |
| 26 | 26 | return $result; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | private function addElementInContent($key, $element) { |
| 30 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 31 | - $this->content[$key]=array (); |
|
| 30 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 31 | + $this->content[$key]=array(); |
|
| 32 | 32 | } |
| 33 | 33 | $this->content[$key][]=$element; |
| 34 | 34 | return $element; |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function addHeader($header, $niveau=4, $type="page") { |
| 38 | 38 | if (!$header instanceof HtmlHeader) { |
| 39 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 39 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 40 | 40 | } |
| 41 | 41 | $this->content["header"]=$this->createContent($header); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function addImage($image, $title="") { |
| 45 | 45 | if (!$image instanceof HtmlImage) { |
| 46 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 46 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 47 | 47 | } |
| 48 | 48 | $image->setClass("image"); |
| 49 | 49 | return $this->addElementInContent("content", $image); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
| 53 | 53 | $reveal=$visibleContent; |
| 54 | 54 | if (!$visibleContent instanceof HtmlReveal) { |
| 55 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 55 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 56 | 56 | } |
| 57 | 57 | return $this->addElementInContent("content", $reveal); |
| 58 | 58 | } |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function addCardHeaderContent($header, $metas=array(), $description=NULL) { |
| 80 | 80 | $count=\sizeof($this->content); |
| 81 | - return $this->addElementInContent("content", new HtmlCardHeaderContent("content-" . $count . "-" . $this->identifier, $header, $metas, $description)); |
|
| 81 | + return $this->addElementInContent("content", new HtmlCardHeaderContent("content-".$count."-".$this->identifier, $header, $metas, $description)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | public function addCardContent($content=array()) { |
| 85 | 85 | $count=\sizeof($this->content); |
| 86 | - return $this->addElementInContent("content", new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 86 | + return $this->addElementInContent("content", new HtmlCardContent("content-".$count."-".$this->identifier, $content)); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function getCardContent($index){ |
|
| 89 | + public function getCardContent($index) { |
|
| 90 | 90 | return $this->content["content"][$index]; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 98 | 98 | */ |
| 99 | 99 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 100 | - $this->content=JArray::sortAssociative($this->content, [ "header","image","content","extra-content" ]); |
|
| 100 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]); |
|
| 101 | 101 | return parent::compile($js, $view); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function asLink($href="") { |
| 105 | 105 | $this->addToProperty("class", "link"); |
| 106 | - if ($href !== "") { |
|
| 106 | + if ($href!=="") { |
|
| 107 | 107 | $this->setProperty("href", $href); |
| 108 | 108 | } |
| 109 | 109 | return $this; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class HtmlCardHeaderContent extends HtmlCardContent { |
| 11 | 11 | |
| 12 | 12 | public function __construct($identifier, $header=NULL, $metas=array(), $description=NULL) { |
| 13 | - parent::__construct($identifier, array ()); |
|
| 13 | + parent::__construct($identifier, array()); |
|
| 14 | 14 | if (isset($header)) { |
| 15 | 15 | $this->setHeader($header); |
| 16 | 16 | } |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function setDescription($value) { |
| 24 | - $this->content["description"]=new HtmlSemDoubleElement("description-" . $this->identifier, "div", "description", $value); |
|
| 24 | + $this->content["description"]=new HtmlSemDoubleElement("description-".$this->identifier, "div", "description", $value); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function setHeader($value) { |
| 28 | - $this->content["header"]=new HtmlSemDoubleElement("header-" . $this->identifier, "a", "header", $value); |
|
| 28 | + $this->content["header"]=new HtmlSemDoubleElement("header-".$this->identifier, "a", "header", $value); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 36 | 36 | */ |
| 37 | 37 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 38 | - $this->content=JArray::sortAssociative($this->content, [ "image","header","meta","description" ]); |
|
| 38 | + $this->content=JArray::sortAssociative($this->content, ["image", "header", "meta", "description"]); |
|
| 39 | 39 | return parent::compile($js, $view); |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -15,16 +15,16 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | private function addElement($content, $baseClass) { |
| 17 | 17 | $count=\sizeof($this->content); |
| 18 | - $result=new HtmlSemDoubleElement("element-" . $count . "-" . $this->identifier, "div", $baseClass, $content); |
|
| 18 | + $result=new HtmlSemDoubleElement("element-".$count."-".$this->identifier, "div", $baseClass, $content); |
|
| 19 | 19 | $this->addContent($result); |
| 20 | 20 | return $result; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function addMeta($value, $direction=Direction::LEFT) { |
| 24 | - if (\array_key_exists("meta", $this->content) === false) { |
|
| 25 | - $this->content["meta"]=new HtmlSemDoubleElement("meta-" . $this->identifier, "div", "meta", array ()); |
|
| 24 | + if (\array_key_exists("meta", $this->content)===false) { |
|
| 25 | + $this->content["meta"]=new HtmlSemDoubleElement("meta-".$this->identifier, "div", "meta", array()); |
|
| 26 | 26 | } |
| 27 | - if ($direction === Direction::RIGHT) { |
|
| 27 | + if ($direction===Direction::RIGHT) { |
|
| 28 | 28 | $value=new HtmlSemDoubleElement("", "span", "", $value); |
| 29 | 29 | $value->setFloated($direction); |
| 30 | 30 | } |
@@ -42,26 +42,26 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function addMetas($metas) { |
| 44 | 44 | if (\is_array($metas)) { |
| 45 | - foreach ( $metas as $meta ) { |
|
| 45 | + foreach ($metas as $meta) { |
|
| 46 | 46 | $this->addMeta($meta); |
| 47 | 47 | } |
| 48 | - } else |
|
| 48 | + }else |
|
| 49 | 49 | $this->addMeta($metas); |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function addContentIcon($icon, $caption=NULL, $direction=Direction::LEFT) { |
| 54 | - if ($direction === Direction::RIGHT) { |
|
| 54 | + if ($direction===Direction::RIGHT) { |
|
| 55 | 55 | if (isset($caption)) { |
| 56 | 56 | $result=new HtmlSemDoubleElement("", "span", "", $caption); |
| 57 | 57 | $result->addIcon($icon); |
| 58 | 58 | $this->addContent($result); |
| 59 | - } else { |
|
| 59 | + }else { |
|
| 60 | 60 | $result=new HtmlIcon("", $icon); |
| 61 | 61 | $this->addContent($result); |
| 62 | 62 | } |
| 63 | 63 | $result->setFloated($direction); |
| 64 | - } else { |
|
| 64 | + }else { |
|
| 65 | 65 | $this->addIcon($icon); |
| 66 | 66 | $result=$this->addContent($caption); |
| 67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | public function addContentIcons($icons, $direction=Direction::LEFT) { |
| 72 | - foreach ( $icons as $icon ) { |
|
| 72 | + foreach ($icons as $icon) { |
|
| 73 | 73 | $this->addContentIcon($icon, NULL, $direction); |
| 74 | 74 | } |
| 75 | 75 | return $this; |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public function addImage($src="", $alt="", $size=NULL) { |
| 36 | 36 | $image=new HtmlImg("img-", $src, $alt); |
| 37 | - if (isset($size)) |
|
| 38 | - $image->setSize($size); |
|
| 37 | + if (isset($size)) { |
|
| 38 | + $image->setSize($size); |
|
| 39 | + } |
|
| 39 | 40 | $this->content["image"]=$image; |
| 40 | 41 | return $image; |
| 41 | 42 | } |
@@ -45,8 +46,9 @@ discard block |
||
| 45 | 46 | foreach ( $metas as $meta ) { |
| 46 | 47 | $this->addMeta($meta); |
| 47 | 48 | } |
| 48 | - } else |
|
| 49 | - $this->addMeta($metas); |
|
| 49 | + } else { |
|
| 50 | + $this->addMeta($metas); |
|
| 51 | + } |
|
| 50 | 52 | return $this; |
| 51 | 53 | } |
| 52 | 54 | |
@@ -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 | /** |