@@ -141,22 +141,36 @@ discard block |
||
| 141 | 141 | return $this; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | + /** |
|
| 145 | + * @param string $name |
|
| 146 | + * @param string $value |
|
| 147 | + */ |
|
| 144 | 148 | protected function removePropertyValue($name, $value) { |
| 145 | 149 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 146 | 150 | return $this; |
| 147 | 151 | } |
| 148 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $name |
|
| 155 | + */ |
|
| 149 | 156 | protected function removePropertyValues($name, $values) { |
| 150 | 157 | $this->removeOldValues($this->properties[$name], $values); |
| 151 | 158 | return $this; |
| 152 | 159 | } |
| 153 | 160 | |
| 161 | + /** |
|
| 162 | + * @param string $name |
|
| 163 | + */ |
|
| 154 | 164 | protected function removeProperty($name) { |
| 155 | 165 | if (\array_key_exists($name, $this->properties)) |
| 156 | 166 | unset($this->properties[$name]); |
| 157 | 167 | return $this; |
| 158 | 168 | } |
| 159 | 169 | |
| 170 | + /** |
|
| 171 | + * @param string $name |
|
| 172 | + * @param string[] $typeCtrl |
|
| 173 | + */ |
|
| 160 | 174 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 161 | 175 | if ($this->ctrl($name, $value, $typeCtrl) === true) { |
| 162 | 176 | if (is_array($typeCtrl)) { |
@@ -181,6 +195,9 @@ discard block |
||
| 181 | 195 | return $this->addToProperty($name, $value); |
| 182 | 196 | } |
| 183 | 197 | |
| 198 | + /** |
|
| 199 | + * @param string $name |
|
| 200 | + */ |
|
| 184 | 201 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 185 | 202 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
| 186 | 203 | } |
@@ -321,6 +338,9 @@ discard block |
||
| 321 | 338 | } |
| 322 | 339 | } |
| 323 | 340 | |
| 341 | + /** |
|
| 342 | + * @param string $operation |
|
| 343 | + */ |
|
| 324 | 344 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 325 | 345 | $params=array ("url" => $url,"responseElement" => $responseElement ); |
| 326 | 346 | $params=array_merge($params, $parameters); |
@@ -328,14 +348,23 @@ discard block |
||
| 328 | 348 | return $this; |
| 329 | 349 | } |
| 330 | 350 | |
| 351 | + /** |
|
| 352 | + * @param string $event |
|
| 353 | + */ |
|
| 331 | 354 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 332 | 355 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 333 | 356 | } |
| 334 | 357 | |
| 358 | + /** |
|
| 359 | + * @param string $url |
|
| 360 | + */ |
|
| 335 | 361 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 336 | 362 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 337 | 363 | } |
| 338 | 364 | |
| 365 | + /** |
|
| 366 | + * @param string $event |
|
| 367 | + */ |
|
| 339 | 368 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 340 | 369 | $parameters["params"]=$params; |
| 341 | 370 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -345,6 +374,9 @@ discard block |
||
| 345 | 374 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 346 | 375 | } |
| 347 | 376 | |
| 377 | + /** |
|
| 378 | + * @param string $event |
|
| 379 | + */ |
|
| 348 | 380 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 349 | 381 | $parameters["form"]=$form; |
| 350 | 382 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -394,6 +426,9 @@ discard block |
||
| 394 | 426 | return $value; |
| 395 | 427 | } |
| 396 | 428 | |
| 429 | + /** |
|
| 430 | + * @param string $jqueryCall |
|
| 431 | + */ |
|
| 397 | 432 | public function jsDoJquery($jqueryCall, $param="") { |
| 398 | 433 | return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
| 399 | 434 | } |
@@ -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() { |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function addToProperty($name, $value, $separator=" ") { |
| 59 | - if ($value !== "" && $this->propertyContains($name, $value) === false) { |
|
| 59 | + if ($value!=="" && $this->propertyContains($name, $value)===false) { |
|
| 60 | 60 | $v=@$this->properties[$name]; |
| 61 | - if (isset($v) && $v !== "") |
|
| 62 | - $v=$v . $separator . $value; |
|
| 61 | + if (isset($v) && $v!=="") |
|
| 62 | + $v=$v.$separator.$value; |
|
| 63 | 63 | else |
| 64 | 64 | $v=$value; |
| 65 | 65 | |
@@ -75,23 +75,23 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 77 | 77 | $result=$this->getTemplate($js); |
| 78 | - foreach ( $this as $key => $value ) { |
|
| 79 | - if (PhalconUtils::startsWith($key, "_") === false && $key !== "events") { |
|
| 78 | + foreach ($this as $key => $value) { |
|
| 79 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
| 80 | 80 | if (is_array($value)) { |
| 81 | 81 | $v=PropertyWrapper::wrap($value, $js); |
| 82 | - } else { |
|
| 82 | + }else { |
|
| 83 | 83 | $v=$value; |
| 84 | 84 | } |
| 85 | - $result=str_ireplace("%" . $key . "%", $v, $result); |
|
| 85 | + $result=str_ireplace("%".$key."%", $v, $result); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | if (isset($js)) { |
| 89 | 89 | $this->run($js); |
| 90 | 90 | } |
| 91 | - if (isset($view) === true) { |
|
| 91 | + if (isset($view)===true) { |
|
| 92 | 92 | $controls=$view->getVar("q"); |
| 93 | - if (isset($controls) === false) { |
|
| 94 | - $controls=array (); |
|
| 93 | + if (isset($controls)===false) { |
|
| 94 | + $controls=array(); |
|
| 95 | 95 | } |
| 96 | 96 | $controls[$this->identifier]=$result; |
| 97 | 97 | $view->setVar("q", $controls); |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | protected function ctrl($name, $value, $typeCtrl) { |
| 103 | 103 | if (is_array($typeCtrl)) { |
| 104 | - if (array_search($value, $typeCtrl) === false) { |
|
| 105 | - throw new \Exception("La valeur passée a propriété `" . $name . "` ne fait pas partie des valeurs possibles : {" . implode(",", $typeCtrl) . "}"); |
|
| 104 | + if (array_search($value, $typeCtrl)===false) { |
|
| 105 | + throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
| 106 | 106 | } |
| 107 | - } else { |
|
| 107 | + }else { |
|
| 108 | 108 | if (!$typeCtrl($value)) { |
| 109 | - throw new \Exception("La fonction " . $typeCtrl . " a retourné faux pour l'affectation de la propriété " . $name); |
|
| 109 | + throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | return true; |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 124 | - if ($this->ctrl($name, $value, $typeCtrl) === true) |
|
| 124 | + if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 125 | 125 | return $this->setProperty($name, $value); |
| 126 | 126 | return $this; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | protected function setMemberCtrl(&$name, $value, $typeCtrl) { |
| 130 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 130 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 131 | 131 | return $name=$value; |
| 132 | 132 | } |
| 133 | 133 | return $this; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | protected function addToMemberUnique(&$name, $value, $typeCtrl, $separator=" ") { |
| 137 | 137 | if (is_array($typeCtrl)) { |
| 138 | 138 | $this->removeOldValues($name, $typeCtrl); |
| 139 | - $name.=$separator . $value; |
|
| 139 | + $name.=$separator.$value; |
|
| 140 | 140 | } |
| 141 | 141 | return $this; |
| 142 | 142 | } |
@@ -158,17 +158,17 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 161 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 161 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 162 | 162 | if (is_array($typeCtrl)) { |
| 163 | 163 | $this->removeOldValues($name, $typeCtrl); |
| 164 | 164 | } |
| 165 | - $name.=$separator . $value; |
|
| 165 | + $name.=$separator.$value; |
|
| 166 | 166 | } |
| 167 | 167 | return $this; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | protected function addToMember(&$name, $value, $separator=" ") { |
| 171 | - $name=str_ireplace($value, "", $name) . $separator . $value; |
|
| 171 | + $name=str_ireplace($value, "", $name).$separator.$value; |
|
| 172 | 172 | return $this; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | public function addToPropertyCtrlCheck($name, $value, $typeCtrl) { |
| 189 | - if ($this->ctrl($name, $value, $typeCtrl) === true) { |
|
| 189 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 190 | 190 | return $this->addToProperty($name, $value); |
| 191 | 191 | } |
| 192 | 192 | return $this; |
@@ -214,28 +214,28 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | public function fromArray($array) { |
| 217 | - foreach ( $this as $key => $value ) { |
|
| 217 | + foreach ($this as $key => $value) { |
|
| 218 | 218 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
| 219 | - $setter="set" . ucfirst($key); |
|
| 219 | + $setter="set".ucfirst($key); |
|
| 220 | 220 | $this->$setter($array[$key]); |
| 221 | 221 | unset($array[$key]); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | - foreach ( $array as $key => $value ) { |
|
| 224 | + foreach ($array as $key => $value) { |
|
| 225 | 225 | if (method_exists($this, $key)) { |
| 226 | 226 | try { |
| 227 | 227 | $this->$key($value); |
| 228 | 228 | unset($array[$key]); |
| 229 | - } catch ( \Exception $e ) { |
|
| 229 | + } catch (\Exception $e) { |
|
| 230 | 230 | // Nothing to do |
| 231 | 231 | } |
| 232 | - } else { |
|
| 233 | - $setter="set" . ucfirst($key); |
|
| 232 | + }else { |
|
| 233 | + $setter="set".ucfirst($key); |
|
| 234 | 234 | if (method_exists($this, $setter)) { |
| 235 | 235 | try { |
| 236 | 236 | $this->$setter($value); |
| 237 | 237 | unset($array[$key]); |
| 238 | - } catch ( \Exception $e ) { |
|
| 238 | + } catch (\Exception $e) { |
|
| 239 | 239 | // Nothing to do |
| 240 | 240 | } |
| 241 | 241 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | public function fromDatabaseObjects($objects, $function) { |
| 248 | 248 | if (isset($objects)) { |
| 249 | - foreach ( $objects as $object ) { |
|
| 249 | + foreach ($objects as $object) { |
|
| 250 | 250 | $this->fromDatabaseObject($object, $function); |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -265,11 +265,11 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 268 | - if ($stopPropagation === true) { |
|
| 269 | - $jsCode="event.stopPropagation();" . $jsCode; |
|
| 268 | + if ($stopPropagation===true) { |
|
| 269 | + $jsCode="event.stopPropagation();".$jsCode; |
|
| 270 | 270 | } |
| 271 | - if ($preventDefault === true) { |
|
| 272 | - $jsCode="event.preventDefault();" . $jsCode; |
|
| 271 | + if ($preventDefault===true) { |
|
| 272 | + $jsCode="event.preventDefault();".$jsCode; |
|
| 273 | 273 | } |
| 274 | 274 | return $this->_addEvent($event, $jsCode); |
| 275 | 275 | } |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | if (array_key_exists($event, $this->_events)) { |
| 279 | 279 | if (is_array($this->_events[$event])) { |
| 280 | 280 | $this->_events[$event][]=$jsCode; |
| 281 | - } else { |
|
| 282 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 281 | + }else { |
|
| 282 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 283 | 283 | } |
| 284 | - } else { |
|
| 284 | + }else { |
|
| 285 | 285 | $this->_events[$event]=$jsCode; |
| 286 | 286 | } |
| 287 | 287 | return $this; |
@@ -301,15 +301,15 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | public function addEventsOnRun(JsUtils $js) { |
| 303 | 303 | if (isset($this->_bsComponent)) { |
| 304 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 304 | + foreach ($this->_events as $event => $jsCode) { |
|
| 305 | 305 | $code=$jsCode; |
| 306 | 306 | if (is_array($jsCode)) { |
| 307 | 307 | $code=""; |
| 308 | - foreach ( $jsCode as $jsC ) { |
|
| 308 | + foreach ($jsCode as $jsC) { |
|
| 309 | 309 | if ($jsC instanceof AjaxCall) { |
| 310 | - $code.="\n" . $jsC->compile($js); |
|
| 311 | - } else { |
|
| 312 | - $code.="\n" . $jsC; |
|
| 310 | + $code.="\n".$jsC->compile($js); |
|
| 311 | + }else { |
|
| 312 | + $code.="\n".$jsC; |
|
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -317,12 +317,12 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | $this->_bsComponent->addEvent($event, $code); |
| 319 | 319 | } |
| 320 | - $this->_events=array (); |
|
| 320 | + $this->_events=array(); |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 325 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 325 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 326 | 326 | $params=array_merge($params, $parameters); |
| 327 | 327 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 328 | 328 | return $this; |
@@ -358,15 +358,15 @@ discard block |
||
| 358 | 358 | if (is_array($elements)) { |
| 359 | 359 | $flag=false; |
| 360 | 360 | $index=0; |
| 361 | - while ( !$flag && $index < sizeof($elements) ) { |
|
| 361 | + while (!$flag && $index<sizeof($elements)) { |
|
| 362 | 362 | if ($elements[$index] instanceof BaseHtml) |
| 363 | - $flag=($elements[$index]->getIdentifier() === $identifier); |
|
| 363 | + $flag=($elements[$index]->getIdentifier()===$identifier); |
|
| 364 | 364 | $index++; |
| 365 | 365 | } |
| 366 | - if ($flag === true) |
|
| 367 | - return $elements[$index - 1]; |
|
| 366 | + if ($flag===true) |
|
| 367 | + return $elements[$index-1]; |
|
| 368 | 368 | } elseif ($elements instanceof BaseHtml) { |
| 369 | - if ($elements->getIdentifier() === $identifier) |
|
| 369 | + if ($elements->getIdentifier()===$identifier) |
|
| 370 | 370 | return $elements; |
| 371 | 371 | } |
| 372 | 372 | return null; |
@@ -388,14 +388,14 @@ discard block |
||
| 388 | 388 | if (is_array($value)) { |
| 389 | 389 | $value=implode(",", $value); |
| 390 | 390 | } |
| 391 | - if (strrpos($value, 'this') === false && strrpos($value, 'event') === false) { |
|
| 392 | - $value='"' . $value . '"'; |
|
| 391 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 392 | + $value='"'.$value.'"'; |
|
| 393 | 393 | } |
| 394 | 394 | return $value; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | public function jsDoJquery($jqueryCall, $param="") { |
| 398 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . $this->_prep_value($param) . ");"; |
|
| 398 | + return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | public function executeOnRun($jsCode) { |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | public function __construct($identifier, $rowCount, $colCount) { |
| 18 | 18 | parent::__construct($identifier, "table", "ui table"); |
| 19 | - $this->content=array (); |
|
| 19 | + $this->content=array(); |
|
| 20 | 20 | $this->setRowCount($rowCount, $colCount); |
| 21 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT,Variation::DEFINITION ]; |
|
| 21 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT, Variation::DEFINITION]; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -137,8 +137,8 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function setBasic($very=false) { |
| 139 | 139 | if ($very) |
| 140 | - $this->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 141 | - return $this->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 140 | + $this->addToPropertyCtrl("class", "very", array("very")); |
|
| 141 | + return $this->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | public function setCollapsing() { |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 35 | 35 | */ |
| 36 | 36 | public function setType($type="") { |
| 37 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 37 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setActiveItem($index) { |
| 41 | 41 | $item=$this->getItem($index); |
| 42 | - if ($item !== null) { |
|
| 42 | + if ($item!==null) { |
|
| 43 | 43 | $item->addToProperty("class", "active"); |
| 44 | 44 | } |
| 45 | 45 | return $this; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | private function getItemToInsert($item) { |
| 49 | 49 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon) { |
| 50 | - $itemO=new HtmlSemDoubleElement("item-" . $this->identifier, "div", ""); |
|
| 50 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
| 51 | 51 | $itemO->setContent($item); |
| 52 | 52 | $item=$itemO; |
| 53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | private function afterInsert($item) { |
| 58 | 58 | if (!$item instanceof HtmlMenu) |
| 59 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 59 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 60 | 60 | else { |
| 61 | 61 | $this->setSecondary(); |
| 62 | 62 | } |
@@ -87,9 +87,9 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | public function generateMenuAsItem($menu, $header=null) { |
| 89 | 89 | $count=$this->count(); |
| 90 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 90 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 91 | 91 | if (isset($header)) { |
| 92 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 92 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 93 | 93 | $headerItem->setContent($header); |
| 94 | 94 | $item->addContent($headerItem); |
| 95 | 95 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 107 | 107 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 108 | 108 | $value=$this->addItem($value); |
| 109 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 109 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 110 | 110 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 111 | 111 | $this->wrap("", $popup); |
| 112 | 112 | return $popup; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | public function addDropdownAsItem($value, $items=NULL) { |
| 116 | 116 | $dd=$value; |
| 117 | 117 | if (\is_string($value)) { |
| 118 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 118 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 119 | 119 | } |
| 120 | 120 | return $this->addItem($dd); |
| 121 | 121 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 128 | 128 | */ |
| 129 | 129 | protected function createItem($value) { |
| 130 | - $itemO=new HtmlLink("item-" . \sizeof($this->content), "", $value); |
|
| 130 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
| 131 | 131 | return $itemO->setClass("item"); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -140,28 +140,28 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | public function setVertical() { |
| 143 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 143 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | public function setPosition($value="right") { |
| 147 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 147 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function setPointing($value=Direction::NONE) { |
| 151 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 151 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function asTab($vertical=false) { |
| 155 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 155 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
| 156 | 156 | $item->setTagName("a"); |
| 157 | 157 | }); |
| 158 | - if ($vertical === true) |
|
| 158 | + if ($vertical===true) |
|
| 159 | 159 | $this->setVertical(); |
| 160 | 160 | return $this->addToProperty("class", "tabular"); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function asPagination() { |
| 164 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 164 | + $this->apply(function(HtmlDoubleElement & $item) { |
|
| 165 | 165 | $item->setTagName("a"); |
| 166 | 166 | }); |
| 167 | 167 | return $this->addToProperty("class", "pagination"); |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | public function setWidth($width) { |
| 200 | 200 | if (\is_int($width)) { |
| 201 | - $width=Wide::getConstants()["W" . $width]; |
|
| 201 | + $width=Wide::getConstants()["W".$width]; |
|
| 202 | 202 | } |
| 203 | 203 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 204 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 204 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public function addImage($identifier, $src="", $alt="") { |
@@ -17,12 +17,12 @@ discard block |
||
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | 19 | class HtmlSegment extends HtmlSemDoubleElement { |
| 20 | - use AttachedTrait,TextAlignmentTrait; |
|
| 20 | + use AttachedTrait, TextAlignmentTrait; |
|
| 21 | 21 | |
| 22 | 22 | public function __construct($identifier, $content="") { |
| 23 | 23 | parent::__construct($identifier, "div", "ui segment"); |
| 24 | - $this->_variations=\array_merge($this->_variations, [ Variation::PADDED,Variation::COMPACT ]); |
|
| 25 | - $this->_states=\array_merge($this->_states, [ State::LOADING ]); |
|
| 24 | + $this->_variations=\array_merge($this->_variations, [Variation::PADDED, Variation::COMPACT]); |
|
| 25 | + $this->_states=\array_merge($this->_states, [State::LOADING]); |
|
| 26 | 26 | $this->content=$content; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function setSens($sens="vertical") { |
| 39 | - return $this->addToPropertyCtrl("class", $sens, array ("vertical","horizontal" )); |
|
| 39 | + return $this->addToPropertyCtrl("class", $sens, array("vertical", "horizontal")); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function setEmphasis($value=Emphasis::SECONDARY) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function setFocusable($value=true) { |
| 57 | - if ($value === true) |
|
| 57 | + if ($value===true) |
|
| 58 | 58 | $this->setProperty("tabindex", "0"); |
| 59 | 59 | else { |
| 60 | 60 | $this->removeProperty("tabindex"); |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function setAnimated($content, $animation="") { |
| 66 | 66 | $this->setTagName("div"); |
| 67 | - $this->addToProperty("class", "animated " . $animation); |
|
| 68 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 67 | + $this->addToProperty("class", "animated ".$animation); |
|
| 68 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 69 | 69 | $visible->setClass("visible content"); |
| 70 | 70 | $visible->setContent($this->content); |
| 71 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 71 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 72 | 72 | $hidden->setClass("hidden content"); |
| 73 | 73 | $hidden->setContent($content); |
| 74 | - $this->content=array ($visible,$hidden ); |
|
| 74 | + $this->content=array($visible, $hidden); |
|
| 75 | 75 | return $hidden; |
| 76 | 76 | } |
| 77 | 77 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function asIcon($icon) { |
| 84 | 84 | $iconO=$icon; |
| 85 | 85 | if (\is_string($icon)) { |
| 86 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 86 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 87 | 87 | } |
| 88 | 88 | $this->addToProperty("class", "icon"); |
| 89 | 89 | $this->content=$iconO; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | public function addLabel($caption, $before=false) { |
| 105 | 105 | $this->tagName="div"; |
| 106 | 106 | $this->addToProperty("class", "labeled"); |
| 107 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 107 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 108 | 108 | $this->content->setTagName("div"); |
| 109 | - $label=new HtmlLabel("label-" . $this->identifier, $caption, "a"); |
|
| 109 | + $label=new HtmlLabel("label-".$this->identifier, $caption, "a"); |
|
| 110 | 110 | $label->setBasic(); |
| 111 | 111 | $this->addContent($label, $before); |
| 112 | 112 | return $label; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function fromArray($array) { |
| 120 | 120 | $array=parent::fromArray($array); |
| 121 | - foreach ( $array as $key => $value ) { |
|
| 121 | + foreach ($array as $key => $value) { |
|
| 122 | 122 | $this->setProperty($key, $value); |
| 123 | 123 | } |
| 124 | 124 | return $array; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | public static function social($identifier, $social, $value=NULL) { |
| 184 | - if ($value === NULL) |
|
| 184 | + if ($value===NULL) |
|
| 185 | 185 | $value=\ucfirst($social); |
| 186 | 186 | $return=new HtmlButton($identifier, $value); |
| 187 | 187 | $return->addIcon($social); |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | use IconTrait; |
| 13 | 13 | |
| 14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
| 15 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
| 15 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 16 | 16 | $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
| 17 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
| 18 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
| 17 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 18 | + $this->_variations=[Variation::TRANSPARENT]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function setFocus() { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function addLoading() { |
| 26 | - if ($this->_hasIcon === false) { |
|
| 26 | + if ($this->_hasIcon===false) { |
|
| 27 | 27 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 28 | 28 | } |
| 29 | 29 | return $this->addToProperty("class", State::LOADING); |
@@ -31,31 +31,31 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
| 33 | 33 | $labelO=$label; |
| 34 | - if (\is_object($label) === false) { |
|
| 35 | - $labelO=new HtmlLabel("label-" . $this->identifier, $label); |
|
| 34 | + if (\is_object($label)===false) { |
|
| 35 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
| 36 | 36 | if (isset($icon)) |
| 37 | 37 | $labelO->addIcon($icon); |
| 38 | - } else { |
|
| 39 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
| 38 | + }else { |
|
| 39 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
| 40 | 40 | } |
| 41 | - $this->addToProperty("class", $direction . " labeled"); |
|
| 42 | - $this->addContent($labelO, \strstr($direction, Direction::LEFT) !== false); |
|
| 41 | + $this->addToProperty("class", $direction." labeled"); |
|
| 42 | + $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
|
| 43 | 43 | return $labelO; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function labeledToCorner($label, $direction=Direction::LEFT, $icon=NULL) { |
| 47 | - return $this->labeled($label, $direction . " corner", $icon)->toCorner($direction); |
|
| 47 | + return $this->labeled($label, $direction." corner", $icon)->toCorner($direction); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) { |
| 51 | 51 | $actionO=$action; |
| 52 | - if (\is_object($action) === false) { |
|
| 53 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
| 52 | + if (\is_object($action)===false) { |
|
| 53 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 54 | 54 | if (isset($icon)) |
| 55 | 55 | $actionO->addIcon($icon, true, $labeled); |
| 56 | 56 | } |
| 57 | - $this->addToProperty("class", $direction . " action"); |
|
| 58 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
| 57 | + $this->addToProperty("class", $direction." action"); |
|
| 58 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 59 | 59 | return $actionO; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | \ No newline at end of file |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | use Ajax\semantic\html\base\constants\Direction; |
| 8 | 8 | |
| 9 | 9 | trait BaseTrait { |
| 10 | - protected $_variations=[ ]; |
|
| 11 | - protected $_states=[ ]; |
|
| 10 | + protected $_variations=[]; |
|
| 11 | + protected $_states=[]; |
|
| 12 | 12 | protected $_baseClass; |
| 13 | 13 | |
| 14 | 14 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function addVariations($variations=array()) { |
| 41 | 41 | if (\is_string($variations)) |
| 42 | 42 | $variations=\explode(" ", $variations); |
| 43 | - foreach ( $variations as $variation ) { |
|
| 43 | + foreach ($variations as $variation) { |
|
| 44 | 44 | $this->addVariation($variation); |
| 45 | 45 | } |
| 46 | 46 | return $this; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function addStates($states=array()) { |
| 50 | 50 | if (\is_string($states)) |
| 51 | 51 | $states=\explode(" ", $states); |
| 52 | - foreach ( $states as $state ) { |
|
| 52 | + foreach ($states as $state) { |
|
| 53 | 53 | $this->addState($state); |
| 54 | 54 | } |
| 55 | 55 | return $this; |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function setFloated($direction="right") { |
| 105 | - return $this->addToPropertyCtrl("class", $direction . " floated", Direction::getConstantValues("floated")); |
|
| 105 | + return $this->addToPropertyCtrl("class", $direction." floated", Direction::getConstantValues("floated")); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function floatRight() { |
@@ -30,10 +30,10 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function setWidth($width) { |
| 32 | 32 | if (\is_int($width)) { |
| 33 | - $width=Wide::getConstants()["W" . $width]; |
|
| 33 | + $width=Wide::getConstants()["W".$width]; |
|
| 34 | 34 | } |
| 35 | 35 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 36 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
| 36 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function setValue($value) { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | public function setColCount($colCount) { |
| 22 | 22 | $count=$this->count(); |
| 23 | - for($i=$count; $i < $colCount; $i++) { |
|
| 23 | + for ($i=$count; $i<$colCount; $i++) { |
|
| 24 | 24 | $item=$this->addItem(NULL); |
| 25 | 25 | $item->setTagName($this->_tdTagName); |
| 26 | 26 | } |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function setValues($values=array()) { |
| 62 | 62 | $count=$this->count(); |
| 63 | - if (\is_array($values) === false) { |
|
| 63 | + if (\is_array($values)===false) { |
|
| 64 | 64 | $values=\array_fill(0, $count, $values); |
| 65 | 65 | } |
| 66 | 66 | $count=\min(\sizeof($values), $count); |
| 67 | 67 | |
| 68 | - for($i=0; $i < $count; $i++) { |
|
| 68 | + for ($i=0; $i<$count; $i++) { |
|
| 69 | 69 | $cell=$this->content[$i]; |
| 70 | 70 | $cell->setValue($values[$i]); |
| 71 | 71 | } |