phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
HtmlGridRow.php
Go to the documentation of this file.
1<?php
2
4
8
11
12
20
21 private $_colSize;
22 private $_implicite=false;
23
24 public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){
25 parent::__construct( $identifier,"div","row");
26 $this->_implicite=$implicite;
27 $width=null;
28 if(isset($numCols)){
29 $numCols=min(16,$numCols);
30 $numCols=max(1,$numCols);
31 if($colSizing)
32 $width=(int)(16/$numCols);
33 else
34 $this->_colSize=16/$numCols;
35 for ($i=0;$i<$numCols;$i++){
36 $this->addItem($width);
37 }
38 }
39 }
40
46 public function setWidth($width){
47 if(\is_int($width)){
48 $width=Wide::getConstants()["W".$width];
49 }
50 $this->addToPropertyCtrl("class", $width, Wide::getConstants());
51 return $this->addToPropertyCtrl("class", "column",array("column"));
52 }
53
59 public function getCol($index){
60 return $this->getItem($index);
61 }
62
63 public function setColsCount($colsCount,$toCreate=true){
64 $this->setWidth($colsCount);
65 if($toCreate===true){
66 $count=$this->count();
67 for($i=$count;$i<$colsCount;$i++){
68 $this->addItem(null);
69 }
70 }
71 return $this;
72 }
73
74 public function addCols($colCount){
75 for($i=0;$i<$colCount;$i++){
76 $this->addItem(null);
77 }
78 return $this;
79 }
80
81 public function addCol($width=NULL){
82 return $this->addItem($width);
83 }
84
89 public function setStretched(){
90 return $this->addToProperty("class", "stretched");
91 }
92
97 public function setColor($color){
98 return $this->addToPropertyCtrl("class", $color,Color::getConstants());
99 }
100
101 public function setValues($values,$force=false){
102 $count=$this->count();
103 $valuesSize=\sizeof($values);
104 if($force===true){
105 for($i=$count;$i<$valuesSize;$i++){
106 $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null));
107 }
108 }
109 $count=\min(array($this->count(),$valuesSize));
110 for($i=0;$i<$count;$i++){
111 $this->content[$i]->setValue($values[$i]);
112 }
113 return $this;
114 }
115
120 protected function createItem($value){
121 $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value);
122 return $col;
123 }
124
125 public function compile(JsUtils $js=NULL,&$view=NULL){
126 if($this->_implicite===true){
127 $this->_template="%wrapContentBefore%%content%%wrapContentAfter%";
128 }
129 return parent::compile($js,$view);
130 }
131}
JQuery PHP library.
Definition JsUtils.php:23
addItem($item)
adds and returns an item
getItem($index)
Return the item at index.
Base class for Semantic Html collections.
addToProperty($name, $value, $separator=" ")
A col in the Semantic Grid component.
A row for the Semantic Grid component.
setColsCount($colsCount, $toCreate=true)
createItem($value)
The item factory.
__construct( $identifier, $numCols=NULL, $colSizing=false, $implicite=false)
compile(JsUtils $js=NULL, &$view=NULL)
getCol($index)
return the col at $index
setWidth($width)
Defines the row width.
setStretched()
stretch the row contents to take up the entire column height