@@ -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 | } |
@@ -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) { |
@@ -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 | /** |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class HtmlLabelGroups extends HtmlSemCollection { |
| 17 | 17 | |
| 18 | - public function __construct($identifier,$labels=array(), $attributes=array()) { |
|
| 18 | + public function __construct($identifier, $labels=array(), $attributes=array()) { |
|
| 19 | 19 | parent::__construct($identifier, "div", "ui labels"); |
| 20 | - $this->_states=\array_merge(Size::getConstants(),Color::getConstants(),["tag","circular"]); |
|
| 20 | + $this->_states=\array_merge(Size::getConstants(), Color::getConstants(), ["tag", "circular"]); |
|
| 21 | 21 | $this->addItems($labels); |
| 22 | 22 | $this->setStates($attributes); |
| 23 | 23 | } |
@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | $icon=JArray::getValue($value, "icon", 1); |
| 32 | 32 | $tagName=JArray::getValue($value, "tagName", 2); |
| 33 | 33 | } |
| 34 | - $labelO=new HtmlLabel("label-" . $this->identifier, $caption,$icon,$tagName); |
|
| 34 | + $labelO=new HtmlLabel("label-".$this->identifier, $caption, $icon, $tagName); |
|
| 35 | 35 | return $labelO; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | protected function createCondition($value) { |
| 39 | - return ($value instanceof HtmlLabel) === false; |
|
| 39 | + return ($value instanceof HtmlLabel)===false; |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | \ No newline at end of file |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected function createItem($value) { |
| 20 | 20 | $count=$this->count(); |
| 21 | - $item=new HtmlListItem("item-" . $this->identifier . "-" . $count, $value); |
|
| 21 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 22 | 22 | return $item; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addHeader($niveau, $content) { |
| 26 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $content, "page"); |
|
| 26 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $content, "page"); |
|
| 27 | 27 | $this->wrap($header); |
| 28 | 28 | return $header; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function getItemPart($index,$partName="header"){ |
|
| 31 | + public function getItemPart($index, $partName="header") { |
|
| 32 | 32 | return $this->getItem($index)->getPart($partName); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function asLink() { |
| 40 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 40 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 41 | 41 | return $this->contentAs("a"); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function run(JsUtils $js) { |
| 63 | - if ($this->_hasCheckedList === true) { |
|
| 64 | - $jsCode=include dirname(__FILE__) . '/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | - $jsCode=\str_replace("%identifier%", "#" . $this->identifier, $jsCode); |
|
| 63 | + if ($this->_hasCheckedList===true) { |
|
| 64 | + $jsCode=include dirname(__FILE__).'/../../components/jsTemplates/tplCheckedList.php'; |
|
| 65 | + $jsCode=\str_replace("%identifier%", "#".$this->identifier, $jsCode); |
|
| 66 | 66 | $this->executeOnRun($jsCode); |
| 67 | 67 | } |
| 68 | 68 | return parent::run($js); |
@@ -86,28 +86,28 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | public function addCheckedList($items=array(), $masterItem=NULL, $values=array()) { |
| 88 | 88 | $count=$this->count(); |
| 89 | - $identifier=$this->identifier . "-" . $count; |
|
| 89 | + $identifier=$this->identifier."-".$count; |
|
| 90 | 90 | if (isset($masterItem)) { |
| 91 | - $masterO=new HtmlFormCheckbox("master-" . $identifier, $masterItem); |
|
| 91 | + $masterO=new HtmlFormCheckbox("master-".$identifier, $masterItem); |
|
| 92 | 92 | $masterO->getField()->addToProperty("class", "master"); |
| 93 | 93 | $masterO->setClass("item"); |
| 94 | 94 | $this->addItem($masterO); |
| 95 | 95 | } |
| 96 | - $fields=array (); |
|
| 96 | + $fields=array(); |
|
| 97 | 97 | $i=0; |
| 98 | - foreach ( $items as $val => $caption ) { |
|
| 99 | - $itemO=new HtmlFormCheckbox($identifier . "-" . $i++, $caption, $val, "child"); |
|
| 100 | - if (\array_search($val, $values) !== false) { |
|
| 98 | + foreach ($items as $val => $caption) { |
|
| 99 | + $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
|
| 100 | + if (\array_search($val, $values)!==false) { |
|
| 101 | 101 | $itemO->getField()->getField()->setProperty("checked", ""); |
| 102 | 102 | } |
| 103 | 103 | $itemO->setClass("item"); |
| 104 | 104 | $fields[]=$itemO; |
| 105 | 105 | } |
| 106 | - if (isset($masterO) === true) { |
|
| 106 | + if (isset($masterO)===true) { |
|
| 107 | 107 | $list=new HtmlList("", $fields); |
| 108 | 108 | $list->setClass("list"); |
| 109 | 109 | $masterO->addContent($list); |
| 110 | - } else { |
|
| 110 | + }else { |
|
| 111 | 111 | $this->addList($fields); |
| 112 | 112 | } |
| 113 | 113 | $this->_hasCheckedList=true; |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | use IconTrait; |
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
| 16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
| 17 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
| 18 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
| 19 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
| 16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 17 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
| 18 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 19 | + $this->_variations=[Variation::TRANSPARENT]; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function setFocus() { |
@@ -24,38 +24,38 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public function addLoading() { |
| 27 | - if ($this->_hasIcon === false) { |
|
| 27 | + if ($this->_hasIcon===false) { |
|
| 28 | 28 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 29 | 29 | } |
| 30 | 30 | return $this->addToProperty("class", State::LOADING); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
| 34 | - $labelO=$this->addLabel($label,$direction===Direction::LEFT,$icon); |
|
| 35 | - $this->addToProperty("class", $direction . " labeled"); |
|
| 34 | + $labelO=$this->addLabel($label, $direction===Direction::LEFT, $icon); |
|
| 35 | + $this->addToProperty("class", $direction." labeled"); |
|
| 36 | 36 | return $labelO; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
| 40 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
| 40 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
| 44 | 44 | $actionO=$action; |
| 45 | - if (\is_object($action) === false) { |
|
| 46 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
| 45 | + if (\is_object($action)===false) { |
|
| 46 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 47 | 47 | if (isset($icon)) |
| 48 | 48 | $actionO->addIcon($icon, true, $labeled); |
| 49 | 49 | } |
| 50 | - $this->addToProperty("class", $direction . " action"); |
|
| 51 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
| 50 | + $this->addToProperty("class", $direction." action"); |
|
| 51 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 52 | 52 | return $actionO; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
| 56 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
| 57 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
| 58 | - return $this->labeled($labelO,$direction); |
|
| 55 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
| 56 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
| 57 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
| 58 | + return $this->labeled($labelO, $direction); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function getField() { |
@@ -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) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @return \Ajax\semantic\html\HtmlIcon |
| 69 | 69 | */ |
| 70 | 70 | public function setFlipped($sens="horizontally") { |
| 71 | - return $this->addToProperty("class", "flipped " . $sens); |
|
| 71 | + return $this->addToProperty("class", "flipped ".$sens); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @return \Ajax\semantic\html\HtmlIcon |
| 78 | 78 | */ |
| 79 | 79 | public function setRotated($sens="clockwise") { |
| 80 | - return $this->addToProperty("class", "rotated " . $sens); |
|
| 80 | + return $this->addToProperty("class", "rotated ".$sens); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function asLink($href=NULL) { |
| 88 | 88 | if (isset($href)) { |
| 89 | - $this->wrap("<a href='" . $href . "'>", "</a>"); |
|
| 89 | + $this->wrap("<a href='".$href."'>", "</a>"); |
|
| 90 | 90 | } |
| 91 | 91 | return $this->addToProperty("class", "link"); |
| 92 | 92 | } |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function setBordered($inverted=false) { |
| 104 | 104 | $invertedStr=""; |
| 105 | - if ($inverted !== false) |
|
| 105 | + if ($inverted!==false) |
|
| 106 | 106 | $invertedStr=" inverted"; |
| 107 | - return $this->addToProperty("class", "bordered" . $invertedStr); |
|
| 107 | + return $this->addToProperty("class", "bordered".$invertedStr); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | public function addLabel($label, $before=false, $icon=NULL) { |
| 119 | - if($before) |
|
| 119 | + if ($before) |
|
| 120 | 120 | $this->wrap($label); |
| 121 | 121 | else |
| 122 | 122 | $this->wrap("", $label); |
| 123 | - if(isset($icon)) |
|
| 123 | + if (isset($icon)) |
|
| 124 | 124 | $this->addToIcon($icon); |
| 125 | 125 | return $this; |
| 126 | 126 | } |