@@ -54,6 +54,9 @@ |
||
| 54 | 54 | return $this->setParam("keyboard", $value); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | + /** |
|
| 58 | + * @param boolean $value |
|
| 59 | + */ |
|
| 57 | 60 | public function setDraggable($value) { |
| 58 | 61 | if ($value) { |
| 59 | 62 | $this->jsCodes ["draggable"]=new Draggable(); |
@@ -19,6 +19,10 @@ discard block |
||
| 19 | 19 | protected $attr; |
| 20 | 20 | |
| 21 | 21 | |
| 22 | + /** |
|
| 23 | + * @param string $identifier |
|
| 24 | + * @param string $tagName |
|
| 25 | + */ |
|
| 22 | 26 | public function __construct($identifier,$tagName){ |
| 23 | 27 | parent::__construct($identifier,$tagName); |
| 24 | 28 | $this->root=""; |
@@ -29,7 +33,6 @@ discard block |
||
| 29 | 33 | * Associate an ajax get to the elements, displayed in $targetSelector |
| 30 | 34 | * $attr member is used to build each element url |
| 31 | 35 | * @param string $targetSelector the target of the get |
| 32 | - * @param string $attr the html attribute used to build the elements url |
|
| 33 | 36 | * @return HtmlNavElement |
| 34 | 37 | */ |
| 35 | 38 | public function autoGetOnClick($targetSelector){ |
@@ -14,6 +14,11 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
| 16 | 16 | private $cols; |
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @param string $identifier |
|
| 20 | + * @param integer $numCols |
|
| 21 | + */ |
|
| 17 | 22 | public function __construct($identifier,$numCols=NULL){ |
| 18 | 23 | parent::__construct($identifier,"div"); |
| 19 | 24 | $this->setProperty("class", "row"); |
@@ -86,6 +91,11 @@ discard block |
||
| 86 | 91 | $this->delete($size,$start+1, $width); |
| 87 | 92 | } |
| 88 | 93 | } |
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @param integer $start |
|
| 97 | + * @param integer $width |
|
| 98 | + */ |
|
| 89 | 99 | public function delete($size=CssSize::SIZE_MD,$start,$width){ |
| 90 | 100 | while($start<sizeof($this->cols)+1 && $width>0){ |
| 91 | 101 | $col=$this->getColAt($start,false); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $result=null; |
| 44 | 44 | if($index<sizeof($this->cols)+1){ |
| 45 | 45 | $result=$this->cols[$index-1]; |
| 46 | - }else if ($force){ |
|
| 46 | + } else if ($force){ |
|
| 47 | 47 | $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
| 48 | 48 | } |
| 49 | 49 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->cols = array_values($this->cols); |
| 97 | 97 | $width=$width-$widthCol; |
| 98 | 98 | } |
| 99 | - }else{ |
|
| 99 | + } else{ |
|
| 100 | 100 | $width=0; |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -49,6 +49,9 @@ |
||
| 49 | 49 | $element->setStyle($value); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | + /** |
|
| 53 | + * @param HtmlDropdown $bt |
|
| 54 | + */ |
|
| 52 | 55 | private function dropdownAsButton($bt) { |
| 53 | 56 | $this->addExistingDropDown($bt); |
| 54 | 57 | $bt->setTagName("button"); |
@@ -45,8 +45,9 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | public function setStyle($value) { |
| 48 | - foreach ( $this->elements as $element ) |
|
| 49 | - $element->setStyle($value); |
|
| 48 | + foreach ( $this->elements as $element ) { |
|
| 49 | + $element->setStyle($value); |
|
| 50 | + } |
|
| 50 | 51 | } |
| 51 | 52 | |
| 52 | 53 | private function dropdownAsButton($bt) { |
@@ -71,16 +72,18 @@ discard block |
||
| 71 | 72 | } elseif ($element instanceof HtmlButton) { |
| 72 | 73 | $this->elements[]=$element; |
| 73 | 74 | } elseif (is_array($element)) { |
| 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); |
|
| 75 | + if (array_key_exists("glyph", $element)) { |
|
| 76 | + $bt=new HtmlGlyphButton($this->identifier."-button-".$iid); |
|
| 77 | + } elseif (array_key_exists("btnCaption", $element)) { |
|
| 78 | + if (array_key_exists("split", $element)) { |
|
| 79 | + $bt=new HtmlSplitbutton($this->identifier."-dropdown-".$iid); |
|
| 80 | + } else { |
|
| 81 | + $bt=new HtmlDropdown($this->identifier."-dropdown-".$iid); |
|
| 82 | + } |
|
| 81 | 83 | $this->dropdownAsButton($bt); |
| 82 | - } else |
|
| 83 | - $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 84 | + } else { |
|
| 85 | + $bt=new HtmlButton($this->identifier."-button-".$iid); |
|
| 86 | + } |
|
| 84 | 87 | $bt->fromArray($element); |
| 85 | 88 | $this->elements[]=$bt; |
| 86 | 89 | $result=$bt; |
@@ -111,8 +114,9 @@ discard block |
||
| 111 | 114 | public function setAlignment($value) { |
| 112 | 115 | if (is_int($value)) { |
| 113 | 116 | $value=CssRef::alignment("btn-group")[$value]; |
| 114 | - } else |
|
| 115 | - $value="btn-group-".$value; |
|
| 117 | + } else { |
|
| 118 | + $value="btn-group-".$value; |
|
| 119 | + } |
|
| 116 | 120 | if (strstr($value, "justified")) { |
| 117 | 121 | foreach ( $this->elements as $element ) { |
| 118 | 122 | $element->wrap('<div class="btn-group" role="group">', '</div>'); |
@@ -127,9 +131,9 @@ discard block |
||
| 127 | 131 | * @return HtmlButton |
| 128 | 132 | */ |
| 129 | 133 | public function getElement($index) { |
| 130 | - if (is_int($index)) |
|
| 131 | - return $this->elements[$index]; |
|
| 132 | - else { |
|
| 134 | + if (is_int($index)) { |
|
| 135 | + return $this->elements[$index]; |
|
| 136 | + } else { |
|
| 133 | 137 | $elm=$this->getElementById($index, $this->elements); |
| 134 | 138 | return $elm; |
| 135 | 139 | } |
@@ -12,6 +12,11 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class HtmlButtontoolbar extends HtmlButtongroups { |
| 14 | 14 | |
| 15 | + /** |
|
| 16 | + * @param string $identifier |
|
| 17 | + * @param string $cssStyle |
|
| 18 | + * @param string $size |
|
| 19 | + */ |
|
| 15 | 20 | public function __construct($identifier, $elements=array(), $cssStyle=NULL, $size=NULL, $tagName="div") { |
| 16 | 21 | parent::__construct($identifier, $elements, $cssStyle, $size, $tagName); |
| 17 | 22 | $this->setClass("btn-toolbar"); |
@@ -57,7 +62,7 @@ discard block |
||
| 57 | 62 | |
| 58 | 63 | /** |
| 59 | 64 | * return the Buttongroups at position $index |
| 60 | - * @return \Ajax\bootstrap\html\HtmlButtongroups |
|
| 65 | + * @return HtmlButton |
|
| 61 | 66 | */ |
| 62 | 67 | public function getGroup($index) { |
| 63 | 68 | return parent::getElement($index); |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | private function getLastButtonGroup() { |
| 48 | 48 | $nb=sizeof($this->elements); |
| 49 | - if ($nb>0) |
|
| 50 | - $bg=$this->elements [$nb-1]; |
|
| 51 | - else { |
|
| 49 | + if ($nb>0) { |
|
| 50 | + $bg=$this->elements [$nb-1]; |
|
| 51 | + } else { |
|
| 52 | 52 | $bg=new HtmlButtongroups($this->identifier."-buttongroups-".$nb); |
| 53 | 53 | $this->elements []=$bg; |
| 54 | 54 | } |
@@ -66,8 +66,9 @@ discard block |
||
| 66 | 66 | public function getLastGroup() { |
| 67 | 67 | $bg=null; |
| 68 | 68 | $nb=sizeof($this->elements); |
| 69 | - if ($nb>0) |
|
| 70 | - $bg=$this->elements [$nb-1]; |
|
| 69 | + if ($nb>0) { |
|
| 70 | + $bg=$this->elements [$nb-1]; |
|
| 71 | + } |
|
| 71 | 72 | return $bg; |
| 72 | 73 | } |
| 73 | 74 | |
@@ -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); |
@@ -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); |
@@ -22,6 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * |
| 24 | 24 | * @param string $identifier the id |
| 25 | + * @param string $cssStyle |
|
| 25 | 26 | */ |
| 26 | 27 | public function __construct($identifier, $value="", $items=array(), $cssStyle=null, $onClick=null) { |
| 27 | 28 | parent::__construct($identifier, "", $cssStyle, $onClick); |
@@ -45,7 +46,7 @@ discard block |
||
| 45 | 46 | /** |
| 46 | 47 | * define the button style |
| 47 | 48 | * avaible values : "btn-default","btn-primary","btn-success","btn-info","btn-warning","btn-danger" |
| 48 | - * @param string|int $cssStyle |
|
| 49 | + * @param string $cssStyle |
|
| 49 | 50 | * @return \Ajax\bootstrap\html\HtmlDropdown default : "btn-default" |
| 50 | 51 | */ |
| 51 | 52 | public function setStyle($cssStyle) { |
@@ -149,10 +150,16 @@ discard block |
||
| 149 | 150 | return $this->items [$index]; |
| 150 | 151 | } |
| 151 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $value |
|
| 155 | + */ |
|
| 152 | 156 | public function setBtnClass($value) { |
| 153 | 157 | $this->class=$value; |
| 154 | 158 | } |
| 155 | 159 | |
| 160 | + /** |
|
| 161 | + * @param string $value |
|
| 162 | + */ |
|
| 156 | 163 | public function setMClass($value) { |
| 157 | 164 | $this->mClass=$value; |
| 158 | 165 | } |
@@ -183,6 +190,7 @@ discard block |
||
| 183 | 190 | /** |
| 184 | 191 | * Sets the tagName's dropdown |
| 185 | 192 | * @see \Ajax\bootstrap\html\BaseHtml::setTagName() |
| 193 | + * @param string $tagName |
|
| 186 | 194 | */ |
| 187 | 195 | public function setTagName($tagName) { |
| 188 | 196 | if ($tagName=="button") |
@@ -194,6 +202,9 @@ discard block |
||
| 194 | 202 | return $this->compile(); |
| 195 | 203 | } |
| 196 | 204 | |
| 205 | + /** |
|
| 206 | + * @param string $btnCaption |
|
| 207 | + */ |
|
| 197 | 208 | public function setBtnCaption($btnCaption) { |
| 198 | 209 | $this->btnCaption=$btnCaption; |
| 199 | 210 | return $this; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function addItem($caption, $href="#") { |
| 90 | 90 | if($caption instanceof HtmlDropdownItem){ |
| 91 | 91 | $item=$caption; |
| 92 | - }else{ |
|
| 92 | + } else{ |
|
| 93 | 93 | $iid=$this->getItemsCount()+1; |
| 94 | 94 | $item=new HtmlDropdownItem($this->identifier."-dropdown-item-".$iid); |
| 95 | 95 | $item->setCaption($caption)->setHref($href); |
@@ -129,10 +129,11 @@ discard block |
||
| 129 | 129 | * @see BaseHtml::fromArray() |
| 130 | 130 | */ |
| 131 | 131 | public function fromArray($array) { |
| 132 | - if (array_keys($array)!==range(0, count($array)-1)) |
|
| 133 | - return parent::fromArray($array); |
|
| 134 | - else |
|
| 135 | - return $this->addItems($array); |
|
| 132 | + if (array_keys($array)!==range(0, count($array)-1)) { |
|
| 133 | + return parent::fromArray($array); |
|
| 134 | + } else { |
|
| 135 | + return $this->addItems($array); |
|
| 136 | + } |
|
| 136 | 137 | } |
| 137 | 138 | |
| 138 | 139 | public function setItems($items) { |
@@ -185,8 +186,9 @@ discard block |
||
| 185 | 186 | * @see \Ajax\bootstrap\html\BaseHtml::setTagName() |
| 186 | 187 | */ |
| 187 | 188 | public function setTagName($tagName) { |
| 188 | - if ($tagName=="button") |
|
| 189 | - $this->class="btn dropdown-toggle"; |
|
| 189 | + if ($tagName=="button") { |
|
| 190 | + $this->class="btn dropdown-toggle"; |
|
| 191 | + } |
|
| 190 | 192 | return parent::setTagName($tagName); |
| 191 | 193 | } |
| 192 | 194 | |
@@ -204,8 +206,9 @@ discard block |
||
| 204 | 206 | } |
| 205 | 207 | |
| 206 | 208 | public function setAlignment($alignment) { |
| 207 | - if (is_int($alignment)) |
|
| 208 | - $alignment="dropdown-menu-".CssRef::alignment()[$alignment]; |
|
| 209 | + if (is_int($alignment)) { |
|
| 210 | + $alignment="dropdown-menu-".CssRef::alignment()[$alignment]; |
|
| 211 | + } |
|
| 209 | 212 | return $this->addToMemberCtrl($this->class, $alignment, CssRef::alignment()); |
| 210 | 213 | } |
| 211 | 214 | |
@@ -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 ) { |
@@ -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 HtmlBsDoubleElement($identifier); |
| 105 | 106 | $group->setTagName("div"); |
| 106 | 107 | $group->setClass("form-group"); |
@@ -16,6 +16,10 @@ |
||
| 16 | 16 | class HtmlGridSystem extends HtmlBsDoubleElement { |
| 17 | 17 | private $rows; |
| 18 | 18 | |
| 19 | + /** |
|
| 20 | + * @param string $identifier |
|
| 21 | + * @param integer $numCols |
|
| 22 | + */ |
|
| 19 | 23 | public function __construct($identifier,$numRows=1,$numCols=NULL){ |
| 20 | 24 | parent::__construct($identifier,"div"); |
| 21 | 25 | $this->setProperty("class", "container-fluid"); |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function getRow($index,$force=true){ |
| 44 | 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 | } |