@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | class HtmlPopup extends HtmlSemDoubleElement { |
| 13 | 13 | private $params; |
| 14 | 14 | private $_container; |
| 15 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
| 15 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
| 16 | 16 | parent::__construct($identifier, "div"); |
| 17 | 17 | $this->_container=$container; |
| 18 | 18 | $this->setClass("ui popup"); |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | $this->params=array("on"=>"hover"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function addList($items=array(),$header=NULL){ |
|
| 24 | - if(!$this->content instanceof HtmlGrid){ |
|
| 25 | - $this->content=new HtmlGrid("grid-".$this->identifier,0); |
|
| 23 | + public function addList($items=array(), $header=NULL) { |
|
| 24 | + if (!$this->content instanceof HtmlGrid) { |
|
| 25 | + $this->content=new HtmlGrid("grid-".$this->identifier, 0); |
|
| 26 | 26 | } |
| 27 | 27 | $grid=$this->content; |
| 28 | 28 | |
| 29 | 29 | $colCount=$grid->colCount(); |
| 30 | 30 | $grid->setNumCols(++$colCount); |
| 31 | 31 | |
| 32 | - $list=new HtmlList("",$items); |
|
| 32 | + $list=new HtmlList("", $items); |
|
| 33 | 33 | $list->asLink(); |
| 34 | - if(isset($header)){ |
|
| 35 | - $list->addHeader(4,$header); |
|
| 34 | + if (isset($header)) { |
|
| 35 | + $list->addHeader(4, $header); |
|
| 36 | 36 | } |
| 37 | - $grid->getCell(0,$colCount-1)->setContent($list); |
|
| 37 | + $grid->getCell(0, $colCount-1)->setContent($list); |
|
| 38 | 38 | $grid->setDivided()->setRelaxed(true); |
| 39 | 39 | return $list; |
| 40 | 40 | } |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * A popup can have no maximum width and continue to flow to fit its content |
| 44 | 44 | */ |
| 45 | - public function setFlowing(){ |
|
| 45 | + public function setFlowing() { |
|
| 46 | 46 | return $this->addToProperty("class", "flowing"); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * A popup can provide more basic formatting |
| 51 | 51 | */ |
| 52 | - public function setBasic(){ |
|
| 52 | + public function setBasic() { |
|
| 53 | 53 | return $this->addToProperty("class", "basic"); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -57,22 +57,22 @@ discard block |
||
| 57 | 57 | * {@inheritDoc} |
| 58 | 58 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 59 | 59 | */ |
| 60 | - public function run(JsUtils $js){ |
|
| 60 | + public function run(JsUtils $js) { |
|
| 61 | 61 | $this->params["popup"]="#".$this->identifier; |
| 62 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->params); |
|
| 62 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->params); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function setOn($event="click"){ |
|
| 65 | + public function setOn($event="click") { |
|
| 66 | 66 | $this->params["on"]=$event; |
| 67 | 67 | return $this; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public function setInline($value=true){ |
|
| 70 | + public function setInline($value=true) { |
|
| 71 | 71 | $this->params["inline"]=$value; |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function setPosition($position){ |
|
| 75 | + public function setPosition($position) { |
|
| 76 | 76 | $this->params["position"]=$position; |
| 77 | 77 | return $this; |
| 78 | 78 | } |
@@ -16,24 +16,24 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGridRow extends HtmlSemCollection{ |
|
| 19 | +class HtmlGridRow extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | |
| 22 | 22 | private $_colSize; |
| 23 | 23 | private $_implicite=false; |
| 24 | 24 | |
| 25 | - public function __construct( $identifier,$numCols=NULL,$colSizing=false,$implicite=false){ |
|
| 26 | - parent::__construct( $identifier,"div","row"); |
|
| 25 | + public function __construct($identifier, $numCols=NULL, $colSizing=false, $implicite=false) { |
|
| 26 | + parent::__construct($identifier, "div", "row"); |
|
| 27 | 27 | $this->_implicite=$implicite; |
| 28 | 28 | $width=null; |
| 29 | - if(isset($numCols)){ |
|
| 30 | - $numCols=min(16,$numCols); |
|
| 31 | - $numCols=max(1,$numCols); |
|
| 32 | - if($colSizing) |
|
| 33 | - $width=(int)(16/$numCols); |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | + $numCols=min(16, $numCols); |
|
| 31 | + $numCols=max(1, $numCols); |
|
| 32 | + if ($colSizing) |
|
| 33 | + $width=(int) (16 / $numCols); |
|
| 34 | 34 | else |
| 35 | - $this->_colSize=16/$numCols; |
|
| 36 | - for ($i=0;$i<$numCols;$i++){ |
|
| 35 | + $this->_colSize=16 / $numCols; |
|
| 36 | + for ($i=0; $i<$numCols; $i++) { |
|
| 37 | 37 | $this->addItem($width); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @param int $width |
| 45 | 45 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 46 | 46 | */ |
| 47 | - public function setWidth($width){ |
|
| 48 | - if(\is_int($width)){ |
|
| 47 | + public function setWidth($width) { |
|
| 48 | + if (\is_int($width)) { |
|
| 49 | 49 | $width=Wide::getConstants()["W".$width]; |
| 50 | 50 | } |
| 51 | 51 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 52 | - return $this->addToPropertyCtrl("class", "column",array("column")); |
|
| 52 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | * @param int $index |
| 58 | 58 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 59 | 59 | */ |
| 60 | - public function getCol($index){ |
|
| 60 | + public function getCol($index) { |
|
| 61 | 61 | return $this->getItem($index); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public function setColsCount($colsCount,$toCreate=true){ |
|
| 64 | + public function setColsCount($colsCount, $toCreate=true) { |
|
| 65 | 65 | $this->setWidth($colsCount); |
| 66 | - if($toCreate===true){ |
|
| 66 | + if ($toCreate===true) { |
|
| 67 | 67 | $count=$this->count(); |
| 68 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 68 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 69 | 69 | $this->addItem(null); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * stretch the row contents to take up the entire column height |
| 77 | 77 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 78 | 78 | */ |
| 79 | - public function setStretched(){ |
|
| 79 | + public function setStretched() { |
|
| 80 | 80 | return $this->addToProperty("class", "stretched"); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -84,19 +84,19 @@ discard block |
||
| 84 | 84 | * @param string $color |
| 85 | 85 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 86 | 86 | */ |
| 87 | - public function setColor($color){ |
|
| 88 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 87 | + public function setColor($color) { |
|
| 88 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public function setValues($values,$force=false){ |
|
| 91 | + public function setValues($values, $force=false) { |
|
| 92 | 92 | $count=$this->count(); |
| 93 | - if($force===true){ |
|
| 94 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 95 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 93 | + if ($force===true) { |
|
| 94 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 95 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 99 | - for($i=0;$i<$count;$i++){ |
|
| 98 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 99 | + for ($i=0; $i<$count; $i++) { |
|
| 100 | 100 | $this->content[$i]->setValue($values[$i]); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -105,15 +105,15 @@ discard block |
||
| 105 | 105 | * {@inheritDoc} |
| 106 | 106 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 107 | 107 | */ |
| 108 | - protected function createItem($value){ |
|
| 109 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 108 | + protected function createItem($value) { |
|
| 109 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 110 | 110 | return $col; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
| 114 | - if($this->_implicite===true){ |
|
| 113 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
| 114 | + if ($this->_implicite===true) { |
|
| 115 | 115 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 116 | 116 | } |
| 117 | - return parent::compile($js,$view); |
|
| 117 | + return parent::compile($js, $view); |
|
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | 120 | \ No newline at end of file |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | * @author jc |
| 14 | 14 | * @version 1.001 |
| 15 | 15 | */ |
| 16 | -class HtmlGridCol extends HtmlSemDoubleElement{ |
|
| 16 | +class HtmlGridCol extends HtmlSemDoubleElement { |
|
| 17 | 17 | use TextAlignmentTrait; |
| 18 | - public function __construct($identifier,$width=NULL){ |
|
| 19 | - parent::__construct($identifier,"div"); |
|
| 18 | + public function __construct($identifier, $width=NULL) { |
|
| 19 | + parent::__construct($identifier, "div"); |
|
| 20 | 20 | $this->setClass("column"); |
| 21 | - if(isset($width)) |
|
| 21 | + if (isset($width)) |
|
| 22 | 22 | $this->setWidth($width); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | * @param int $width |
| 28 | 28 | * @return \Ajax\semantic\html\content\HtmlGridCol |
| 29 | 29 | */ |
| 30 | - public function setWidth($width){ |
|
| 31 | - if(\is_int($width)){ |
|
| 30 | + public function setWidth($width) { |
|
| 31 | + if (\is_int($width)) { |
|
| 32 | 32 | $width=Wide::getConstants()["W".$width]; |
| 33 | 33 | } |
| 34 | 34 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 35 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
| 35 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -40,17 +40,17 @@ discard block |
||
| 40 | 40 | * @param Direction $value left or right |
| 41 | 41 | * @return \Ajax\semantic\html\content\HtmlGridCol |
| 42 | 42 | */ |
| 43 | - public function setFloated($value="left"){ |
|
| 44 | - return $this->addToPropertyCtrl("class", $value." floated",Direction::getConstantValues("floated")); |
|
| 43 | + public function setFloated($value="left") { |
|
| 44 | + return $this->addToPropertyCtrl("class", $value." floated", Direction::getConstantValues("floated")); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
| 48 | - public function setValue($value){ |
|
| 48 | + public function setValue($value) { |
|
| 49 | 49 | $this->content=$value; |
| 50 | 50 | return $this; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function setValues($value){ |
|
| 53 | + public function setValues($value) { |
|
| 54 | 54 | return $this->setValue($value); |
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | \ No newline at end of file |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | * @param string $type one of text,item |
| 35 | 35 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 36 | 36 | */ |
| 37 | - public function setType($type=""){ |
|
| 38 | - return $this->addToPropertyCtrl("class", $type, array("","item","text")); |
|
| 37 | + public function setType($type="") { |
|
| 38 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setActiveItem($index){ |
|
| 41 | + public function setActiveItem($index) { |
|
| 42 | 42 | $item=$this->getItem($index); |
| 43 | - if($item!==null){ |
|
| 43 | + if ($item!==null) { |
|
| 44 | 44 | $item->addToProperty("class", "active"); |
| 45 | 45 | } |
| 46 | 46 | return $this; |
@@ -50,26 +50,26 @@ discard block |
||
| 50 | 50 | * {@inheritDoc} |
| 51 | 51 | * @see \Ajax\common\html\html5\HtmlCollection::addItem() |
| 52 | 52 | */ |
| 53 | - public function addItem($item){ |
|
| 54 | - if($item instanceof HtmlInput || $item instanceof HtmlImg){ |
|
| 55 | - $itemO=new HtmlSemDoubleElement("item-".$this->identifier,"div",""); |
|
| 53 | + public function addItem($item) { |
|
| 54 | + if ($item instanceof HtmlInput || $item instanceof HtmlImg) { |
|
| 55 | + $itemO=new HtmlSemDoubleElement("item-".$this->identifier, "div", ""); |
|
| 56 | 56 | $itemO->setContent($item); |
| 57 | 57 | $item=$itemO; |
| 58 | 58 | } |
| 59 | 59 | $item=parent::addItem($item); |
| 60 | - if(!$item instanceof HtmlMenu) |
|
| 61 | - $item->addToPropertyCtrl("class", "item",array("item")); |
|
| 62 | - else{ |
|
| 60 | + if (!$item instanceof HtmlMenu) |
|
| 61 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 62 | + else { |
|
| 63 | 63 | $this->setSecondary(); |
| 64 | 64 | } |
| 65 | 65 | return $item; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function generateMenuAsItem($menu,$header=null){ |
|
| 68 | + public function generateMenuAsItem($menu, $header=null) { |
|
| 69 | 69 | $count=$this->count(); |
| 70 | - $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count,"div"); |
|
| 71 | - if(isset($header)){ |
|
| 72 | - $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count,"div","header"); |
|
| 70 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 71 | + if (isset($header)) { |
|
| 72 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 73 | 73 | $headerItem->setContent($header); |
| 74 | 74 | $item->addContent($headerItem); |
| 75 | 75 | } |
@@ -77,24 +77,24 @@ discard block |
||
| 77 | 77 | $item->addContent($menu); |
| 78 | 78 | return $item; |
| 79 | 79 | } |
| 80 | - public function addMenuAsItem($menu,$header=null){ |
|
| 81 | - return $this->addItem($this->generateMenuAsItem($menu,$header)); |
|
| 80 | + public function addMenuAsItem($menu, $header=null) { |
|
| 81 | + return $this->addItem($this->generateMenuAsItem($menu, $header)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function addPopupAsItem($value,$identifier, $content=""){ |
|
| 85 | - $value=new HtmlSemDoubleElement($identifier,"a","browse item",$value); |
|
| 84 | + public function addPopupAsItem($value, $identifier, $content="") { |
|
| 85 | + $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
|
| 86 | 86 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 87 | 87 | $value=$this->addItem($value); |
| 88 | - $popup=new HtmlPopup($value,"popup-".$this->identifier."-".$this->count(),$content); |
|
| 88 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 89 | 89 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 90 | - $this->wrap("",$popup); |
|
| 90 | + $this->wrap("", $popup); |
|
| 91 | 91 | return $popup; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - public function addDropdownAsItem($value,$items=NULL){ |
|
| 94 | + public function addDropdownAsItem($value, $items=NULL) { |
|
| 95 | 95 | $dd=$value; |
| 96 | - if(\is_string($value)){ |
|
| 97 | - $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(),$value,$items); |
|
| 96 | + if (\is_string($value)) { |
|
| 97 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 98 | 98 | } |
| 99 | 99 | return $this->addItem($dd); |
| 100 | 100 | } |
@@ -103,51 +103,51 @@ discard block |
||
| 103 | 103 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 104 | 104 | */ |
| 105 | 105 | protected function createItem($value) { |
| 106 | - $itemO=new HtmlLink("item-".\sizeof($this->content),"",$value); |
|
| 106 | + $itemO=new HtmlLink("item-".\sizeof($this->content), "", $value); |
|
| 107 | 107 | return $itemO->setClass("item"); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - public function setInverted(){ |
|
| 110 | + public function setInverted() { |
|
| 111 | 111 | return $this->addToProperty("class", "inverted"); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function setSecondary(){ |
|
| 114 | + public function setSecondary() { |
|
| 115 | 115 | return $this->addToProperty("class", "secondary"); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - public function setVertical(){ |
|
| 119 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 118 | + public function setVertical() { |
|
| 119 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - public function setPosition($value="right"){ |
|
| 123 | - return $this->addToPropertyCtrl("class", $value,array("right","left")); |
|
| 122 | + public function setPosition($value="right") { |
|
| 123 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function setPointing($value=Direction::NONE){ |
|
| 127 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 126 | + public function setPointing($value=Direction::NONE) { |
|
| 127 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - public function asTab($vertical=false){ |
|
| 131 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
| 132 | - if($vertical===true) |
|
| 130 | + public function asTab($vertical=false) { |
|
| 131 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
| 132 | + if ($vertical===true) |
|
| 133 | 133 | $this->setVertical(); |
| 134 | 134 | return $this->addToProperty("class", "tabular"); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function asPagination(){ |
|
| 138 | - $this->apply(function(HtmlDoubleElement &$item){$item->setTagName("a");}); |
|
| 137 | + public function asPagination() { |
|
| 138 | + $this->apply(function(HtmlDoubleElement & $item) {$item->setTagName("a"); }); |
|
| 139 | 139 | return $this->addToProperty("class", "pagination"); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - public function setFixed(){ |
|
| 142 | + public function setFixed() { |
|
| 143 | 143 | return $this->addToProperty("class", "fixed"); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - public function setFluid(){ |
|
| 146 | + public function setFluid() { |
|
| 147 | 147 | return $this->addToProperty("class", "fluid"); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - public function setCompact(){ |
|
| 150 | + public function setCompact() { |
|
| 151 | 151 | return $this->addToProperty("class", "compact"); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function fromDatabaseObject($object, $function) { |
| 158 | 158 | $return=$function($object); |
| 159 | - if(\is_array($return)) |
|
| 159 | + if (\is_array($return)) |
|
| 160 | 160 | $this->addItems($return); |
| 161 | 161 | else |
| 162 | 162 | $this->addItem($return); |
@@ -167,15 +167,15 @@ discard block |
||
| 167 | 167 | * @param int $width |
| 168 | 168 | * @return \Ajax\semantic\html\collections\menus\HtmlMenu |
| 169 | 169 | */ |
| 170 | - public function setWidth($width){ |
|
| 171 | - if(\is_int($width)){ |
|
| 170 | + public function setWidth($width) { |
|
| 171 | + if (\is_int($width)) { |
|
| 172 | 172 | $width=Wide::getConstants()["W".$width]; |
| 173 | 173 | } |
| 174 | 174 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 175 | - return $this->addToPropertyCtrl("class", "item",array("item")); |
|
| 175 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - public function addImage($identifier, $src="", $alt=""){ |
|
| 179 | - return $this->addItem(new HtmlImg($identifier,$src,$alt)); |
|
| 178 | + public function addImage($identifier, $src="", $alt="") { |
|
| 179 | + return $this->addItem(new HtmlImg($identifier, $src, $alt)); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | \ No newline at end of file |
@@ -16,31 +16,31 @@ discard block |
||
| 16 | 16 | * @author jc |
| 17 | 17 | * @version 1.001 |
| 18 | 18 | */ |
| 19 | -class HtmlGrid extends HtmlSemCollection{ |
|
| 19 | +class HtmlGrid extends HtmlSemCollection { |
|
| 20 | 20 | use TextAlignmentTrait; |
| 21 | 21 | private $_createCols; |
| 22 | 22 | private $_colSizing=true; |
| 23 | 23 | private $_implicitRows=false; |
| 24 | - public function __construct( $identifier,$numRows=1,$numCols=NULL,$createCols=true,$implicitRows=false){ |
|
| 25 | - parent::__construct( $identifier, "div","ui grid"); |
|
| 24 | + public function __construct($identifier, $numRows=1, $numCols=NULL, $createCols=true, $implicitRows=false) { |
|
| 25 | + parent::__construct($identifier, "div", "ui grid"); |
|
| 26 | 26 | $this->_implicitRows=$implicitRows; |
| 27 | 27 | $this->_createCols=$createCols; |
| 28 | - if(isset($numCols)){ |
|
| 28 | + if (isset($numCols)) { |
|
| 29 | 29 | //if($this->_createCols){ |
| 30 | 30 | $this->_colSizing=false; |
| 31 | 31 | //} |
| 32 | 32 | $this->setWide($numCols); |
| 33 | 33 | } |
| 34 | - $this->setRowsCount($numRows,$numCols); |
|
| 34 | + $this->setRowsCount($numRows, $numCols); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setWide($wide){ |
|
| 37 | + public function setWide($wide) { |
|
| 38 | 38 | $wide=Wide::getConstants()["W".$wide]; |
| 39 | 39 | $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 40 | - return $this->addToPropertyCtrl("class","column",array("column")); |
|
| 40 | + return $this->addToPropertyCtrl("class", "column", array("column")); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function addRow($colsCount=NULL){ |
|
| 43 | + public function addRow($colsCount=NULL) { |
|
| 44 | 44 | return $this->addItem($colsCount); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -50,41 +50,41 @@ discard block |
||
| 50 | 50 | * @param int $colsCount |
| 51 | 51 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 52 | 52 | */ |
| 53 | - public function setRowsCount($rowsCount,$colsCount=NULL){ |
|
| 53 | + public function setRowsCount($rowsCount, $colsCount=NULL) { |
|
| 54 | 54 | $count=$this->count(); |
| 55 | - if($rowsCount<2){ |
|
| 56 | - for($i=$count;$i<$colsCount;$i++){ |
|
| 55 | + if ($rowsCount<2) { |
|
| 56 | + for ($i=$count; $i<$colsCount; $i++) { |
|
| 57 | 57 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
| 58 | 58 | } |
| 59 | - }else{ |
|
| 60 | - if($this->hasOnlyCols($count)){ |
|
| 59 | + }else { |
|
| 60 | + if ($this->hasOnlyCols($count)) { |
|
| 61 | 61 | $tmpContent=$this->content; |
| 62 | 62 | $item=$this->addItem($colsCount); |
| 63 | 63 | $item->setContent($tmpContent); |
| 64 | 64 | $this->content=array(); |
| 65 | 65 | $count=1; |
| 66 | 66 | } |
| 67 | - for($i=$count;$i<$rowsCount;$i++){ |
|
| 67 | + for ($i=$count; $i<$rowsCount; $i++) { |
|
| 68 | 68 | $this->addItem($colsCount); |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | return $this; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - protected function hasOnlyCols($count){ |
|
| 74 | + protected function hasOnlyCols($count) { |
|
| 75 | 75 | return $count>0 && $this->content[0] instanceof HtmlGridCol; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function setColsCount($numCols,$toCreate=true){ |
|
| 78 | + public function setColsCount($numCols, $toCreate=true) { |
|
| 79 | 79 | $this->setWide($numCols); |
| 80 | - if($toCreate==true){ |
|
| 80 | + if ($toCreate==true) { |
|
| 81 | 81 | $count=$this->count(); |
| 82 | - if($count==0 || $this->hasOnlyCols($count)){ |
|
| 83 | - for($i=$count;$i<$numCols;$i++){ |
|
| 82 | + if ($count==0 || $this->hasOnlyCols($count)) { |
|
| 83 | + for ($i=$count; $i<$numCols; $i++) { |
|
| 84 | 84 | $this->addItem(new HtmlGridCol("col-".$this->identifier."-".$i)); |
| 85 | 85 | } |
| 86 | - }else{ |
|
| 87 | - for($i=0;$i<$count;$i++){ |
|
| 86 | + }else { |
|
| 87 | + for ($i=0; $i<$count; $i++) { |
|
| 88 | 88 | $this->getItem($i)->setNumCols($numCols); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * @param int $index |
| 98 | 98 | * @return \Ajax\semantic\html\collections\HtmlGridRow |
| 99 | 99 | */ |
| 100 | - public function getRow($index){ |
|
| 100 | + public function getRow($index) { |
|
| 101 | 101 | return $this->getItem($index); |
| 102 | 102 | } |
| 103 | 103 | |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | * @param int $col |
| 107 | 107 | * @return \Ajax\semantic\html\collections\HtmlGridCol |
| 108 | 108 | */ |
| 109 | - public function getCell($row,$col){ |
|
| 110 | - if($row<2 && $this->hasOnlyCols($this->count())) |
|
| 109 | + public function getCell($row, $col) { |
|
| 110 | + if ($row<2 && $this->hasOnlyCols($this->count())) |
|
| 111 | 111 | return $this->getItem($col); |
| 112 | 112 | $row=$this->getItem($row); |
| 113 | - if(isset($row)){ |
|
| 113 | + if (isset($row)) { |
|
| 114 | 114 | $col=$row->getItem($col); |
| 115 | 115 | } |
| 116 | 116 | return $col; |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * @param boolean $vertically |
| 122 | 122 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 123 | 123 | */ |
| 124 | - public function setDivided($vertically=false){ |
|
| 125 | - $value=($vertically===true)?"vertically divided":"divided"; |
|
| 126 | - return $this->addToPropertyCtrl("class", $value,array("divided")); |
|
| 124 | + public function setDivided($vertically=false) { |
|
| 125 | + $value=($vertically===true) ? "vertically divided" : "divided"; |
|
| 126 | + return $this->addToPropertyCtrl("class", $value, array("divided")); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -131,16 +131,16 @@ discard block |
||
| 131 | 131 | * @param boolean $internally true for internal cells |
| 132 | 132 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 133 | 133 | */ |
| 134 | - public function setCelled($internally=false){ |
|
| 135 | - $value=($internally===true)?"internally celled":"celled"; |
|
| 136 | - return $this->addToPropertyCtrl("class", $value,array("celled","internally celled")); |
|
| 134 | + public function setCelled($internally=false) { |
|
| 135 | + $value=($internally===true) ? "internally celled" : "celled"; |
|
| 136 | + return $this->addToPropertyCtrl("class", $value, array("celled", "internally celled")); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * automatically resize all elements to split the available width evenly |
| 141 | 141 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 142 | 142 | */ |
| 143 | - public function setEqualWidth(){ |
|
| 143 | + public function setEqualWidth() { |
|
| 144 | 144 | return $this->addToProperty("class", "equal width"); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -149,9 +149,9 @@ discard block |
||
| 149 | 149 | * @param string $value |
| 150 | 150 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 151 | 151 | */ |
| 152 | - public function setPadded($value=NULL){ |
|
| 153 | - if(isset($value)) |
|
| 154 | - $this->addToPropertyCtrl("class", $value,array("vertically","horizontally")); |
|
| 152 | + public function setPadded($value=NULL) { |
|
| 153 | + if (isset($value)) |
|
| 154 | + $this->addToPropertyCtrl("class", $value, array("vertically", "horizontally")); |
|
| 155 | 155 | return $this->addToProperty("class", "padded"); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -159,49 +159,49 @@ discard block |
||
| 159 | 159 | * @param boolean $very |
| 160 | 160 | * @return \Ajax\semantic\html\collections\HtmlGrid |
| 161 | 161 | */ |
| 162 | - public function setRelaxed($very=false){ |
|
| 163 | - $value=($very===true)?"very relaxed":"relaxed"; |
|
| 164 | - return $this->addToPropertyCtrl("class", $value,array("relaxed","very relaxed")); |
|
| 162 | + public function setRelaxed($very=false) { |
|
| 163 | + $value=($very===true) ? "very relaxed" : "relaxed"; |
|
| 164 | + return $this->addToPropertyCtrl("class", $value, array("relaxed", "very relaxed")); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - public function setVerticalAlignment($value=VerticalAlignment::MIDDLE){ |
|
| 168 | - return $this->addToPropertyCtrl("class", $value." aligned",VerticalAlignment::getConstantValues("aligned")); |
|
| 167 | + public function setVerticalAlignment($value=VerticalAlignment::MIDDLE) { |
|
| 168 | + return $this->addToPropertyCtrl("class", $value." aligned", VerticalAlignment::getConstantValues("aligned")); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * {@inheritDoc} |
| 173 | 173 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 174 | 174 | */ |
| 175 | - protected function createItem($value){ |
|
| 176 | - if($this->_createCols===false) |
|
| 175 | + protected function createItem($value) { |
|
| 176 | + if ($this->_createCols===false) |
|
| 177 | 177 | $value=null; |
| 178 | - $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1),$value,$this->_colSizing,$this->_implicitRows); |
|
| 178 | + $item=new HtmlGridRow($this->identifier."-row-".($this->count()+1), $value, $this->_colSizing, $this->_implicitRows); |
|
| 179 | 179 | return $item; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - public function setValues($values){ |
|
| 182 | + public function setValues($values) { |
|
| 183 | 183 | $count=$this->count(); |
| 184 | - if($this->_createCols===false){ |
|
| 185 | - for($i=$count;$i<\sizeof($values);$i++){ |
|
| 184 | + if ($this->_createCols===false) { |
|
| 185 | + for ($i=$count; $i<\sizeof($values); $i++) { |
|
| 186 | 186 | $colSize=\sizeof($values[$i]); |
| 187 | - $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1),$colSize,$this->_colSizing,$this->_implicitRows)); |
|
| 187 | + $this->addItem(new HtmlGridRow($this->identifier."-row-".($this->count()+1), $colSize, $this->_colSizing, $this->_implicitRows)); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | - $count=\min(array($this->count(),\sizeof($values))); |
|
| 191 | - for($i=0;$i<$count;$i++){ |
|
| 192 | - $this->content[$i]->setValues($values[$i],$this->_createCols===false); |
|
| 190 | + $count=\min(array($this->count(), \sizeof($values))); |
|
| 191 | + for ($i=0; $i<$count; $i++) { |
|
| 192 | + $this->content[$i]->setValues($values[$i], $this->_createCols===false); |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - public function rowCount(){ |
|
| 196 | + public function rowCount() { |
|
| 197 | 197 | return $this->count(); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - public function colCount(){ |
|
| 200 | + public function colCount() { |
|
| 201 | 201 | $result=0; |
| 202 | 202 | $count=$this->count(); |
| 203 | - if($count>0){ |
|
| 204 | - if($this->content[0] instanceof HtmlGridCol) |
|
| 203 | + if ($count>0) { |
|
| 204 | + if ($this->content[0] instanceof HtmlGridCol) |
|
| 205 | 205 | $result=$count; |
| 206 | 206 | else |
| 207 | 207 | $result=$this->content[0]->count(); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * stretch the row contents to take up the entire column height |
| 214 | 214 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 215 | 215 | */ |
| 216 | - public function setStretched(){ |
|
| 216 | + public function setStretched() { |
|
| 217 | 217 | return $this->addToProperty("class", "stretched"); |
| 218 | 218 | } |
| 219 | 219 | |
@@ -5,34 +5,34 @@ |
||
| 5 | 5 | use Ajax\semantic\html\base\HtmlSemCollection; |
| 6 | 6 | use Ajax\semantic\html\content\HtmlListItem; |
| 7 | 7 | |
| 8 | -class HtmlList extends HtmlSemCollection{ |
|
| 8 | +class HtmlList extends HtmlSemCollection { |
|
| 9 | 9 | |
| 10 | 10 | |
| 11 | - public function __construct( $identifier, $items=array()){ |
|
| 12 | - parent::__construct( $identifier, "div", "ui list"); |
|
| 11 | + public function __construct($identifier, $items=array()) { |
|
| 12 | + parent::__construct($identifier, "div", "ui list"); |
|
| 13 | 13 | $this->addItems($items); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | |
| 17 | - protected function createItem($value){ |
|
| 17 | + protected function createItem($value) { |
|
| 18 | 18 | $count=$this->count(); |
| 19 | - if(\is_array($value)){ |
|
| 19 | + if (\is_array($value)) { |
|
| 20 | 20 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
| 21 | 21 | $item->addIcon($value[1]); |
| 22 | 22 | }else |
| 23 | - $item= new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 23 | + $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
|
| 24 | 24 | return $item; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function addHeader($niveau,$content){ |
|
| 28 | - return $this->wrap(new HtmlHeader("header-".$this->identifier,$niveau,$content,"page")); |
|
| 27 | + public function addHeader($niveau, $content) { |
|
| 28 | + return $this->wrap(new HtmlHeader("header-".$this->identifier, $niveau, $content, "page")); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function itemsAs($tagName){ |
|
| 31 | + public function itemsAs($tagName) { |
|
| 32 | 32 | return $this->contentAs($tagName); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function asLink(){ |
|
| 35 | + public function asLink() { |
|
| 36 | 36 | $this->addToPropertyCtrl("class", "link", array("link")); |
| 37 | 37 | return $this->contentAs("a"); |
| 38 | 38 | } |