@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | private $pages_visibles; |
| 10 | 10 | private $row_count; |
| 11 | 11 | |
| 12 | - public function __construct($items_per_page=10,$pages_visibles=null,$page=1,$row_count=null){ |
|
| 12 | + public function __construct($items_per_page=10, $pages_visibles=null, $page=1, $row_count=null) { |
|
| 13 | 13 | $this->items_per_page=$items_per_page; |
| 14 | 14 | $this->row_count=$row_count; |
| 15 | 15 | $this->page=$page; |
@@ -17,30 +17,30 @@ discard block |
||
| 17 | 17 | $this->visible=true; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function getObjects($objects){ |
|
| 20 | + public function getObjects($objects) { |
|
| 21 | 21 | $auto=(!isset($this->row_count)); |
| 22 | 22 | $os=$objects; |
| 23 | - if(!\is_array($os)){ |
|
| 23 | + if (!\is_array($os)) { |
|
| 24 | 24 | $os=[]; |
| 25 | - foreach ($objects as $o){ |
|
| 25 | + foreach ($objects as $o) { |
|
| 26 | 26 | $os[]=$o; |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - $this->page_count = 0; |
|
| 30 | - $row_count=($auto)?\sizeof($os):$this->row_count; |
|
| 31 | - if (0 === $row_count) { |
|
| 29 | + $this->page_count=0; |
|
| 30 | + $row_count=($auto) ?\sizeof($os) : $this->row_count; |
|
| 31 | + if (0===$row_count) { |
|
| 32 | 32 | $this->visible=false; |
| 33 | 33 | } else { |
| 34 | 34 | |
| 35 | - $this->page_count = (int)ceil($row_count / $this->items_per_page); |
|
| 35 | + $this->page_count=(int)ceil($row_count/$this->items_per_page); |
|
| 36 | 36 | $this->visible=$this->page_count>1; |
| 37 | - if($this->page > $this->page_count+1) { |
|
| 38 | - $this->page = 1; |
|
| 37 | + if ($this->page>$this->page_count+1) { |
|
| 38 | + $this->page=1; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | - if($auto){ |
|
| 42 | - $offset = ($this->page - 1) * $this->items_per_page; |
|
| 43 | - return array_slice($os, $offset,$this->items_per_page); |
|
| 41 | + if ($auto) { |
|
| 42 | + $offset=($this->page-1)*$this->items_per_page; |
|
| 43 | + return array_slice($os, $offset, $this->items_per_page); |
|
| 44 | 44 | } |
| 45 | 45 | return $os; |
| 46 | 46 | } |
@@ -76,22 +76,22 @@ discard block |
||
| 76 | 76 | return $this->page_count; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function getPagesNumbers(){ |
|
| 80 | - $middle= (int)ceil(($this->pages_visibles-1)/ 2); |
|
| 79 | + public function getPagesNumbers() { |
|
| 80 | + $middle=(int)ceil(($this->pages_visibles-1)/2); |
|
| 81 | 81 | $first=$this->page-$middle; |
| 82 | - if($first<1){ |
|
| 82 | + if ($first<1) { |
|
| 83 | 83 | $first=1; |
| 84 | 84 | } |
| 85 | 85 | $last=$first+$this->pages_visibles-1; |
| 86 | - if($last>$this->page_count){ |
|
| 86 | + if ($last>$this->page_count) { |
|
| 87 | 87 | $last=$this->page_count; |
| 88 | 88 | } |
| 89 | 89 | return \range($first, $last); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function setPagesVisibles($pages_visibles) { |
| 93 | - if(!isset($pages_visibles)) |
|
| 94 | - $pages_visibles=(int)ceil($this->row_count / $this->items_per_page)+1; |
|
| 93 | + if (!isset($pages_visibles)) |
|
| 94 | + $pages_visibles=(int)ceil($this->row_count/$this->items_per_page)+1; |
|
| 95 | 95 | $this->pages_visibles=$pages_visibles; |
| 96 | 96 | return $this; |
| 97 | 97 | } |
@@ -16,16 +16,16 @@ |
||
| 16 | 16 | return $this; |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function showDimmer(){ |
|
| 19 | + public function showDimmer() { |
|
| 20 | 20 | return $this->setBehavior("hide dimmer"); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setInverted(){ |
|
| 23 | + public function setInverted() { |
|
| 24 | 24 | $this->params["inverted"]=true; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function setOnHidden($jsCode) { |
| 28 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
| 28 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
| 29 | 29 | return $this->setParam("onHidden", "%function(){".$jsCode."}%"); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | abstract class HtmlViewItem extends HtmlSemDoubleElement { |
| 18 | 18 | use ContentPartTrait; |
| 19 | 19 | |
| 20 | - public function __construct($identifier,$baseClass,$content=NULL) { |
|
| 20 | + public function __construct($identifier, $baseClass, $content=NULL) { |
|
| 21 | 21 | parent::__construct($identifier, "div", $baseClass); |
| 22 | 22 | $this->content=["content"=>new HtmlViewContent("content-".$this->identifier)]; |
| 23 | - if(isset($content)) |
|
| 23 | + if (isset($content)) |
|
| 24 | 24 | $this->setContent($content); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setContent($value){ |
|
| 27 | + public function setContent($value) { |
|
| 28 | 28 | if (\is_array($value)) { |
| 29 | 29 | $image=JArray::getValue($value, "image", 0); |
| 30 | 30 | $content=JArray::getValue($value, "content", 1); |
@@ -32,57 +32,57 @@ discard block |
||
| 32 | 32 | if (isset($image)) { |
| 33 | 33 | $this->addImage($image); |
| 34 | 34 | } |
| 35 | - if(isset($content)) |
|
| 35 | + if (isset($content)) |
|
| 36 | 36 | $this->content["content"]->setContent($content); |
| 37 | - if(isset($extra)) |
|
| 37 | + if (isset($extra)) |
|
| 38 | 38 | $this->addExtraContent($extra); |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | private function createContent($content, $baseClass="content") { |
| 43 | 43 | $count=\sizeof($this->content); |
| 44 | - $result=new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 44 | + $result=new HtmlViewContent("content-".$count."-".$this->identifier, $content); |
|
| 45 | 45 | $result->setClass($baseClass); |
| 46 | 46 | return $result; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | private function addElementIn($key, $element) { |
| 50 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 50 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 51 | 51 | $this->content[$key]=[]; |
| 52 | 52 | } |
| 53 | - if($this->content[$key] instanceof HtmlViewContent) |
|
| 53 | + if ($this->content[$key] instanceof HtmlViewContent) |
|
| 54 | 54 | $this->content[$key]->addElement($element); |
| 55 | 55 | else |
| 56 | 56 | $this->content[$key][]=$element; |
| 57 | 57 | return $element; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public function addIcon($icon,$before=true){ |
|
| 61 | - return $this->addElementIn("icon",new HtmlIcon("icon-" . $this->identifier, $icon)); |
|
| 60 | + public function addIcon($icon, $before=true) { |
|
| 61 | + return $this->addElementIn("icon", new HtmlIcon("icon-".$this->identifier, $icon)); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | 65 | public function addHeader($header, $niveau=4, $type="page") { |
| 66 | 66 | if (!$header instanceof HtmlHeader) { |
| 67 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 67 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 68 | 68 | } |
| 69 | - return $this->addElementIn("header",$this->createContent($header)); |
|
| 69 | + return $this->addElementIn("header", $this->createContent($header)); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public function addImage($image, $title="") { |
| 73 | 73 | if (!$image instanceof HtmlImage) { |
| 74 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 74 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 75 | 75 | } |
| 76 | 76 | $image->setClass("ui image"); |
| 77 | - return $this->content["image"]= $image; |
|
| 77 | + return $this->content["image"]=$image; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL,$key="extra-content") { |
|
| 80 | + public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL, $key="extra-content") { |
|
| 81 | 81 | $reveal=$visibleContent; |
| 82 | 82 | if (!$visibleContent instanceof HtmlReveal) { |
| 83 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 83 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 84 | 84 | } |
| 85 | - return $this->content[$key]= $reveal; |
|
| 85 | + return $this->content[$key]=$reveal; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function addRevealImage($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | if (!$visibleContent instanceof HtmlReveal) { |
| 91 | 91 | return $this->addReveal(new HtmlImage("", $visibleContent), new HtmlImage("", $hiddenContent), $type, $attributeType); |
| 92 | 92 | } |
| 93 | - return $this->content["image"]= $reveal; |
|
| 93 | + return $this->content["image"]=$reveal; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | public function addExtraContent($content=array()) { |
| 97 | - return $this->content["extra-content"]= $this->createContent($content, "extra content"); |
|
| 97 | + return $this->content["extra-content"]=$this->createContent($content, "extra content"); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /*public function addContent($content=array(), $before=false) { |
@@ -112,23 +112,23 @@ discard block |
||
| 112 | 112 | * @param boolean $before |
| 113 | 113 | * @return HtmlButtonGroups |
| 114 | 114 | */ |
| 115 | - public function addContentButtons($elements=array(), $asIcons=false,$part="extra",$before=false){ |
|
| 116 | - return $this->content["content"]->addContentButtons($elements,$asIcons,$part, $before); |
|
| 115 | + public function addContentButtons($elements=array(), $asIcons=false, $part="extra", $before=false) { |
|
| 116 | + return $this->content["content"]->addContentButtons($elements, $asIcons, $part, $before); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| 121 | - public function addItemHeaderContent($header, $metas=array(), $description=NULL,$extra=NULL) { |
|
| 122 | - return $this->content["content"]->addHeaderContent($header, $metas, $description,$extra); |
|
| 121 | + public function addItemHeaderContent($header, $metas=array(), $description=NULL, $extra=NULL) { |
|
| 122 | + return $this->content["content"]->addHeaderContent($header, $metas, $description, $extra); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function addItemContent($content=array()) { |
| 126 | 126 | $count=\sizeof($this->content); |
| 127 | - return $this->addElementIn("content", new HtmlViewContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 127 | + return $this->addElementIn("content", new HtmlViewContent("content-".$count."-".$this->identifier, $content)); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public function getItemContent() { |
| 131 | - return $this->getPart("content",null,true); |
|
| 131 | + return $this->getPart("content", null, true); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | public function getItemExtraContent() { |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | * @see HtmlSemDoubleElement::compile() |
| 151 | 151 | */ |
| 152 | 152 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 153 | - $this->content=JArray::sortAssociative($this->content, ["header","image","icon","content","extra-content"]); |
|
| 153 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "icon", "content", "extra-content"]); |
|
| 154 | 154 | return parent::compile($js, $view); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - public function asLink($href="",$target=NULL) { |
|
| 157 | + public function asLink($href="", $target=NULL) { |
|
| 158 | 158 | $this->addToProperty("class", "link"); |
| 159 | - if ($href !== "") { |
|
| 159 | + if ($href!=="") { |
|
| 160 | 160 | $this->setProperty("href", $href); |
| 161 | 161 | if (isset($target)) |
| 162 | 162 | $this->setProperty("target", $target); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | abstract class HtmlViewGroups extends HtmlSemCollection { |
| 11 | 11 | |
| 12 | - public function __construct($identifier, $uiClass,$items=array()) { |
|
| 12 | + public function __construct($identifier, $uiClass, $items=array()) { |
|
| 13 | 13 | parent::__construct($identifier, "div", $uiClass); |
| 14 | 14 | $this->addItems($items); |
| 15 | 15 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param int $wide |
| 42 | 42 | */ |
| 43 | 43 | public function setWide($wide) { |
| 44 | - $wide=Wide::getConstants()["W" . $wide]; |
|
| 44 | + $wide=Wide::getConstants()["W".$wide]; |
|
| 45 | 45 | return $this->addToPropertyCtrl("class", $wide, Wide::getConstants()); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | return $this->addItem($function($object)); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function run(JsUtils $js){ |
|
| 62 | + public function run(JsUtils $js) { |
|
| 63 | 63 | $result=parent::run($js); |
| 64 | 64 | return $result->setItemSelector(".item"); |
| 65 | 65 | } |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | * @author jc |
| 8 | 8 | * @property HtmlTable $_self |
| 9 | 9 | */ |
| 10 | -trait TableTrait{ |
|
| 10 | +trait TableTrait { |
|
| 11 | 11 | |
| 12 | 12 | abstract public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false); |
| 13 | 13 | abstract public function getOn($event, $url, $responseElement="", $parameters=array()); |
| 14 | 14 | |
| 15 | - protected function addToPropertyTable($property,$value){ |
|
| 15 | + protected function addToPropertyTable($property, $value) { |
|
| 16 | 16 | return $this->_self->addToProperty($property, $value); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | public function setBasic($very=false) { |
| 24 | 24 | $table=$this->_self; |
| 25 | 25 | if ($very) |
| 26 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 27 | - return $table->addToPropertyCtrl("class", "basic", array ("basic" )); |
|
| 26 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 27 | + return $table->addToPropertyCtrl("class", "basic", array("basic")); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function setCompact($very=false) { |
| 31 | 31 | $table=$this->_self; |
| 32 | 32 | if ($very) |
| 33 | - $table->addToPropertyCtrl("class", "very", array ("very" )); |
|
| 34 | - return $table->addToPropertyCtrl("class", "compact", array ("compact" )); |
|
| 33 | + $table->addToPropertyCtrl("class", "very", array("very")); |
|
| 34 | + return $table->addToPropertyCtrl("class", "compact", array("compact")); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function setCollapsing() { |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | return $this->addToPropertyTable("class", "striped"); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false){ |
|
| 74 | - return $this->onRow("click", $jsCode,$stopPropagation,$preventDefault); |
|
| 73 | + public function onRowClick($jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 74 | + return $this->onRow("click", $jsCode, $stopPropagation, $preventDefault); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function onRow($event,$jsCode, $stopPropagation=false, $preventDefault=false){ |
|
| 78 | - return $this->_self->addEvent($event."{{tr}}",$jsCode,$stopPropagation,$preventDefault); |
|
| 77 | + public function onRow($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
|
| 78 | + return $this->_self->addEvent($event."{{tr}}", $jsCode, $stopPropagation, $preventDefault); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - public function getOnRow($event, $url, $responseElement="", $parameters=array()){ |
|
| 82 | - $parameters=\array_merge($parameters,["stopPropagation"=>false,"preventDefault"=>false]); |
|
| 83 | - return $this->_self->getOn($event."{{tbody tr}}", $url,$responseElement,$parameters); |
|
| 81 | + public function getOnRow($event, $url, $responseElement="", $parameters=array()) { |
|
| 82 | + $parameters=\array_merge($parameters, ["stopPropagation"=>false, "preventDefault"=>false]); |
|
| 83 | + return $this->_self->getOn($event."{{tbody tr}}", $url, $responseElement, $parameters); |
|
| 84 | 84 | } |
| 85 | 85 | } |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public function __construct($identifier, $rowCount, $colCount) { |
| 30 | 30 | parent::__construct($identifier, "table", "ui table"); |
| 31 | - $this->content=array (); |
|
| 31 | + $this->content=array(); |
|
| 32 | 32 | $this->setRowCount($rowCount, $colCount); |
| 33 | - $this->_variations=[ Variation::CELLED,Variation::PADDED,Variation::COMPACT ]; |
|
| 34 | - $this->_compileParts=["thead","tbody","tfoot"]; |
|
| 33 | + $this->_variations=[Variation::CELLED, Variation::PADDED, Variation::COMPACT]; |
|
| 34 | + $this->_compileParts=["thead", "tbody", "tfoot"]; |
|
| 35 | 35 | $this->_afterCompileEvents=[]; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | * @return HtmlTableContent |
| 42 | 42 | */ |
| 43 | 43 | public function getPart($key) { |
| 44 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 44 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 45 | 45 | $this->content[$key]=new HtmlTableContent("", $key); |
| 46 | - if ($key !== "tbody") { |
|
| 46 | + if ($key!=="tbody") { |
|
| 47 | 47 | $this->content[$key]->setRowCount(1, $this->_colCount); |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | return $this->content[$key]; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - protected function _getFirstPart(){ |
|
| 54 | - if(isset($this->content["thead"])){ |
|
| 53 | + protected function _getFirstPart() { |
|
| 54 | + if (isset($this->content["thead"])) { |
|
| 55 | 55 | return $this->content["thead"]; |
| 56 | 56 | } |
| 57 | 57 | return $this->content["tbody"]; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @return boolean |
| 97 | 97 | */ |
| 98 | 98 | public function hasPart($key) { |
| 99 | - return \array_key_exists($key, $this->content) === true; |
|
| 99 | + return \array_key_exists($key, $this->content)===true; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -229,8 +229,8 @@ discard block |
||
| 229 | 229 | return $this->colAlign($colIndex, "colLeft"); |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - public function setColAlignment($colIndex,$alignment){ |
|
| 233 | - switch ($alignment){ |
|
| 232 | + public function setColAlignment($colIndex, $alignment) { |
|
| 233 | + switch ($alignment) { |
|
| 234 | 234 | case TextAlignment::LEFT: |
| 235 | 235 | $function="colLeft"; |
| 236 | 236 | break; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | private function colAlign($colIndex, $function) { |
| 250 | 250 | if (\is_array($colIndex)) { |
| 251 | - foreach ( $colIndex as $cIndex ) { |
|
| 251 | + foreach ($colIndex as $cIndex) { |
|
| 252 | 252 | $this->colAlign($cIndex, $function); |
| 253 | 253 | } |
| 254 | 254 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | * @see HtmlSemDoubleElement::compile() |
| 310 | 310 | */ |
| 311 | 311 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 312 | - if(\sizeof($this->_compileParts)<3){ |
|
| 312 | + if (\sizeof($this->_compileParts)<3) { |
|
| 313 | 313 | $this->_template="%content%"; |
| 314 | 314 | $this->refresh(); |
| 315 | 315 | } |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | protected function compile_once(JsUtils $js=NULL, &$view=NULL) { |
| 321 | - parent::compile_once($js,$view); |
|
| 321 | + parent::compile_once($js, $view); |
|
| 322 | 322 | if ($this->propertyContains("class", "sortable")) { |
| 323 | - $this->addEvent("execute", "$('#" . $this->identifier . "').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
| 323 | + $this->addEvent("execute", "$('#".$this->identifier."').tablesort().data('tablesort').sort($('th.default-sort'));"); |
|
| 324 | 324 | } |
| 325 | - if(isset($this->_activeRowSelector)){ |
|
| 325 | + if (isset($this->_activeRowSelector)) { |
|
| 326 | 326 | $this->_activeRowSelector->compile(); |
| 327 | 327 | } |
| 328 | 328 | } |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | public function fromDatabaseObject($object, $function) { |
| 337 | 337 | $result=$function($object); |
| 338 | 338 | if (\is_array($result)) { |
| 339 | - $result= $this->addRow($function($object)); |
|
| 339 | + $result=$this->addRow($function($object)); |
|
| 340 | 340 | } else { |
| 341 | - $result= $this->getBody()->_addRow($result); |
|
| 341 | + $result=$this->getBody()->_addRow($result); |
|
| 342 | 342 | } |
| 343 | - if(isset($this->_afterCompileEvents["onNewRow"])){ |
|
| 344 | - if(\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 345 | - $this->_afterCompileEvents["onNewRow"]($result,$object); |
|
| 343 | + if (isset($this->_afterCompileEvents["onNewRow"])) { |
|
| 344 | + if (\is_callable($this->_afterCompileEvents["onNewRow"])) |
|
| 345 | + $this->_afterCompileEvents["onNewRow"]($result, $object); |
|
| 346 | 346 | } |
| 347 | 347 | return $result; |
| 348 | 348 | } |
@@ -357,14 +357,14 @@ discard block |
||
| 357 | 357 | return $this; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | - public function refresh(){ |
|
| 360 | + public function refresh() { |
|
| 361 | 361 | $this->_footer=$this->getFooter(); |
| 362 | 362 | $this->addEvent("execute", '$("#'.$this->identifier.' tfoot").replaceWith("'.\addslashes($this->_footer).'");'); |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - public function run(JsUtils $js){ |
|
| 366 | - $result= parent::run($js); |
|
| 367 | - if(isset($this->_footer)) |
|
| 365 | + public function run(JsUtils $js) { |
|
| 366 | + $result=parent::run($js); |
|
| 367 | + if (isset($this->_footer)) |
|
| 368 | 368 | $this->_footer->run($js); |
| 369 | 369 | return $result; |
| 370 | 370 | } |
@@ -387,47 +387,47 @@ discard block |
||
| 387 | 387 | * @param boolean $multiple |
| 388 | 388 | * @return HtmlTable |
| 389 | 389 | */ |
| 390 | - public function setActiveRowSelector($class="active",$event="click",$multiple=false){ |
|
| 391 | - $this->_activeRowSelector=new ActiveRow($this,$class,$event,$multiple); |
|
| 390 | + public function setActiveRowSelector($class="active", $event="click", $multiple=false) { |
|
| 391 | + $this->_activeRowSelector=new ActiveRow($this, $class, $event, $multiple); |
|
| 392 | 392 | return $this; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - public function hideColumn($colIndex){ |
|
| 396 | - if(isset($this->content["thead"])){ |
|
| 395 | + public function hideColumn($colIndex) { |
|
| 396 | + if (isset($this->content["thead"])) { |
|
| 397 | 397 | $this->content["thead"]->hideColumn($colIndex); |
| 398 | 398 | } |
| 399 | 399 | $this->content["tbody"]->hideColumn($colIndex); |
| 400 | - if(isset($this->content["tfoot"])){ |
|
| 400 | + if (isset($this->content["tfoot"])) { |
|
| 401 | 401 | $this->content["tfoot"]->hideColumn($colIndex); |
| 402 | 402 | } |
| 403 | 403 | return $this; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - public function setColWidth($colIndex,$width){ |
|
| 406 | + public function setColWidth($colIndex, $width) { |
|
| 407 | 407 | $part=$this->_getFirstPart(); |
| 408 | - if($part!==null && $part->count()>0) |
|
| 408 | + if ($part!==null && $part->count()>0) |
|
| 409 | 409 | $part->getCell(0, $colIndex)->setWidth($width); |
| 410 | 410 | return $this; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - public function setColWidths($widths){ |
|
| 413 | + public function setColWidths($widths) { |
|
| 414 | 414 | $part=$this->_getFirstPart(); |
| 415 | - if($part!==null && $part->count()>0){ |
|
| 415 | + if ($part!==null && $part->count()>0) { |
|
| 416 | 416 | $count=$part->getColCount(); |
| 417 | - if(!\is_array($widths)){ |
|
| 417 | + if (!\is_array($widths)) { |
|
| 418 | 418 | $widths=\array_fill(0, $count, $widths); |
| 419 | 419 | } |
| 420 | - $max=\min(\sizeof($widths),$count); |
|
| 421 | - for($i=0;$i<$max;$i++){ |
|
| 420 | + $max=\min(\sizeof($widths), $count); |
|
| 421 | + for ($i=0; $i<$max; $i++) { |
|
| 422 | 422 | $part->getCell(0, $i)->setWidth($widths[$i]); |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | return $this; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - public function mergeIdentiqualValues($colIndex,$function="strip_tags"){ |
|
| 428 | + public function mergeIdentiqualValues($colIndex, $function="strip_tags") { |
|
| 429 | 429 | $body=$this->getBody(); |
| 430 | - $body->mergeIdentiqualValues($colIndex,$function); |
|
| 430 | + $body->mergeIdentiqualValues($colIndex, $function); |
|
| 431 | 431 | return $this; |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | if (isset($label)) |
| 37 | 37 | $this->setLabel($label); |
| 38 | - foreach ( $fields as $field ) { |
|
| 38 | + foreach ($fields as $field) { |
|
| 39 | 39 | $this->addItem($field); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | public function addItem($item) { |
| 59 | 59 | $item=parent::addItem($item); |
| 60 | - if($item instanceof HtmlFormField) |
|
| 60 | + if ($item instanceof HtmlFormField) |
|
| 61 | 61 | $item->setContainer($this); |
| 62 | 62 | return $item; |
| 63 | 63 | } |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
| 101 | - $fields=array (); |
|
| 101 | + $fields=array(); |
|
| 102 | 102 | $i=0; |
| 103 | - foreach ( $items as $val => $caption ) { |
|
| 103 | + foreach ($items as $val => $caption) { |
|
| 104 | 104 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
| 105 | 105 | if ($val===$value) { |
| 106 | 106 | $itemO->getDataField()->setProperty("checked", ""); |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
| 117 | - $fields=array (); |
|
| 117 | + $fields=array(); |
|
| 118 | 118 | $i=0; |
| 119 | - foreach ( $items as $val => $caption ) { |
|
| 119 | + foreach ($items as $val => $caption) { |
|
| 120 | 120 | $itemO=new HtmlFormCheckbox($name."-".$i++, $caption, $val, $type); |
| 121 | 121 | $itemO->setName($name); |
| 122 | 122 | if (\array_search($val, $values)!==false) { |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | public function setFocusable($value=true) { |
| 58 | - if ($value === true) |
|
| 58 | + if ($value===true) |
|
| 59 | 59 | $this->setProperty("tabindex", "0"); |
| 60 | 60 | else { |
| 61 | 61 | $this->removeProperty("tabindex"); |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | public function setAnimated($content, $animation="") { |
| 67 | 67 | $this->setTagName("div"); |
| 68 | - $this->addToProperty("class", "animated " . $animation); |
|
| 69 | - $visible=new HtmlSemDoubleElement("visible-" . $this->identifier, "div"); |
|
| 68 | + $this->addToProperty("class", "animated ".$animation); |
|
| 69 | + $visible=new HtmlSemDoubleElement("visible-".$this->identifier, "div"); |
|
| 70 | 70 | $visible->setClass("visible content"); |
| 71 | 71 | $visible->setContent($this->content); |
| 72 | - $hidden=new HtmlSemDoubleElement("hidden-" . $this->identifier, "div"); |
|
| 72 | + $hidden=new HtmlSemDoubleElement("hidden-".$this->identifier, "div"); |
|
| 73 | 73 | $hidden->setClass("hidden content"); |
| 74 | 74 | $hidden->setContent($content); |
| 75 | - $this->content=array ($visible,$hidden ); |
|
| 75 | + $this->content=array($visible, $hidden); |
|
| 76 | 76 | return $hidden; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | public function asIcon($icon) { |
| 85 | 85 | $iconO=$icon; |
| 86 | 86 | if (\is_string($icon)) { |
| 87 | - $iconO=new HtmlIcon("icon-" . $this->identifier, $icon); |
|
| 87 | + $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
|
| 88 | 88 | } |
| 89 | 89 | $this->addToProperty("class", "icon"); |
| 90 | 90 | $this->content=$iconO; |
@@ -104,17 +104,17 @@ discard block |
||
| 104 | 104 | * @return HtmlLabel |
| 105 | 105 | */ |
| 106 | 106 | public function addLabel($label, $before=false, $icon=NULL) { |
| 107 | - $this->tagName="div";$prefix=""; |
|
| 108 | - if($before) |
|
| 107 | + $this->tagName="div"; $prefix=""; |
|
| 108 | + if ($before) |
|
| 109 | 109 | $prefix="left "; |
| 110 | 110 | $this->addToProperty("class", $prefix."labeled"); |
| 111 | 111 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
| 112 | - $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
|
| 113 | - if($isIcon){ |
|
| 112 | + $this->content=new HtmlButton("button-".$this->identifier, $this->content); |
|
| 113 | + if ($isIcon) { |
|
| 114 | 114 | $this->content->addClass("icon"); |
| 115 | 115 | } |
| 116 | 116 | $this->content->setTagName("div"); |
| 117 | - $label=new HtmlLabel("label-" . $this->identifier, $label, $icon,"a"); |
|
| 117 | + $label=new HtmlLabel("label-".$this->identifier, $label, $icon, "a"); |
|
| 118 | 118 | $label->setBasic(); |
| 119 | 119 | $this->addContent($label, $before); |
| 120 | 120 | return $label; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function fromArray($array) { |
| 128 | 128 | $array=parent::fromArray($array); |
| 129 | - foreach ( $array as $key => $value ) { |
|
| 129 | + foreach ($array as $key => $value) { |
|
| 130 | 130 | $this->setProperty($key, $value); |
| 131 | 131 | } |
| 132 | 132 | return $array; |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | return $this->addToProperty("class", "positive"); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function setColor($color){ |
|
| 144 | - if(\is_array($this->content)){ |
|
| 145 | - foreach ($this->content as $content){ |
|
| 146 | - if($content instanceof HtmlButton) |
|
| 143 | + public function setColor($color) { |
|
| 144 | + if (\is_array($this->content)) { |
|
| 145 | + foreach ($this->content as $content) { |
|
| 146 | + if ($content instanceof HtmlButton) |
|
| 147 | 147 | $content->setColor($color); |
| 148 | 148 | } |
| 149 | 149 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @return HtmlButton |
| 202 | 202 | */ |
| 203 | 203 | public static function social($identifier, $social, $value=NULL) { |
| 204 | - if ($value === NULL) |
|
| 204 | + if ($value===NULL) |
|
| 205 | 205 | $value=\ucfirst($social); |
| 206 | 206 | $return=new HtmlButton($identifier, $value); |
| 207 | 207 | $return->addIcon($social); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | * {@inheritDoc} |
| 239 | 239 | * @see HtmlSemDoubleElement::asLink() |
| 240 | 240 | */ |
| 241 | - public function asLink($href=NULL,$target=NULL) { |
|
| 242 | - parent::asLink($href,$target); |
|
| 241 | + public function asLink($href=NULL, $target=NULL) { |
|
| 242 | + parent::asLink($href, $target); |
|
| 243 | 243 | return $this; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | * @param string $icon |
| 253 | 253 | * @return HtmlButtonGroups |
| 254 | 254 | */ |
| 255 | - public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
|
| 256 | - $result=new HtmlButtonGroups($identifier,[$value]); |
|
| 257 | - $result->addDropdown($items,$asCombo); |
|
| 258 | - if(isset($icon)) |
|
| 255 | + public static function dropdown($identifier, $value, $items=[], $asCombo=false, $icon=null) { |
|
| 256 | + $result=new HtmlButtonGroups($identifier, [$value]); |
|
| 257 | + $result->addDropdown($items, $asCombo); |
|
| 258 | + if (isset($icon)) |
|
| 259 | 259 | $result->setIcon($icon); |
| 260 | 260 | return $result; |
| 261 | 261 | } |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | protected $image; |
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $content=NULL) { |
| 12 | - parent::__construct($identifier,"item",$content); |
|
| 12 | + parent::__construct($identifier, "item", $content); |
|
| 13 | 13 | } |
| 14 | - protected function initContent($content){ |
|
| 15 | - if(\is_array($content)){ |
|
| 16 | - if(JArray::isAssociative($content)===false){ |
|
| 14 | + protected function initContent($content) { |
|
| 15 | + if (\is_array($content)) { |
|
| 16 | + if (JArray::isAssociative($content)===false) { |
|
| 17 | 17 | $icon=@$content[0]; |
| 18 | 18 | $title=@$content[1]; |
| 19 | 19 | $desc=@$content[2]; |
| 20 | - }else{ |
|
| 20 | + } else { |
|
| 21 | 21 | $icon=@$content["icon"]; |
| 22 | 22 | $image=@$content["image"]; |
| 23 | 23 | $title=@$content["title"]; |
@@ -25,38 +25,38 @@ discard block |
||
| 25 | 25 | $desc=@$content["description"]; |
| 26 | 26 | $items=@$content["items"]; |
| 27 | 27 | } |
| 28 | - if(isset($icon)){ |
|
| 28 | + if (isset($icon)) { |
|
| 29 | 29 | $this->setIcon($icon); |
| 30 | 30 | } |
| 31 | - if(isset($image)){ |
|
| 31 | + if (isset($image)) { |
|
| 32 | 32 | $this->setImage($image); |
| 33 | 33 | } |
| 34 | - if(isset($title)){ |
|
| 35 | - $this->setTitle($title,$desc); |
|
| 36 | - }elseif (isset($header)){ |
|
| 37 | - $this->setTitle($header,$desc,"header"); |
|
| 34 | + if (isset($title)) { |
|
| 35 | + $this->setTitle($title, $desc); |
|
| 36 | + }elseif (isset($header)) { |
|
| 37 | + $this->setTitle($header, $desc, "header"); |
|
| 38 | 38 | } |
| 39 | - if(isset($items)){ |
|
| 39 | + if (isset($items)) { |
|
| 40 | 40 | $this->addList($items); |
| 41 | 41 | } |
| 42 | - }else{ |
|
| 42 | + } else { |
|
| 43 | 43 | $this->setContent($content); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - public function addList($items=array(),$ordered=false) { |
|
| 46 | + public function addList($items=array(), $ordered=false) { |
|
| 47 | 47 | $list=new HtmlList("", $items); |
| 48 | - if($ordered) |
|
| 48 | + if ($ordered) |
|
| 49 | 49 | $list->setOrdered(); |
| 50 | 50 | $list->setClass("list"); |
| 51 | 51 | $this->content["list"]=$list; |
| 52 | 52 | return $list; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function getList(){ |
|
| 55 | + public function getList() { |
|
| 56 | 56 | return $this->content["list"]; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function getItem($index){ |
|
| 59 | + public function getItem($index) { |
|
| 60 | 60 | return $this->getList()->getItem($index); |
| 61 | 61 | } |
| 62 | 62 | } |