@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class HtmlCard extends HtmlViewItem { |
| 8 | 8 | |
| 9 | - public function __construct($identifier,$content=NULL) { |
|
| 9 | + public function __construct($identifier, $content=NULL) { |
|
| 10 | 10 | parent::__construct($identifier, "ui card", $content); |
| 11 | 11 | } |
| 12 | 12 | } |
@@ -14,64 +14,64 @@ |
||
| 14 | 14 | protected $params; |
| 15 | 15 | protected $semElement; |
| 16 | 16 | |
| 17 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
| 17 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
| 18 | 18 | $this->semElement=$semElement; |
| 19 | 19 | $this->title=$title; |
| 20 | 20 | $this->content=$content; |
| 21 | - $this->setAttributes($variation,$params); |
|
| 21 | + $this->setAttributes($variation, $params); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function setHtml($html) { |
| 25 | - $this->html= $html; |
|
| 25 | + $this->html=$html; |
|
| 26 | 26 | return $this; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - public function setAttributes($variation=NULL,$params=array()){ |
|
| 29 | + public function setAttributes($variation=NULL, $params=array()) { |
|
| 30 | 30 | $this->variation=$variation; |
| 31 | 31 | $this->params=$params; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function onShow($jsCode){ |
|
| 34 | + public function onShow($jsCode) { |
|
| 35 | 35 | $this->params["onShow"]=$jsCode; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function compile(JsUtils $js=NULL){ |
|
| 39 | - if(JString::isNotNull($this->title)){ |
|
| 38 | + public function compile(JsUtils $js=NULL) { |
|
| 39 | + if (JString::isNotNull($this->title)) { |
|
| 40 | 40 | $this->semElement->addToProperty("data-title", $this->title); |
| 41 | 41 | } |
| 42 | - if(JString::isNotNull($this->content)){ |
|
| 42 | + if (JString::isNotNull($this->content)) { |
|
| 43 | 43 | $this->semElement->addToProperty("data-content", $this->content); |
| 44 | 44 | } |
| 45 | 45 | $this->_compileHtml($js); |
| 46 | - if(JString::isNotNull($this->variation)){ |
|
| 46 | + if (JString::isNotNull($this->variation)) { |
|
| 47 | 47 | $this->semElement->addToProperty("data-variation", $this->variation); |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - private function _compileHtml(JsUtils $js=NULL){ |
|
| 52 | - if(JString::isNotNull($this->html)){ |
|
| 51 | + private function _compileHtml(JsUtils $js=NULL) { |
|
| 52 | + if (JString::isNotNull($this->html)) { |
|
| 53 | 53 | $html=$this->html; |
| 54 | - if(\is_array($html)){ |
|
| 54 | + if (\is_array($html)) { |
|
| 55 | 55 | \array_walk($html, function(&$item) use($js){ |
| 56 | - if($item instanceof HtmlSemDoubleElement){ |
|
| 56 | + if ($item instanceof HtmlSemDoubleElement) { |
|
| 57 | 57 | $comp=$item->compile($js); |
| 58 | - if(isset($js)){ |
|
| 58 | + if (isset($js)) { |
|
| 59 | 59 | $bs=$item->run($js); |
| 60 | - if(isset($bs)) |
|
| 60 | + if (isset($bs)) |
|
| 61 | 61 | $this->params['onShow']=$bs->getScript(); |
| 62 | 62 | } |
| 63 | 63 | $item=$comp; |
| 64 | 64 | } |
| 65 | 65 | }); |
| 66 | - $html=\implode("",$html); |
|
| 66 | + $html=\implode("", $html); |
|
| 67 | 67 | } |
| 68 | 68 | $html=\str_replace("\"", "'", $html); |
| 69 | 69 | $this->semElement->addToProperty("data-html", $html); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function run(JsUtils $js){ |
|
| 74 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
| 73 | + public function run(JsUtils $js) { |
|
| 74 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function setWidth($width) { |
| 32 | 32 | if (\is_int($width)) { |
| 33 | - $width=Wide::getConstants()["W" . $width]; |
|
| 33 | + $width=Wide::getConstants()["W".$width]; |
|
| 34 | 34 | } |
| 35 | 35 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 36 | - return $this->addToPropertyCtrl("class", "wide", array ("wide" )); |
|
| 36 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function setValue($value) { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $divider->setVertical(); |
| 52 | 52 | else |
| 53 | 53 | $divider->setHorizontal(); |
| 54 | - $this->wrap($divider,""); |
|
| 54 | + $this->wrap($divider, ""); |
|
| 55 | 55 | return $divider; |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -12,34 +12,34 @@ discard block |
||
| 12 | 12 | use Ajax\semantic\html\base\traits\MenuItemTrait; |
| 13 | 13 | |
| 14 | 14 | class HtmlDropdownItem extends HtmlSemDoubleElement { |
| 15 | - use IconTrait,MenuItemTrait; |
|
| 16 | - public function __construct($identifier, $content="",$value=NULL,$image=NULL,$description=NULL) { |
|
| 15 | + use IconTrait, MenuItemTrait; |
|
| 16 | + public function __construct($identifier, $content="", $value=NULL, $image=NULL, $description=NULL) { |
|
| 17 | 17 | parent::__construct($identifier, "a"); |
| 18 | 18 | $this->setClass("item"); |
| 19 | 19 | $this->setContent($content); |
| 20 | - if($value!==NULL) |
|
| 20 | + if ($value!==NULL) |
|
| 21 | 21 | $this->setData($value); |
| 22 | - if($image!==NULL) |
|
| 22 | + if ($image!==NULL) |
|
| 23 | 23 | $this->asMiniAvatar($image); |
| 24 | - if($description!==NULL) |
|
| 24 | + if ($description!==NULL) |
|
| 25 | 25 | $this->setDescription($description); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function setDescription($description){ |
|
| 29 | - $descO=new HtmlDoubleElement("desc-".$this->identifier,"span"); |
|
| 28 | + public function setDescription($description) { |
|
| 29 | + $descO=new HtmlDoubleElement("desc-".$this->identifier, "span"); |
|
| 30 | 30 | $descO->setClass("description"); |
| 31 | 31 | $descO->setContent($description); |
| 32 | - return $this->addContent($descO,true); |
|
| 32 | + return $this->addContent($descO, true); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function setData($value){ |
|
| 35 | + public function setData($value) { |
|
| 36 | 36 | $this->setProperty("data-value", $value); |
| 37 | 37 | return $this; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function asOption(){ |
|
| 40 | + public function asOption() { |
|
| 41 | 41 | $this->tagName="option"; |
| 42 | - if($this->getProperty("data-value")!==null) |
|
| 42 | + if ($this->getProperty("data-value")!==null) |
|
| 43 | 43 | $this->setProperty("value", $this->getProperty("data-value")); |
| 44 | 44 | } |
| 45 | 45 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * @param string $image the image src |
| 48 | 48 | * @return \Ajax\common\html\html5\HtmlImg |
| 49 | 49 | */ |
| 50 | - public function asMiniAvatar($image){ |
|
| 50 | + public function asMiniAvatar($image) { |
|
| 51 | 51 | $this->tagName="div"; |
| 52 | - $img=new HtmlImg("image-".$this->identifier,$image); |
|
| 52 | + $img=new HtmlImg("image-".$this->identifier, $image); |
|
| 53 | 53 | $img->setClass("ui mini avatar image"); |
| 54 | - $this->addContent($img,true); |
|
| 54 | + $this->addContent($img, true); |
|
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | * @param string $icon |
| 61 | 61 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 62 | 62 | */ |
| 63 | - public function asIcon($caption,$icon){ |
|
| 63 | + public function asIcon($caption, $icon) { |
|
| 64 | 64 | $this->setContent($caption); |
| 65 | - $this->addContent(new HtmlIcon("", $icon),true); |
|
| 65 | + $this->addContent(new HtmlIcon("", $icon), true); |
|
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -71,23 +71,23 @@ discard block |
||
| 71 | 71 | * @param string $color |
| 72 | 72 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 73 | 73 | */ |
| 74 | - public function asCircularLabel($caption,$color){ |
|
| 74 | + public function asCircularLabel($caption, $color) { |
|
| 75 | 75 | $this->setContent($caption); |
| 76 | 76 | $lbl=new HtmlLabel(""); |
| 77 | 77 | $lbl->setCircular()->setColor($color)->setEmpty(); |
| 78 | - $this->addContent($lbl,true); |
|
| 78 | + $this->addContent($lbl, true); |
|
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | public function addMenuItem($items) { |
| 85 | - $menu=new HtmlMenu("menu-" . $this->identifier, $items); |
|
| 85 | + $menu=new HtmlMenu("menu-".$this->identifier, $items); |
|
| 86 | 86 | $content=$this->content; |
| 87 | 87 | $this->setTagName("div"); |
| 88 | 88 | $this->setProperty("class", "item"); |
| 89 | 89 | $icon=new HtmlIcon("", "dropdown"); |
| 90 | - $this->content=[$icon,new HtmlSemDoubleElement("","span","text",$content),$menu]; |
|
| 90 | + $this->content=[$icon, new HtmlSemDoubleElement("", "span", "text", $content), $menu]; |
|
| 91 | 91 | return $menu; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | * @param string $icon |
| 97 | 97 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 98 | 98 | */ |
| 99 | - public static function searchInput($placeholder=NULL,$icon=NULL){ |
|
| 100 | - return (new HtmlDropdownItem(""))->asSearchInput($placeholder,$icon); |
|
| 99 | + public static function searchInput($placeholder=NULL, $icon=NULL) { |
|
| 100 | + return (new HtmlDropdownItem(""))->asSearchInput($placeholder, $icon); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 105 | 105 | */ |
| 106 | - public static function divider(){ |
|
| 106 | + public static function divider() { |
|
| 107 | 107 | return (new HtmlDropdownItem(""))->asDivider(); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * @param string $icon |
| 113 | 113 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 114 | 114 | */ |
| 115 | - public static function header($caption=NULL,$icon=NULL){ |
|
| 116 | - return (new HtmlDropdownItem(""))->asHeader($caption,$icon); |
|
| 115 | + public static function header($caption=NULL, $icon=NULL) { |
|
| 116 | + return (new HtmlDropdownItem(""))->asHeader($caption, $icon); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -121,8 +121,8 @@ discard block |
||
| 121 | 121 | * @param string $color |
| 122 | 122 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 123 | 123 | */ |
| 124 | - public static function circular($caption,$color){ |
|
| 125 | - return (new HtmlDropdownItem(""))->asCircularLabel($caption,$color); |
|
| 124 | + public static function circular($caption, $color) { |
|
| 125 | + return (new HtmlDropdownItem(""))->asCircularLabel($caption, $color); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | /** |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | * @param string $icon |
| 131 | 131 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 132 | 132 | */ |
| 133 | - public static function icon($caption,$icon){ |
|
| 134 | - return (new HtmlDropdownItem(""))->asIcon($caption,$icon); |
|
| 133 | + public static function icon($caption, $icon) { |
|
| 134 | + return (new HtmlDropdownItem(""))->asIcon($caption, $icon); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @param unknown $image |
| 140 | 140 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 141 | 141 | */ |
| 142 | - public static function avatar($caption,$image){ |
|
| 143 | - return (new HtmlDropdownItem("",$caption))->asMiniAvatar($image); |
|
| 142 | + public static function avatar($caption, $image) { |
|
| 143 | + return (new HtmlDropdownItem("", $caption))->asMiniAvatar($image); |
|
| 144 | 144 | } |
| 145 | 145 | } |
@@ -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) |
|
| 29 | + if (isset($numCols)) { |
|
| 30 | + $numCols=min(16, $numCols); |
|
| 31 | + $numCols=max(1, $numCols); |
|
| 32 | + if ($colSizing) |
|
| 33 | 33 | $width=(int)(16/$numCols); |
| 34 | 34 | else |
| 35 | 35 | $this->_colSize=16/$numCols; |
| 36 | - for ($i=0;$i<$numCols;$i++){ |
|
| 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,29 +57,29 @@ 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 | } |
| 72 | 72 | return $this; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function addCols($colCount){ |
|
| 76 | - for($i=0;$i<$colCount;$i++){ |
|
| 75 | + public function addCols($colCount) { |
|
| 76 | + for ($i=0; $i<$colCount; $i++) { |
|
| 77 | 77 | $this->addItem(null); |
| 78 | 78 | } |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function addCol($width=NULL){ |
|
| 82 | + public function addCol($width=NULL) { |
|
| 83 | 83 | return $this->addItem($width); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * stretch the row contents to take up the entire column height |
| 88 | 88 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 89 | 89 | */ |
| 90 | - public function setStretched(){ |
|
| 90 | + public function setStretched() { |
|
| 91 | 91 | return $this->addToProperty("class", "stretched"); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | * @param string $color |
| 96 | 96 | * @return \Ajax\semantic\html\content\HtmlGridRow |
| 97 | 97 | */ |
| 98 | - public function setColor($color){ |
|
| 99 | - return $this->addToPropertyCtrl("class", $color,Color::getConstants()); |
|
| 98 | + public function setColor($color) { |
|
| 99 | + return $this->addToPropertyCtrl("class", $color, Color::getConstants()); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function setValues($values,$force=false){ |
|
| 102 | + public function setValues($values, $force=false) { |
|
| 103 | 103 | $count=$this->count(); |
| 104 | 104 | $valuesSize=\sizeof($values); |
| 105 | - if($force===true){ |
|
| 106 | - for($i=$count;$i<$valuesSize;$i++){ |
|
| 107 | - $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1),null)); |
|
| 105 | + if ($force===true) { |
|
| 106 | + for ($i=$count; $i<$valuesSize; $i++) { |
|
| 107 | + $this->addItem(new HtmlGridCol($this->identifier."-col-".($this->count()+1), null)); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | - $count=\min(array($this->count(),$valuesSize)); |
|
| 111 | - for($i=0;$i<$count;$i++){ |
|
| 110 | + $count=\min(array($this->count(), $valuesSize)); |
|
| 111 | + for ($i=0; $i<$count; $i++) { |
|
| 112 | 112 | $this->content[$i]->setValue($values[$i]); |
| 113 | 113 | } |
| 114 | 114 | return $this; |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | * {@inheritDoc} |
| 119 | 119 | * @see \Ajax\common\html\HtmlCollection::createItem() |
| 120 | 120 | */ |
| 121 | - protected function createItem($value){ |
|
| 122 | - $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1),$value); |
|
| 121 | + protected function createItem($value) { |
|
| 122 | + $col=new HtmlGridCol($this->identifier."-col-".($this->count()+1), $value); |
|
| 123 | 123 | return $col; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - public function compile(JsUtils $js=NULL,&$view=NULL){ |
|
| 127 | - if($this->_implicite===true){ |
|
| 126 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 127 | + if ($this->_implicite===true) { |
|
| 128 | 128 | $this->_template="%wrapContentBefore%%content%%wrapContentAfter%"; |
| 129 | 129 | } |
| 130 | - return parent::compile($js,$view); |
|
| 130 | + return parent::compile($js, $view); |
|
| 131 | 131 | } |
| 132 | 132 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param string $event |
| 22 | 22 | * @param boolean $multiple |
| 23 | 23 | */ |
| 24 | - public function __construct($table,$class="active",$event="click",$multiple=false){ |
|
| 24 | + public function __construct($table, $class="active", $event="click", $multiple=false) { |
|
| 25 | 25 | $this->table=$table; |
| 26 | 26 | $this->class=$class; |
| 27 | 27 | $this->event=$event; |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | return $this; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public function compile(){ |
|
| 58 | + public function compile() { |
|
| 59 | 59 | $multiple=""; |
| 60 | - if(!$this->multiple){ |
|
| 60 | + if (!$this->multiple) { |
|
| 61 | 61 | $multiple="$(this).closest('tbody').children('tr').removeClass('".$this->class."');"; |
| 62 | 62 | } |
| 63 | - $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');",false,false); |
|
| 63 | + $this->table->onRow($this->event, $multiple."$(this).toggleClass('".$this->class."');", false, false); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | } |
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | * @author jc |
| 13 | 13 | * @version 1.001 |
| 14 | 14 | */ |
| 15 | -class HtmlLabeledIconMenu extends HtmlMenu{ |
|
| 15 | +class HtmlLabeledIconMenu extends HtmlMenu { |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $identifier |
| 20 | 20 | * @param array $items icons |
| 21 | 21 | */ |
| 22 | - public function __construct( $identifier, $items=array()){ |
|
| 23 | - parent::__construct( $identifier, $items); |
|
| 22 | + public function __construct($identifier, $items=array()) { |
|
| 23 | + parent::__construct($identifier, $items); |
|
| 24 | 24 | $this->addToProperty("class", "labeled icon"); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | protected function createItem($value) { |
| 32 | 32 | $text=""; |
| 33 | 33 | $v=$value; |
| 34 | - if(\is_array($value)){ |
|
| 34 | + if (\is_array($value)) { |
|
| 35 | 35 | $v=@$value[0]; |
| 36 | 36 | $text=@$value[1]; |
| 37 | 37 | } |
| 38 | 38 | $count=\sizeof($this->content); |
| 39 | 39 | $value=new HtmlIcon("icon-".$count, $v); |
| 40 | - $value->wrap("",$text); |
|
| 41 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
| 40 | + $value->wrap("", $text); |
|
| 41 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
| 42 | 42 | return $itemO->setClass("item"); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | * @author jc |
| 13 | 13 | * @version 1.001 |
| 14 | 14 | */ |
| 15 | -class HtmlIconMenu extends HtmlMenu{ |
|
| 15 | +class HtmlIconMenu extends HtmlMenu { |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $identifier |
| 20 | 20 | * @param array $items icons |
| 21 | 21 | */ |
| 22 | - public function __construct( $identifier, $items=array()){ |
|
| 23 | - parent::__construct( $identifier, $items); |
|
| 22 | + public function __construct($identifier, $items=array()) { |
|
| 23 | + parent::__construct($identifier, $items); |
|
| 24 | 24 | $this->addToProperty("class", "icon"); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | protected function createItem($value) { |
| 33 | 33 | $count=\sizeof($this->content); |
| 34 | 34 | $value=new HtmlIcon("icon-".$count, $value); |
| 35 | - $itemO=new HtmlLink("item-".$count,"",$value); |
|
| 35 | + $itemO=new HtmlLink("item-".$count, "", $value); |
|
| 36 | 36 | return $itemO->setClass("item"); |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 41 | 41 | */ |
| 42 | 42 | public function setType($type="") { |
| 43 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 43 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function setActiveItem($index) { |
| 47 | 47 | $item=$this->getItem($index); |
| 48 | - if ($item !== null) { |
|
| 48 | + if ($item!==null) { |
|
| 49 | 49 | $item->addToProperty("class", "active"); |
| 50 | 50 | } |
| 51 | 51 | return $this; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | private function getItemToInsert($item) { |
| 55 | 55 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButtonGroups || $item instanceof HtmlButton || $item instanceof HtmlLabel) { |
| 56 | - $itemO=new HtmlMenuItem("item-" . $this->identifier . "-" . \sizeof($this->content) , $item); |
|
| 56 | + $itemO=new HtmlMenuItem("item-".$this->identifier."-".\sizeof($this->content), $item); |
|
| 57 | 57 | $item=$itemO; |
| 58 | 58 | } |
| 59 | 59 | return $item; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | private function afterInsert($item) { |
| 63 | 63 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 64 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 64 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 65 | 65 | else { |
| 66 | 66 | $this->setSecondary(); |
| 67 | 67 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function addItem($item) { |
| 78 | 78 | $number=$item; |
| 79 | 79 | $item=parent::addItem($this->getItemToInsert($item)); |
| 80 | - if(\is_int($number)) |
|
| 80 | + if (\is_int($number)) |
|
| 81 | 81 | $item->setProperty("data-page", $number); |
| 82 | 82 | return $this->afterInsert($item); |
| 83 | 83 | } |
@@ -95,15 +95,15 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | public function generateMenuAsItem($menu, $header=null) { |
| 97 | 97 | $count=$this->count(); |
| 98 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 98 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 99 | 99 | if (isset($header)) { |
| 100 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 100 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 101 | 101 | $headerItem->setContent($header); |
| 102 | 102 | $item->addContent($headerItem); |
| 103 | 103 | $this->_itemHeader=$headerItem; |
| 104 | 104 | } |
| 105 | - if(\is_array($menu)){ |
|
| 106 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 105 | + if (\is_array($menu)) { |
|
| 106 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 107 | 107 | } |
| 108 | 108 | $menu->setClass("menu"); |
| 109 | 109 | $item->addContent($menu); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 119 | 119 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 120 | 120 | $value=$this->addItem($value); |
| 121 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 121 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 122 | 122 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 123 | 123 | $this->wrap("", $popup); |
| 124 | 124 | return $popup; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | public function addDropdownAsItem($value, $items=NULL) { |
| 128 | 128 | $dd=$value; |
| 129 | 129 | if (\is_string($value)) { |
| 130 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 130 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 131 | 131 | } |
| 132 | 132 | $this->addItem($dd); |
| 133 | 133 | return $dd; |
@@ -140,14 +140,14 @@ discard block |
||
| 140 | 140 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 141 | 141 | */ |
| 142 | 142 | protected function createItem($value) { |
| 143 | - $itemO=new HtmlMenuItem($this->identifier."-item-" . \sizeof($this->content),""); |
|
| 143 | + $itemO=new HtmlMenuItem($this->identifier."-item-".\sizeof($this->content), ""); |
|
| 144 | 144 | $itemO->setTagName("a"); |
| 145 | 145 | $itemO->setContent($value); |
| 146 | 146 | return $itemO; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public function setSecondary($value=true) { |
| 150 | - if($value) |
|
| 150 | + if ($value) |
|
| 151 | 151 | $this->addToProperty("class", "secondary"); |
| 152 | 152 | else |
| 153 | 153 | $this->removePropertyValue("class", "secondary"); |
@@ -155,28 +155,28 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function setVertical() { |
| 158 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 158 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function setPosition($value="right") { |
| 162 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 162 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function setPointing($value=Direction::NONE) { |
| 166 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 166 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function asTab($vertical=false) { |
| 170 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 170 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 171 | 171 | $item->setTagName("a"); |
| 172 | 172 | }); |
| 173 | - if ($vertical === true) |
|
| 173 | + if ($vertical===true) |
|
| 174 | 174 | $this->setVertical(); |
| 175 | 175 | return $this->addToProperty("class", "tabular"); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | public function asPagination() { |
| 179 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 179 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 180 | 180 | $item->setTagName("a"); |
| 181 | 181 | }); |
| 182 | 182 | return $this->addToProperty("class", "pagination"); |
@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function setWidth($width) { |
| 215 | 215 | if (\is_int($width)) { |
| 216 | - $width=Wide::getConstants()["W" . $width]; |
|
| 216 | + $width=Wide::getConstants()["W".$width]; |
|
| 217 | 217 | } |
| 218 | 218 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 219 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 219 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function addImage($identifier, $src="", $alt="") { |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | return $this->_itemHeader; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function setHasContainer(){ |
|
| 235 | - return $this->wrapContent("<div class='ui container'>","</div>"); |
|
| 234 | + public function setHasContainer() { |
|
| 235 | + return $this->wrapContent("<div class='ui container'>", "</div>"); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - public function run(JsUtils $js){ |
|
| 239 | - if($this->identifier!=="" && !isset($this->_bsComponent)) |
|
| 240 | - $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}',false,false); |
|
| 241 | - $result= parent::run($js); |
|
| 238 | + public function run(JsUtils $js) { |
|
| 239 | + if ($this->identifier!=="" && !isset($this->_bsComponent)) |
|
| 240 | + $this->onClick('if(!$(this).hasClass("dropdown")&&!$(this).hasClass("no-active")){$(this).addClass("active").siblings().removeClass("active");}', false, false); |
|
| 241 | + $result=parent::run($js); |
|
| 242 | 242 | return $result->setItemSelector(".item"); |
| 243 | 243 | } |
| 244 | 244 | } |