@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function __construct(JsUtils $js) { |
16 | 16 | parent::__construct($js); |
17 | - $this->params=array ( |
|
17 | + $this->params=array( |
|
18 | 18 | "value" => 50 |
19 | 19 | ); |
20 | 20 | $this->uiName="progressbar"; |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @param string $value default : swing |
31 | 31 | */ |
32 | 32 | public function setEasing($value) { |
33 | - $this->setParamCtrl("easing", $value, array ( |
|
33 | + $this->setParamCtrl("easing", $value, array( |
|
34 | 34 | "linear", |
35 | 35 | "swing", |
36 | 36 | "easeInQuad", |
@@ -74,7 +74,7 @@ |
||
74 | 74 | protected function setParamCtrl($key, $value, $typeCtrl) { |
75 | 75 | if (!$typeCtrl($value)) { |
76 | 76 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." à la position"); |
77 | - } else |
|
77 | + }else |
|
78 | 78 | $this->setParam($key, $value); |
79 | 79 | } |
80 | 80 |
@@ -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; |
@@ -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; |
@@ -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) { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function __construct($params) { |
53 | 53 | $this->params=array(); |
54 | - foreach ( $params as $key => $val ) { |
|
54 | + foreach ($params as $key => $val) { |
|
55 | 55 | $this->params[$key]=$params[$key]; |
56 | 56 | } |
57 | 57 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function _click($element='this', $js=array(), $ret_false=TRUE) { |
167 | 167 | if (!is_array($js)) { |
168 | - $js=array ( |
|
168 | + $js=array( |
|
169 | 169 | $js |
170 | 170 | ); |
171 | 171 | } |
@@ -360,12 +360,12 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function _output($array_js='') { |
362 | 362 | if (!is_array($array_js)) { |
363 | - $array_js=array ( |
|
363 | + $array_js=array( |
|
364 | 364 | $array_js |
365 | 365 | ); |
366 | 366 | } |
367 | 367 | |
368 | - foreach ( $array_js as $js ) { |
|
368 | + foreach ($array_js as $js) { |
|
369 | 369 | $this->jquery_code_for_compile[]="\t$js\n"; |
370 | 370 | } |
371 | 371 | } |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * @param boolean $immediatly defers the execution if set to false |
421 | 421 | * @return string |
422 | 422 | */ |
423 | - public function after($element='this', $value='', $immediatly=false){ |
|
423 | + public function after($element='this', $value='', $immediatly=false) { |
|
424 | 424 | $element=$this->_prep_element($element); |
425 | 425 | $value=$this->_prep_value($value); |
426 | 426 | $str="$({$element}).after({$value});"; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | if (isset($value)) { |
442 | 442 | $value=$this->_prep_value($value); |
443 | 443 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
444 | - } else |
|
444 | + }else |
|
445 | 445 | $str="$({$element}).attr(\"$attributeName\");"; |
446 | 446 | if ($immediatly) |
447 | 447 | $this->jquery_code_for_compile[]=$str; |
@@ -455,12 +455,12 @@ discard block |
||
455 | 455 | * @param string $param |
456 | 456 | * @param boolean $immediatly delayed if false |
457 | 457 | */ |
458 | - public function _genericCallValue($jQueryCall,$element='this', $param="", $immediatly=false) { |
|
458 | + public function _genericCallValue($jQueryCall, $element='this', $param="", $immediatly=false) { |
|
459 | 459 | $element=$this->_prep_element($element); |
460 | 460 | if (isset($param)) { |
461 | 461 | $param=$this->_prep_value($param); |
462 | 462 | $str="$({$element}).{$jQueryCall}({$param});"; |
463 | - } else |
|
463 | + }else |
|
464 | 464 | $str="$({$element}).{$jQueryCall}();"; |
465 | 465 | if ($immediatly) |
466 | 466 | $this->jquery_code_for_compile[]=$str; |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * @param boolean $immediatly delayed if false |
475 | 475 | * @return string |
476 | 476 | */ |
477 | - public function _genericCallElement($jQueryCall,$to='this', $element, $immediatly=false) { |
|
477 | + public function _genericCallElement($jQueryCall, $to='this', $element, $immediatly=false) { |
|
478 | 478 | $to=$this->_prep_element($to); |
479 | 479 | $element=$this->_prep_element($element); |
480 | 480 | $str="$({$to}).{$jQueryCall}({$element});"; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | $animations="\t\t\t"; |
502 | 502 | if (is_array($params)) { |
503 | - foreach ( $params as $param => $value ) { |
|
503 | + foreach ($params as $param => $value) { |
|
504 | 504 | $animations.=$param.': \''.$value.'\', '; |
505 | 505 | } |
506 | 506 | } |
@@ -772,12 +772,12 @@ discard block |
||
772 | 772 | */ |
773 | 773 | public function sortable($element, $options=array()) { |
774 | 774 | if (count($options)>0) { |
775 | - $sort_options=array (); |
|
776 | - foreach ( $options as $k => $v ) { |
|
775 | + $sort_options=array(); |
|
776 | + foreach ($options as $k => $v) { |
|
777 | 777 | $sort_options[]="\n\t\t".$k.': '.$v.""; |
778 | 778 | } |
779 | 779 | $sort_options=implode(",", $sort_options); |
780 | - } else { |
|
780 | + }else { |
|
781 | 781 | $sort_options=''; |
782 | 782 | } |
783 | 783 | |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | * @param boolean $stopPropagation Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. |
812 | 812 | * @return string |
813 | 813 | */ |
814 | - public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
814 | + public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
815 | 815 | if (is_array($js)) { |
816 | 816 | $js=implode("\n\t\t", $js); |
817 | 817 | } |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
826 | 826 | else |
827 | 827 | $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
828 | - if($immediatly) |
|
828 | + if ($immediatly) |
|
829 | 829 | $this->jquery_code_for_compile[]=$event; |
830 | 830 | return $event; |
831 | 831 | } |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | |
860 | 860 | // External references |
861 | 861 | $external_scripts=implode('', $this->jquery_code_for_load); |
862 | - extract(array ( |
|
862 | + extract(array( |
|
863 | 863 | 'library_src' => $external_scripts |
864 | 864 | )); |
865 | 865 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | $script.='});'; |
875 | 875 | |
876 | 876 | $this->jquery_code_for_compile=array(); |
877 | - if($this->params["debug"]==false){ |
|
877 | + if ($this->params["debug"]==false) { |
|
878 | 878 | $script=$this->minify($script); |
879 | 879 | } |
880 | 880 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | * @return void |
897 | 897 | */ |
898 | 898 | public function _clear_compile() { |
899 | - $this->jquery_code_for_compile=array (); |
|
899 | + $this->jquery_code_for_compile=array(); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | // -------------------------------------------------------------------- |
@@ -908,12 +908,12 @@ discard block |
||
908 | 908 | */ |
909 | 909 | public function _document_ready($js) { |
910 | 910 | if (!is_array($js)) { |
911 | - $js=array ( |
|
911 | + $js=array( |
|
912 | 912 | $js |
913 | 913 | ); |
914 | 914 | } |
915 | 915 | |
916 | - foreach ( $js as $script ) { |
|
916 | + foreach ($js as $script) { |
|
917 | 917 | $this->jquery_code_for_compile[]=$script; |
918 | 918 | } |
919 | 919 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * @return string |
930 | 930 | */ |
931 | 931 | public function _prep_element($element) { |
932 | - if (strrpos($element, 'this')===false&&strrpos($element, 'event')===false&&strrpos($element, 'self')===false) { |
|
932 | + if (strrpos($element, 'this')===false && strrpos($element, 'event')===false && strrpos($element, 'self')===false) { |
|
933 | 933 | $element='"'.addslashes($element).'"'; |
934 | 934 | } |
935 | 935 | return $element; |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | if (is_array($value)) { |
948 | 948 | $value=implode(",", $value); |
949 | 949 | } |
950 | - if (strrpos($value, 'this')===false&&strrpos($value, 'event')===false&&strrpos($value, 'self')===false) { |
|
950 | + if (strrpos($value, 'this')===false && strrpos($value, 'event')===false && strrpos($value, 'self')===false) { |
|
951 | 951 | $value='"'.$value.'"'; |
952 | 952 | } |
953 | 953 | return $value; |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | * @return string |
963 | 963 | */ |
964 | 964 | private function _validate_speed($speed) { |
965 | - if (in_array($speed, array ( |
|
966 | - 'slow','normal','fast' |
|
965 | + if (in_array($speed, array( |
|
966 | + 'slow', 'normal', 'fast' |
|
967 | 967 | ))) { |
968 | 968 | $speed='"'.$speed.'"'; |
969 | 969 | } elseif (preg_match("/[^0-9]/", $speed)) { |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $loading_notifier='<div class="ajax-loader">'; |
978 | 978 | if ($this->ajaxLoader=='') { |
979 | 979 | $loading_notifier.="Loading..."; |
980 | - } else { |
|
980 | + }else { |
|
981 | 981 | $loading_notifier.=$this->ajaxLoader; |
982 | 982 | } |
983 | 983 | $loading_notifier.='</div>'; |
@@ -985,20 +985,20 @@ discard block |
||
985 | 985 | $retour.="\t\t$({$responseElement}).prepend('{$loading_notifier}');\n"; |
986 | 986 | } |
987 | 987 | |
988 | - public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
989 | - return $this->_ajax("get", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
988 | + public function _get($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
989 | + return $this->_ajax("get", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
990 | 990 | } |
991 | - public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
992 | - return $this->_ajax("post", $url,$params,$responseElement,$jsCallback,$attr,$hasLoader,$immediatly); |
|
991 | + public function _post($url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
992 | + return $this->_ajax("post", $url, $params, $responseElement, $jsCallback, $attr, $hasLoader, $immediatly); |
|
993 | 993 | } |
994 | 994 | |
995 | - protected function _ajax($method,$url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
996 | - if(JString::isNull($params)){$params="{}";} |
|
995 | + protected function _ajax($method, $url, $params="{}", $responseElement="", $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
996 | + if (JString::isNull($params)) {$params="{}"; } |
|
997 | 997 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
998 | 998 | $retour=$this->_getAjaxUrl($url, $attr); |
999 | 999 | $responseElement=$this->_getResponseElement($responseElement); |
1000 | 1000 | $retour.="var self=this;\n"; |
1001 | - if($hasLoader===true){ |
|
1001 | + if ($hasLoader===true) { |
|
1002 | 1002 | $this->addLoading($retour, $responseElement); |
1003 | 1003 | } |
1004 | 1004 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
@@ -1008,22 +1008,22 @@ discard block |
||
1008 | 1008 | return $retour; |
1009 | 1009 | } |
1010 | 1010 | |
1011 | - protected function _getAjaxUrl($url,$attr){ |
|
1011 | + protected function _getAjaxUrl($url, $attr) { |
|
1012 | 1012 | $url=$this->_correctAjaxUrl($url); |
1013 | 1013 | $retour="url='".$url."';\n"; |
1014 | 1014 | $slash="/"; |
1015 | - if(PhalconUtils::endsWith($url, "/")) |
|
1015 | + if (PhalconUtils::endsWith($url, "/")) |
|
1016 | 1016 | $slash=""; |
1017 | - if(JString::isNotNull($attr)){ |
|
1017 | + if (JString::isNotNull($attr)) { |
|
1018 | 1018 | if ($attr=="value") |
1019 | 1019 | $retour.="url=url+'".$slash."'+$(this).val();\n"; |
1020 | - else if($attr!=null && $attr!=="") |
|
1020 | + else if ($attr!=null && $attr!=="") |
|
1021 | 1021 | $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
1022 | 1022 | } |
1023 | 1023 | return $retour; |
1024 | 1024 | } |
1025 | 1025 | |
1026 | - protected function _getOnAjaxDone($responseElement,$jsCallback){ |
|
1026 | + protected function _getOnAjaxDone($responseElement, $jsCallback) { |
|
1027 | 1027 | $retour=""; |
1028 | 1028 | if ($responseElement!=="") { |
1029 | 1029 | $retour="\t$({$responseElement}).html( data );\n"; |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | return $retour; |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - protected function _getResponseElement($responseElement){ |
|
1035 | + protected function _getResponseElement($responseElement) { |
|
1036 | 1036 | if ($responseElement!=="") { |
1037 | 1037 | $responseElement=$this->_prep_value($responseElement); |
1038 | 1038 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | protected function _correctAjaxUrl($url) { |
1043 | 1043 | if (PhalconUtils::endsWith($url, "/")) |
1044 | 1044 | $url=substr($url, 0, strlen($url)-1); |
1045 | - if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
|
1045 | + if (strncmp($url, 'http://', 7)!=0 && strncmp($url, 'https://', 8)!=0) { |
|
1046 | 1046 | $url=$this->_di->get("url")->get($url); |
1047 | 1047 | } |
1048 | 1048 | return $url; |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | * @param string $jsCallback javascript code to execute after the request |
1057 | 1057 | * @param boolean $immediatly |
1058 | 1058 | */ |
1059 | - public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
1059 | + public function _json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
1060 | 1060 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
1061 | 1061 | $retour=$this->_getAjaxUrl($url, $attr); |
1062 | 1062 | $retour.="$.{$method}(url,".$params.").done(function( data ) {\n"; |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | * @param string $url the request address |
1078 | 1078 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
1079 | 1079 | */ |
1080 | - public function _jsonOn($event,$element, $url,$parameters=array()) { |
|
1080 | + public function _jsonOn($event, $element, $url, $parameters=array()) { |
|
1081 | 1081 | $preventDefault=true; |
1082 | 1082 | $stopPropagation=true; |
1083 | 1083 | $jsCallback=null; |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | $params="{}"; |
1088 | 1088 | $immediatly=true; |
1089 | 1089 | extract($parameters); |
1090 | - return $this->_add_event($element, $this->_json($url,$method, $params,$jsCallback, $attr,$context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1090 | + return $this->_add_event($element, $this->_json($url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | /** |
@@ -1099,19 +1099,19 @@ discard block |
||
1099 | 1099 | * @param string $context jquery DOM element, array container. |
1100 | 1100 | * @param boolean $immediatly |
1101 | 1101 | */ |
1102 | - public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null,$immediatly=false) { |
|
1102 | + public function _jsonArray($maskSelector, $url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context=null, $immediatly=false) { |
|
1103 | 1103 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
1104 | 1104 | $retour=$this->_getAjaxUrl($url, $attr); |
1105 | - if($context===null){ |
|
1105 | + if ($context===null) { |
|
1106 | 1106 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
1107 | - $newElm = "$('#'+newId)"; |
|
1108 | - }else{ |
|
1107 | + $newElm="$('#'+newId)"; |
|
1108 | + }else { |
|
1109 | 1109 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
1110 | - $newElm = $context.".find('#'+newId)"; |
|
1110 | + $newElm=$context.".find('#'+newId)"; |
|
1111 | 1111 | } |
1112 | 1112 | $retour.="var self = $(this);\n$.{$method}(url,".$params.").done(function( data ) {\n"; |
1113 | 1113 | $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"; |
1114 | - $retour.= $appendTo; |
|
1114 | + $retour.=$appendTo; |
|
1115 | 1115 | $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"; |
1116 | 1116 | $retour.="\t$(document).trigger('jsonReady',[data]);\n"; |
1117 | 1117 | $retour.="\t".$jsCallback."\n"."});\n"; |
@@ -1126,26 +1126,26 @@ discard block |
||
1126 | 1126 | * @param string $url the request address |
1127 | 1127 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get", "context"=>null) |
1128 | 1128 | */ |
1129 | - public function _jsonArrayOn($event,$element, $maskSelector,$url,$parameters=array()) { |
|
1129 | + public function _jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
1130 | 1130 | $preventDefault=true; |
1131 | 1131 | $stopPropagation=true; |
1132 | 1132 | $jsCallback=null; |
1133 | 1133 | $attr="id"; |
1134 | 1134 | $method="get"; |
1135 | - $context = null; |
|
1135 | + $context=null; |
|
1136 | 1136 | $params="{}"; |
1137 | 1137 | $immediatly=true; |
1138 | 1138 | extract($parameters); |
1139 | - return $this->_add_event($element, $this->_jsonArray($maskSelector,$url,$method, $params,$jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1139 | + return $this->_add_event($element, $this->_jsonArray($maskSelector, $url, $method, $params, $jsCallback, $attr, $context), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1140 | 1140 | } |
1141 | 1141 | |
1142 | - public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true,$immediatly=false) { |
|
1142 | + public function _postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true, $immediatly=false) { |
|
1143 | 1143 | $jsCallback=isset($jsCallback) ? $jsCallback : ""; |
1144 | 1144 | $retour=$this->_getAjaxUrl($url, $attr); |
1145 | 1145 | $retour.="\nvar params=$('#".$form."').serialize();\n"; |
1146 | 1146 | $responseElement=$this->_getResponseElement($responseElement); |
1147 | 1147 | $retour.="var self=this;\n"; |
1148 | - if($hasLoader===true){ |
|
1148 | + if ($hasLoader===true) { |
|
1149 | 1149 | $this->addLoading($retour, $responseElement); |
1150 | 1150 | } |
1151 | 1151 | $retour.="$.post(url,params).done(function( data ) {\n"; |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | * @param string $responseElement |
1173 | 1173 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
1174 | 1174 | */ |
1175 | - public function _getOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
1175 | + public function _getOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
1176 | 1176 | $preventDefault=true; |
1177 | 1177 | $stopPropagation=true; |
1178 | 1178 | $jsCallback=null; |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | $hasLoader=true; |
1181 | 1181 | $immediatly=true; |
1182 | 1182 | extract($parameters); |
1183 | - return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1183 | + return $this->_add_event($element, $this->_get($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | /** |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | * @param string $responseElement |
1194 | 1194 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true) |
1195 | 1195 | */ |
1196 | - public function _postOn($event,$element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
1196 | + public function _postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
|
1197 | 1197 | $preventDefault=true; |
1198 | 1198 | $stopPropagation=true; |
1199 | 1199 | $jsCallback=null; |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | $hasLoader=true; |
1202 | 1202 | $immediatly=true; |
1203 | 1203 | extract($parameters); |
1204 | - return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1204 | + return $this->_add_event($element, $this->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | /** |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | * @param string $responseElement |
1215 | 1215 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
1216 | 1216 | */ |
1217 | - public function _postFormOn($event,$element, $url, $form, $responseElement="", $parameters=array()) { |
|
1217 | + public function _postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
|
1218 | 1218 | $preventDefault=true; |
1219 | 1219 | $stopPropagation=true; |
1220 | 1220 | $validation=false; |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | $hasLoader=true; |
1224 | 1224 | $immediatly=true; |
1225 | 1225 | extract($parameters); |
1226 | - return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr,$hasLoader), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1226 | + return $this->_add_event($element, $this->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1227 | 1227 | } |
1228 | 1228 | |
1229 | 1229 | /** |
@@ -1259,8 +1259,8 @@ discard block |
||
1259 | 1259 | * @param boolean $immediatly |
1260 | 1260 | * @return string |
1261 | 1261 | */ |
1262 | - public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="",$immediatly=true) { |
|
1263 | - return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1262 | + public function _doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true) { |
|
1263 | + return $this->_add_event($element, $this->_doJQuery($elementToModify, $jqueryCall, $param, $jsCallback), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | /** |
@@ -1286,12 +1286,12 @@ discard block |
||
1286 | 1286 | * @param boolean $immediatly |
1287 | 1287 | * @return String |
1288 | 1288 | */ |
1289 | - public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false,$immediatly=true) { |
|
1290 | - return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation,$immediatly); |
|
1289 | + public function _execOn($element, $event, $js, $preventDefault=false, $stopPropagation=false, $immediatly=true) { |
|
1290 | + return $this->_add_event($element, $this->_exec($js), $event, $preventDefault, $stopPropagation, $immediatly); |
|
1291 | 1291 | } |
1292 | 1292 | |
1293 | 1293 | private function minify($input) { |
1294 | - if(trim($input) === "") return $input; |
|
1294 | + if (trim($input)==="") return $input; |
|
1295 | 1295 | return preg_replace( |
1296 | 1296 | array( |
1297 | 1297 | // Remove comment(s) |