@@ -22,6 +22,11 @@ discard block |
||
| 22 | 22 | protected $_contentSeparator=""; |
| 23 | 23 | |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + * @param string $tagName |
|
| 28 | + * @param string $baseClass |
|
| 29 | + */ |
|
| 25 | 30 | public function __construct($identifier,$tagName,$baseClass){ |
| 26 | 31 | parent::__construct($identifier,$tagName,$baseClass); |
| 27 | 32 | $this->root=""; |
@@ -31,7 +36,7 @@ discard block |
||
| 31 | 36 | /** |
| 32 | 37 | * Associate an ajax get to the elements, displayed in $targetSelector |
| 33 | 38 | * @param string $targetSelector the target of the get |
| 34 | - * @return HtmlNavElement |
|
| 39 | + * @return HtmlSemNavElement |
|
| 35 | 40 | */ |
| 36 | 41 | public function autoGetOnClick($targetSelector){ |
| 37 | 42 | return $this->getOnClick($this->root, $targetSelector,array("attr"=>$this->attr)); |
@@ -63,7 +68,7 @@ discard block |
||
| 63 | 68 | /** |
| 64 | 69 | * Define the html attribute for each element url in ajax |
| 65 | 70 | * @param string $attr html attribute |
| 66 | - * @return HtmlNavElement |
|
| 71 | + * @return HtmlSemNavElement |
|
| 67 | 72 | */ |
| 68 | 73 | public function setAttr($attr) { |
| 69 | 74 | $this->attr = $attr; |
@@ -103,6 +108,9 @@ discard block |
||
| 103 | 108 | return $this; |
| 104 | 109 | } |
| 105 | 110 | |
| 111 | + /** |
|
| 112 | + * @param integer $index |
|
| 113 | + */ |
|
| 106 | 114 | protected function getContentDivider($index){ |
| 107 | 115 | if(\is_array($this->_contentSeparator)===true){ |
| 108 | 116 | return @$this->_contentSeparator[$index]; |
@@ -14,89 +14,89 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class HtmlGridRow extends HtmlBsDoubleElement { |
| 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){ |
|
| 42 | + public function getCol($index, $force=true) { |
|
| 43 | 43 | $result=null; |
| 44 | - if($index<sizeof($this->cols)+1){ |
|
| 44 | + if ($index<sizeof($this->cols)+1) { |
|
| 45 | 45 | $result=$this->cols[$index-1]; |
| 46 | - }else if ($force){ |
|
| 47 | - $result=$this->addColAt(CssSize::SIZE_MD,1,$index); |
|
| 46 | + }else if ($force) { |
|
| 47 | + $result=$this->addColAt(CssSize::SIZE_MD, 1, $index); |
|
| 48 | 48 | } |
| 49 | 49 | return $result; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function getColAt($offset,$force=true){ |
|
| 52 | + public function getColAt($offset, $force=true) { |
|
| 53 | 53 | $result=null; |
| 54 | - foreach ($this->cols as $col){ |
|
| 54 | + foreach ($this->cols as $col) { |
|
| 55 | 55 | $offsets=$col->getOffsets(); |
| 56 | - if($result=array_search($offset, $offsets)){ |
|
| 56 | + if ($result=array_search($offset, $offsets)) { |
|
| 57 | 57 | break; |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | - if(!$result || isset($result)==false){ |
|
| 61 | - $result=$this->getCol($offset,$force); |
|
| 60 | + if (!$result || isset($result)==false) { |
|
| 61 | + $result=$this->getCol($offset, $force); |
|
| 62 | 62 | } |
| 63 | 63 | return $result; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 67 | 67 | |
| 68 | - foreach ($this->cols as $col){ |
|
| 68 | + foreach ($this->cols as $col) { |
|
| 69 | 69 | $this->addContent($col); |
| 70 | 70 | } |
| 71 | - return parent::compile($js,$view); |
|
| 71 | + return parent::compile($js, $view); |
|
| 72 | 72 | } |
| 73 | 73 | public function getCols() { |
| 74 | 74 | return $this->cols; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function setContentForAll($content){ |
|
| 78 | - foreach ($this->cols as $col){ |
|
| 77 | + public function setContentForAll($content) { |
|
| 78 | + foreach ($this->cols as $col) { |
|
| 79 | 79 | $col->setContent($content); |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | - public function merge($size=CssSize::SIZE_MD,$start,$width){ |
|
| 83 | - $col=$this->getColAt($start,false); |
|
| 84 | - if(isset($col)){ |
|
| 85 | - $col->setWidth($size,$width+1); |
|
| 86 | - $this->delete($size,$start+1, $width); |
|
| 82 | + public function merge($size=CssSize::SIZE_MD, $start, $width) { |
|
| 83 | + $col=$this->getColAt($start, false); |
|
| 84 | + if (isset($col)) { |
|
| 85 | + $col->setWidth($size, $width+1); |
|
| 86 | + $this->delete($size, $start+1, $width); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - public function delete($size=CssSize::SIZE_MD,$start,$width){ |
|
| 90 | - while($start<sizeof($this->cols)+1 && $width>0){ |
|
| 91 | - $col=$this->getColAt($start,false); |
|
| 92 | - if(isset($col)){ |
|
| 89 | + public function delete($size=CssSize::SIZE_MD, $start, $width) { |
|
| 90 | + while ($start<sizeof($this->cols)+1 && $width>0) { |
|
| 91 | + $col=$this->getColAt($start, false); |
|
| 92 | + if (isset($col)) { |
|
| 93 | 93 | $widthCol=$col->getWidth($size); |
| 94 | - if($widthCol<=$width){ |
|
| 94 | + if ($widthCol<=$width) { |
|
| 95 | 95 | unset($this->cols[$start-1]); |
| 96 | - $this->cols = array_values($this->cols); |
|
| 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 | } |