phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
HtmlGridSystem.php
Go to the documentation of this file.
1 <?php
2 namespace Ajax\bootstrap\html;
3 
7 use Ajax\JsUtils;
8 
9 
17  private $rows;
18 
19  public function __construct($identifier,$numRows=1,$numCols=NULL){
20  parent::__construct($identifier,"div");
21  $this->setProperty("class", "container-fluid");
22  $this->rows=array();
23  $this->setNumRows($numRows,$numCols);
24  }
25 
31  public function addRow($numCols=NULL){
32  $row=new HtmlGridRow($this->identifier."-row-".(sizeof($this->rows)+1),$numCols);
33  $this->rows[]=$row;
34  return $row;
35  }
36 
43  public function getRow($index,$force=true){
44  if($index<sizeof($this->rows)){
45  $result=$this->rows[$index-1];
46  }else if ($force){
47  $this->setNumRows($index);
48  $result=$this->rows[$index-1];
49  }
50  return $result;
51  }
52 
59  public function setNumRows($numRows,$numCols=NULL){
60  for($i=sizeof($this->rows);$i<$numRows;$i++){
61  $this->addRow($numCols);
62  }
63  return $this;
64  }
65 
72  public function getCell($row,$col,$force=true){
73  $row=$this->getRow($row,$force);
74  if(isset($row)){
75  $col=$row->getCol($col,$force);
76  }
77  return $col;
78  }
79 
85  public function getCellAt($row,$col,$force=true){
86  $row=$this->getRow($row,$force);
87  if(isset($row)){
88  $col=$row->getColAt($col,$force);
89  }
90  return $col;
91  }
92 
93  public function compile(JsUtils $js=NULL, &$view=NULL) {
94  foreach ($this->rows as $row){
95  $this->addContent($row);
96  }
97  return parent::compile($js,$view);
98  }
99  public function setContentForAll($content){
100  foreach ($this->rows as $row){
101  $row->setContentForAll($content);
102  }
103  }
104 }
getCellAt($row, $col, $force=true)
getCell($row, $col, $force=true)
addRow($numCols=NULL)
Add a new row.
addContent($content, $before=false)
Composant Twitter Bootstrap Grid system.
getRow($index, $force=true)
return the row at $index
__construct($identifier, $numRows=1, $numCols=NULL)
compile(JsUtils $js=NULL, &$view=NULL)
JQuery PHP library.
Definition: JsUtils.php:23
Inner element for Twitter Bootstrap Grid row.
Definition: HtmlGridRow.php:15
setNumRows($numRows, $numCols=NULL)
Create $numRows rows.