@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | abstract class BaseHtml extends BaseWidget { |
| 16 | 16 | protected $_template; |
| 17 | 17 | protected $tagName; |
| 18 | - protected $properties=array (); |
|
| 19 | - protected $events=array (); |
|
| 18 | + protected $properties=array(); |
|
| 19 | + protected $events=array(); |
|
| 20 | 20 | protected $wrapBefore=""; |
| 21 | 21 | protected $wrapAfter=""; |
| 22 | 22 | protected $_bsComponent; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function addToProperty($name, $value, $separator=" ") { |
| 57 | 57 | $v=$this->properties [$name]; |
| 58 | - if (isset($v)&&$v!=="") |
|
| 58 | + if (isset($v) && $v!=="") |
|
| 59 | 59 | $v=$v.$separator.$value; |
| 60 | 60 | else |
| 61 | 61 | $v=$value; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 72 | 72 | $result=$this->getTemplate(); |
| 73 | - foreach ( $this as $key => $value ) { |
|
| 74 | - if (PhalconUtils::startsWith($key, "_")===false&&$key!=="events") { |
|
| 73 | + foreach ($this as $key => $value) { |
|
| 74 | + if (PhalconUtils::startsWith($key, "_")===false && $key!=="events") { |
|
| 75 | 75 | if (is_array($value)) { |
| 76 | 76 | $v=PropertyWrapper::wrap($value, $js); |
| 77 | - } else { |
|
| 77 | + }else { |
|
| 78 | 78 | $v=$value; |
| 79 | 79 | } |
| 80 | 80 | $result=str_ireplace("%".$key."%", $v, $result); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | if (isset($view)===true) { |
| 87 | 87 | $controls=$view->getVar("q"); |
| 88 | 88 | if (isset($controls)===false) { |
| 89 | - $controls=array (); |
|
| 89 | + $controls=array(); |
|
| 90 | 90 | } |
| 91 | 91 | $controls [$this->identifier]=$result; |
| 92 | 92 | $view->setVar("q", $controls); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | if (array_search($value, $typeCtrl)===false) { |
| 100 | 100 | throw new \Exception("La valeur passée a propriété `".$name."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
| 101 | 101 | } |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | if (!$typeCtrl($value)) { |
| 104 | 104 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$name); |
| 105 | 105 | } |
@@ -176,28 +176,28 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | public function fromArray($array) { |
| 179 | - foreach ( $this as $key => $value ) { |
|
| 179 | + foreach ($this as $key => $value) { |
|
| 180 | 180 | if (array_key_exists($key, $array) && !PhalconUtils::startsWith($key, "_")) { |
| 181 | 181 | $setter="set".ucfirst($key); |
| 182 | 182 | $this->$setter($array [$key]); |
| 183 | 183 | unset($array [$key]); |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | - foreach ( $array as $key => $value ) { |
|
| 186 | + foreach ($array as $key => $value) { |
|
| 187 | 187 | if (method_exists($this, $key)) { |
| 188 | 188 | try { |
| 189 | 189 | $this->$key($value); |
| 190 | 190 | unset($array [$key]); |
| 191 | - } catch ( \Exception $e ) { |
|
| 191 | + } catch (\Exception $e) { |
|
| 192 | 192 | // Nothing to do |
| 193 | 193 | } |
| 194 | - } else { |
|
| 194 | + }else { |
|
| 195 | 195 | $setter="set".ucfirst($key); |
| 196 | 196 | if (method_exists($this, $setter)) { |
| 197 | 197 | try { |
| 198 | 198 | $this->$setter($value); |
| 199 | 199 | unset($array [$key]); |
| 200 | - } catch ( \Exception $e ) { |
|
| 200 | + } catch (\Exception $e) { |
|
| 201 | 201 | // Nothing to do |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -206,21 +206,21 @@ discard block |
||
| 206 | 206 | return $array; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - public function fromDatabaseObjects($objects,$function) { |
|
| 210 | - if(isset($objects)){ |
|
| 211 | - foreach ($objects as $object){ |
|
| 212 | - $this->fromDatabaseObject($object,$function); |
|
| 209 | + public function fromDatabaseObjects($objects, $function) { |
|
| 210 | + if (isset($objects)) { |
|
| 211 | + foreach ($objects as $object) { |
|
| 212 | + $this->fromDatabaseObject($object, $function); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | return $this; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - public function fromDatabaseObject($object,$function){ |
|
| 218 | + public function fromDatabaseObject($object, $function) { |
|
| 219 | 219 | |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function wrap($before, $after="") { |
| 223 | - if(isset($before)){ |
|
| 223 | + if (isset($before)) { |
|
| 224 | 224 | $this->wrapBefore.=$before; |
| 225 | 225 | } |
| 226 | 226 | $this->wrapAfter=$after.$this->wrapAfter; |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | if (array_key_exists($event, $this->events)) { |
| 243 | 243 | if (is_array($this->events [$event])) { |
| 244 | 244 | $this->events [$event] []=$jsCode; |
| 245 | - } else { |
|
| 246 | - $this->events [$event]=array ( |
|
| 245 | + }else { |
|
| 246 | + $this->events [$event]=array( |
|
| 247 | 247 | $this->events [$event], |
| 248 | 248 | $jsCode |
| 249 | 249 | ); |
| 250 | 250 | } |
| 251 | - } else { |
|
| 251 | + }else { |
|
| 252 | 252 | $this->events [$event]=$jsCode; |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -267,14 +267,14 @@ discard block |
||
| 267 | 267 | |
| 268 | 268 | public function addEventsOnRun(JsUtils $js) { |
| 269 | 269 | if (isset($this->_bsComponent)) { |
| 270 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 270 | + foreach ($this->events as $event => $jsCode) { |
|
| 271 | 271 | $code=$jsCode; |
| 272 | 272 | if (is_array($jsCode)) { |
| 273 | 273 | $code=""; |
| 274 | - foreach ( $jsCode as $jsC ) { |
|
| 274 | + foreach ($jsCode as $jsC) { |
|
| 275 | 275 | if ($jsC instanceof AjaxCall) { |
| 276 | 276 | $code.="\n".$jsC->compile($js); |
| 277 | - } else { |
|
| 277 | + }else { |
|
| 278 | 278 | $code.="\n".$jsC; |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 291 | - $params=array ( |
|
| 291 | + $params=array( |
|
| 292 | 292 | "url" => $url, |
| 293 | 293 | "responseElement" => $responseElement |
| 294 | 294 | ); |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | if (is_array($elements)) { |
| 328 | 328 | $flag=false; |
| 329 | 329 | $index=0; |
| 330 | - while ( !$flag&&$index<sizeof($elements) ) { |
|
| 330 | + while (!$flag && $index<sizeof($elements)) { |
|
| 331 | 331 | if ($elements [$index] instanceof BaseHtml) |
| 332 | 332 | $flag=($elements [$index]->getIdentifier()===$identifier); |
| 333 | 333 | $index++; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | return null; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - public function __toString(){ |
|
| 344 | + public function __toString() { |
|
| 345 | 345 | return $this->compile(); |
| 346 | 346 | } |
| 347 | 347 | |
@@ -357,25 +357,25 @@ discard block |
||
| 357 | 357 | if (is_array($value)) { |
| 358 | 358 | $value=implode(",", $value); |
| 359 | 359 | } |
| 360 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false) { |
|
| 360 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false) { |
|
| 361 | 361 | $value='"'.$value.'"'; |
| 362 | 362 | } |
| 363 | 363 | return $value; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - public function jsDoJquery($jqueryCall, $param=""){ |
|
| 366 | + public function jsDoJquery($jqueryCall, $param="") { |
|
| 367 | 367 | return "$('#".$this->identifier."').".$jqueryCall."(".$this->_prep_value($param).");"; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - public function jsHtml($content=""){ |
|
| 371 | - return $this->jsDoJquery("html",$content); |
|
| 370 | + public function jsHtml($content="") { |
|
| 371 | + return $this->jsDoJquery("html", $content); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - public function jsShow(){ |
|
| 374 | + public function jsShow() { |
|
| 375 | 375 | return $this->jsDoJquery("show"); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - public function jsHide(){ |
|
| 378 | + public function jsHide() { |
|
| 379 | 379 | return $this->jsDoJquery("hide"); |
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | \ No newline at end of file |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | return $this->content; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function addContent($content,$before=false) { |
|
| 30 | + public function addContent($content, $before=false) { |
|
| 31 | 31 | if (is_array($this->content)===false) { |
| 32 | - if(isset($this->content)) |
|
| 33 | - $this->content=array ($this->content); |
|
| 32 | + if (isset($this->content)) |
|
| 33 | + $this->content=array($this->content); |
|
| 34 | 34 | else |
| 35 | 35 | $this->content=array(); |
| 36 | 36 | } |
| 37 | - if($before) |
|
| 38 | - array_unshift($this->content,$content); |
|
| 37 | + if ($before) |
|
| 38 | + array_unshift($this->content, $content); |
|
| 39 | 39 | else |
| 40 | 40 | $this->content []=$content; |
| 41 | 41 | return $this; |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | parent::run($js); |
| 50 | 50 | if ($this->content instanceof HtmlDoubleElement) { |
| 51 | 51 | $this->content->run($js); |
| 52 | - } else if (is_array($this->content)) { |
|
| 53 | - foreach ( $this->content as $itemContent ) { |
|
| 52 | + }else if (is_array($this->content)) { |
|
| 53 | + foreach ($this->content as $itemContent) { |
|
| 54 | 54 | if ($itemContent instanceof HtmlDoubleElement) { |
| 55 | 55 | $itemContent->run($js); |
| 56 | 56 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function setClass($classNames) { |
| 16 | - if(is_array($classNames)){ |
|
| 16 | + if (is_array($classNames)) { |
|
| 17 | 17 | $classNames=implode(" ", $classNames); |
| 18 | 18 | } |
| 19 | 19 | $this->setProperty("class", $classNames); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | public function fromArray($array) { |
| 42 | 42 | $array=parent::fromArray($array); |
| 43 | - foreach ( $array as $key => $value ) { |
|
| 43 | + foreach ($array as $key => $value) { |
|
| 44 | 44 | $this->setProperty($key, $value); |
| 45 | 45 | } |
| 46 | 46 | return $array; |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class HtmlOption extends HtmlDoubleElement { |
| 11 | 11 | protected $value; |
| 12 | 12 | protected $selected; |
| 13 | - public function __construct($identifier,$caption,$value="") { |
|
| 13 | + public function __construct($identifier, $caption, $value="") { |
|
| 14 | 14 | parent::__construct($identifier, "option"); |
| 15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
| 16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $this->selected=""; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function select(){ |
|
| 21 | + public function select() { |
|
| 22 | 22 | $this->selected="selected"; |
| 23 | 23 | return $this; |
| 24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return $this->value; |
| 28 | 28 | } |
| 29 | 29 | public function setValue($value) { |
| 30 | - $this->value = $value; |
|
| 30 | + $this->value=$value; |
|
| 31 | 31 | return $this; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | private $default; |
| 17 | 17 | private $options; |
| 18 | 18 | |
| 19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
| 19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
| 20 | 20 | parent::__construct($identifier, "select"); |
| 21 | 21 | $this->setProperty("name", $identifier); |
| 22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | $this->options=array(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function addOption($element,$value="",$selected=false){ |
|
| 29 | - if($element instanceof HtmlOption){ |
|
| 28 | + public function addOption($element, $value="", $selected=false) { |
|
| 29 | + if ($element instanceof HtmlOption) { |
|
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
| 31 | + }else { |
|
| 32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
| 33 | 33 | } |
| 34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
| 34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
| 35 | 35 | $option->select(); |
| 36 | 36 | } |
| 37 | 37 | $this->options[]=$option; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setValue($value) { |
| 41 | - foreach ( $this->options as $option ) { |
|
| 42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
| 41 | + foreach ($this->options as $option) { |
|
| 42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
| 43 | 43 | $option->setProperty("selected", ""); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 54 | 54 | $this->content=array(); |
| 55 | - if(isset($this->default)){ |
|
| 55 | + if (isset($this->default)) { |
|
| 56 | 56 | $default=new HtmlOption("", $this->default); |
| 57 | 57 | $this->content[]=$default; |
| 58 | 58 | } |
| 59 | - foreach ($this->options as $option){ |
|
| 59 | + foreach ($this->options as $option) { |
|
| 60 | 60 | $this->content[]=$option; |
| 61 | 61 | } |
| 62 | 62 | return parent::compile($js, $view); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function fromArray($array){ |
|
| 66 | - if(JArray::isAssociative($array)){ |
|
| 67 | - foreach ($array as $k=>$v){ |
|
| 65 | + public function fromArray($array) { |
|
| 66 | + if (JArray::isAssociative($array)) { |
|
| 67 | + foreach ($array as $k=>$v) { |
|
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 71 | - foreach ($array as $v){ |
|
| 70 | + }else { |
|
| 71 | + foreach ($array as $v) { |
|
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $this->addOption($function($object)); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function setSize($size){ |
|
| 104 | + public function setSize($size) { |
|
| 105 | 105 | return $this->setProperty("size", $size); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function _setDi($di) { |
| 52 | 52 | $this->_di=$di; |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 53 | + if ($this->js!=null && $di!=null) |
|
| 54 | 54 | $this->js->setDi($di); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -145,18 +145,18 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function __construct($params=array()) { |
| 148 | - $defaults=array ( |
|
| 148 | + $defaults=array( |
|
| 149 | 149 | 'driver' => 'Jquery', |
| 150 | 150 | 'debug' => true |
| 151 | 151 | ); |
| 152 | - foreach ( $defaults as $key => $val ) { |
|
| 153 | - if (isset($params[$key])&&$params[$key]!=="") { |
|
| 152 | + foreach ($defaults as $key => $val) { |
|
| 153 | + if (isset($params[$key]) && $params[$key]!=="") { |
|
| 154 | 154 | $defaults[$key]=$params[$key]; |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | extract($defaults); |
| 158 | 158 | $this->js=new Jquery($defaults); |
| 159 | - $this->cdns=array (); |
|
| 159 | + $this->cdns=array(); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | public function addToCompile($jsScript) { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * @return string |
| 409 | 409 | */ |
| 410 | 410 | public function addClass($element='this', $class='', $immediatly=false) { |
| 411 | - return $this->js->_genericCallValue('addClass',$element, $class, $immediatly); |
|
| 411 | + return $this->js->_genericCallValue('addClass', $element, $class, $immediatly); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | * @param boolean $immediatly defers the execution if set to false |
| 419 | 419 | * @return string |
| 420 | 420 | */ |
| 421 | - public function after($to, $element, $immediatly=false){ |
|
| 422 | - return $this->js->_genericCallElement('after',$to, $element, $immediatly); |
|
| 421 | + public function after($to, $element, $immediatly=false) { |
|
| 422 | + return $this->js->_genericCallElement('after', $to, $element, $immediatly); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
@@ -429,8 +429,8 @@ discard block |
||
| 429 | 429 | * @param boolean $immediatly defers the execution if set to false |
| 430 | 430 | * @return string |
| 431 | 431 | */ |
| 432 | - public function before($to, $element, $immediatly=false){ |
|
| 433 | - return $this->js->_genericCallElement('before',$to, $element, $immediatly); |
|
| 432 | + public function before($to, $element, $immediatly=false) { |
|
| 433 | + return $this->js->_genericCallElement('before', $to, $element, $immediatly); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | * @param string $value |
| 451 | 451 | * @param boolean $immediatly defers the execution if set to false |
| 452 | 452 | */ |
| 453 | - public function val($element='this',$value='',$immediatly=false){ |
|
| 454 | - return $this->js->_genericCallValue('val',$element,$value,$immediatly); |
|
| 453 | + public function val($element='this', $value='', $immediatly=false) { |
|
| 454 | + return $this->js->_genericCallValue('val', $element, $value, $immediatly); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | * @param boolean $immediatly defers the execution if set to false |
| 462 | 462 | */ |
| 463 | 463 | public function html($element='this', $value='', $immediatly=false) { |
| 464 | - return $this->js->_genericCallValue('html',$element, $value, $immediatly); |
|
| 464 | + return $this->js->_genericCallValue('html', $element, $value, $immediatly); |
|
| 465 | 465 | } |
| 466 | 466 | // -------------------------------------------------------------------- |
| 467 | 467 | /** |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * @return string |
| 487 | 487 | */ |
| 488 | 488 | public function append($to, $element, $immediatly=false) { |
| 489 | - return $this->js->_genericCallElement('append',$to, $element, $immediatly); |
|
| 489 | + return $this->js->_genericCallElement('append', $to, $element, $immediatly); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * @return string |
| 498 | 498 | */ |
| 499 | 499 | public function prepend($to, $element, $immediatly=false) { |
| 500 | - return $this->js->_genericCallElement('prepend',$to, $element, $immediatly); |
|
| 500 | + return $this->js->_genericCallElement('prepend', $to, $element, $immediatly); |
|
| 501 | 501 | } |
| 502 | 502 | // -------------------------------------------------------------------- |
| 503 | 503 | /** |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * @return string |
| 549 | 549 | */ |
| 550 | 550 | public function removeClass($element='this', $class='', $immediatly=false) { |
| 551 | - return $this->js->_genericCall('removeClass',$element, $class, $immediatly); |
|
| 551 | + return $this->js->_genericCall('removeClass', $element, $class, $immediatly); |
|
| 552 | 552 | } |
| 553 | 553 | // -------------------------------------------------------------------- |
| 554 | 554 | /** |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | * @return string |
| 610 | 610 | */ |
| 611 | 611 | public function toggleClass($element='this', $class='', $immediatly=false) { |
| 612 | - return $this->js->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
| 612 | + return $this->js->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | /** |
@@ -656,11 +656,11 @@ discard block |
||
| 656 | 656 | */ |
| 657 | 657 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 658 | 658 | $bs=$this->_bootstrap; |
| 659 | - if (isset($bs)&&isset($view)) { |
|
| 659 | + if (isset($bs) && isset($view)) { |
|
| 660 | 660 | $bs->compileHtml($this, $view); |
| 661 | 661 | } |
| 662 | 662 | $sem=$this->_semantic; |
| 663 | - if (isset($sem)&&isset($view)) { |
|
| 663 | + if (isset($sem) && isset($view)) { |
|
| 664 | 664 | $sem->compileHtml($this, $view); |
| 665 | 665 | } |
| 666 | 666 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -740,27 +740,27 @@ discard block |
||
| 740 | 740 | $json_result=$result->result_array(); |
| 741 | 741 | } elseif (is_array($result)) { |
| 742 | 742 | $json_result=$result; |
| 743 | - } else { |
|
| 743 | + }else { |
|
| 744 | 744 | return $this->_prep_args($result); |
| 745 | 745 | } |
| 746 | - } else { |
|
| 746 | + }else { |
|
| 747 | 747 | return 'null'; |
| 748 | 748 | } |
| 749 | 749 | return $this->_create_json($json_result, $match_array_type); |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | private function _create_json($json_result, $match_array_type) { |
| 753 | - $json=array (); |
|
| 753 | + $json=array(); |
|
| 754 | 754 | $_is_assoc=TRUE; |
| 755 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 755 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 756 | 756 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 757 | 757 | } elseif ($match_array_type) { |
| 758 | 758 | $_is_assoc=$this->_is_associative_array($json_result); |
| 759 | 759 | } |
| 760 | - foreach ( $json_result as $k => $v ) { |
|
| 760 | + foreach ($json_result as $k => $v) { |
|
| 761 | 761 | if ($_is_assoc) { |
| 762 | 762 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 763 | - } else { |
|
| 763 | + }else { |
|
| 764 | 764 | $json[]=$this->generate_json($v, $match_array_type); |
| 765 | 765 | } |
| 766 | 766 | } |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | * @return type |
| 776 | 776 | */ |
| 777 | 777 | public function _is_associative_array($arr) { |
| 778 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 778 | + foreach (array_keys($arr) as $key => $val) { |
|
| 779 | 779 | if ($key!==$val) { |
| 780 | 780 | return TRUE; |
| 781 | 781 | } |
@@ -794,11 +794,11 @@ discard block |
||
| 794 | 794 | return 'null'; |
| 795 | 795 | } elseif (is_bool($result)) { |
| 796 | 796 | return ($result===TRUE) ? 'true' : 'false'; |
| 797 | - } elseif (is_string($result)||$is_key) { |
|
| 798 | - return '"'.str_replace(array ( |
|
| 799 | - '\\',"\t","\n","\r",'"','/' |
|
| 800 | - ), array ( |
|
| 801 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 797 | + } elseif (is_string($result) || $is_key) { |
|
| 798 | + return '"'.str_replace(array( |
|
| 799 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 800 | + ), array( |
|
| 801 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 802 | 802 | ), $result).'"'; |
| 803 | 803 | } elseif (is_scalar($result)) { |
| 804 | 804 | return $result; |
@@ -813,8 +813,8 @@ discard block |
||
| 813 | 813 | * @param string $jsCallback javascript code to execute after the request |
| 814 | 814 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 815 | 815 | */ |
| 816 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 817 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 816 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 817 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
@@ -825,8 +825,8 @@ discard block |
||
| 825 | 825 | * @param string $jsCallback javascript code to execute after the request |
| 826 | 826 | * @param boolean $immediatly |
| 827 | 827 | */ |
| 828 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 829 | - return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly); |
|
| 828 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 829 | + return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /** |
@@ -836,8 +836,8 @@ discard block |
||
| 836 | 836 | * @param string $url the request address |
| 837 | 837 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 838 | 838 | */ |
| 839 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
| 840 | - return $this->js->_jsonOn($event, $element, $url,$parameters); |
|
| 839 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
| 840 | + return $this->js->_jsonOn($event, $element, $url, $parameters); |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
@@ -881,8 +881,8 @@ discard block |
||
| 881 | 881 | * @param string $url the request url |
| 882 | 882 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 883 | 883 | */ |
| 884 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
| 885 | - return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters); |
|
| 884 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 885 | + return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters); |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | /** |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | * @param string $jsCallback javascript code to execute after the request |
| 895 | 895 | * @param string $attr the html attribute added to the request |
| 896 | 896 | */ |
| 897 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id") { |
|
| 897 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id") { |
|
| 898 | 898 | return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false); |
| 899 | 899 | } |
| 900 | 900 | |
@@ -932,8 +932,8 @@ discard block |
||
| 932 | 932 | * @param string $jsCallback javascript code to execute after the request |
| 933 | 933 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 934 | 934 | */ |
| 935 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 936 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 935 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 936 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | /** |
@@ -946,8 +946,8 @@ discard block |
||
| 946 | 946 | * @param string $jsCallback javascript code to execute after the request |
| 947 | 947 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 948 | 948 | */ |
| 949 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true) { |
|
| 950 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,false); |
|
| 949 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 950 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, false); |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | /** |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 962 | 962 | */ |
| 963 | 963 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 964 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 964 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
@@ -985,8 +985,8 @@ discard block |
||
| 985 | 985 | * @param string $jsCallback javascript code to execute after the request |
| 986 | 986 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 987 | 987 | */ |
| 988 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true) { |
|
| 989 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,true); |
|
| 988 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true) { |
|
| 989 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, true); |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | /** |
@@ -999,8 +999,8 @@ discard block |
||
| 999 | 999 | * @param string $attr the html attribute added to the request |
| 1000 | 1000 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 1001 | 1001 | */ |
| 1002 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true) { |
|
| 1003 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,false); |
|
| 1002 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 1003 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, false); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | /** |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 1015 | 1015 | */ |
| 1016 | 1016 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
| 1017 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
| 1017 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | /** |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | $preventDefault=false; |
| 1070 | 1070 | $immediatly=true; |
| 1071 | 1071 | extract($parameters); |
| 1072 | - return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
| 1072 | + return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /** |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | $preventDefault=false; |
| 1097 | 1097 | $immediatly=true; |
| 1098 | 1098 | extract($parameters); |
| 1099 | - $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation,$immediatly); |
|
| 1099 | + $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation, $immediatly); |
|
| 1100 | 1100 | return $script; |
| 1101 | 1101 | } |
| 1102 | 1102 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | public function setCDNs($cdns) { |
| 1108 | 1108 | if (is_array($cdns)===false) { |
| 1109 | - $cdns=array ( |
|
| 1109 | + $cdns=array( |
|
| 1110 | 1110 | $cdns |
| 1111 | 1111 | ); |
| 1112 | 1112 | } |
@@ -1117,9 +1117,9 @@ discard block |
||
| 1117 | 1117 | $hasJQuery=false; |
| 1118 | 1118 | $hasJQueryUI=false; |
| 1119 | 1119 | $hasBootstrap=false; |
| 1120 | - $result=array (); |
|
| 1121 | - foreach ( $this->cdns as $cdn ) { |
|
| 1122 | - switch(get_class($cdn)) { |
|
| 1120 | + $result=array(); |
|
| 1121 | + foreach ($this->cdns as $cdn) { |
|
| 1122 | + switch (get_class($cdn)) { |
|
| 1123 | 1123 | case "Ajax\lib\CDNJQuery": |
| 1124 | 1124 | $hasJQuery=true; |
| 1125 | 1125 | $result[0]=$cdn; |
@@ -1137,10 +1137,10 @@ discard block |
||
| 1137 | 1137 | if ($hasJQuery===false) { |
| 1138 | 1138 | $result[0]=new CDNJQuery("x"); |
| 1139 | 1139 | } |
| 1140 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 1140 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 1141 | 1141 | $result[1]=new CDNGuiGen("x", $template); |
| 1142 | 1142 | } |
| 1143 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 1143 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 1144 | 1144 | $result[2]=new CDNBootstrap("x"); |
| 1145 | 1145 | } |
| 1146 | 1146 | ksort($result); |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | $this->_setDi($di); |
| 1155 | 1155 | } |
| 1156 | 1156 | } |
| 1157 | -} else { |
|
| 1157 | +}else { |
|
| 1158 | 1158 | class JsUtils extends _JsUtils { |
| 1159 | 1159 | |
| 1160 | 1160 | public function setDi(DiInterface $di) { |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | class Color extends BaseEnum { |
| 8 | - const 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 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 |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | namespace Ajax\semantic\html\base; |
| 3 | 3 | use Ajax\common\BaseEnum; |
| 4 | 4 | abstract class IconSize extends BaseEnum { |
| 5 | - const MINI="mini", TINY="tiny", SMALL="small", NORMAL="",LARGE="large", BIG="big", HUGE="huge", MASSIVE="massive"; |
|
| 5 | + const MINI="mini", TINY="tiny", SMALL="small", NORMAL="", LARGE="large", BIG="big", HUGE="huge", MASSIVE="massive"; |
|
| 6 | 6 | } |
| 7 | 7 | \ No newline at end of file |
@@ -41,15 +41,15 @@ discard block |
||
| 41 | 41 | * @param boolean $autoActive sets the last element's class to <b>active</b> if true |
| 42 | 42 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 43 | 43 | */ |
| 44 | - public function __construct($identifier,$elements=array(),$autoActive=true,$startIndex=0,$hrefFunction=NULL){ |
|
| 45 | - parent::__construct($identifier,"ol"); |
|
| 44 | + public function __construct($identifier, $elements=array(), $autoActive=true, $startIndex=0, $hrefFunction=NULL) { |
|
| 45 | + parent::__construct($identifier, "ol"); |
|
| 46 | 46 | $this->startIndex=$startIndex; |
| 47 | 47 | $this->setProperty("class", "breadcrumb"); |
| 48 | 48 | $this->content=array(); |
| 49 | 49 | $this->autoActive=$autoActive; |
| 50 | 50 | $this->absolutePaths; |
| 51 | - $this->_hrefFunction=function ($e){return $e->getContent();}; |
|
| 52 | - if(isset($hrefFunction)){ |
|
| 51 | + $this->_hrefFunction=function($e) {return $e->getContent(); }; |
|
| 52 | + if (isset($hrefFunction)) { |
|
| 53 | 53 | $this->_hrefFunction=$hrefFunction; |
| 54 | 54 | } |
| 55 | 55 | $this->addElements($elements); |
@@ -60,43 +60,43 @@ discard block |
||
| 60 | 60 | * @param string $href |
| 61 | 61 | * @return \Ajax\bootstrap\html\HtmlLink |
| 62 | 62 | */ |
| 63 | - public function addElement($element,$href="",$glyph=NULL){ |
|
| 63 | + public function addElement($element, $href="", $glyph=NULL) { |
|
| 64 | 64 | $size=sizeof($this->content); |
| 65 | - if(is_array($element)){ |
|
| 65 | + if (is_array($element)) { |
|
| 66 | 66 | $elm=new HtmlLink("lnk-".$this->identifier."-".$size); |
| 67 | 67 | $elm->fromArray($element); |
| 68 | - }else if($element instanceof HtmlLink){ |
|
| 68 | + }else if ($element instanceof HtmlLink) { |
|
| 69 | 69 | $elm=$element; |
| 70 | - }else{ |
|
| 71 | - $elm=new HtmlLink("lnk-".$this->identifier."-".$size,$href,$element); |
|
| 72 | - if(isset($glyph)){ |
|
| 70 | + }else { |
|
| 71 | + $elm=new HtmlLink("lnk-".$this->identifier."-".$size, $href, $element); |
|
| 72 | + if (isset($glyph)) { |
|
| 73 | 73 | $elm->wrapContentWithGlyph($glyph); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | - $elm->wrap("<li>","</li>"); |
|
| 76 | + $elm->wrap("<li>", "</li>"); |
|
| 77 | 77 | $this->content[]=$elm; |
| 78 | 78 | $elm->setProperty($this->attr, $this->getHref($size)); |
| 79 | 79 | return $elm; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setActive($index=null){ |
|
| 83 | - if(!isset($index)){ |
|
| 82 | + public function setActive($index=null) { |
|
| 83 | + if (!isset($index)) { |
|
| 84 | 84 | $index=sizeof($this->content)-1; |
| 85 | 85 | } |
| 86 | - $li=new HtmlBsDoubleElement("","li"); |
|
| 86 | + $li=new HtmlBsDoubleElement("", "li"); |
|
| 87 | 87 | $li->setClass("active"); |
| 88 | 88 | $li->setContent($this->content[$index]->getContent()); |
| 89 | 89 | $this->content[$index]=$li; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function addElements($elements){ |
|
| 93 | - foreach ( $elements as $element ) { |
|
| 92 | + public function addElements($elements) { |
|
| 93 | + foreach ($elements as $element) { |
|
| 94 | 94 | $this->addElement($element); |
| 95 | 95 | } |
| 96 | 96 | return $this; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - public function fromArray($array){ |
|
| 99 | + public function fromArray($array) { |
|
| 100 | 100 | $array=parent::fromArray($array); |
| 101 | 101 | $this->addElements($array); |
| 102 | 102 | return $array; |
@@ -108,14 +108,14 @@ discard block |
||
| 108 | 108 | * @param string $separator |
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | - public function getHref($index=null,$separator="/"){ |
|
| 112 | - if(!isset($index)){ |
|
| 111 | + public function getHref($index=null, $separator="/") { |
|
| 112 | + if (!isset($index)) { |
|
| 113 | 113 | $index=sizeof($this->content); |
| 114 | 114 | } |
| 115 | - if($this->absolutePaths===true){ |
|
| 115 | + if ($this->absolutePaths===true) { |
|
| 116 | 116 | return $this->_hrefFunction($this->content[$index]); |
| 117 | - }else{ |
|
| 118 | - return $this->root.implode($separator, array_slice(array_map(function($e){return $this->_hrefFunction($e);}, $this->content),$this->startIndex,$index+1)); |
|
| 117 | + }else { |
|
| 118 | + return $this->root.implode($separator, array_slice(array_map(function($e) {return $this->_hrefFunction($e); }, $this->content), $this->startIndex, $index+1)); |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @see \Ajax\bootstrap\html\BaseHtml::compile() |
| 125 | 125 | */ |
| 126 | 126 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 127 | - if($this->autoActive){ |
|
| 127 | + if ($this->autoActive) { |
|
| 128 | 128 | $this->setActive(); |
| 129 | 129 | } |
| 130 | 130 | return parent::compile($js, $view); |
@@ -142,19 +142,19 @@ discard block |
||
| 142 | 142 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 143 | 143 | */ |
| 144 | 144 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 145 | - foreach ($this->content as $element){ |
|
| 146 | - $element->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 145 | + foreach ($this->content as $element) { |
|
| 146 | + $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 147 | 147 | } |
| 148 | 148 | return $this; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function setAutoActive($autoActive) { |
| 152 | - $this->autoActive = $autoActive; |
|
| 152 | + $this->autoActive=$autoActive; |
|
| 153 | 153 | return $this; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 157 | - foreach ($this->content as $element){ |
|
| 157 | + foreach ($this->content as $element) { |
|
| 158 | 158 | $element->_ajaxOn($operation, $event, $url, $responseElement, $parameters); |
| 159 | 159 | } |
| 160 | 160 | return $this; |
@@ -167,18 +167,18 @@ discard block |
||
| 167 | 167 | * @param string $attr the html attribute used to build the elements url |
| 168 | 168 | * @return HtmlBreadcrumbs |
| 169 | 169 | */ |
| 170 | - public function autoGetOnClick($targetSelector){ |
|
| 171 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 170 | + public function autoGetOnClick($targetSelector) { |
|
| 171 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - public function contentAsString(){ |
|
| 175 | - if($this->autoActive){ |
|
| 174 | + public function contentAsString() { |
|
| 175 | + if ($this->autoActive) { |
|
| 176 | 176 | $this->setActive(); |
| 177 | 177 | } |
| 178 | 178 | return parent::contentAsString(); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function getElement($index){ |
|
| 181 | + public function getElement($index) { |
|
| 182 | 182 | return $this->content[$index]; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @param mixed $glyph |
| 188 | 188 | * @param int $index |
| 189 | 189 | */ |
| 190 | - public function addGlyph($glyph,$index=0){ |
|
| 190 | + public function addGlyph($glyph, $index=0) { |
|
| 191 | 191 | $elm=$this->getElement($index); |
| 192 | 192 | return $elm->wrapContentWithGlyph($glyph); |
| 193 | 193 | } |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | * @param Dispatcher $dispatcher the request dispatcher |
| 198 | 198 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 199 | 199 | */ |
| 200 | - public function fromDispatcher($dispatcher){ |
|
| 200 | + public function fromDispatcher($dispatcher) { |
|
| 201 | 201 | $params=$dispatcher->getParams(); |
| 202 | 202 | $action=$dispatcher->getActionName(); |
| 203 | 203 | $items=array($dispatcher->getControllerName()); |
| 204 | - if(\sizeof($params)>0 || \strtolower($action)!="index" ){ |
|
| 204 | + if (\sizeof($params)>0 || \strtolower($action)!="index") { |
|
| 205 | 205 | $items[]=$action; |
| 206 | - foreach ($params as $p){ |
|
| 207 | - if(\is_object($p)===false) |
|
| 206 | + foreach ($params as $p) { |
|
| 207 | + if (\is_object($p)===false) |
|
| 208 | 208 | $items[]=$p; |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @return \Ajax\bootstrap\html\HtmlBreadcrumbs |
| 219 | 219 | */ |
| 220 | 220 | public function setHrefFunction($_hrefFunction) { |
| 221 | - $this->_hrefFunction = $_hrefFunction; |
|
| 221 | + $this->_hrefFunction=$_hrefFunction; |
|
| 222 | 222 | return $this; |
| 223 | 223 | } |
| 224 | 224 | |