@@ -23,19 +23,19 @@ |
||
23 | 23 | return $this; |
24 | 24 | } |
25 | 25 | |
26 | - public function addGlyph($glyphicon,$before=true){ |
|
26 | + public function addGlyph($glyphicon, $before=true) { |
|
27 | 27 | $glyph=new HtmlGlyphicon(""); |
28 | 28 | $glyph->setGlyphicon($glyphicon); |
29 | - $this->addContent($glyph,$before); |
|
29 | + $this->addContent($glyph, $before); |
|
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function wrapContentWithGlyph($glyphBefore,$glyphAfter=""){ |
|
33 | + public function wrapContentWithGlyph($glyphBefore, $glyphAfter="") { |
|
34 | 34 | $before=HtmlGlyphicon::getGlyphicon($glyphBefore)." "; |
35 | 35 | $after=""; |
36 | - if($glyphAfter!==""){ |
|
36 | + if ($glyphAfter!=="") { |
|
37 | 37 | $after=" ".HtmlGlyphicon::getGlyphicon($glyphAfter); |
38 | 38 | } |
39 | - return $this->wrapContent($before,$after); |
|
39 | + return $this->wrapContent($before, $after); |
|
40 | 40 | } |
41 | 41 | } |
@@ -69,7 +69,8 @@ |
||
69 | 69 | } |
70 | 70 | |
71 | 71 | public function getPanel($index) { |
72 | - if ($index<sizeof($this->content)) |
|
73 | - return $this->content [$index]; |
|
72 | + if ($index<sizeof($this->content)) { |
|
73 | + return $this->content [$index]; |
|
74 | + } |
|
74 | 75 | } |
75 | 76 | } |
@@ -50,14 +50,14 @@ |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | - * render the content of $controller::$action and set the response to a new panel |
|
54 | - * @param JsUtils $js |
|
55 | - * @param string $title The panel title |
|
56 | - * @param object $initialController |
|
57 | - * @param string $controller a Phalcon controller |
|
58 | - * @param string $action a Phalcon action |
|
59 | - * @param array $params |
|
60 | - */ |
|
53 | + * render the content of $controller::$action and set the response to a new panel |
|
54 | + * @param JsUtils $js |
|
55 | + * @param string $title The panel title |
|
56 | + * @param object $initialController |
|
57 | + * @param string $controller a Phalcon controller |
|
58 | + * @param string $action a Phalcon action |
|
59 | + * @param array $params |
|
60 | + */ |
|
61 | 61 | public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
62 | 62 | return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
63 | 63 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $this->setClass("panel-group"); |
20 | 20 | $this->setRole("tablist"); |
21 | 21 | $this->setProperty("aria-multiselectable", "true"); |
22 | - $this->content=array (); |
|
22 | + $this->content=array(); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function addPanel($title, $content) { |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @param string $viewName |
46 | 46 | * @param array $params The parameters to pass to the view |
47 | 47 | */ |
48 | - public function renderViewPanel(JsUtils $js,$title,$initialController, $viewName, $params=array()) { |
|
49 | - return $this->addPanel($title, $js->renderContent($initialController, $viewName,$params)); |
|
48 | + public function renderViewPanel(JsUtils $js, $title, $initialController, $viewName, $params=array()) { |
|
49 | + return $this->addPanel($title, $js->renderContent($initialController, $viewName, $params)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * @param string $action a Phalcon action |
59 | 59 | * @param array $params |
60 | 60 | */ |
61 | - public function forwardPanel(JsUtils $js,$title,$initialController,$controller,$action,$params=array()){ |
|
62 | - return $this->addPanel($title, $js->forward($initialController, $controller, $action,$params)); |
|
61 | + public function forwardPanel(JsUtils $js, $title, $initialController, $controller, $action, $params=array()) { |
|
62 | + return $this->addPanel($title, $js->forward($initialController, $controller, $action, $params)); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function run(JsUtils $js) { |
66 | - foreach ( $this->content as $content ) { |
|
66 | + foreach ($this->content as $content) { |
|
67 | 67 | $content->run($js); |
68 | 68 | } |
69 | 69 | } |
@@ -62,15 +62,15 @@ |
||
62 | 62 | */ |
63 | 63 | public function setIdentifier($identifier) { |
64 | 64 | parent::setIdentifier($identifier); |
65 | - if($this->content instanceof HtmlLink){ |
|
65 | + if ($this->content instanceof HtmlLink) { |
|
66 | 66 | $this->content->setIdentifier("link-".$identifier); |
67 | 67 | } |
68 | 68 | } |
69 | - public function setActive($value=true){ |
|
70 | - $this->setProperty("class", ($value)?"active":""); |
|
69 | + public function setActive($value=true) { |
|
70 | + $this->setProperty("class", ($value) ? "active" : ""); |
|
71 | 71 | } |
72 | 72 | |
73 | - public function disable(){ |
|
73 | + public function disable() { |
|
74 | 74 | $this->setProperty("class", "disabled"); |
75 | 75 | } |
76 | 76 | } |
@@ -1,15 +1,15 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Ajax\service; |
3 | 3 | class JQueryAjaxEffect { |
4 | - public static function none($responseElement,$jqueryDone="html"){ |
|
4 | + public static function none($responseElement, $jqueryDone="html") { |
|
5 | 5 | return "\t$({$responseElement}).{$jqueryDone}( data );\n"; |
6 | 6 | } |
7 | 7 | |
8 | - public static function fade($responseElement,$jqueryDone="html"){ |
|
8 | + public static function fade($responseElement, $jqueryDone="html") { |
|
9 | 9 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).fadeIn();\n"; |
10 | 10 | } |
11 | 11 | |
12 | - public static function slide($responseElement,$jqueryDone="html"){ |
|
12 | + public static function slide($responseElement, $jqueryDone="html") { |
|
13 | 13 | return "\t$({$responseElement}).hide().{$jqueryDone}( data ).slideDown();\n"; |
14 | 14 | } |
15 | 15 | } |
@@ -8,22 +8,22 @@ discard block |
||
8 | 8 | * @property string $root |
9 | 9 | * @property string $attr |
10 | 10 | */ |
11 | -trait NavElementTrait{ |
|
11 | +trait NavElementTrait { |
|
12 | 12 | |
13 | 13 | abstract public function contentAsString(); |
14 | 14 | /** |
15 | 15 | * Generate the jquery script to set the elements to the HtmlNavElement |
16 | 16 | * @param JsUtils $jsUtils |
17 | 17 | */ |
18 | - public function jsSetContent(JsUtils $jsUtils){ |
|
19 | - $jsUtils->html("#".$this->identifier,str_replace("\"","'", $this->contentAsString()),true); |
|
18 | + public function jsSetContent(JsUtils $jsUtils) { |
|
19 | + $jsUtils->html("#".$this->identifier, str_replace("\"", "'", $this->contentAsString()), true); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | public function getRoot() { |
23 | 23 | return $this->root; |
24 | 24 | } |
25 | 25 | public function setRoot($root) { |
26 | - $this->root = $root; |
|
26 | + $this->root=$root; |
|
27 | 27 | return $this; |
28 | 28 | } |
29 | 29 | public function getAttr() { |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @return HtmlNavElement |
37 | 37 | */ |
38 | 38 | public function setAttr($attr) { |
39 | - $this->attr = $attr; |
|
39 | + $this->attr=$attr; |
|
40 | 40 | return $this; |
41 | 41 | } |
42 | 42 | |
43 | 43 | public function __call($method, $args) { |
44 | - if(isset($this->$method) && is_callable($this->$method)) { |
|
44 | + if (isset($this->$method) && is_callable($this->$method)) { |
|
45 | 45 | return call_user_func_array( |
46 | 46 | $this->$method, |
47 | 47 | $args |
@@ -49,5 +49,5 @@ discard block |
||
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | - abstract public function fromDispatcher(JsUtils $js,$dispatcher,$startIndex=0); |
|
52 | + abstract public function fromDispatcher(JsUtils $js, $dispatcher, $startIndex=0); |
|
53 | 53 | } |
@@ -18,27 +18,27 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __construct(JsUtils $js=NULL) { |
20 | 20 | parent::__construct($js); |
21 | - $this->events=array (); |
|
21 | + $this->events=array(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | protected function compileEvents() { |
25 | - foreach ( $this->events as $event => $jsCode ) { |
|
25 | + foreach ($this->events as $event => $jsCode) { |
|
26 | 26 | $itemSelector=JString::getValueBetween($event); |
27 | - if($event=="execute"){ |
|
27 | + if ($event=="execute") { |
|
28 | 28 | $this->jquery_code_for_compile []=$jsCode; |
29 | - }else if($event=="beforeExecute"){ |
|
29 | + } else if ($event=="beforeExecute") { |
|
30 | 30 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
31 | - }else{ |
|
31 | + } else { |
|
32 | 32 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
33 | 33 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
34 | 34 | } |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | - protected function _createSelector($itemSelector,$selector){ |
|
39 | - if(!isset($itemSelector)) |
|
38 | + protected function _createSelector($itemSelector, $selector) { |
|
39 | + if (!isset($itemSelector)) |
|
40 | 40 | $itemSelector=$this->itemSelector; |
41 | - if(isset($itemSelector) && $itemSelector!=="") |
|
41 | + if (isset($itemSelector) && $itemSelector!=="") |
|
42 | 42 | $selector.=" ".$itemSelector; |
43 | 43 | return $selector; |
44 | 44 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $result=implode("\n", $this->jquery_code_for_compile); |
48 | 48 | $result=str_ireplace("\"%", "", $result); |
49 | 49 | $result=str_ireplace("%\"", "", $result); |
50 | - $result=str_replace(array ( |
|
50 | + $result=str_replace(array( |
|
51 | 51 | "\\n", |
52 | 52 | "\\r", |
53 | 53 | "\\t" |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | public function getScript() { |
59 | 59 | $allParams=$this->params; |
60 | - $this->jquery_code_for_compile=array (); |
|
60 | + $this->jquery_code_for_compile=array(); |
|
61 | 61 | $this->jquery_code_for_compile []="$( \"".$this->attachTo."\" ).{$this->uiName}(".$this->getParamsAsJSON($allParams).");"; |
62 | 62 | $this->compileEvents(); |
63 | 63 | return $this->compileJQueryCode(); |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | $itemSelector=JString::getValueBetween($event); |
27 | 27 | if($event=="execute"){ |
28 | 28 | $this->jquery_code_for_compile []=$jsCode; |
29 | - }else if($event=="beforeExecute"){ |
|
29 | + } else if($event=="beforeExecute"){ |
|
30 | 30 | \array_unshift($this->jquery_code_for_compile, $jsCode); |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $selector=$this->_createSelector($itemSelector, $this->attachTo); |
33 | 33 | $this->jquery_code_for_compile []="$( \"".$selector."\" ).on(\"".$event."\" , function( event, data ) {".$jsCode."});"; |
34 | 34 | } |
@@ -36,10 +36,12 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | protected function _createSelector($itemSelector,$selector){ |
39 | - if(!isset($itemSelector)) |
|
40 | - $itemSelector=$this->itemSelector; |
|
41 | - if(isset($itemSelector) && $itemSelector!=="") |
|
42 | - $selector.=" ".$itemSelector; |
|
39 | + if(!isset($itemSelector)) { |
|
40 | + $itemSelector=$this->itemSelector; |
|
41 | + } |
|
42 | + if(isset($itemSelector) && $itemSelector!=="") { |
|
43 | + $selector.=" ".$itemSelector; |
|
44 | + } |
|
43 | 45 | return $selector; |
44 | 46 | } |
45 | 47 | |
@@ -82,8 +84,9 @@ discard block |
||
82 | 84 | |
83 | 85 | protected function setParamCtrl($key, $value, $typeCtrl) { |
84 | 86 | if (\is_array($typeCtrl)) { |
85 | - if (array_search($value, $typeCtrl)===false) |
|
86 | - throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
87 | + if (array_search($value, $typeCtrl)===false) { |
|
88 | + throw new \Exception("La valeur passée a propriété `".$key."` pour le composant `".$this->uiName."` ne fait pas partie des valeurs possibles : {".implode(",", $typeCtrl)."}"); |
|
89 | + } |
|
87 | 90 | } else { |
88 | 91 | if (!$typeCtrl($value)) { |
89 | 92 | throw new \Exception("La fonction ".$typeCtrl." a retourné faux pour l'affectation de la propriété ".$key." au composant ".$this->uiName); |
@@ -21,7 +21,7 @@ |
||
21 | 21 | return $this->setParam("context", $value); |
22 | 22 | } |
23 | 23 | |
24 | - public function setOffset($offset=0){ |
|
24 | + public function setOffset($offset=0) { |
|
25 | 25 | return $this->setParam("offset", $offset); |
26 | 26 | } |
27 | 27 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $this->params["onUnchecked"]="%function(){".$value."}%"; |
21 | 21 | } |
22 | 22 | |
23 | - public function setOnChange($value){ |
|
23 | + public function setOnChange($value) { |
|
24 | 24 | $this->params["onChange"]="%function(){".$value."}%"; |
25 | 25 | } |
26 | 26 | } |
@@ -8,16 +8,16 @@ |
||
8 | 8 | class HtmlFormInput extends HtmlFormField { |
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
12 | - if(!isset($placeholder) && $type==="text") |
|
11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
12 | + if (!isset($placeholder) && $type==="text") |
|
13 | 13 | $placeholder=$label; |
14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
15 | 15 | $this->_identifier=$identifier; |
16 | 16 | } |
17 | 17 | |
18 | - public function getDataField(){ |
|
19 | - $field= $this->getField(); |
|
20 | - if($field instanceof HtmlInput) |
|
18 | + public function getDataField() { |
|
19 | + $field=$this->getField(); |
|
20 | + if ($field instanceof HtmlInput) |
|
21 | 21 | $field=$field->getDataField(); |
22 | 22 | return $field; |
23 | 23 | } |
@@ -9,16 +9,18 @@ |
||
9 | 9 | use TextFieldsTrait; |
10 | 10 | |
11 | 11 | public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
12 | - if(!isset($placeholder) && $type==="text") |
|
13 | - $placeholder=$label; |
|
12 | + if(!isset($placeholder) && $type==="text") { |
|
13 | + $placeholder=$label; |
|
14 | + } |
|
14 | 15 | parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
15 | 16 | $this->_identifier=$identifier; |
16 | 17 | } |
17 | 18 | |
18 | 19 | public function getDataField(){ |
19 | 20 | $field= $this->getField(); |
20 | - if($field instanceof HtmlInput) |
|
21 | - $field=$field->getDataField(); |
|
21 | + if($field instanceof HtmlInput) { |
|
22 | + $field=$field->getDataField(); |
|
23 | + } |
|
22 | 24 | return $field; |
23 | 25 | } |
24 | 26 | } |