@@ -50,16 +50,18 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getProperty($name) { |
| 53 | - if (array_key_exists($name, $this->properties)) |
|
| 54 | - return $this->properties [$name]; |
|
| 53 | + if (array_key_exists($name, $this->properties)) { |
|
| 54 | + return $this->properties [$name]; |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 59 | $v=@$this->properties[$name]; |
| 59 | - if (isset($v)&&$v!=="") |
|
| 60 | - $v=$v.$separator.$value; |
|
| 61 | - else |
|
| 62 | - $v=$value; |
|
| 60 | + if (isset($v)&&$v!=="") { |
|
| 61 | + $v=$v.$separator.$value; |
|
| 62 | + } else { |
|
| 63 | + $v=$value; |
|
| 64 | + } |
|
| 63 | 65 | |
| 64 | 66 | return $this->setProperty($name, $v); |
| 65 | 67 | } |
@@ -117,8 +119,9 @@ discard block |
||
| 117 | 119 | } |
| 118 | 120 | |
| 119 | 121 | protected function setPropertyCtrl($name, $value, $typeCtrl) { |
| 120 | - if ($this->ctrl($name, $value, $typeCtrl)===true) |
|
| 121 | - return $this->setProperty($name, $value); |
|
| 122 | + if ($this->ctrl($name, $value, $typeCtrl)===true) { |
|
| 123 | + return $this->setProperty($name, $value); |
|
| 124 | + } |
|
| 122 | 125 | return $this; |
| 123 | 126 | } |
| 124 | 127 | |
@@ -143,8 +146,9 @@ discard block |
||
| 143 | 146 | } |
| 144 | 147 | |
| 145 | 148 | protected function removeProperty($name){ |
| 146 | - if(\array_key_exists($name, $this->properties)) |
|
| 147 | - unset($this->properties[$name]); |
|
| 149 | + if(\array_key_exists($name, $this->properties)) { |
|
| 150 | + unset($this->properties[$name]); |
|
| 151 | + } |
|
| 148 | 152 | return $this; |
| 149 | 153 | } |
| 150 | 154 | |
@@ -164,8 +168,9 @@ discard block |
||
| 164 | 168 | } |
| 165 | 169 | |
| 166 | 170 | protected function addToPropertyUnique($name, $value, $typeCtrl) { |
| 167 | - if (@class_exists($typeCtrl, true)) |
|
| 168 | - $typeCtrl=$typeCtrl::getConstants(); |
|
| 171 | + if (@class_exists($typeCtrl, true)) { |
|
| 172 | + $typeCtrl=$typeCtrl::getConstants(); |
|
| 173 | + } |
|
| 169 | 174 | if (is_array($typeCtrl)) { |
| 170 | 175 | $this->removeOldValues($this->properties [$name], $typeCtrl); |
| 171 | 176 | } |
@@ -348,15 +353,18 @@ discard block |
||
| 348 | 353 | $flag=false; |
| 349 | 354 | $index=0; |
| 350 | 355 | while ( !$flag&&$index<sizeof($elements) ) { |
| 351 | - if ($elements [$index] instanceof BaseHtml) |
|
| 352 | - $flag=($elements [$index]->getIdentifier()===$identifier); |
|
| 356 | + if ($elements [$index] instanceof BaseHtml) { |
|
| 357 | + $flag=($elements [$index]->getIdentifier()===$identifier); |
|
| 358 | + } |
|
| 353 | 359 | $index++; |
| 354 | 360 | } |
| 355 | - if ($flag===true) |
|
| 356 | - return $elements [$index-1]; |
|
| 361 | + if ($flag===true) { |
|
| 362 | + return $elements [$index-1]; |
|
| 363 | + } |
|
| 357 | 364 | } elseif ($elements instanceof BaseHtml) { |
| 358 | - if ($elements->getIdentifier()===$identifier) |
|
| 359 | - return $elements; |
|
| 365 | + if ($elements->getIdentifier()===$identifier) { |
|
| 366 | + return $elements; |
|
| 367 | + } |
|
| 360 | 368 | } |
| 361 | 369 | return null; |
| 362 | 370 | } |
@@ -16,8 +16,8 @@ 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 (); |
|
| 19 | + protected $properties=array(); |
|
| 20 | + protected $events=array(); |
|
| 21 | 21 | protected $wrapBefore=""; |
| 22 | 22 | protected $wrapAfter=""; |
| 23 | 23 | protected $_bsComponent; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public function addToProperty($name, $value, $separator=" ") { |
| 58 | 58 | $v=@$this->properties[$name]; |
| 59 | - if (isset($v)&&$v!=="") |
|
| 59 | + if (isset($v) && $v!=="") |
|
| 60 | 60 | $v=$v.$separator.$value; |
| 61 | 61 | else |
| 62 | 62 | $v=$value; |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 73 | 73 | $result=$this->getTemplate(); |
| 74 | - foreach ( $this as $key => $value ) { |
|
| 75 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
| 74 | + foreach ($this as $key => $value) { |
|
| 75 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
| 76 | 76 | if (is_array($value)) { |
| 77 | 77 | $v=PropertyWrapper::wrap($value, $js); |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $v=$value; |
| 80 | 80 | } |
| 81 | 81 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if (isset($view)===true) { |
| 88 | 88 | $controls=$view->getVar("q"); |
| 89 | 89 | if (isset($controls)===false) { |
| 90 | - $controls=array (); |
|
| 90 | + $controls=array(); |
|
| 91 | 91 | } |
| 92 | 92 | $controls [$this->identifier]=$result; |
| 93 | 93 | $view->setVar("q", $controls); |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | if (array_search($value, $typeCtrl)===false) { |
| 101 | 101 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
| 102 | 102 | } |
| 103 | - } else { |
|
| 103 | + }else { |
|
| 104 | 104 | if (!$typeCtrl($value)) { |
| 105 | 105 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
| 106 | 106 | } |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - protected function propertyContains($propertyName,$value){ |
|
| 111 | + protected function propertyContains($propertyName, $value) { |
|
| 112 | 112 | $values=$this->getProperty($propertyName); |
| 113 | - if(isset($values)){ |
|
| 113 | + if (isset($values)) { |
|
| 114 | 114 | return JString::contains($values, $value); |
| 115 | 115 | } |
| 116 | 116 | return false; |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | return $this; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - protected function removePropertyValue($name,$value){ |
|
| 140 | + protected function removePropertyValue($name, $value) { |
|
| 141 | 141 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - protected function removeProperty($name){ |
|
| 146 | - if(\array_key_exists($name, $this->properties)) |
|
| 145 | + protected function removeProperty($name) { |
|
| 146 | + if (\array_key_exists($name, $this->properties)) |
|
| 147 | 147 | unset($this->properties[$name]); |
| 148 | 148 | return $this; |
| 149 | 149 | } |
@@ -196,28 +196,28 @@ discard block |
||
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | public function fromArray($array) { |
| 199 | - foreach ( $this as $key => $value ) { |
|
| 199 | + foreach ($this as $key => $value) { |
|
| 200 | 200 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
| 201 | 201 | $setter="set".ucfirst($key); |
| 202 | 202 | $this->$setter($array [$key]); |
| 203 | 203 | unset($array [$key]); |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | - foreach ( $array as $key => $value ) { |
|
| 206 | + foreach ($array as $key => $value) { |
|
| 207 | 207 | if (method_exists($this, $key)) { |
| 208 | 208 | try { |
| 209 | 209 | $this->$key($value); |
| 210 | 210 | unset($array [$key]); |
| 211 | - } catch ( \Exception $e ) { |
|
| 211 | + } catch (\Exception $e) { |
|
| 212 | 212 | // Nothing to do |
| 213 | 213 | } |
| 214 | - } else { |
|
| 214 | + }else { |
|
| 215 | 215 | $setter="set".ucfirst($key); |
| 216 | 216 | if (method_exists($this, $setter)) { |
| 217 | 217 | try { |
| 218 | 218 | $this->$setter($value); |
| 219 | 219 | unset($array [$key]); |
| 220 | - } catch ( \Exception $e ) { |
|
| 220 | + } catch (\Exception $e) { |
|
| 221 | 221 | // Nothing to do |
| 222 | 222 | } |
| 223 | 223 | } |
@@ -226,21 +226,21 @@ discard block |
||
| 226 | 226 | return $array; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - public function fromDatabaseObjects($objects,$function) { |
|
| 230 | - if(isset($objects)){ |
|
| 231 | - foreach ($objects as $object){ |
|
| 232 | - $this->fromDatabaseObject($object,$function); |
|
| 229 | + public function fromDatabaseObjects($objects, $function) { |
|
| 230 | + if (isset($objects)) { |
|
| 231 | + foreach ($objects as $object) { |
|
| 232 | + $this->fromDatabaseObject($object, $function); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | return $this; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function fromDatabaseObject($object,$function){ |
|
| 238 | + public function fromDatabaseObject($object, $function) { |
|
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | public function wrap($before, $after="") { |
| 243 | - if(isset($before)){ |
|
| 243 | + if (isset($before)) { |
|
| 244 | 244 | $this->wrapBefore.=$before; |
| 245 | 245 | } |
| 246 | 246 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | if (array_key_exists($event, $this->events)) { |
| 263 | 263 | if (is_array($this->events [$event])) { |
| 264 | 264 | $this->events [$event] []=$jsCode; |
| 265 | - } else { |
|
| 266 | - $this->events [$event]=array ( |
|
| 265 | + }else { |
|
| 266 | + $this->events [$event]=array( |
|
| 267 | 267 | $this->events [$event], |
| 268 | 268 | $jsCode |
| 269 | 269 | ); |
| 270 | 270 | } |
| 271 | - } else { |
|
| 271 | + }else { |
|
| 272 | 272 | $this->events [$event]=$jsCode; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -287,14 +287,14 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | public function addEventsOnRun(JsUtils $js) { |
| 289 | 289 | if (isset($this->_bsComponent)) { |
| 290 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 290 | + foreach ($this->events as $event => $jsCode) { |
|
| 291 | 291 | $code=$jsCode; |
| 292 | 292 | if (is_array($jsCode)) { |
| 293 | 293 | $code=""; |
| 294 | - foreach ( $jsCode as $jsC ) { |
|
| 294 | + foreach ($jsCode as $jsC) { |
|
| 295 | 295 | if ($jsC instanceof AjaxCall) { |
| 296 | 296 | $code.="\n".$jsC->compile($js); |
| 297 | - } else { |
|
| 297 | + }else { |
|
| 298 | 298 | $code.="\n".$jsC; |
| 299 | 299 | } |
| 300 | 300 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 311 | - $params=array ( |
|
| 311 | + $params=array( |
|
| 312 | 312 | "url" => $url, |
| 313 | 313 | "responseElement" => $responseElement |
| 314 | 314 | ); |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | if (is_array($elements)) { |
| 348 | 348 | $flag=false; |
| 349 | 349 | $index=0; |
| 350 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
| 350 | + while (!$flag && $index<sizeof($elements)) { |
|
| 351 | 351 | if ($elements [$index] instanceof BaseHtml) |
| 352 | 352 | $flag=($elements [$index]->getIdentifier()===$identifier); |
| 353 | 353 | $index++; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | return null; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - public function __toString(){ |
|
| 364 | + public function __toString() { |
|
| 365 | 365 | return $this->compile(); |
| 366 | 366 | } |
| 367 | 367 | |
@@ -377,25 +377,25 @@ discard block |
||
| 377 | 377 | if (is_array($value)) { |
| 378 | 378 | $value=implode(",", $value); |
| 379 | 379 | } |
| 380 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
| 380 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 381 | 381 | $value='"'.$value.'"'; |
| 382 | 382 | } |
| 383 | 383 | return $value; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
| 386 | + public function jsDoJquery($jqueryCall, $param="") { |
|
| 387 | 387 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - public function jsHtml($content=""){ |
|
| 391 | - return $this->jsDoJquery("html",$content); |
|
| 390 | + public function jsHtml($content="") { |
|
| 391 | + return $this->jsDoJquery("html", $content); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | - public function jsShow(){ |
|
| 394 | + public function jsShow() { |
|
| 395 | 395 | return $this->jsDoJquery("show"); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - public function jsHide(){ |
|
| 398 | + public function jsHide() { |
|
| 399 | 399 | return $this->jsDoJquery("hide"); |
| 400 | 400 | } |
| 401 | 401 | |
@@ -108,6 +108,10 @@ discard block |
||
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + /** |
|
| 112 | + * @param string $propertyName |
|
| 113 | + * @param string $value |
|
| 114 | + */ |
|
| 111 | 115 | protected function propertyContains($propertyName,$value){ |
| 112 | 116 | $values=$this->getProperty($propertyName); |
| 113 | 117 | if(isset($values)){ |
@@ -137,17 +141,28 @@ discard block |
||
| 137 | 141 | return $this; |
| 138 | 142 | } |
| 139 | 143 | |
| 144 | + /** |
|
| 145 | + * @param string $name |
|
| 146 | + * @param string $value |
|
| 147 | + */ |
|
| 140 | 148 | protected function removePropertyValue($name,$value){ |
| 141 | 149 | $this->properties[$name]=\str_replace($value, "", $this->properties[$name]); |
| 142 | 150 | return $this; |
| 143 | 151 | } |
| 144 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $name |
|
| 155 | + */ |
|
| 145 | 156 | protected function removeProperty($name){ |
| 146 | 157 | if(\array_key_exists($name, $this->properties)) |
| 147 | 158 | unset($this->properties[$name]); |
| 148 | 159 | return $this; |
| 149 | 160 | } |
| 150 | 161 | |
| 162 | + /** |
|
| 163 | + * @param string $name |
|
| 164 | + * @param string[] $typeCtrl |
|
| 165 | + */ |
|
| 151 | 166 | protected function addToMemberCtrl(&$name, $value, $typeCtrl, $separator=" ") { |
| 152 | 167 | if ($this->ctrl($name, $value, $typeCtrl)===true) { |
| 153 | 168 | if (is_array($typeCtrl)) { |
@@ -172,6 +187,9 @@ discard block |
||
| 172 | 187 | return $this->addToProperty($name, $value); |
| 173 | 188 | } |
| 174 | 189 | |
| 190 | + /** |
|
| 191 | + * @param string $name |
|
| 192 | + */ |
|
| 175 | 193 | public function addToPropertyCtrl($name, $value, $typeCtrl) { |
| 176 | 194 | // if($this->ctrl($name, $value, $typeCtrl)===true){ |
| 177 | 195 | return $this->addToPropertyUnique($name, $value, $typeCtrl); |
@@ -239,6 +257,9 @@ discard block |
||
| 239 | 257 | |
| 240 | 258 | } |
| 241 | 259 | |
| 260 | + /** |
|
| 261 | + * @param string $before |
|
| 262 | + */ |
|
| 242 | 263 | public function wrap($before, $after="") { |
| 243 | 264 | if(isset($before)){ |
| 244 | 265 | $this->wrapBefore.=$before; |
@@ -307,6 +328,9 @@ discard block |
||
| 307 | 328 | } |
| 308 | 329 | } |
| 309 | 330 | |
| 331 | + /** |
|
| 332 | + * @param string $operation |
|
| 333 | + */ |
|
| 310 | 334 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 311 | 335 | $params=array ( |
| 312 | 336 | "url" => $url, |
@@ -317,14 +341,23 @@ discard block |
||
| 317 | 341 | return $this; |
| 318 | 342 | } |
| 319 | 343 | |
| 344 | + /** |
|
| 345 | + * @param string $event |
|
| 346 | + */ |
|
| 320 | 347 | public function getOn($event, $url, $responseElement="", $parameters=array()) { |
| 321 | 348 | return $this->_ajaxOn("get", $event, $url, $responseElement, $parameters); |
| 322 | 349 | } |
| 323 | 350 | |
| 351 | + /** |
|
| 352 | + * @param string $url |
|
| 353 | + */ |
|
| 324 | 354 | public function getOnClick($url, $responseElement="", $parameters=array()) { |
| 325 | 355 | return $this->getOn("click", $url, $responseElement, $parameters); |
| 326 | 356 | } |
| 327 | 357 | |
| 358 | + /** |
|
| 359 | + * @param string $event |
|
| 360 | + */ |
|
| 328 | 361 | public function postOn($event, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 329 | 362 | $parameters ["params"]=$params; |
| 330 | 363 | return $this->_ajaxOn("post", $event, $url, $responseElement, $parameters); |
@@ -334,6 +367,9 @@ discard block |
||
| 334 | 367 | return $this->postOn("click", $url, $params, $responseElement, $parameters); |
| 335 | 368 | } |
| 336 | 369 | |
| 370 | + /** |
|
| 371 | + * @param string $event |
|
| 372 | + */ |
|
| 337 | 373 | public function postFormOn($event, $url, $form, $responseElement="", $parameters=array()) { |
| 338 | 374 | $parameters ["form"]=$form; |
| 339 | 375 | return $this->_ajaxOn("postForm", $event, $url, $responseElement, $parameters); |
@@ -383,6 +419,9 @@ discard block |
||
| 383 | 419 | return $value; |
| 384 | 420 | } |
| 385 | 421 | |
| 422 | + /** |
|
| 423 | + * @param string $jqueryCall |
|
| 424 | + */ |
|
| 386 | 425 | public function jsDoJquery($jqueryCall, $param=""){ |
| 387 | 426 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 388 | 427 | } |
@@ -8,53 +8,53 @@ |
||
| 8 | 8 | use Ajax\semantic\html\base\constants\Variation; |
| 9 | 9 | use Ajax\semantic\html\base\traits\IconTrait; |
| 10 | 10 | |
| 11 | -class HtmlInput extends HtmlSemDoubleElement{ |
|
| 11 | +class HtmlInput extends HtmlSemDoubleElement { |
|
| 12 | 12 | use IconTrait; |
| 13 | - public function __construct($identifier,$type="text",$value="",$placeholder=""){ |
|
| 14 | - parent::__construct("div-".$identifier,"div","ui input"); |
|
| 15 | - $this->content=new \Ajax\common\html\html5\HtmlInput($identifier,$type,$value,$placeholder); |
|
| 16 | - $this->_states=[State::DISABLED,State::FOCUS,State::ERROR]; |
|
| 13 | + public function __construct($identifier, $type="text", $value="", $placeholder="") { |
|
| 14 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 15 | + $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
|
| 16 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 17 | 17 | $this->_variations=[Variation::TRANSPARENT]; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function setFocus(){ |
|
| 20 | + public function setFocus() { |
|
| 21 | 21 | $this->addToProperty("class", State::FOCUS); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function addLoading(){ |
|
| 25 | - if($this->_hasIcon===false){ |
|
| 24 | + public function addLoading() { |
|
| 25 | + if ($this->_hasIcon===false) { |
|
| 26 | 26 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
| 27 | 27 | } |
| 28 | 28 | return $this->addToProperty("class", State::LOADING); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function addLabel($label,$direction=Direction::LEFT,$icon=NULL){ |
|
| 31 | + public function addLabel($label, $direction=Direction::LEFT, $icon=NULL) { |
|
| 32 | 32 | $labelO=$label; |
| 33 | - if(\is_object($label)===false){ |
|
| 34 | - $labelO=new HtmlLabel("label-".$this->identifier,$label); |
|
| 35 | - if(isset($icon)) |
|
| 33 | + if (\is_object($label)===false) { |
|
| 34 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
| 35 | + if (isset($icon)) |
|
| 36 | 36 | $labelO->addIcon($icon); |
| 37 | - }else{ |
|
| 37 | + }else { |
|
| 38 | 38 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
| 39 | 39 | } |
| 40 | 40 | $this->addToProperty("class", $direction." labeled"); |
| 41 | - $this->addContent($labelO,\strstr($direction,Direction::LEFT)!==false); |
|
| 41 | + $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
|
| 42 | 42 | return $labelO; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function addLabelToCorner($label,$direction=Direction::LEFT,$icon=NULL){ |
|
| 46 | - return $this->addLabel($label,$direction." corner",$icon)->toCorner($direction); |
|
| 45 | + public function addLabelToCorner($label, $direction=Direction::LEFT, $icon=NULL) { |
|
| 46 | + return $this->addLabel($label, $direction." corner", $icon)->toCorner($direction); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function addAction($action,$direction=Direction::LEFT,$icon=NULL,$labeled=false){ |
|
| 49 | + public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) { |
|
| 50 | 50 | $actionO=$action; |
| 51 | - if(\is_object($action)===false){ |
|
| 52 | - $actionO=new HtmlButton("action-".$this->identifier,$action); |
|
| 53 | - if(isset($icon)) |
|
| 54 | - $actionO->addIcon($icon,true,$labeled); |
|
| 51 | + if (\is_object($action)===false) { |
|
| 52 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
| 53 | + if (isset($icon)) |
|
| 54 | + $actionO->addIcon($icon, true, $labeled); |
|
| 55 | 55 | } |
| 56 | 56 | $this->addToProperty("class", $direction." action"); |
| 57 | - $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
|
| 57 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
| 58 | 58 | return $actionO; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -32,9 +32,10 @@ discard block |
||
| 32 | 32 | $labelO=$label; |
| 33 | 33 | if(\is_object($label)===false){ |
| 34 | 34 | $labelO=new HtmlLabel("label-".$this->identifier,$label); |
| 35 | - if(isset($icon)) |
|
| 36 | - $labelO->addIcon($icon); |
|
| 37 | - }else{ |
|
| 35 | + if(isset($icon)) { |
|
| 36 | + $labelO->addIcon($icon); |
|
| 37 | + } |
|
| 38 | + } else{ |
|
| 38 | 39 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
| 39 | 40 | } |
| 40 | 41 | $this->addToProperty("class", $direction." labeled"); |
@@ -50,8 +51,9 @@ discard block |
||
| 50 | 51 | $actionO=$action; |
| 51 | 52 | if(\is_object($action)===false){ |
| 52 | 53 | $actionO=new HtmlButton("action-".$this->identifier,$action); |
| 53 | - if(isset($icon)) |
|
| 54 | - $actionO->addIcon($icon,true,$labeled); |
|
| 54 | + if(isset($icon)) { |
|
| 55 | + $actionO->addIcon($icon,true,$labeled); |
|
| 56 | + } |
|
| 55 | 57 | } |
| 56 | 58 | $this->addToProperty("class", $direction." action"); |
| 57 | 59 | $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
@@ -5,5 +5,5 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | abstract class Emphasis extends BaseEnum { |
| 8 | - const PRIMARY="primary",SECONDARY="secondary",TERTIARY="tertiary"; |
|
| 8 | + const PRIMARY="primary", SECONDARY="secondary", TERTIARY="tertiary"; |
|
| 9 | 9 | } |
| 10 | 10 | \ No newline at end of file |
@@ -20,21 +20,21 @@ |
||
| 20 | 20 | public static function getDefaultValue($array, $key, $default) { |
| 21 | 21 | if (array_key_exists($key, $array)) { |
| 22 | 22 | return $array [$key]; |
| 23 | - } else |
|
| 23 | + }else |
|
| 24 | 24 | return $default; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function implode($glue,$pieces){ |
|
| 27 | + public static function implode($glue, $pieces) { |
|
| 28 | 28 | $result=""; |
| 29 | - if(\is_array($glue)){ |
|
| 29 | + if (\is_array($glue)) { |
|
| 30 | 30 | $size=\sizeof($pieces); |
| 31 | - if($size>0){ |
|
| 32 | - for($i=0;$i<$size-1;$i++){ |
|
| 31 | + if ($size>0) { |
|
| 32 | + for ($i=0; $i<$size-1; $i++) { |
|
| 33 | 33 | $result.=$pieces[$i].@$glue[$i]; |
| 34 | 34 | } |
| 35 | 35 | $result.=$pieces[$size-1]; |
| 36 | 36 | } |
| 37 | - }else{ |
|
| 37 | + }else { |
|
| 38 | 38 | $result=\implode($glue, $pieces); |
| 39 | 39 | } |
| 40 | 40 | return $result; |
@@ -13,15 +13,17 @@ discard block |
||
| 13 | 13 | return $array [$key]; |
| 14 | 14 | } |
| 15 | 15 | $values=array_values($array); |
| 16 | - if ($pos<sizeof($values)) |
|
| 17 | - return $values [$pos]; |
|
| 16 | + if ($pos<sizeof($values)) { |
|
| 17 | + return $values [$pos]; |
|
| 18 | + } |
|
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | public static function getDefaultValue($array, $key, $default) { |
| 21 | 22 | if (array_key_exists($key, $array)) { |
| 22 | 23 | return $array [$key]; |
| 23 | - } else |
|
| 24 | - return $default; |
|
| 24 | + } else { |
|
| 25 | + return $default; |
|
| 26 | + } |
|
| 25 | 27 | } |
| 26 | 28 | |
| 27 | 29 | public static function implode($glue,$pieces){ |
@@ -34,7 +36,7 @@ discard block |
||
| 34 | 36 | } |
| 35 | 37 | $result.=$pieces[$size-1]; |
| 36 | 38 | } |
| 37 | - }else{ |
|
| 39 | + } else{ |
|
| 38 | 40 | $result=\implode($glue, $pieces); |
| 39 | 41 | } |
| 40 | 42 | return $result; |
@@ -13,17 +13,17 @@ |
||
| 13 | 13 | * @param boolean $labeled |
| 14 | 14 | * @return \Ajax\semantic\html\elements\HtmlIcon |
| 15 | 15 | */ |
| 16 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 16 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 17 | 17 | $iconO=$icon; |
| 18 | - if(\is_string($icon)){ |
|
| 18 | + if (\is_string($icon)) { |
|
| 19 | 19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 20 | 20 | } |
| 21 | - if($labeled!==false){ |
|
| 22 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
| 21 | + if ($labeled!==false) { |
|
| 22 | + $direction=($before===true) ? Direction::LEFT : Direction::RIGHT; |
|
| 23 | 23 | $this->addToProperty("class", $direction." labeled icon"); |
| 24 | 24 | $this->tagName="div"; |
| 25 | 25 | } |
| 26 | - $this->addContent($iconO,$before); |
|
| 26 | + $this->addContent($iconO, $before); |
|
| 27 | 27 | return $iconO; |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | \ No newline at end of file |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | abstract class Color extends BaseEnum { |
| 8 | - const STANDARD="",RED="red",ORANGE="orange",YELLOW="yellow", |
|
| 9 | - OLIVE="olive",GREEN="green",TEAL="teal", |
|
| 10 | - BLUE="blue",VIOLET="violet",PURPLE="purple", |
|
| 11 | - PINK="pink",BROWN="brown",GREY="grey",BLACK="black"; |
|
| 8 | + const STANDARD="", RED="red", ORANGE="orange", YELLOW="yellow", |
|
| 9 | + OLIVE="olive", GREEN="green", TEAL="teal", |
|
| 10 | + BLUE="blue", VIOLET="violet", PURPLE="purple", |
|
| 11 | + PINK="pink", BROWN="brown", GREY="grey", BLACK="black"; |
|
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
| 18 | 18 | * @return \Ajax\semantic\components\Dropdown |
| 19 | 19 | */ |
| 20 | - public function setAction($action){ |
|
| 21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
| 20 | + public function setAction($action) { |
|
| 21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event) |
| 27 | 27 | * @return \Ajax\semantic\components\Dropdown |
| 28 | 28 | */ |
| 29 | - public function setOn($event){ |
|
| 29 | + public function setOn($event) { |
|
| 30 | 30 | return $this->setParam("on", $event); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - public function setFullTextSearch($value){ |
|
| 33 | + public function setFullTextSearch($value) { |
|
| 34 | 34 | return $this->setParam("fullTextSearch", $value); |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | \ No newline at end of file |
@@ -1,9 +1,9 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -return array ( |
|
| 3 | - "JQuery" => array ( |
|
| 4 | - "MaxCDN" => array ( |
|
| 2 | +return array( |
|
| 3 | + "JQuery" => array( |
|
| 4 | + "MaxCDN" => array( |
|
| 5 | 5 | "url" => "http://code.jquery.com/jquery-%version%.min.js", |
| 6 | - "versions" => array ( |
|
| 6 | + "versions" => array( |
|
| 7 | 7 | "2.2.3", |
| 8 | 8 | "2.2.1", |
| 9 | 9 | "2.1.4", |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | "1.11.2" |
| 12 | 12 | ) |
| 13 | 13 | ), |
| 14 | - "Google" => array ( |
|
| 14 | + "Google" => array( |
|
| 15 | 15 | "url" => "https://ajax.googleapis.com/ajax/libs/jquery/%version%/jquery.min.js", |
| 16 | - "versions" => array ( |
|
| 16 | + "versions" => array( |
|
| 17 | 17 | "2.2.2", |
| 18 | 18 | "2.2.1", |
| 19 | 19 | "2.2.0", |
@@ -25,17 +25,17 @@ discard block |
||
| 25 | 25 | ) |
| 26 | 26 | ) |
| 27 | 27 | ), |
| 28 | - "JQueryUI" => array ( |
|
| 29 | - "MaxCDN" => array ( |
|
| 28 | + "JQueryUI" => array( |
|
| 29 | + "MaxCDN" => array( |
|
| 30 | 30 | "core" => "http://code.jquery.com/ui/%version%/jquery-ui.min.js", |
| 31 | 31 | "css" => "http://code.jquery.com/ui/%version%/themes/%theme%/jquery-ui.css", |
| 32 | - "versions" => array ( |
|
| 32 | + "versions" => array( |
|
| 33 | 33 | "1.11.4", |
| 34 | 34 | "1.11.3", |
| 35 | 35 | "1.11.2", |
| 36 | 36 | "1.10.4" |
| 37 | 37 | ), |
| 38 | - "themes" => array ( |
|
| 38 | + "themes" => array( |
|
| 39 | 39 | "black-tie", |
| 40 | 40 | "blitzer", |
| 41 | 41 | "cupertino", |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | "vader" |
| 63 | 63 | ) |
| 64 | 64 | ), |
| 65 | - "Google" => array ( |
|
| 65 | + "Google" => array( |
|
| 66 | 66 | "core" => "https://ajax.googleapis.com/ajax/libs/jqueryui/%version%/jquery-ui.min.js", |
| 67 | 67 | "css" => "https://ajax.googleapis.com/ajax/libs/jqueryui/%version%/themes/%theme%/jquery-ui.css", |
| 68 | - "versions" => array ( |
|
| 68 | + "versions" => array( |
|
| 69 | 69 | "1.11.4", |
| 70 | 70 | "1.11.3", |
| 71 | 71 | "1.11.2", |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | "1.10.4", |
| 75 | 75 | "1.10.0" |
| 76 | 76 | ), |
| 77 | - "themes" => array ( |
|
| 77 | + "themes" => array( |
|
| 78 | 78 | "black-tie", |
| 79 | 79 | "blitzer", |
| 80 | 80 | "cupertino", |
@@ -102,25 +102,25 @@ discard block |
||
| 102 | 102 | ) |
| 103 | 103 | ) |
| 104 | 104 | ), |
| 105 | - "Bootstrap" => array ( |
|
| 106 | - "MaxCDN" => array ( |
|
| 105 | + "Bootstrap" => array( |
|
| 106 | + "MaxCDN" => array( |
|
| 107 | 107 | "core" => "http://maxcdn.bootstrapcdn.com/bootstrap/%version%/js/bootstrap.min.js", |
| 108 | 108 | "css" => "http://maxcdn.bootstrapcdn.com/bootstrap/%version%/css/bootstrap.min.css", |
| 109 | - "versions" => array ( |
|
| 109 | + "versions" => array( |
|
| 110 | 110 | "3.3.6", |
| 111 | 111 | "3.3.5" |
| 112 | 112 | ), |
| 113 | - "themes" => array () |
|
| 113 | + "themes" => array() |
|
| 114 | 114 | ) |
| 115 | 115 | ), |
| 116 | - "Semantic" => array ( |
|
| 117 | - "cdnjs" => array ( |
|
| 116 | + "Semantic" => array( |
|
| 117 | + "cdnjs" => array( |
|
| 118 | 118 | "core" => "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/%version%/semantic.min.js", |
| 119 | 119 | "css" => "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/%version%/semantic.min.js", |
| 120 | - "versions" => array ( |
|
| 120 | + "versions" => array( |
|
| 121 | 121 | "2.1.8" |
| 122 | 122 | ), |
| 123 | - "themes" => array () |
|
| 123 | + "themes" => array() |
|
| 124 | 124 | ) |
| 125 | 125 | ) |
| 126 | 126 | ); |
| 127 | 127 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | protected $localCss; |
| 10 | 10 | protected $framework; |
| 11 | 11 | |
| 12 | - public function __construct($framework,$version, $provider="MaxCDN") { |
|
| 12 | + public function __construct($framework, $version, $provider="MaxCDN") { |
|
| 13 | 13 | parent::__construct($version, $provider); |
| 14 | 14 | $this->framework=$framework; |
| 15 | 15 | $this->data=$this->data [$framework]; |