@@ -48,6 +48,9 @@ |
||
| 48 | 48 | $element->setStyle($value); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param HtmlDropdown $bt |
|
| 53 | + */ |
|
| 51 | 54 | private function dropdownAsButton($bt) { |
| 52 | 55 | $this->addExistingDropDown($bt); |
| 53 | 56 | $bt->setTagName("button"); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return HtmlButtongroups default : "" |
| 35 | 35 | */ |
| 36 | 36 | public function setSize($size) { |
| 37 | - foreach ( $this->elements as $element ) { |
|
| 37 | + foreach ($this->elements as $element) { |
|
| 38 | 38 | $element->setSize($size); |
| 39 | 39 | } |
| 40 | 40 | if (is_int($size)) { |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function setStyle($value) { |
| 47 | - foreach ( $this->elements as $element ) |
|
| 47 | + foreach ($this->elements as $element) |
|
| 48 | 48 | $element->setStyle($value); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function addElement($element) { |
| 65 | 65 | $result=$element; |
| 66 | 66 | $iid=sizeof($this->elements)+1; |
| 67 | - if (($element instanceof HtmlDropdown)||($element instanceof HtmlSplitbutton)) { |
|
| 67 | + if (($element instanceof HtmlDropdown) || ($element instanceof HtmlSplitbutton)) { |
|
| 68 | 68 | $this->addExistingDropDown($element); |
| 69 | 69 | $this->elements[]=$element; |
| 70 | 70 | } elseif ($element instanceof HtmlButton) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | else |
| 79 | 79 | $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
| 80 | 80 | $this->dropdownAsButton($bt); |
| 81 | - } else |
|
| 81 | + }else |
|
| 82 | 82 | $bt=new HtmlButton($this->identifier."-button-".$iid); |
| 83 | 83 | $bt->fromArray($element); |
| 84 | 84 | $this->elements[]=$bt; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function addElements($elements) { |
| 96 | - foreach ( $elements as $element ) { |
|
| 96 | + foreach ($elements as $element) { |
|
| 97 | 97 | $this->addElement($element); |
| 98 | 98 | } |
| 99 | 99 | return $this; |
@@ -110,10 +110,10 @@ discard block |
||
| 110 | 110 | public function setAlignment($value) { |
| 111 | 111 | if (is_int($value)) { |
| 112 | 112 | $value=CssRef::alignment("btn-group")[$value]; |
| 113 | - } else |
|
| 113 | + }else |
|
| 114 | 114 | $value="btn-group-".$value; |
| 115 | 115 | if (strstr($value, "justified")) { |
| 116 | - foreach ( $this->elements as $element ) { |
|
| 116 | + foreach ($this->elements as $element) { |
|
| 117 | 117 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
| 118 | 118 | } |
| 119 | 119 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @see \Ajax\bootstrap\html\base\BaseHtml::on() |
| 145 | 145 | */ |
| 146 | 146 | public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 147 | - foreach ( $this->elements as $element ) { |
|
| 147 | + foreach ($this->elements as $element) { |
|
| 148 | 148 | $element->on($event, $jsCode, $stopPropagation, $preventDefault); |
| 149 | 149 | } |
| 150 | 150 | return $this; |
@@ -44,8 +44,9 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function setStyle($value) { |
| 47 | - foreach ( $this->elements as $element ) |
|
| 48 | - $element->setStyle($value); |
|
| 47 | + foreach ( $this->elements as $element ) { |
|
| 48 | + $element->setStyle($value); |
|
| 49 | + } |
|
| 49 | 50 | } |
| 50 | 51 | |
| 51 | 52 | private function dropdownAsButton($bt) { |
@@ -70,16 +71,18 @@ discard block |
||
| 70 | 71 | } elseif ($element instanceof HtmlButton) { |
| 71 | 72 | $this->elements[]=$element; |
| 72 | 73 | } elseif (is_array($element)) { |
| 73 | - if (array_key_exists("glyph", $element)) |
|
| 74 | - $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 75 | - elseif (array_key_exists("btnCaption", $element)) { |
|
| 76 | - if (array_key_exists("split", $element)) |
|
| 77 | - $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 78 | - else |
|
| 79 | - $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 74 | + if (array_key_exists("glyph", $element)) { |
|
| 75 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 76 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
| 77 | + if (array_key_exists("split", $element)) { |
|
| 78 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 79 | + } else { |
|
| 80 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 81 | + } |
|
| 80 | 82 | $this->dropdownAsButton($bt); |
| 81 | - } else |
|
| 82 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 83 | + } else { |
|
| 84 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 85 | + } |
|
| 83 | 86 | $bt->fromArray($element); |
| 84 | 87 | $this->elements[]=$bt; |
| 85 | 88 | $result=$bt; |
@@ -110,8 +113,9 @@ discard block |
||
| 110 | 113 | public function setAlignment($value) { |
| 111 | 114 | if (is_int($value)) { |
| 112 | 115 | $value=CssRef::alignment("btn-group")[$value]; |
| 113 | - } else |
|
| 114 | - $value="btn-group-".$value; |
|
| 116 | + } else { |
|
| 117 | + $value="btn-group-".$value; |
|
| 118 | + } |
|
| 115 | 119 | if (strstr($value, "justified")) { |
| 116 | 120 | foreach ( $this->elements as $element ) { |
| 117 | 121 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -126,9 +130,9 @@ discard block |
||
| 126 | 130 | * @return HtmlButton |
| 127 | 131 | */ |
| 128 | 132 | public function getElement($index) { |
| 129 | - if (is_int($index)) |
|
| 130 | - return $this->elements[$index]; |
|
| 131 | - else { |
|
| 133 | + if (is_int($index)) { |
|
| 134 | + return $this->elements[$index]; |
|
| 135 | + } else { |
|
| 132 | 136 | $elm=$this->getElementById($index, $this->elements); |
| 133 | 137 | return $elm; |
| 134 | 138 | } |
@@ -11,6 +11,11 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class HtmlButtontoolbar extends HtmlButtongroups { |
| 13 | 13 | |
| 14 | + /** |
|
| 15 | + * @param string $identifier |
|
| 16 | + * @param string $cssStyle |
|
| 17 | + * @param string $size |
|
| 18 | + */ |
|
| 14 | 19 | public function __construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div") { |
| 15 | 20 | parent::__construct($identifier, $elements, $cssStyle, $size, $tagName); |
| 16 | 21 | $this->setClass("btn-toolbar"); |
@@ -56,7 +61,7 @@ discard block |
||
| 56 | 61 | |
| 57 | 62 | /** |
| 58 | 63 | * return the Buttongroups at position $index |
| 59 | - * @return \Ajax\bootstrap\html\HtmlButtongroups |
|
| 64 | + * @return HtmlButton |
|
| 60 | 65 | */ |
| 61 | 66 | public function getGroup($index) { |
| 62 | 67 | return parent::getElement($index); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function addElement($element) { |
| 24 | 24 | if ($element instanceof HtmlButtongroups) { |
| 25 | 25 | $this->elements []=$element; |
| 26 | - } else { |
|
| 26 | + }else { |
|
| 27 | 27 | $this->getLastButtonGroup()->addElement($element); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | $element=null; |
| 79 | 79 | $i=0; |
| 80 | 80 | if (is_int($index)) { |
| 81 | - $elements=array (); |
|
| 82 | - foreach ( $this->elements as $group ) { |
|
| 81 | + $elements=array(); |
|
| 82 | + foreach ($this->elements as $group) { |
|
| 83 | 83 | $elements=array_merge($elements, $group->getElements()); |
| 84 | 84 | } |
| 85 | 85 | if ($index<sizeof($elements)) { |
| 86 | 86 | $element=$elements [$index]; |
| 87 | 87 | } |
| 88 | - } else { |
|
| 89 | - while ( $element==null&&$i<sizeof($this->elements) ) { |
|
| 88 | + }else { |
|
| 89 | + while ($element==null && $i<sizeof($this->elements)) { |
|
| 90 | 90 | $element=$this->elements [$i]->getElement($index); |
| 91 | 91 | $i++; |
| 92 | 92 | } |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | private function getLastButtonGroup() { |
| 47 | 47 | $nb=sizeof($this->elements); |
| 48 | - if ($nb>0) |
|
| 49 | - $bg=$this->elements [$nb-1]; |
|
| 50 | - else { |
|
| 48 | + if ($nb>0) { |
|
| 49 | + $bg=$this->elements [$nb-1]; |
|
| 50 | + } else { |
|
| 51 | 51 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
| 52 | 52 | $this->elements []=$bg; |
| 53 | 53 | } |
@@ -65,8 +65,9 @@ discard block |
||
| 65 | 65 | public function getLastGroup() { |
| 66 | 66 | $bg=null; |
| 67 | 67 | $nb=sizeof($this->elements); |
| 68 | - if ($nb>0) |
|
| 69 | - $bg=$this->elements [$nb-1]; |
|
| 68 | + if ($nb>0) { |
|
| 69 | + $bg=$this->elements [$nb-1]; |
|
| 70 | + } |
|
| 70 | 71 | return $bg; |
| 71 | 72 | } |
| 72 | 73 | |
@@ -23,6 +23,9 @@ discard block |
||
| 23 | 23 | protected $_base=""; |
| 24 | 24 | protected $_glyphs=array (); |
| 25 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $identifier |
|
| 28 | + */ |
|
| 26 | 29 | public function __construct($identifier, $images=NULL) { |
| 27 | 30 | parent::__construct($identifier); |
| 28 | 31 | $this->_template=include 'templates/tplCarousel.php'; |
@@ -61,7 +64,7 @@ discard block |
||
| 61 | 64 | * |
| 62 | 65 | * @param string $caption |
| 63 | 66 | * @param string $sens |
| 64 | - * @return HtmlCarouselControl|string |
|
| 67 | + * @return HtmlCarouselControl |
|
| 65 | 68 | */ |
| 66 | 69 | private function createControl($caption="next", $sens="left") { |
| 67 | 70 | $control=new HtmlCarouselControl($sens."-ctrl-".$this->identifier); |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | * @version 1.001 |
| 17 | 17 | */ |
| 18 | 18 | class HtmlCarousel extends BaseHtml { |
| 19 | - protected $indicators=array (); |
|
| 20 | - protected $slides=array (); |
|
| 19 | + protected $indicators=array(); |
|
| 20 | + protected $slides=array(); |
|
| 21 | 21 | protected $leftControl=""; |
| 22 | 22 | protected $rightControl=""; |
| 23 | 23 | protected $_base=""; |
| 24 | - protected $_glyphs=array (); |
|
| 24 | + protected $_glyphs=array(); |
|
| 25 | 25 | |
| 26 | 26 | public function __construct($identifier, $images=NULL) { |
| 27 | 27 | parent::__construct($identifier); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setBase($_base) { |
| 41 | - foreach ($this->slides as $slide){ |
|
| 41 | + foreach ($this->slides as $slide) { |
|
| 42 | 42 | $imgSrc=$slide->getImageSrc(); |
| 43 | 43 | $slide->setImageSrc(str_replace($this->_base.$imgSrc, $_base.$imgSrc, $imgSrc)); |
| 44 | 44 | } |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
| 96 | - if(is_array($imageSrc)){ |
|
| 97 | - $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
|
| 98 | - }else{ |
|
| 96 | + if (is_array($imageSrc)) { |
|
| 97 | + $this->addImage($imageSrc[0], @$imageSrc[1], @$imageSrc[2], @$imageSrc[3]); |
|
| 98 | + }else { |
|
| 99 | 99 | $image=new HtmlCarouselItem("item-".$this->identifier); |
| 100 | 100 | $image->setImageSrc($this->_base.$imageSrc); |
| 101 | 101 | $image->setImageAlt($imageAlt); |
@@ -118,10 +118,10 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | public function fromArray($array) { |
| 120 | 120 | if (is_array($array) && sizeof($array)>0) { |
| 121 | - foreach ( $array as $value ) { |
|
| 121 | + foreach ($array as $value) { |
|
| 122 | 122 | if (is_array($value)) { |
| 123 | 123 | $this->addImage($value ["src"], @$value ["alt"], @$value ["caption"], @$value ["description"]); |
| 124 | - } else { |
|
| 124 | + }else { |
|
| 125 | 125 | $this->addImage($value); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -75,27 +75,30 @@ |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | private function getGlyph($sens="left") { |
| 78 | - if (array_key_exists($sens, $this->_glyphs)) |
|
| 79 | - return $this->_glyphs [$sens]; |
|
| 78 | + if (array_key_exists($sens, $this->_glyphs)) { |
|
| 79 | + return $this->_glyphs [$sens]; |
|
| 80 | + } |
|
| 80 | 81 | return "glyphicon-chevron-".$sens; |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | public function setRightGlyph($glyphicon) { |
| 84 | 85 | $glyphs=CssRef::glyphIcons(); |
| 85 | - if (array_search($glyphicon, $glyphs)!==false) |
|
| 86 | - $this->_glyphs ["right"]=$glyphicon; |
|
| 86 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
| 87 | + $this->_glyphs ["right"]=$glyphicon; |
|
| 88 | + } |
|
| 87 | 89 | } |
| 88 | 90 | |
| 89 | 91 | public function setLeftGlyph($glyphicon) { |
| 90 | 92 | $glyphs=CssRef::glyphIcons(); |
| 91 | - if (array_search($glyphicon, $glyphs)!==false) |
|
| 92 | - $this->_glyphs ["left"]=$glyphicon; |
|
| 93 | + if (array_search($glyphicon, $glyphs)!==false) { |
|
| 94 | + $this->_glyphs ["left"]=$glyphicon; |
|
| 95 | + } |
|
| 93 | 96 | } |
| 94 | 97 | |
| 95 | 98 | public function addImage($imageSrc, $imageAlt="", $caption=NULL, $description=NULL) { |
| 96 | 99 | if(is_array($imageSrc)){ |
| 97 | 100 | $this->addImage($imageSrc[0],@$imageSrc[1],@$imageSrc[2],@$imageSrc[3]); |
| 98 | - }else{ |
|
| 101 | + } else{ |
|
| 99 | 102 | $image=new HtmlCarouselItem("item-".$this->identifier); |
| 100 | 103 | $image->setImageSrc($this->_base.$imageSrc); |
| 101 | 104 | $image->setImageAlt($imageAlt); |
@@ -87,6 +87,9 @@ |
||
| 87 | 87 | return $result; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | + /** |
|
| 91 | + * @return string |
|
| 92 | + */ |
|
| 90 | 93 | private function getPrefix($element) { |
| 91 | 94 | $result="input_text"; |
| 92 | 95 | foreach ( $this->formElementsPrefix as $k => $v ) { |
@@ -15,8 +15,8 @@ discard block |
||
| 15 | 15 | public function __construct($identifier) { |
| 16 | 16 | parent::__construct($identifier, "form"); |
| 17 | 17 | $this->_template='<form id="%identifier%" name="%identifier%" %properties%>%content%</form>'; |
| 18 | - $this->futureElements=array (); |
|
| 19 | - $this->formGroups=array (); |
|
| 18 | + $this->futureElements=array(); |
|
| 19 | + $this->formGroups=array(); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /* |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 27 | 27 | if (isset($js)) { |
| 28 | 28 | $this->formElementsPrefix=$js->config()->getVar("formElementsPrefix"); |
| 29 | - foreach ( $this->futureElements as $futureElement ) { |
|
| 29 | + foreach ($this->futureElements as $futureElement) { |
|
| 30 | 30 | $futureElementValue=$this->getPrefix($futureElement); |
| 31 | 31 | $futureElementValues=explode("_", $futureElementValue); |
| 32 | - switch($futureElementValues [0]) { |
|
| 32 | + switch ($futureElementValues [0]) { |
|
| 33 | 33 | case "input": |
| 34 | 34 | $control=new HtmlInput($futureElement); |
| 35 | 35 | $control->setClass("form-control"); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $this->addElement($control); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - foreach ( $this->formGroups as $group ) { |
|
| 64 | + foreach ($this->formGroups as $group) { |
|
| 65 | 65 | $this->addContent($group); |
| 66 | 66 | } |
| 67 | 67 | return parent::compile($js, $view); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $result=preg_split('/(?=[A-Z])/', $str); |
| 72 | 72 | if (sizeof($result)>$part) { |
| 73 | 73 | $result=$result [$part]; |
| 74 | - } else { |
|
| 74 | + }else { |
|
| 75 | 75 | $result=$str; |
| 76 | 76 | } |
| 77 | 77 | return $result; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $result=preg_split('/(?=[A-Z])/', $str); |
| 82 | 82 | if (sizeof($result)>2) { |
| 83 | 83 | $result=$result [2]; |
| 84 | - } else { |
|
| 84 | + }else { |
|
| 85 | 85 | $result=$str; |
| 86 | 86 | } |
| 87 | 87 | return $result; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | private function getPrefix($element) { |
| 91 | 91 | $result="input_text"; |
| 92 | - foreach ( $this->formElementsPrefix as $k => $v ) { |
|
| 92 | + foreach ($this->formElementsPrefix as $k => $v) { |
|
| 93 | 93 | if (Text::startsWith($element, $k)) { |
| 94 | 94 | $result=$v; |
| 95 | 95 | break; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function getElement($name) { |
| 121 | 121 | $element=null; |
| 122 | - foreach ( $this->formGroups as $group ) { |
|
| 122 | + foreach ($this->formGroups as $group) { |
|
| 123 | 123 | } |
| 124 | 124 | return $element; |
| 125 | 125 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @see \Ajax\bootstrap\html\base\HtmlSingleElement::fromArray() |
| 130 | 130 | */ |
| 131 | 131 | public function fromArray($array) { |
| 132 | - foreach ( $array as $value ) { |
|
| 132 | + foreach ($array as $value) { |
|
| 133 | 133 | if (is_string($value)) { |
| 134 | 134 | $this->futureElements []=$value; |
| 135 | 135 | } |
@@ -99,8 +99,9 @@ |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function addGroup($identifier="") { |
| 102 | - if ($identifier==="") |
|
| 103 | - $identifier="form-".$this->identifier; |
|
| 102 | + if ($identifier==="") { |
|
| 103 | + $identifier="form-".$this->identifier; |
|
| 104 | + } |
|
| 104 | 105 | $group=new HtmlDoubleElement($identifier); |
| 105 | 106 | $group->setTagName("div"); |
| 106 | 107 | $group->setClass("form-group"); |
@@ -208,7 +208,7 @@ |
||
| 208 | 208 | * Includes a modal-backdrop element. |
| 209 | 209 | * Alternatively, specify static for a backdrop which doesn't close the modal on click. |
| 210 | 210 | * @param Boolean $value default : true |
| 211 | - * @return HtmlModal |
|
| 211 | + * @return boolean |
|
| 212 | 212 | */ |
| 213 | 213 | public function setBackdrop($value) { |
| 214 | 214 | return $this->backdrop=$value; |
@@ -5,7 +5,6 @@ |
||
| 5 | 5 | use Phalcon\Mvc\View; |
| 6 | 6 | use Ajax\JsUtils; |
| 7 | 7 | use Ajax\bootstrap\html\base\BaseHtml; |
| 8 | -use Phalcon\Mvc\Dispatcher; |
|
| 9 | 8 | use Phalcon\Mvc\Controller; |
| 10 | 9 | |
| 11 | 10 | /** |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | class HtmlModal extends BaseHtml { |
| 17 | 17 | protected $title="Titre de ma boîte"; |
| 18 | 18 | protected $content=""; |
| 19 | - protected $buttons=array (); |
|
| 19 | + protected $buttons=array(); |
|
| 20 | 20 | protected $showOnStartup=false; |
| 21 | 21 | protected $draggable=false; |
| 22 | 22 | protected $validCondition=NULL; |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | public function __construct($identifier, $title="", $content="", $buttonCaptions=array()) { |
| 30 | 30 | parent::__construct($identifier); |
| 31 | 31 | $this->_template=include 'templates/tplModal.php'; |
| 32 | - $this->buttons=array (); |
|
| 32 | + $this->buttons=array(); |
|
| 33 | 33 | $this->title=$title; |
| 34 | 34 | $this->content=$content; |
| 35 | - foreach ( $buttonCaptions as $button ) { |
|
| 35 | + foreach ($buttonCaptions as $button) { |
|
| 36 | 36 | $this->addButton($button); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @param string $value |
| 68 | 68 | * @return HtmlButton |
| 69 | 69 | */ |
| 70 | - public function addOkayButton($value="Okay",$jsCode="") { |
|
| 70 | + public function addOkayButton($value="Okay", $jsCode="") { |
|
| 71 | 71 | $btn=$this->addButton($value, "btn-primary"); |
| 72 | 72 | $btn->onClick("if(".$this->getValidCondition()."){ ".$jsCode."$('#".$this->identifier."').modal('hide');}"); |
| 73 | 73 | return $btn; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function getValidCondition() { |
| 85 | 85 | if ($this->validCondition==NULL) { |
| 86 | 86 | return $this->getDefaultValidCondition(); |
| 87 | - } else { |
|
| 87 | + }else { |
|
| 88 | 88 | return $this->validCondition; |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param $params The parameters to pass to the view |
| 118 | 118 | */ |
| 119 | 119 | public function renderContent($view, $controller, $action, $params=NULL) { |
| 120 | - $template=$view->getRender($controller, $action, $params, function ($view) { |
|
| 120 | + $template=$view->getRender($controller, $action, $params, function($view) { |
|
| 121 | 121 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
| 122 | 122 | }); |
| 123 | 123 | $this->content=$template; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | * @param string $controller a Phalcon controller |
| 130 | 130 | * @param string $action a Phalcon action |
| 131 | 131 | */ |
| 132 | - public function forward($initialController,$controller,$action){ |
|
| 133 | - $dispatcher = $initialController->dispatcher; |
|
| 132 | + public function forward($initialController, $controller, $action) { |
|
| 133 | + $dispatcher=$initialController->dispatcher; |
|
| 134 | 134 | $dispatcher->setControllerName($controller); |
| 135 | 135 | $dispatcher->setActionName($action); |
| 136 | 136 | $dispatcher->dispatch(); |
| 137 | - $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(),$dispatcher->getParams(), function ($view) { |
|
| 137 | + $template=$initialController->view->getRender($dispatcher->getControllerName(), $dispatcher->getActionName(), $dispatcher->getParams(), function($view) { |
|
| 138 | 138 | $view->setRenderLevel(View::LEVEL_ACTION_VIEW); |
| 139 | 139 | }); |
| 140 | 140 | $this->content=$template; |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | * @see BaseHtml::run() |
| 146 | 146 | */ |
| 147 | 147 | public function run(JsUtils $js) { |
| 148 | - if($this->content instanceof BaseHtml){ |
|
| 148 | + if ($this->content instanceof BaseHtml) { |
|
| 149 | 149 | $this->content->run($js); |
| 150 | 150 | } |
| 151 | - $this->_bsComponent=$js->bootstrap()->modal("#".$this->identifier, array ( |
|
| 151 | + $this->_bsComponent=$js->bootstrap()->modal("#".$this->identifier, array( |
|
| 152 | 152 | "show" => $this->showOnStartup |
| 153 | 153 | )); |
| 154 | 154 | if ($this->draggable) |
@@ -151,18 +151,20 @@ discard block |
||
| 151 | 151 | $this->_bsComponent=$js->bootstrap()->modal("#".$this->identifier, array ( |
| 152 | 152 | "show" => $this->showOnStartup |
| 153 | 153 | )); |
| 154 | - if ($this->draggable) |
|
| 155 | - $this->_bsComponent->setDraggable(true); |
|
| 154 | + if ($this->draggable) { |
|
| 155 | + $this->_bsComponent->setDraggable(true); |
|
| 156 | + } |
|
| 156 | 157 | $this->_bsComponent->setBackdrop($this->backdrop); |
| 157 | 158 | $this->addEventsOnRun($js); |
| 158 | 159 | return $this->_bsComponent; |
| 159 | 160 | } |
| 160 | 161 | |
| 161 | 162 | public function getButton($index) { |
| 162 | - if (is_int($index)) |
|
| 163 | - return $this->buttons [$index]; |
|
| 164 | - else |
|
| 165 | - return $this->getElementById($index, $this->buttons); |
|
| 163 | + if (is_int($index)) { |
|
| 164 | + return $this->buttons [$index]; |
|
| 165 | + } else { |
|
| 166 | + return $this->getElementById($index, $this->buttons); |
|
| 167 | + } |
|
| 166 | 168 | } |
| 167 | 169 | |
| 168 | 170 | public function showOnCreate() { |
@@ -188,8 +190,9 @@ discard block |
||
| 188 | 190 | |
| 189 | 191 | public function jsHideButton($index) { |
| 190 | 192 | $btn=$this->getButton($index); |
| 191 | - if ($btn) |
|
| 192 | - return "$('#".$btn->getIdentifier()."').hide();"; |
|
| 193 | + if ($btn) { |
|
| 194 | + return "$('#".$btn->getIdentifier()."').hide();"; |
|
| 195 | + } |
|
| 193 | 196 | } |
| 194 | 197 | |
| 195 | 198 | /** |
@@ -21,6 +21,11 @@ discard block |
||
| 21 | 21 | protected $collapseEnd; |
| 22 | 22 | protected $_showOnStartup; |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $identifier |
|
| 26 | + * @param string $header |
|
| 27 | + * @param string $footer |
|
| 28 | + */ |
|
| 24 | 29 | public function __construct($identifier, $content=NULL, $header=NULL, $footer=NULL) { |
| 25 | 30 | parent::__construct($identifier, "div"); |
| 26 | 31 | $this->_template=include 'templates/tplPanel.php'; |
@@ -109,6 +114,9 @@ discard block |
||
| 109 | 114 | return $this->_bsComponent; |
| 110 | 115 | } |
| 111 | 116 | |
| 117 | + /** |
|
| 118 | + * @param boolean $_collapsable |
|
| 119 | + */ |
|
| 112 | 120 | public function setCollapsable($_collapsable) { |
| 113 | 121 | $this->_collapsable=$_collapsable; |
| 114 | 122 | if ($_collapsable) { |
@@ -89,8 +89,9 @@ discard block |
||
| 89 | 89 | * @return \Ajax\bootstrap\html\HtmlPanel default : "panel-default" |
| 90 | 90 | */ |
| 91 | 91 | public function setStyle($cssStyle) { |
| 92 | - if (!PhalconUtils::startsWith($cssStyle, "panel")) |
|
| 93 | - $cssStyle="panel".$cssStyle; |
|
| 92 | + if (!PhalconUtils::startsWith($cssStyle, "panel")) { |
|
| 93 | + $cssStyle="panel".$cssStyle; |
|
| 94 | + } |
|
| 94 | 95 | return $this->addToPropertyCtrl("class", $cssStyle, CssRef::Styles("panel")); |
| 95 | 96 | } |
| 96 | 97 | |
@@ -132,7 +133,8 @@ discard block |
||
| 132 | 133 | * @return $this default : false |
| 133 | 134 | */ |
| 134 | 135 | public function show($value) { |
| 135 | - if ($this->_collapsable) |
|
| 136 | - $this->_showOnStartup=$value; |
|
| 136 | + if ($this->_collapsable) { |
|
| 137 | + $this->_showOnStartup=$value; |
|
| 138 | + } |
|
| 137 | 139 | } |
| 138 | 140 | } |
| 139 | 141 | \ No newline at end of file |
@@ -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,6 +20,9 @@ |
||
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
| 23 | + /** |
|
| 24 | + * @param string $identifier |
|
| 25 | + */ |
|
| 23 | 26 | public function __construct($identifier, $tagName="ul") { |
| 24 | 27 | parent::__construct($identifier, $tagName); |
| 25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | use Phalcon\Mvc\View; |
| 17 | 17 | |
| 18 | 18 | class HtmlTabs extends HtmlDoubleElement { |
| 19 | - protected $tabs=array (); |
|
| 19 | + protected $tabs=array(); |
|
| 20 | 20 | protected $_tabsType="tabs"; |
| 21 | 21 | protected $stacked=""; |
| 22 | 22 | |
@@ -27,25 +27,25 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | protected function addTab_($tab, $index=null) { |
| 30 | - if($tab instanceof HtmlDropdown){ |
|
| 30 | + if ($tab instanceof HtmlDropdown) { |
|
| 31 | 31 | $tab->setMTagName("li"); |
| 32 | 32 | } |
| 33 | 33 | if (isset($index)) { |
| 34 | - $inserted=array ( |
|
| 34 | + $inserted=array( |
|
| 35 | 35 | $tab |
| 36 | 36 | ); |
| 37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
| 38 | - } else |
|
| 38 | + }else |
|
| 39 | 39 | $this->tabs []=$tab; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function setActive($index){ |
|
| 43 | - for ($i=0;$i<sizeof($this->tabs);$i++){ |
|
| 42 | + public function setActive($index) { |
|
| 43 | + for ($i=0; $i<sizeof($this->tabs); $i++) { |
|
| 44 | 44 | $this->tabs[$i]->setActive($i==$index); |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function disable($index){ |
|
| 48 | + public function disable($index) { |
|
| 49 | 49 | $this->tabs[$index]->disable(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $tab=new HtmlTabItem("tab-".$this->identifier."-".$iid); |
| 60 | 60 | $tab->fromArray($element); |
| 61 | 61 | $this->addTab_($tab, $index); |
| 62 | - } else { |
|
| 62 | + }else { |
|
| 63 | 63 | $this->addTab_($tab, $index); |
| 64 | 64 | } |
| 65 | 65 | return $tab; |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function addTabs($tabs) { |
| 79 | - foreach ( $tabs as $tab ) { |
|
| 79 | + foreach ($tabs as $tab) { |
|
| 80 | 80 | $this->addTab($tab); |
| 81 | 81 | } |
| 82 | 82 | return $this; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function run(JsUtils $js) { |
| 108 | 108 | $this->_bsComponent=new Tabs($js); |
| 109 | - foreach ( $this->tabs as $tab ) { |
|
| 109 | + foreach ($this->tabs as $tab) { |
|
| 110 | 110 | $this->_bsComponent->addTab($tab->run($js)); |
| 111 | 111 | } |
| 112 | 112 | $this->addEventsOnRun($js); |
@@ -115,11 +115,11 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | public function createTabContents() { |
| 117 | 117 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
| 118 | - foreach ( $this->tabs as $tab ) { |
|
| 118 | + foreach ($this->tabs as $tab) { |
|
| 119 | 119 | if ($tab instanceof HtmlTabItem) |
| 120 | 120 | $tabContent->addTabItem($tab->getHref()); |
| 121 | 121 | elseif ($tab instanceof HtmlDropdown) { |
| 122 | - foreach ( $tab->getItems() as $dropdownItem ) { |
|
| 122 | + foreach ($tab->getItems() as $dropdownItem) { |
|
| 123 | 123 | $tabContent->addTabItem($dropdownItem->getHref()); |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -154,21 +154,21 @@ discard block |
||
| 154 | 154 | if (sizeof($this->content->getTabItems())>0) { |
| 155 | 155 | $this->content->getTabItem(0)->addToProperty("class", "fade in"); |
| 156 | 156 | $size=sizeof($this->tabs); |
| 157 | - for($index=0; $index<$size; $index++) { |
|
| 157 | + for ($index=0; $index<$size; $index++) { |
|
| 158 | 158 | $this->content->getTabItem($index)->addToProperty("class", "fade"); |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){ |
|
| 164 | - foreach ($this->tabs as $tab){ |
|
| 165 | - $tab->on($event,$jsCode,$stopPropagation,$preventDefault); |
|
| 163 | + public function on($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 164 | + foreach ($this->tabs as $tab) { |
|
| 165 | + $tab->on($event, $jsCode, $stopPropagation, $preventDefault); |
|
| 166 | 166 | } |
| 167 | 167 | return $this; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - public function setStacked($stacked=true){ |
|
| 171 | - if($stacked) |
|
| 170 | + public function setStacked($stacked=true) { |
|
| 171 | + if ($stacked) |
|
| 172 | 172 | $this->stacked="nav-stacked"; |
| 173 | 173 | else $this->stacked=""; |
| 174 | 174 | } |
@@ -35,8 +35,9 @@ discard block |
||
| 35 | 35 | $tab |
| 36 | 36 | ); |
| 37 | 37 | array_splice($this->tabs, $index, 0, $inserted); |
| 38 | - } else |
|
| 39 | - $this->tabs []=$tab; |
|
| 38 | + } else { |
|
| 39 | + $this->tabs []=$tab; |
|
| 40 | + } |
|
| 40 | 41 | } |
| 41 | 42 | |
| 42 | 43 | public function setActive($index){ |
@@ -116,9 +117,9 @@ discard block |
||
| 116 | 117 | public function createTabContents() { |
| 117 | 118 | $tabContent=new HtmlTabContent("tabcontent-".$this->identifier); |
| 118 | 119 | foreach ( $this->tabs as $tab ) { |
| 119 | - if ($tab instanceof HtmlTabItem) |
|
| 120 | - $tabContent->addTabItem($tab->getHref()); |
|
| 121 | - elseif ($tab instanceof HtmlDropdown) { |
|
| 120 | + if ($tab instanceof HtmlTabItem) { |
|
| 121 | + $tabContent->addTabItem($tab->getHref()); |
|
| 122 | + } elseif ($tab instanceof HtmlDropdown) { |
|
| 122 | 123 | foreach ( $tab->getItems() as $dropdownItem ) { |
| 123 | 124 | $tabContent->addTabItem($dropdownItem->getHref()); |
| 124 | 125 | } |
@@ -137,8 +138,9 @@ discard block |
||
| 137 | 138 | |
| 138 | 139 | public function setContentToTab($index, $text) { |
| 139 | 140 | $tabContentItem=$this->content->getTabItem($index); |
| 140 | - if (isset($tabContentItem)) |
|
| 141 | - $tabContentItem->setContent($text); |
|
| 141 | + if (isset($tabContentItem)) { |
|
| 142 | + $tabContentItem->setContent($text); |
|
| 143 | + } |
|
| 142 | 144 | } |
| 143 | 145 | |
| 144 | 146 | public function countTabs() { |
@@ -146,8 +148,9 @@ discard block |
||
| 146 | 148 | } |
| 147 | 149 | |
| 148 | 150 | public function getTabItem($index) { |
| 149 | - if ($index<sizeof($this->content->get)) |
|
| 150 | - return $this->content; |
|
| 151 | + if ($index<sizeof($this->content->get)) { |
|
| 152 | + return $this->content; |
|
| 153 | + } |
|
| 151 | 154 | } |
| 152 | 155 | |
| 153 | 156 | public function fadeEffect() { |
@@ -168,9 +171,11 @@ discard block |
||
| 168 | 171 | } |
| 169 | 172 | |
| 170 | 173 | public function setStacked($stacked=true){ |
| 171 | - if($stacked) |
|
| 172 | - $this->stacked="nav-stacked"; |
|
| 173 | - else $this->stacked=""; |
|
| 174 | + if($stacked) { |
|
| 175 | + $this->stacked="nav-stacked"; |
|
| 176 | + } else { |
|
| 177 | + $this->stacked=""; |
|
| 178 | + } |
|
| 174 | 179 | } |
| 175 | 180 | |
| 176 | 181 | /* (non-PHPdoc) |
@@ -676,6 +676,9 @@ discard block |
||
| 676 | 676 | return $this->_create_json($json_result, $match_array_type); |
| 677 | 677 | } |
| 678 | 678 | |
| 679 | + /** |
|
| 680 | + * @param boolean $match_array_type |
|
| 681 | + */ |
|
| 679 | 682 | private function _create_json($json_result, $match_array_type) { |
| 680 | 683 | $json=array (); |
| 681 | 684 | $_is_assoc=TRUE; |
@@ -699,7 +702,7 @@ discard block |
||
| 699 | 702 | * Checks for an associative array |
| 700 | 703 | * |
| 701 | 704 | * @param type |
| 702 | - * @return type |
|
| 705 | + * @return boolean |
|
| 703 | 706 | */ |
| 704 | 707 | public function _is_associative_array($arr) { |
| 705 | 708 | foreach ( array_keys($arr) as $key => $val ) { |
@@ -939,7 +942,7 @@ discard block |
||
| 939 | 942 | * @param string $jqueryCall the JQuery callback |
| 940 | 943 | * @param mixed $param array or string parameters |
| 941 | 944 | * @param string $jsCallback javascript code to execute after the jquery call |
| 942 | - * @return mixed |
|
| 945 | + * @return string |
|
| 943 | 946 | */ |
| 944 | 947 | public function doJQuery($element, $jqueryCall, $param="", $jsCallback="") { |
| 945 | 948 | return $this->js->_doJQuery($element, $jqueryCall, $param, $jsCallback, true); |
@@ -951,7 +954,7 @@ discard block |
||
| 951 | 954 | * @param string $jqueryCall the JQuery callback |
| 952 | 955 | * @param mixed $param array or string parameters |
| 953 | 956 | * @param string $jsCallback javascript code to execute after the jquery call |
| 954 | - * @return mixed |
|
| 957 | + * @return string |
|
| 955 | 958 | */ |
| 956 | 959 | public function doJQueryDeferred($element, $jqueryCall, $param="", $jsCallback="") { |
| 957 | 960 | return $this->js->_doJQuery($element, $jqueryCall, $param, $jsCallback, false); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function _setDi($di) { |
| 52 | 52 | $this->_di=$di; |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 53 | + if ($this->js!=null && $di!=null) |
|
| 54 | 54 | $this->js->setDi($di); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -145,18 +145,18 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function __construct($params=array()) { |
| 148 | - $defaults=array ( |
|
| 148 | + $defaults=array( |
|
| 149 | 149 | 'driver' => 'Jquery', |
| 150 | 150 | 'debug' => true |
| 151 | 151 | ); |
| 152 | - foreach ( $defaults as $key => $val ) { |
|
| 153 | - if (isset($params[$key])&&$params[$key]!=="") { |
|
| 152 | + foreach ($defaults as $key => $val) { |
|
| 153 | + if (isset($params[$key]) && $params[$key]!=="") { |
|
| 154 | 154 | $defaults[$key]=$params[$key]; |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | extract($defaults); |
| 158 | 158 | $this->js=new Jquery($defaults); |
| 159 | - $this->cdns=array (); |
|
| 159 | + $this->cdns=array(); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | public function addToCompile($jsScript) { |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | * @return string |
| 409 | 409 | */ |
| 410 | 410 | public function addClass($element='this', $class='', $immediatly=false) { |
| 411 | - return $this->js->_genericCallValue('addClass',$element, $class, $immediatly); |
|
| 411 | + return $this->js->_genericCallValue('addClass', $element, $class, $immediatly); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -418,8 +418,8 @@ discard block |
||
| 418 | 418 | * @param boolean $immediatly defers the execution if set to false |
| 419 | 419 | * @return string |
| 420 | 420 | */ |
| 421 | - public function after($to, $element, $immediatly=false){ |
|
| 422 | - return $this->js->_genericCallElement('after',$to, $element, $immediatly); |
|
| 421 | + public function after($to, $element, $immediatly=false) { |
|
| 422 | + return $this->js->_genericCallElement('after', $to, $element, $immediatly); |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | 425 | /** |
@@ -429,8 +429,8 @@ discard block |
||
| 429 | 429 | * @param boolean $immediatly defers the execution if set to false |
| 430 | 430 | * @return string |
| 431 | 431 | */ |
| 432 | - public function before($to, $element, $immediatly=false){ |
|
| 433 | - return $this->js->_genericCallElement('before',$to, $element, $immediatly); |
|
| 432 | + public function before($to, $element, $immediatly=false) { |
|
| 433 | + return $this->js->_genericCallElement('before', $to, $element, $immediatly); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | /** |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | * @param string $value |
| 451 | 451 | * @param boolean $immediatly defers the execution if set to false |
| 452 | 452 | */ |
| 453 | - public function val($element='this',$value='',$immediatly=false){ |
|
| 454 | - return $this->js->_genericCallValue('val',$element,$value,$immediatly); |
|
| 453 | + public function val($element='this', $value='', $immediatly=false) { |
|
| 454 | + return $this->js->_genericCallValue('val', $element, $value, $immediatly); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | * @param boolean $immediatly defers the execution if set to false |
| 462 | 462 | */ |
| 463 | 463 | public function html($element='this', $value='', $immediatly=false) { |
| 464 | - return $this->js->_genericCallValue('html',$element, $value, $immediatly); |
|
| 464 | + return $this->js->_genericCallValue('html', $element, $value, $immediatly); |
|
| 465 | 465 | } |
| 466 | 466 | // -------------------------------------------------------------------- |
| 467 | 467 | /** |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | * @return string |
| 487 | 487 | */ |
| 488 | 488 | public function append($to, $element, $immediatly=false) { |
| 489 | - return $this->js->_genericCallElement('append',$to, $element, $immediatly); |
|
| 489 | + return $this->js->_genericCallElement('append', $to, $element, $immediatly); |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | /** |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * @return string |
| 498 | 498 | */ |
| 499 | 499 | public function prepend($to, $element, $immediatly=false) { |
| 500 | - return $this->js->_genericCallElement('prepend',$to, $element, $immediatly); |
|
| 500 | + return $this->js->_genericCallElement('prepend', $to, $element, $immediatly); |
|
| 501 | 501 | } |
| 502 | 502 | // -------------------------------------------------------------------- |
| 503 | 503 | /** |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * @return string |
| 549 | 549 | */ |
| 550 | 550 | public function removeClass($element='this', $class='', $immediatly=false) { |
| 551 | - return $this->js->_genericCall('removeClass',$element, $class, $immediatly); |
|
| 551 | + return $this->js->_genericCall('removeClass', $element, $class, $immediatly); |
|
| 552 | 552 | } |
| 553 | 553 | // -------------------------------------------------------------------- |
| 554 | 554 | /** |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | * @return string |
| 610 | 610 | */ |
| 611 | 611 | public function toggleClass($element='this', $class='', $immediatly=false) { |
| 612 | - return $this->js->_genericCallValue('toggleClass',$element, $class, $immediatly); |
|
| 612 | + return $this->js->_genericCallValue('toggleClass', $element, $class, $immediatly); |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | /** |
@@ -656,11 +656,11 @@ discard block |
||
| 656 | 656 | */ |
| 657 | 657 | public function compile($view=NULL, $view_var='script_foot', $script_tags=TRUE) { |
| 658 | 658 | $bs=$this->_bootstrap; |
| 659 | - if (isset($bs)&&isset($view)) { |
|
| 659 | + if (isset($bs) && isset($view)) { |
|
| 660 | 660 | $bs->compileHtml($this, $view); |
| 661 | 661 | } |
| 662 | 662 | $sem=$this->_semantic; |
| 663 | - if (isset($sem)&&isset($view)) { |
|
| 663 | + if (isset($sem) && isset($view)) { |
|
| 664 | 664 | $sem->compileHtml($this, $view); |
| 665 | 665 | } |
| 666 | 666 | return $this->js->_compile($view, $view_var, $script_tags); |
@@ -740,27 +740,27 @@ discard block |
||
| 740 | 740 | $json_result=$result->result_array(); |
| 741 | 741 | } elseif (is_array($result)) { |
| 742 | 742 | $json_result=$result; |
| 743 | - } else { |
|
| 743 | + }else { |
|
| 744 | 744 | return $this->_prep_args($result); |
| 745 | 745 | } |
| 746 | - } else { |
|
| 746 | + }else { |
|
| 747 | 747 | return 'null'; |
| 748 | 748 | } |
| 749 | 749 | return $this->_create_json($json_result, $match_array_type); |
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | private function _create_json($json_result, $match_array_type) { |
| 753 | - $json=array (); |
|
| 753 | + $json=array(); |
|
| 754 | 754 | $_is_assoc=TRUE; |
| 755 | - if (!is_array($json_result)&&empty($json_result)) { |
|
| 755 | + if (!is_array($json_result) && empty($json_result)) { |
|
| 756 | 756 | show_error("Generate JSON Failed - Illegal key, value pair."); |
| 757 | 757 | } elseif ($match_array_type) { |
| 758 | 758 | $_is_assoc=$this->_is_associative_array($json_result); |
| 759 | 759 | } |
| 760 | - foreach ( $json_result as $k => $v ) { |
|
| 760 | + foreach ($json_result as $k => $v) { |
|
| 761 | 761 | if ($_is_assoc) { |
| 762 | 762 | $json[]=$this->_prep_args($k, TRUE).':'.$this->generate_json($v, $match_array_type); |
| 763 | - } else { |
|
| 763 | + }else { |
|
| 764 | 764 | $json[]=$this->generate_json($v, $match_array_type); |
| 765 | 765 | } |
| 766 | 766 | } |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | * @return type |
| 776 | 776 | */ |
| 777 | 777 | public function _is_associative_array($arr) { |
| 778 | - foreach ( array_keys($arr) as $key => $val ) { |
|
| 778 | + foreach (array_keys($arr) as $key => $val) { |
|
| 779 | 779 | if ($key!==$val) { |
| 780 | 780 | return TRUE; |
| 781 | 781 | } |
@@ -794,11 +794,11 @@ discard block |
||
| 794 | 794 | return 'null'; |
| 795 | 795 | } elseif (is_bool($result)) { |
| 796 | 796 | return ($result===TRUE) ? 'true' : 'false'; |
| 797 | - } elseif (is_string($result)||$is_key) { |
|
| 798 | - return '"'.str_replace(array ( |
|
| 799 | - '\\',"\t","\n","\r",'"','/' |
|
| 800 | - ), array ( |
|
| 801 | - '\\\\','\\t','\\n',"\\r",'\"','\/' |
|
| 797 | + } elseif (is_string($result) || $is_key) { |
|
| 798 | + return '"'.str_replace(array( |
|
| 799 | + '\\', "\t", "\n", "\r", '"', '/' |
|
| 800 | + ), array( |
|
| 801 | + '\\\\', '\\t', '\\n', "\\r", '\"', '\/' |
|
| 802 | 802 | ), $result).'"'; |
| 803 | 803 | } elseif (is_scalar($result)) { |
| 804 | 804 | return $result; |
@@ -813,8 +813,8 @@ discard block |
||
| 813 | 813 | * @param string $jsCallback javascript code to execute after the request |
| 814 | 814 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 815 | 815 | */ |
| 816 | - public function get($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 817 | - return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 816 | + public function get($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 817 | + return $this->js->_get($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | /** |
@@ -825,8 +825,8 @@ discard block |
||
| 825 | 825 | * @param string $jsCallback javascript code to execute after the request |
| 826 | 826 | * @param boolean $immediatly |
| 827 | 827 | */ |
| 828 | - public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document",$immediatly=false) { |
|
| 829 | - return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context,$immediatly); |
|
| 828 | + public function json($url, $method="get", $params="{}", $jsCallback=NULL, $attr="id", $context="document", $immediatly=false) { |
|
| 829 | + return $this->js->_json($url, $method, $params, $jsCallback, $attr, $context, $immediatly); |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /** |
@@ -836,8 +836,8 @@ discard block |
||
| 836 | 836 | * @param string $url the request address |
| 837 | 837 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 838 | 838 | */ |
| 839 | - public function jsonOn($event,$element, $url,$parameters=array()) { |
|
| 840 | - return $this->js->_jsonOn($event, $element, $url,$parameters); |
|
| 839 | + public function jsonOn($event, $element, $url, $parameters=array()) { |
|
| 840 | + return $this->js->_jsonOn($event, $element, $url, $parameters); |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
@@ -881,8 +881,8 @@ discard block |
||
| 881 | 881 | * @param string $url the request url |
| 882 | 882 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","params"=>"{}","method"=>"get","immediatly"=>true) |
| 883 | 883 | */ |
| 884 | - public function jsonArrayOn($event,$element,$maskSelector, $url,$parameters=array()) { |
|
| 885 | - return $this->js->_jsonArrayOn($event,$element,$maskSelector, $url, $parameters); |
|
| 884 | + public function jsonArrayOn($event, $element, $maskSelector, $url, $parameters=array()) { |
|
| 885 | + return $this->js->_jsonArrayOn($event, $element, $maskSelector, $url, $parameters); |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | /** |
@@ -894,7 +894,7 @@ discard block |
||
| 894 | 894 | * @param string $jsCallback javascript code to execute after the request |
| 895 | 895 | * @param string $attr the html attribute added to the request |
| 896 | 896 | */ |
| 897 | - public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL,$attr="id") { |
|
| 897 | + public function getDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id") { |
|
| 898 | 898 | return $this->js->_get($url, $params, $responseElement, $jsCallback, $attr, false); |
| 899 | 899 | } |
| 900 | 900 | |
@@ -932,8 +932,8 @@ discard block |
||
| 932 | 932 | * @param string $jsCallback javascript code to execute after the request |
| 933 | 933 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 934 | 934 | */ |
| 935 | - public function post($url, $responseElement="", $params="{}", $jsCallback=NULL,$hasLoader=true) { |
|
| 936 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader,true); |
|
| 935 | + public function post($url, $responseElement="", $params="{}", $jsCallback=NULL, $hasLoader=true) { |
|
| 936 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, NULL, $hasLoader, true); |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | /** |
@@ -946,8 +946,8 @@ discard block |
||
| 946 | 946 | * @param string $jsCallback javascript code to execute after the request |
| 947 | 947 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 948 | 948 | */ |
| 949 | - public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id",$hasLoader=true) { |
|
| 950 | - return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader,false); |
|
| 949 | + public function postDeferred($url, $responseElement="", $params="{}", $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 950 | + return $this->js->_post($url, $params, $responseElement, $jsCallback, $attr, $hasLoader, false); |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | /** |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 962 | 962 | */ |
| 963 | 963 | public function postOn($event, $element, $url, $params="{}", $responseElement="", $parameters=array()) { |
| 964 | - return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 964 | + return $this->js->_postOn($event, $element, $url, $params, $responseElement, $parameters); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
@@ -985,8 +985,8 @@ discard block |
||
| 985 | 985 | * @param string $jsCallback javascript code to execute after the request |
| 986 | 986 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 987 | 987 | */ |
| 988 | - public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$hasLoader=true) { |
|
| 989 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader,true); |
|
| 988 | + public function postForm($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $hasLoader=true) { |
|
| 989 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, NULL, $hasLoader, true); |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | /** |
@@ -999,8 +999,8 @@ discard block |
||
| 999 | 999 | * @param string $attr the html attribute added to the request |
| 1000 | 1000 | * @param boolean $hasLoader true for showing ajax loader. default : true |
| 1001 | 1001 | */ |
| 1002 | - public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL,$attr="id",$hasLoader=true) { |
|
| 1003 | - return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader,false); |
|
| 1002 | + public function postFormDeferred($url, $form, $responseElement, $validation=false, $jsCallback=NULL, $attr="id", $hasLoader=true) { |
|
| 1003 | + return $this->js->_postForm($url, $form, $responseElement, $validation, $jsCallback, $attr, $hasLoader, false); |
|
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | 1006 | /** |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | * @param array $parameters default : array("preventDefault"=>true,"stopPropagation"=>true,"validation"=>false,"jsCallback"=>NULL,"attr"=>"id","hasLoader"=>true,"immediatly"=>true) |
| 1015 | 1015 | */ |
| 1016 | 1016 | public function postFormOn($event, $element, $url, $form, $responseElement="", $parameters=array()) { |
| 1017 | - return $this->js->_postFormOn($event,$element, $url, $form, $responseElement, $parameters); |
|
| 1017 | + return $this->js->_postFormOn($event, $element, $url, $form, $responseElement, $parameters); |
|
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | 1020 | /** |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | $preventDefault=false; |
| 1070 | 1070 | $immediatly=true; |
| 1071 | 1071 | extract($parameters); |
| 1072 | - return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback,$immediatly); |
|
| 1072 | + return $this->js->_doJQueryOn($event, $element, $elementToModify, $jqueryCall, $param, $preventDefault, $stopPropagation, $jsCallback, $immediatly); |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /** |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | $preventDefault=false; |
| 1097 | 1097 | $immediatly=true; |
| 1098 | 1098 | extract($parameters); |
| 1099 | - $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation,$immediatly); |
|
| 1099 | + $script=$this->js->_execOn($element, $event, $js, $preventDefault, $stopPropagation, $immediatly); |
|
| 1100 | 1100 | return $script; |
| 1101 | 1101 | } |
| 1102 | 1102 | |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | |
| 1107 | 1107 | public function setCDNs($cdns) { |
| 1108 | 1108 | if (is_array($cdns)===false) { |
| 1109 | - $cdns=array ( |
|
| 1109 | + $cdns=array( |
|
| 1110 | 1110 | $cdns |
| 1111 | 1111 | ); |
| 1112 | 1112 | } |
@@ -1118,9 +1118,9 @@ discard block |
||
| 1118 | 1118 | $hasJQueryUI=false; |
| 1119 | 1119 | $hasBootstrap=false; |
| 1120 | 1120 | $hasSemantic=false; |
| 1121 | - $result=array (); |
|
| 1122 | - foreach ( $this->cdns as $cdn ) { |
|
| 1123 | - switch(get_class($cdn)) { |
|
| 1121 | + $result=array(); |
|
| 1122 | + foreach ($this->cdns as $cdn) { |
|
| 1123 | + switch (get_class($cdn)) { |
|
| 1124 | 1124 | case "Ajax\lib\CDNJQuery": |
| 1125 | 1125 | $hasJQuery=true; |
| 1126 | 1126 | $result[0]=$cdn; |
@@ -1130,11 +1130,11 @@ discard block |
||
| 1130 | 1130 | $result[1]=$cdn; |
| 1131 | 1131 | break; |
| 1132 | 1132 | case "Ajax\lib\CDNCoreCss": |
| 1133 | - if($cdn->getFramework()==="Bootstrap") |
|
| 1133 | + if ($cdn->getFramework()==="Bootstrap") |
|
| 1134 | 1134 | $hasBootstrap=true; |
| 1135 | - elseif($cdn->getFramework()==="Semantic") |
|
| 1135 | + elseif ($cdn->getFramework()==="Semantic") |
|
| 1136 | 1136 | $hasSemantic=true; |
| 1137 | - if($hasSemantic || $hasBootstrap) |
|
| 1137 | + if ($hasSemantic || $hasBootstrap) |
|
| 1138 | 1138 | $result[2]=$cdn; |
| 1139 | 1139 | break; |
| 1140 | 1140 | } |
@@ -1142,14 +1142,14 @@ discard block |
||
| 1142 | 1142 | if ($hasJQuery===false) { |
| 1143 | 1143 | $result[0]=new CDNJQuery("x"); |
| 1144 | 1144 | } |
| 1145 | - if ($hasJQueryUI===false&&isset($this->_ui)) { |
|
| 1145 | + if ($hasJQueryUI===false && isset($this->_ui)) { |
|
| 1146 | 1146 | $result[1]=new CDNGuiGen("x", $template); |
| 1147 | 1147 | } |
| 1148 | - if ($hasBootstrap===false&&isset($this->_bootstrap)) { |
|
| 1149 | - $result[2]=new CDNCoreCss("Bootstrap","x"); |
|
| 1148 | + if ($hasBootstrap===false && isset($this->_bootstrap)) { |
|
| 1149 | + $result[2]=new CDNCoreCss("Bootstrap", "x"); |
|
| 1150 | 1150 | } |
| 1151 | - if ($hasSemantic===false&&isset($this->_semantic)) { |
|
| 1152 | - $result[2]=new CDNCoreCss("Semantic","x"); |
|
| 1151 | + if ($hasSemantic===false && isset($this->_semantic)) { |
|
| 1152 | + $result[2]=new CDNCoreCss("Semantic", "x"); |
|
| 1153 | 1153 | } |
| 1154 | 1154 | ksort($result); |
| 1155 | 1155 | return implode("\n", $result); |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | $this->_setDi($di); |
| 1163 | 1163 | } |
| 1164 | 1164 | } |
| 1165 | -} else { |
|
| 1165 | +}else { |
|
| 1166 | 1166 | class JsUtils extends _JsUtils { |
| 1167 | 1167 | |
| 1168 | 1168 | public function setDi(DiInterface $di) { |
@@ -50,8 +50,9 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | protected function _setDi($di) { |
| 52 | 52 | $this->_di=$di; |
| 53 | - if ($this->js!=null&&$di!=null) |
|
| 54 | - $this->js->setDi($di); |
|
| 53 | + if ($this->js!=null&&$di!=null) { |
|
| 54 | + $this->js->setDi($di); |
|
| 55 | + } |
|
| 55 | 56 | } |
| 56 | 57 | |
| 57 | 58 | /** |
@@ -1130,12 +1131,14 @@ discard block |
||
| 1130 | 1131 | $result[1]=$cdn; |
| 1131 | 1132 | break; |
| 1132 | 1133 | case "Ajax\lib\CDNCoreCss": |
| 1133 | - if($cdn->getFramework()==="Bootstrap") |
|
| 1134 | - $hasBootstrap=true; |
|
| 1135 | - elseif($cdn->getFramework()==="Semantic") |
|
| 1136 | - $hasSemantic=true; |
|
| 1137 | - if($hasSemantic || $hasBootstrap) |
|
| 1138 | - $result[2]=$cdn; |
|
| 1134 | + if($cdn->getFramework()==="Bootstrap") { |
|
| 1135 | + $hasBootstrap=true; |
|
| 1136 | + } elseif($cdn->getFramework()==="Semantic") { |
|
| 1137 | + $hasSemantic=true; |
|
| 1138 | + } |
|
| 1139 | + if($hasSemantic || $hasBootstrap) { |
|
| 1140 | + $result[2]=$cdn; |
|
| 1141 | + } |
|
| 1139 | 1142 | break; |
| 1140 | 1143 | } |
| 1141 | 1144 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | protected function compileEvents() { |
| 68 | - foreach ( $this->events as $event => $jsCode ) { |
|
| 68 | + foreach ($this->events as $event => $jsCode) { |
|
| 69 | 69 | $this->jquery_code_for_compile []="$( \"".$this->collapsed."\" ).on(\"".$event."\" , function (e) {".$jsCode."});"; |
| 70 | 70 | } |
| 71 | 71 | } |