@@ -149,7 +149,7 @@ |
||
| 149 | 149 | $glyph->setGlyphicon($glyphicon); |
| 150 | 150 | if ($left) { |
| 151 | 151 | $this->content=$glyph->compile().$separator.$this->content; |
| 152 | - } else { |
|
| 152 | + }else { |
|
| 153 | 153 | $this->content.=$separator.$glyph->compile(); |
| 154 | 154 | } |
| 155 | 155 | return $this; |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | protected $attr; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - public function __construct($identifier,$tagName){ |
|
| 24 | - parent::__construct($identifier,$tagName); |
|
| 23 | + public function __construct($identifier, $tagName) { |
|
| 24 | + parent::__construct($identifier, $tagName); |
|
| 25 | 25 | $this->root=""; |
| 26 | 26 | $this->attr="data-ajax"; |
| 27 | 27 | } |
@@ -33,11 +33,11 @@ discard block |
||
| 33 | 33 | * @param string $attr the html attribute used to build the elements url |
| 34 | 34 | * @return HtmlNavElement |
| 35 | 35 | */ |
| 36 | - public function autoGetOnClick($targetSelector){ |
|
| 37 | - return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
|
| 36 | + public function autoGetOnClick($targetSelector) { |
|
| 37 | + return $this->getOnClick($this->root, $targetSelector, array("attr"=>$this->attr)); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function contentAsString(){ |
|
| 40 | + public function contentAsString() { |
|
| 41 | 41 | return implode("", $this->content); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | * Generate the jquery script to set the elements to the HtmlNavElement |
| 46 | 46 | * @param JsUtils $jsUtils |
| 47 | 47 | */ |
| 48 | - public function jsSetContent(JsUtils $jsUtils){ |
|
| 49 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
| 48 | + public function jsSetContent(JsUtils $jsUtils) { |
|
| 49 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function getRoot() { |
| 53 | 53 | return $this->root; |
| 54 | 54 | } |
| 55 | 55 | public function setRoot($root) { |
| 56 | - $this->root = $root; |
|
| 56 | + $this->root=$root; |
|
| 57 | 57 | return $this; |
| 58 | 58 | } |
| 59 | 59 | public function getAttr() { |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | * @return HtmlNavElement |
| 67 | 67 | */ |
| 68 | 68 | public function setAttr($attr) { |
| 69 | - $this->attr = $attr; |
|
| 69 | + $this->attr=$attr; |
|
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function __call($method, $args) { |
| 74 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
| 74 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
| 75 | 75 | return call_user_func_array( |
| 76 | 76 | $this->$method, |
| 77 | 77 | $args |
@@ -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 |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | * @param string $tagName container tagName |
| 270 | 270 | * @return HtmlListgroup |
| 271 | 271 | */ |
| 272 | - public function htmlListgroup($identifier,$items=array(),$tagName="ul"){ |
|
| 273 | - $listGroup=new HtmlListgroup($identifier,$tagName); |
|
| 272 | + public function htmlListgroup($identifier, $items=array(), $tagName="ul") { |
|
| 273 | + $listGroup=new HtmlListgroup($identifier, $tagName); |
|
| 274 | 274 | $listGroup->addItems($items); |
| 275 | 275 | return $this->addHtmlComponent($listGroup); |
| 276 | 276 | } |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @param string $onClick |
| 296 | 296 | * @return HtmlSplitbutton |
| 297 | 297 | */ |
| 298 | - public function htmlSplitbutton($identifier,$value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 299 | - return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle,$onClick)); |
|
| 298 | + public function htmlSplitbutton($identifier, $value="", $items=array(), $cssStyle="btn-default", $onClick=NULL) { |
|
| 299 | + return $this->addHtmlComponent(new HtmlSplitbutton($identifier, $value, $items, $cssStyle, $onClick)); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * @param string $identifier |
| 305 | 305 | * @return HtmlInputgroup |
| 306 | 306 | */ |
| 307 | - public function htmlInputgroup($identifier){ |
|
| 307 | + public function htmlInputgroup($identifier) { |
|
| 308 | 308 | return $this->addHtmlComponent(new HtmlInputgroup($identifier)); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | * @param function $hrefFunction the function who generates the href elements. default : function($e){return $e->getContent()} |
| 317 | 317 | * @return HtmlBreadcrumbs |
| 318 | 318 | */ |
| 319 | - public function htmlBreadcrumbs($identifier,$elements=array(),$autoActive=true,$hrefFunction=NULL){ |
|
| 320 | - return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier,$elements,$autoActive,$hrefFunction)); |
|
| 319 | + public function htmlBreadcrumbs($identifier, $elements=array(), $autoActive=true, $hrefFunction=NULL) { |
|
| 320 | + return $this->addHtmlComponent(new HtmlBreadcrumbs($identifier, $elements, $autoActive, $hrefFunction)); |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | /** |
@@ -329,8 +329,8 @@ discard block |
||
| 329 | 329 | * @param int $active The active page |
| 330 | 330 | * @return HtmlPagination |
| 331 | 331 | */ |
| 332 | - public function htmlPagination($identifier,$from=1,$to=1,$active=NULL,$countVisible=NULL){ |
|
| 333 | - return $this->addHtmlComponent(new HtmlPagination($identifier,$from,$to,$active,$countVisible)); |
|
| 332 | + public function htmlPagination($identifier, $from=1, $to=1, $active=NULL, $countVisible=NULL) { |
|
| 333 | + return $this->addHtmlComponent(new HtmlPagination($identifier, $from, $to, $active, $countVisible)); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | * @param int $numCols |
| 342 | 342 | * @return HtmlGridSystem |
| 343 | 343 | */ |
| 344 | - public function htmlGridSystem($identifier,$numRows=1,$numCols=NULL){ |
|
| 345 | - return $this->addHtmlComponent(new HtmlGridSystem($identifier,$numRows,$numCols)); |
|
| 344 | + public function htmlGridSystem($identifier, $numRows=1, $numCols=NULL) { |
|
| 345 | + return $this->addHtmlComponent(new HtmlGridSystem($identifier, $numRows, $numCols)); |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | \ No newline at end of file |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | class HtmlGridSystem extends HtmlDoubleElement { |
| 17 | 17 | private $rows; |
| 18 | 18 | |
| 19 | - public function __construct($identifier,$numRows=1,$numCols=NULL){ |
|
| 20 | - parent::__construct($identifier,"div"); |
|
| 19 | + public function __construct($identifier, $numRows=1, $numCols=NULL) { |
|
| 20 | + parent::__construct($identifier, "div"); |
|
| 21 | 21 | $this->setProperty("class", "container-fluid"); |
| 22 | 22 | $this->rows=array(); |
| 23 | - $this->setNumRows($numRows,$numCols); |
|
| 23 | + $this->setNumRows($numRows, $numCols); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | * @param int $numCols |
| 29 | 29 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
| 30 | 30 | */ |
| 31 | - public function addRow($numCols=NULL){ |
|
| 32 | - $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols); |
|
| 31 | + public function addRow($numCols=NULL) { |
|
| 32 | + $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1), $numCols); |
|
| 33 | 33 | $this->rows[]=$row; |
| 34 | 34 | return $row; |
| 35 | 35 | } |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | * @param boolean $force add the row at $index if true |
| 41 | 41 | * @return \Ajax\bootstrap\html\content\HtmlGridRow |
| 42 | 42 | */ |
| 43 | - public function getRow($index,$force=true){ |
|
| 44 | - if($index<sizeof($this->rows)){ |
|
| 43 | + public function getRow($index, $force=true) { |
|
| 44 | + if ($index<sizeof($this->rows)) { |
|
| 45 | 45 | $result=$this->rows[$index-1]; |
| 46 | - }else if ($force){ |
|
| 46 | + }else if ($force) { |
|
| 47 | 47 | $this->setNumRows($index); |
| 48 | 48 | $result=$this->rows[$index-1]; |
| 49 | 49 | } |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * @param int $numCols |
| 57 | 57 | * @return \Ajax\bootstrap\html\HtmlGridSystem |
| 58 | 58 | */ |
| 59 | - public function setNumRows($numRows,$numCols=NULL){ |
|
| 60 | - for($i=sizeof($this->rows);$i<$numRows;$i++){ |
|
| 59 | + public function setNumRows($numRows, $numCols=NULL) { |
|
| 60 | + for ($i=sizeof($this->rows); $i<$numRows; $i++) { |
|
| 61 | 61 | $this->addRow($numCols); |
| 62 | 62 | } |
| 63 | 63 | return $this; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | * @param $force add the cell at $row,$col if true |
| 70 | 70 | * @return HtmlGridCol |
| 71 | 71 | */ |
| 72 | - public function getCell($row,$col,$force=true){ |
|
| 73 | - $row=$this->getRow($row,$force); |
|
| 74 | - if(isset($row)){ |
|
| 75 | - $col=$row->getCol($col,$force); |
|
| 72 | + public function getCell($row, $col, $force=true) { |
|
| 73 | + $row=$this->getRow($row, $force); |
|
| 74 | + if (isset($row)) { |
|
| 75 | + $col=$row->getCol($col, $force); |
|
| 76 | 76 | } |
| 77 | 77 | return $col; |
| 78 | 78 | } |
@@ -82,22 +82,22 @@ discard block |
||
| 82 | 82 | * @param int $col |
| 83 | 83 | * @return HtmlGridCol |
| 84 | 84 | */ |
| 85 | - public function getCellAt($row,$col,$force=true){ |
|
| 86 | - $row=$this->getRow($row,$force); |
|
| 87 | - if(isset($row)){ |
|
| 88 | - $col=$row->getColAt($col,$force); |
|
| 85 | + public function getCellAt($row, $col, $force=true) { |
|
| 86 | + $row=$this->getRow($row, $force); |
|
| 87 | + if (isset($row)) { |
|
| 88 | + $col=$row->getColAt($col, $force); |
|
| 89 | 89 | } |
| 90 | 90 | return $col; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 94 | - foreach ($this->rows as $row){ |
|
| 94 | + foreach ($this->rows as $row) { |
|
| 95 | 95 | $this->addContent($row); |
| 96 | 96 | } |
| 97 | - return parent::compile($js,$view); |
|
| 97 | + return parent::compile($js, $view); |
|
| 98 | 98 | } |
| 99 | - public function setContentForAll($content){ |
|
| 100 | - foreach ($this->rows as $row){ |
|
| 99 | + public function setContentForAll($content) { |
|
| 100 | + foreach ($this->rows as $row) { |
|
| 101 | 101 | $row->setContentForAll($content); |
| 102 | 102 | } |
| 103 | 103 | } |
@@ -15,22 +15,22 @@ discard block |
||
| 15 | 15 | class HtmlGridCol extends HtmlDoubleElement { |
| 16 | 16 | private $positions; |
| 17 | 17 | private $offsets; |
| 18 | - public function __construct($identifier,$size=CssSize::SIZE_MD,$width=1){ |
|
| 19 | - parent::__construct($identifier,"div"); |
|
| 18 | + public function __construct($identifier, $size=CssSize::SIZE_MD, $width=1) { |
|
| 19 | + parent::__construct($identifier, "div"); |
|
| 20 | 20 | $this->positions=array(); |
| 21 | 21 | $this->offsets=array(); |
| 22 | - $this->addPosition($size,$width); |
|
| 22 | + $this->addPosition($size, $width); |
|
| 23 | 23 | } |
| 24 | - public function addPosition($size=CssSize::SIZE_MD,$width=1){ |
|
| 24 | + public function addPosition($size=CssSize::SIZE_MD, $width=1) { |
|
| 25 | 25 | $this->positions[$size]=$width; |
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | - private function _generateClass(){ |
|
| 28 | + private function _generateClass() { |
|
| 29 | 29 | $result=array(); |
| 30 | - foreach ($this->positions as $size=>$width){ |
|
| 30 | + foreach ($this->positions as $size=>$width) { |
|
| 31 | 31 | $result[]="col-".$size."-".$width; |
| 32 | 32 | } |
| 33 | - foreach ($this->offsets as $size=>$offset){ |
|
| 33 | + foreach ($this->offsets as $size=>$offset) { |
|
| 34 | 34 | $result[]="col-".$size."-offset-".$offset; |
| 35 | 35 | } |
| 36 | 36 | return implode(" ", $result); |
@@ -38,63 +38,63 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 40 | 40 | $this->setProperty("class", $this->_generateClass()); |
| 41 | - return parent::compile($js,$view); |
|
| 41 | + return parent::compile($js, $view); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setOffset($size,$offset){ |
|
| 44 | + public function setOffset($size, $offset) { |
|
| 45 | 45 | $this->offsets[$size]=$offset; |
| 46 | 46 | return $this; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function setOffsetForAll($newOffset){ |
|
| 50 | - foreach ($this->offsets as &$value){ |
|
| 49 | + public function setOffsetForAll($newOffset) { |
|
| 50 | + foreach ($this->offsets as &$value) { |
|
| 51 | 51 | $value=$newOffset; |
| 52 | 52 | } |
| 53 | 53 | unset($value); |
| 54 | 54 | return $this; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function setWidthForAll($newWidth){ |
|
| 58 | - foreach ($this->positions as &$pos){ |
|
| 57 | + public function setWidthForAll($newWidth) { |
|
| 58 | + foreach ($this->positions as &$pos) { |
|
| 59 | 59 | $pos=$newWidth; |
| 60 | 60 | } |
| 61 | 61 | unset($pos); |
| 62 | 62 | return $this; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function setWidth($size=CssSize::SIZE_MD,$width=1){ |
|
| 65 | + public function setWidth($size=CssSize::SIZE_MD, $width=1) { |
|
| 66 | 66 | $this->positions[$size]=$width; |
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function setPosition($size=CssSize::SIZE_MD,$width=1){ |
|
| 71 | - return $this->addPosition($size,$width); |
|
| 70 | + public function setPosition($size=CssSize::SIZE_MD, $width=1) { |
|
| 71 | + return $this->addPosition($size, $width); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function getWidth($size){ |
|
| 74 | + public function getWidth($size) { |
|
| 75 | 75 | return @$this->positions[$size]; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function getOffest($size){ |
|
| 78 | + public function getOffest($size) { |
|
| 79 | 79 | return @$this->offsets[$size]; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addClear(){ |
|
| 83 | - $this->wrap("","<div class='clearfix'></div>"); |
|
| 82 | + public function addClear() { |
|
| 83 | + $this->wrap("", "<div class='clearfix'></div>"); |
|
| 84 | 84 | } |
| 85 | 85 | public function setOffsets($offsets) { |
| 86 | - $this->offsets = $offsets; |
|
| 86 | + $this->offsets=$offsets; |
|
| 87 | 87 | return $this; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public function copy($identifier){ |
|
| 90 | + public function copy($identifier) { |
|
| 91 | 91 | $result=new HtmlGridCol($identifier); |
| 92 | 92 | $result->setPositions($this->positions); |
| 93 | 93 | $result->setOffsets($this->offsets); |
| 94 | 94 | return $result; |
| 95 | 95 | } |
| 96 | 96 | public function setPositions($positions) { |
| 97 | - $this->positions = $positions; |
|
| 97 | + $this->positions=$positions; |
|
| 98 | 98 | return $this; |
| 99 | 99 | } |
| 100 | 100 | public function getOffsets() { |
@@ -14,88 +14,88 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class HtmlGridRow extends HtmlDoubleElement { |
| 16 | 16 | private $cols; |
| 17 | - public function __construct($identifier,$numCols=NULL){ |
|
| 18 | - parent::__construct($identifier,"div"); |
|
| 17 | + public function __construct($identifier, $numCols=NULL) { |
|
| 18 | + parent::__construct($identifier, "div"); |
|
| 19 | 19 | $this->setProperty("class", "row"); |
| 20 | 20 | $this->cols=array(); |
| 21 | - if(isset($numCols)){ |
|
| 22 | - $numCols=min(12,$numCols); |
|
| 23 | - $numCols=max(1,$numCols); |
|
| 24 | - $width=12/$numCols; |
|
| 25 | - for ($i=0;$i<$numCols;$i++){ |
|
| 26 | - $this->addCol(CssSize::SIZE_MD,$width); |
|
| 21 | + if (isset($numCols)) { |
|
| 22 | + $numCols=min(12, $numCols); |
|
| 23 | + $numCols=max(1, $numCols); |
|
| 24 | + $width=12 / $numCols; |
|
| 25 | + for ($i=0; $i<$numCols; $i++) { |
|
| 26 | + $this->addCol(CssSize::SIZE_MD, $width); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function addCol($size=CssSize::SIZE_MD,$width=1){ |
|
| 32 | - $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1),$size,$width); |
|
| 31 | + public function addCol($size=CssSize::SIZE_MD, $width=1) { |
|
| 32 | + $col=new HtmlGridCol($this->identifier."-col-".(sizeof($this->cols)+1), $size, $width); |
|
| 33 | 33 | $this->cols[]=$col; |
| 34 | 34 | return $col; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function addColAt($size=CssSize::SIZE_MD,$width=1,$offset=1){ |
|
| 38 | - $col=$this->addCol($size,$width); |
|
| 39 | - return $col->setOffset($size, max($offset,sizeof($this->cols)+1)); |
|
| 37 | + public function addColAt($size=CssSize::SIZE_MD, $width=1, $offset=1) { |
|
| 38 | + $col=$this->addCol($size, $width); |
|
| 39 | + return $col->setOffset($size, max($offset, sizeof($this->cols)+1)); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function getCol($index,$force=true){ |
|
| 43 | - if($index<sizeof($this->cols)+1){ |
|
| 42 | + public function getCol($index, $force=true) { |
|
| 43 | + if ($index<sizeof($this->cols)+1) { |
|
| 44 | 44 | $result=$this->cols[$index-1]; |
| 45 | - }else if ($force){ |
|
| 46 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
| 45 | + }else if ($force) { |
|
| 46 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
| 47 | 47 | } |
| 48 | 48 | return $result; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function getColAt($offset,$force=true){ |
|
| 51 | + public function getColAt($offset, $force=true) { |
|
| 52 | 52 | $result=null; |
| 53 | - foreach ($this->cols as $col){ |
|
| 53 | + foreach ($this->cols as $col) { |
|
| 54 | 54 | $offsets=$col->getOffsets(); |
| 55 | - if($result=array_search($offset, $offsets)){ |
|
| 55 | + if ($result=array_search($offset, $offsets)) { |
|
| 56 | 56 | break; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | - if(!$result || isset($result)==false){ |
|
| 60 | - $result=$this->getCol($offset,$force); |
|
| 59 | + if (!$result || isset($result)==false) { |
|
| 60 | + $result=$this->getCol($offset, $force); |
|
| 61 | 61 | } |
| 62 | 62 | return $result; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 66 | 66 | |
| 67 | - foreach ($this->cols as $col){ |
|
| 67 | + foreach ($this->cols as $col) { |
|
| 68 | 68 | $this->addContent($col); |
| 69 | 69 | } |
| 70 | - return parent::compile($js,$view); |
|
| 70 | + return parent::compile($js, $view); |
|
| 71 | 71 | } |
| 72 | 72 | public function getCols() { |
| 73 | 73 | return $this->cols; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - public function setContentForAll($content){ |
|
| 77 | - foreach ($this->cols as $col){ |
|
| 76 | + public function setContentForAll($content) { |
|
| 77 | + foreach ($this->cols as $col) { |
|
| 78 | 78 | $col->setContent($content); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | - public function merge($size=CssSize::SIZE_MD,$start,$width){ |
|
| 82 | - $col=$this->getColAt($start,false); |
|
| 83 | - if(isset($col)){ |
|
| 84 | - $col->setWidth($size,$width+1); |
|
| 85 | - $this->delete($size,$start+1, $width); |
|
| 81 | + public function merge($size=CssSize::SIZE_MD, $start, $width) { |
|
| 82 | + $col=$this->getColAt($start, false); |
|
| 83 | + if (isset($col)) { |
|
| 84 | + $col->setWidth($size, $width+1); |
|
| 85 | + $this->delete($size, $start+1, $width); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | - public function delete($size=CssSize::SIZE_MD,$start,$width){ |
|
| 89 | - while($start<sizeof($this->cols)+1 && $width>0){ |
|
| 90 | - $col=$this->getColAt($start,false); |
|
| 91 | - if(isset($col)){ |
|
| 88 | + public function delete($size=CssSize::SIZE_MD, $start, $width) { |
|
| 89 | + while ($start<sizeof($this->cols)+1 && $width>0) { |
|
| 90 | + $col=$this->getColAt($start, false); |
|
| 91 | + if (isset($col)) { |
|
| 92 | 92 | $widthCol=$col->getWidth($size); |
| 93 | - if($widthCol<=$width){ |
|
| 93 | + if ($widthCol<=$width) { |
|
| 94 | 94 | unset($this->cols[$start-1]); |
| 95 | - $this->cols = array_values($this->cols); |
|
| 95 | + $this->cols=array_values($this->cols); |
|
| 96 | 96 | $width=$width-$widthCol; |
| 97 | 97 | } |
| 98 | - }else{ |
|
| 98 | + }else { |
|
| 99 | 99 | $width=0; |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | protected $_bootstrap; |
| 22 | 22 | protected $libraryFile; |
| 23 | 23 | protected $_javascript_folder='js'; |
| 24 | - protected $jquery_code_for_load=array (); |
|
| 25 | - protected $jquery_code_for_compile=array (); |
|
| 24 | + protected $jquery_code_for_load=array(); |
|
| 25 | + protected $jquery_code_for_compile=array(); |
|
| 26 | 26 | protected $jquery_corner_active=FALSE; |
| 27 | 27 | protected $jquery_table_sorter_active=FALSE; |
| 28 | 28 | protected $jquery_table_sorter_pager_active=FALSE; |
| 29 | 29 | protected $ajaxLoader='<span></span><span></span><span></span><span></span><span></span>'; |
| 30 | - protected $jquery_events=array ( |
|
| 31 | - "bind","blur","change","click","dblclick","delegate","die","error","focus","focusin","focusout","hover","keydown","keypress","keyup","live","load","mousedown","mousseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","off","on","one","ready","resize","scroll","select","submit","toggle","trigger","triggerHandler","undind","undelegate","unload" |
|
| 30 | + protected $jquery_events=array( |
|
| 31 | + "bind", "blur", "change", "click", "dblclick", "delegate", "die", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "live", "load", "mousedown", "mousseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "off", "on", "one", "ready", "resize", "scroll", "select", "submit", "toggle", "trigger", "triggerHandler", "undind", "undelegate", "unload" |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | public function setDi($di) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
| 163 | 163 | if (!is_array($js)) { |
| 164 | - $js=array ( |
|
| 164 | + $js=array( |
|
| 165 | 165 | $js |
| 166 | 166 | ); |
| 167 | 167 | } |
@@ -356,12 +356,12 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | public function _output($array_js='') { |
| 358 | 358 | if (!is_array($array_js)) { |
| 359 | - $array_js=array ( |
|
| 359 | + $array_js=array( |
|
| 360 | 360 | $array_js |
| 361 | 361 | ); |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - foreach ( $array_js as $js ) { |
|
| 364 | + foreach ($array_js as $js) { |
|
| 365 | 365 | $this->jquery_code_for_compile[]="\t$js\n"; |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * @param boolean $immediatly defers the execution if set to false |
| 417 | 417 | * @return string |
| 418 | 418 | */ |
| 419 | - public function after($element='this', $value='', $immediatly=false){ |
|
| 419 | + public function after($element='this', $value='', $immediatly=false) { |
|
| 420 | 420 | $element=$this->_prep_element($element); |
| 421 | 421 | $value=$this->_prep_value($value); |
| 422 | 422 | $str="$({$element}).after({$value});"; |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | if (isset($value)) { |
| 438 | 438 | $value=$this->_prep_value($value); |
| 439 | 439 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
| 440 | - } else |
|
| 440 | + }else |
|
| 441 | 441 | $str="$({$element}).attr(\"$attributeName\");"; |
| 442 | 442 | if ($immediatly) |
| 443 | 443 | $this->jquery_code_for_compile[]=$str; |
@@ -451,12 +451,12 @@ discard block |
||
| 451 | 451 | * @param string $param |
| 452 | 452 | * @param boolean $immediatly delayed if false |
| 453 | 453 | */ |
| 454 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
| 454 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
| 455 | 455 | $element=$this->_prep_element($element); |
| 456 | 456 | if (isset($param)) { |
| 457 | 457 | $param=$this->_prep_value($param); |
| 458 | 458 | $str="$({$element}).{$jQueryCall}({$param});"; |
| 459 | - } else |
|
| 459 | + }else |
|
| 460 | 460 | $str="$({$element}).{$jQueryCall}();"; |
| 461 | 461 | if ($immediatly) |
| 462 | 462 | $this->jquery_code_for_compile[]=$str; |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | * @param boolean $immediatly delayed if false |
| 471 | 471 | * @return string |
| 472 | 472 | */ |
| 473 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
| 473 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
| 474 | 474 | $to=$this->_prep_element($to); |
| 475 | 475 | $element=$this->_prep_element($element); |
| 476 | 476 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | |
| 497 | 497 | $animations="\t\t\t"; |
| 498 | 498 | if (is_array($params)) { |
| 499 | - foreach ( $params as $param => $value ) { |
|
| 499 | + foreach ($params as $param => $value) { |
|
| 500 | 500 | $animations.=$param.': \''.$value.'\', '; |
| 501 | 501 | } |
| 502 | 502 | } |
@@ -768,12 +768,12 @@ discard block |
||
| 768 | 768 | */ |
| 769 | 769 | public function sortable($element, $options=array()) { |
| 770 | 770 | if (count($options)>0) { |
| 771 | - $sort_options=array (); |
|
| 772 | - foreach ( $options as $k => $v ) { |
|
| 771 | + $sort_options=array(); |
|
| 772 | + foreach ($options as $k => $v) { |
|
| 773 | 773 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
| 774 | 774 | } |
| 775 | 775 | $sort_options=implode(",", $sort_options); |
| 776 | - } else { |
|
| 776 | + }else { |
|
| 777 | 777 | $sort_options=''; |
| 778 | 778 | } |
| 779 | 779 | |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | // External references |
| 856 | 856 | $external_scripts=implode('', $this->jquery_code_for_load); |
| 857 | - extract(array ( |
|
| 857 | + extract(array( |
|
| 858 | 858 | 'library_src' => $external_scripts |
| 859 | 859 | )); |
| 860 | 860 | |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | * @return void |
| 888 | 888 | */ |
| 889 | 889 | public function _clear_compile() { |
| 890 | - $this->jquery_code_for_compile=array (); |
|
| 890 | + $this->jquery_code_for_compile=array(); |
|
| 891 | 891 | } |
| 892 | 892 | |
| 893 | 893 | // -------------------------------------------------------------------- |
@@ -899,12 +899,12 @@ discard block |
||
| 899 | 899 | */ |
| 900 | 900 | public function _document_ready($js) { |
| 901 | 901 | if (!is_array($js)) { |
| 902 | - $js=array ( |
|
| 902 | + $js=array( |
|
| 903 | 903 | $js |
| 904 | 904 | ); |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | - foreach ( $js as $script ) { |
|
| 907 | + foreach ($js as $script) { |
|
| 908 | 908 | $this->jquery_code_for_compile[]=$script; |
| 909 | 909 | } |
| 910 | 910 | } |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | * @return string |
| 921 | 921 | */ |
| 922 | 922 | public function _prep_element($element) { |
| 923 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
| 923 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
| 924 | 924 | $element='"'.addslashes($element).'"'; |
| 925 | 925 | } |
| 926 | 926 | return $element; |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | if (is_array($value)) { |
| 939 | 939 | $value=implode(",", $value); |
| 940 | 940 | } |
| 941 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
| 941 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
| 942 | 942 | $value='"'.$value.'"'; |
| 943 | 943 | } |
| 944 | 944 | return $value; |
@@ -953,8 +953,8 @@ discard block |
||
| 953 | 953 | * @return string |
| 954 | 954 | */ |
| 955 | 955 | private function _validate_speed($speed) { |
| 956 | - if (in_array($speed, array ( |
|
| 957 | - 'slow','normal','fast' |
|
| 956 | + if (in_array($speed, array( |
|
| 957 | + 'slow', 'normal', 'fast' |
|
| 958 | 958 | ))) { |
| 959 | 959 | $speed='"'.$speed.'"'; |
| 960 | 960 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | $loading_notifier='<div class="ajax-loader">'; |
| 969 | 969 | if ($this->ajaxLoader=='') { |
| 970 | 970 | $loading_notifier.="Loading..."; |
| 971 | - } else { |
|
| 971 | + }else { |
|
| 972 | 972 | $loading_notifier.=$this->ajaxLoader; |
| 973 | 973 | } |
| 974 | 974 | $loading_notifier.='</div>'; |
@@ -976,20 +976,20 @@ discard block |
||
| 976 | 976 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 980 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 979 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 980 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 981 | 981 | } |
| 982 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 983 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
| 982 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 983 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 987 | - if(JString::isNull($params)){$params="{}";} |
|
| 986 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 987 | + if (JString::isNull($params)) {$params="{}"; } |
|
| 988 | 988 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 989 | 989 | $retour=$this->_getAjaxUrl($url, $attr); |
| 990 | 990 | $responseElement=$this->_getResponseElement($responseElement); |
| 991 | 991 | $retour.="var self=this;\n"; |
| 992 | - if($hasLoader===true){ |
|
| 992 | + if ($hasLoader===true) { |
|
| 993 | 993 | $this->addLoading($retour, $responseElement); |
| 994 | 994 | } |
| 995 | 995 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -999,22 +999,22 @@ discard block |
||
| 999 | 999 | return $retour; |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | - protected function _getAjaxUrl($url,$attr){ |
|
| 1002 | + protected function _getAjaxUrl($url, $attr) { |
|
| 1003 | 1003 | $url=$this->_correctAjaxUrl($url); |
| 1004 | 1004 | $retour="url='".$url."';\n"; |
| 1005 | 1005 | $slash="/"; |
| 1006 | - if(PhalconUtils::endsWith($url, "/")) |
|
| 1006 | + if (PhalconUtils::endsWith($url, "/")) |
|
| 1007 | 1007 | $slash=""; |
| 1008 | - if(JString::isNotNull($attr)){ |
|
| 1008 | + if (JString::isNotNull($attr)) { |
|
| 1009 | 1009 | if ($attr=="value") |
| 1010 | 1010 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
| 1011 | - else if($attr!=null && $attr!=="") |
|
| 1011 | + else if ($attr!=null && $attr!=="") |
|
| 1012 | 1012 | $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
| 1013 | 1013 | } |
| 1014 | 1014 | return $retour; |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
| 1017 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
| 1018 | 1018 | $retour=""; |
| 1019 | 1019 | if ($responseElement!=="") { |
| 1020 | 1020 | $retour="\t$({$responseElement}).html( data );\n"; |
@@ -1023,7 +1023,7 @@ discard block |
||
| 1023 | 1023 | return $retour; |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | - protected function _getResponseElement($responseElement){ |
|
| 1026 | + protected function _getResponseElement($responseElement) { |
|
| 1027 | 1027 | if ($responseElement!=="") { |
| 1028 | 1028 | $responseElement=$this->_prep_value($responseElement); |
| 1029 | 1029 | } |
@@ -1033,7 +1033,7 @@ discard block |
||
| 1033 | 1033 | protected function _correctAjaxUrl($url) { |
| 1034 | 1034 | if (PhalconUtils::endsWith($url, "/")) |
| 1035 | 1035 | $url=substr($url, 0, strlen($url)-1); |
| 1036 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
| 1036 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
| 1037 | 1037 | $url=$this->_di->get("url")->get($url); |
| 1038 | 1038 | } |
| 1039 | 1039 | return $url; |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | * @param string $method Method use |
| 1047 | 1047 | * @param string $jsCallback javascript code to execute after the request |
| 1048 | 1048 | */ |
| 1049 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 1049 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 1050 | 1050 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1051 | 1051 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1052 | 1052 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | * @param string $url the request address |
| 1067 | 1067 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get") |
| 1068 | 1068 | */ |
| 1069 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
| 1069 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
| 1070 | 1070 | $preventDefault=true; |
| 1071 | 1071 | $stopPropagation=true; |
| 1072 | 1072 | $jsCallback=null; |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | $context="document"; |
| 1076 | 1076 | $params="{}"; |
| 1077 | 1077 | extract($parameters); |
| 1078 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation); |
|
| 1078 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation); |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | /** |
@@ -1086,19 +1086,19 @@ discard block |
||
| 1086 | 1086 | * @param string $jsCallback javascript code to execute after the request |
| 1087 | 1087 | * @param string $context jquery DOM element, array container. |
| 1088 | 1088 | */ |
| 1089 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) { |
|
| 1089 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) { |
|
| 1090 | 1090 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1091 | 1091 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1092 | - if($context===null){ |
|
| 1092 | + if ($context===null) { |
|
| 1093 | 1093 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
| 1094 | - $newElm = "$('#'+newId)"; |
|
| 1095 | - }else{ |
|
| 1094 | + $newElm="$('#'+newId)"; |
|
| 1095 | + }else { |
|
| 1096 | 1096 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
| 1097 | - $newElm = $context.".find('#'+newId)"; |
|
| 1097 | + $newElm=$context.".find('#'+newId)"; |
|
| 1098 | 1098 | } |
| 1099 | 1099 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
| 1100 | 1100 | $retour.="\tdata=$.parseJSON(data);$.each(data, function(index, value) {\n"."\tvar created=false;var maskElm=$('".$maskSelector."').first();maskElm.hide();"."\tvar newId=(maskElm.attr('id') || 'mask')+'-'+index;"."\tvar newElm=".$newElm.";\n"."\tif(!newElm.length){\n"."\t\tnewElm=maskElm.clone();newElm.attr('id',newId);\n"; |
| 1101 | - $retour.= $appendTo; |
|
| 1101 | + $retour.=$appendTo; |
|
| 1102 | 1102 | $retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n"; |
| 1103 | 1103 | |
| 1104 | 1104 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -1113,25 +1113,25 @@ discard block |
||
| 1113 | 1113 | * @param string $url the request address |
| 1114 | 1114 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
| 1115 | 1115 | */ |
| 1116 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
| 1116 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 1117 | 1117 | $preventDefault=true; |
| 1118 | 1118 | $stopPropagation=true; |
| 1119 | 1119 | $jsCallback=null; |
| 1120 | 1120 | $attr="id"; |
| 1121 | 1121 | $method="get"; |
| 1122 | - $context = null; |
|
| 1122 | + $context=null; |
|
| 1123 | 1123 | $params="{}"; |
| 1124 | 1124 | extract($parameters); |
| 1125 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation); |
|
| 1125 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation); |
|
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
| 1128 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
| 1129 | 1129 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
| 1130 | 1130 | $retour=$this->_getAjaxUrl($url, $attr); |
| 1131 | 1131 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
| 1132 | 1132 | $responseElement=$this->_getResponseElement($responseElement); |
| 1133 | 1133 | $retour.="var self=this;\n"; |
| 1134 | - if($hasLoader===true){ |
|
| 1134 | + if ($hasLoader===true) { |
|
| 1135 | 1135 | $this->addLoading($retour, $responseElement); |
| 1136 | 1136 | } |
| 1137 | 1137 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -1158,14 +1158,14 @@ discard block |
||
| 1158 | 1158 | * @param string $responseElement |
| 1159 | 1159 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1160 | 1160 | */ |
| 1161 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1161 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1162 | 1162 | $preventDefault=true; |
| 1163 | 1163 | $stopPropagation=true; |
| 1164 | 1164 | $jsCallback=null; |
| 1165 | 1165 | $attr="id"; |
| 1166 | 1166 | $hasLoader=true; |
| 1167 | 1167 | extract($parameters); |
| 1168 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1168 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | /** |
@@ -1178,14 +1178,14 @@ discard block |
||
| 1178 | 1178 | * @param string $responseElement |
| 1179 | 1179 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1180 | 1180 | */ |
| 1181 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1181 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
| 1182 | 1182 | $preventDefault=true; |
| 1183 | 1183 | $stopPropagation=true; |
| 1184 | 1184 | $jsCallback=null; |
| 1185 | 1185 | $attr="id"; |
| 1186 | 1186 | $hasLoader=true; |
| 1187 | 1187 | extract($parameters); |
| 1188 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1188 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | 1191 | /** |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | * @param string $responseElement |
| 1199 | 1199 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
| 1200 | 1200 | */ |
| 1201 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 1201 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
| 1202 | 1202 | $preventDefault=true; |
| 1203 | 1203 | $stopPropagation=true; |
| 1204 | 1204 | $validation=false; |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | $attr="id"; |
| 1207 | 1207 | $hasLoader=true; |
| 1208 | 1208 | extract($parameters); |
| 1209 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1209 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation); |
|
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | /** |