@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * @param string $placeholder |
| 27 | 27 | * @param string $icon |
| 28 | - * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
|
| 28 | + * @return MenuItemTrait |
|
| 29 | 29 | */ |
| 30 | 30 | public function asSearchInput($placeholder=NULL,$icon=NULL){ |
| 31 | 31 | $this->setClass("ui icon search input"); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
|
| 42 | + * @return MenuItemTrait |
|
| 43 | 43 | */ |
| 44 | 44 | public function asDivider(){ |
| 45 | 45 | $this->content=NULL; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @param string $caption |
| 53 | 53 | * @param string $icon |
| 54 | - * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
|
| 54 | + * @return MenuItemTrait |
|
| 55 | 55 | */ |
| 56 | 56 | public function asHeader($caption=NULL,$icon=NULL){ |
| 57 | 57 | $this->setClass("header"); |
@@ -8,16 +8,16 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | trait MenuItemTrait { |
| 10 | 10 | |
| 11 | - public function setContent($content){ |
|
| 12 | - if($content==="-"){ |
|
| 11 | + public function setContent($content) { |
|
| 12 | + if ($content==="-") { |
|
| 13 | 13 | $this->asDivider(); |
| 14 | - }elseif($content==="-search-"){ |
|
| 15 | - $values=\explode(",",$content,-1); |
|
| 16 | - $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search")); |
|
| 17 | - }elseif(JString::startswith($content, "-")){ |
|
| 18 | - $content=\ltrim($content,"-"); |
|
| 14 | + }elseif ($content==="-search-") { |
|
| 15 | + $values=\explode(",", $content, -1); |
|
| 16 | + $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."), JArray::getDefaultValue($values, 1, "search")); |
|
| 17 | + }elseif (JString::startswith($content, "-")) { |
|
| 18 | + $content=\ltrim($content, "-"); |
|
| 19 | 19 | $this->asHeader($content); |
| 20 | - }else |
|
| 20 | + } else |
|
| 21 | 21 | parent::setContent($content); |
| 22 | 22 | return $this; |
| 23 | 23 | } |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | * @param string $icon |
| 28 | 28 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
| 29 | 29 | */ |
| 30 | - public function asSearchInput($placeholder=NULL,$icon=NULL){ |
|
| 30 | + public function asSearchInput($placeholder=NULL, $icon=NULL) { |
|
| 31 | 31 | $this->setClass("ui icon search input"); |
| 32 | 32 | $input=new HtmlInput("search-".$this->identifier); |
| 33 | - if(isset($placeholder)) |
|
| 33 | + if (isset($placeholder)) |
|
| 34 | 34 | $input->setProperty("placeholder", $placeholder); |
| 35 | 35 | $this->content=$input; |
| 36 | - if(isset($icon)) |
|
| 36 | + if (isset($icon)) |
|
| 37 | 37 | $this->addIcon($icon); |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
| 43 | 43 | */ |
| 44 | - public function asDivider(){ |
|
| 44 | + public function asDivider() { |
|
| 45 | 45 | $this->content=NULL; |
| 46 | 46 | $this->tagName="div"; |
| 47 | 47 | $this->setClass("divider"); |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * @param string $icon |
| 54 | 54 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|\Ajax\semantic\html\content\HtmlMenuItem |
| 55 | 55 | */ |
| 56 | - public function asHeader($caption=NULL,$icon=NULL){ |
|
| 56 | + public function asHeader($caption=NULL, $icon=NULL) { |
|
| 57 | 57 | $this->setClass("header"); |
| 58 | 58 | $this->tagName="div"; |
| 59 | 59 | $this->content=$caption; |
| 60 | - if(isset($icon)) |
|
| 61 | - $this->addIcon($icon,Direction::LEFT); |
|
| 60 | + if (isset($icon)) |
|
| 61 | + $this->addIcon($icon, Direction::LEFT); |
|
| 62 | 62 | return $this; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | \ No newline at end of file |
@@ -12,6 +12,10 @@ discard block |
||
| 12 | 12 | protected $variation; |
| 13 | 13 | protected $params; |
| 14 | 14 | protected $semElement; |
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @param HtmlSemDoubleElement $semElement |
|
| 18 | + */ |
|
| 15 | 19 | public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
| 16 | 20 | $this->semElement=$semElement; |
| 17 | 21 | $this->title=$title; |
@@ -19,6 +23,9 @@ discard block |
||
| 19 | 23 | $this->setAttributes($variation,$params); |
| 20 | 24 | } |
| 21 | 25 | |
| 26 | + /** |
|
| 27 | + * @param string $html |
|
| 28 | + */ |
|
| 22 | 29 | public function setHtml($html) { |
| 23 | 30 | $this->html= $html; |
| 24 | 31 | return $this; |
@@ -12,58 +12,58 @@ |
||
| 12 | 12 | protected $variation; |
| 13 | 13 | protected $params; |
| 14 | 14 | protected $semElement; |
| 15 | - public function __construct($semElement,$title="",$content="",$variation=NULL,$params=array()){ |
|
| 15 | + public function __construct($semElement, $title="", $content="", $variation=NULL, $params=array()) { |
|
| 16 | 16 | $this->semElement=$semElement; |
| 17 | 17 | $this->title=$title; |
| 18 | 18 | $this->content=$content; |
| 19 | - $this->setAttributes($variation,$params); |
|
| 19 | + $this->setAttributes($variation, $params); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | public function setHtml($html) { |
| 23 | - $this->html= $html; |
|
| 23 | + $this->html=$html; |
|
| 24 | 24 | return $this; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setAttributes($variation=NULL,$params=array()){ |
|
| 27 | + public function setAttributes($variation=NULL, $params=array()) { |
|
| 28 | 28 | $this->variation=$variation; |
| 29 | 29 | $this->params=$params; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function onShow($jsCode){ |
|
| 32 | + public function onShow($jsCode) { |
|
| 33 | 33 | $this->params["onShow"]=$jsCode; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function compile(JsUtils $js=NULL){ |
|
| 37 | - if(JString::isNotNull($this->title)){ |
|
| 36 | + public function compile(JsUtils $js=NULL) { |
|
| 37 | + if (JString::isNotNull($this->title)) { |
|
| 38 | 38 | $this->semElement->addToProperty("data-title", $this->title); |
| 39 | 39 | } |
| 40 | - if(JString::isNotNull($this->content)){ |
|
| 40 | + if (JString::isNotNull($this->content)) { |
|
| 41 | 41 | $this->semElement->addToProperty("data-content", $this->content); |
| 42 | 42 | } |
| 43 | - if(JString::isNotNull($this->html)){ |
|
| 43 | + if (JString::isNotNull($this->html)) { |
|
| 44 | 44 | $html=$this->html; |
| 45 | - if(\is_array($html)){ |
|
| 45 | + if (\is_array($html)) { |
|
| 46 | 46 | \array_walk($html, function(&$item) use($js){ |
| 47 | - if($item instanceof HtmlSemDoubleElement){ |
|
| 47 | + if ($item instanceof HtmlSemDoubleElement) { |
|
| 48 | 48 | $comp=$item->compile($js); |
| 49 | 49 | $bs=$item->run($js); |
| 50 | - if(isset($bs)) |
|
| 50 | + if (isset($bs)) |
|
| 51 | 51 | $this->params['onShow']=$bs->getScript(); |
| 52 | 52 | $item=$comp; |
| 53 | 53 | } |
| 54 | 54 | }); |
| 55 | - $html=\implode("",$html); |
|
| 55 | + $html=\implode("", $html); |
|
| 56 | 56 | } |
| 57 | 57 | $html=\str_replace("\"", "'", $html); |
| 58 | 58 | $this->semElement->addToProperty("data-html", $html); |
| 59 | 59 | } |
| 60 | - if(JString::isNotNull($this->variation)){ |
|
| 60 | + if (JString::isNotNull($this->variation)) { |
|
| 61 | 61 | $this->semElement->addToProperty("data-variation", $this->variation); |
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function run(JsUtils $js){ |
|
| 66 | - $js->semantic()->popup("#".$this->semElement->getIdentifier(),$this->params); |
|
| 65 | + public function run(JsUtils $js) { |
|
| 66 | + $js->semantic()->popup("#".$this->semElement->getIdentifier(), $this->params); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | \ No newline at end of file |
@@ -22,6 +22,9 @@ discard block |
||
| 22 | 22 | protected $input; |
| 23 | 23 | protected $value; |
| 24 | 24 | |
| 25 | + /** |
|
| 26 | + * @param string $identifier |
|
| 27 | + */ |
|
| 25 | 28 | public function __construct($identifier, $value="", $items=array()) { |
| 26 | 29 | parent::__construct($identifier, "div"); |
| 27 | 30 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
@@ -49,7 +52,7 @@ discard block |
||
| 49 | 52 | /** |
| 50 | 53 | * Insert an item at a position |
| 51 | 54 | * @param mixed $item |
| 52 | - * @param number $position |
|
| 55 | + * @param integer $position |
|
| 53 | 56 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 54 | 57 | */ |
| 55 | 58 | public function insertItem($item,$position=0){ |
@@ -240,6 +243,9 @@ discard block |
||
| 240 | 243 | return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
| 241 | 244 | } |
| 242 | 245 | |
| 246 | + /** |
|
| 247 | + * @param string $value |
|
| 248 | + */ |
|
| 243 | 249 | public function setValue($value){ |
| 244 | 250 | $this->value=$value; |
| 245 | 251 | return $this; |
@@ -274,6 +280,9 @@ discard block |
||
| 274 | 280 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 275 | 281 | } |
| 276 | 282 | |
| 283 | + /** |
|
| 284 | + * @param string $action |
|
| 285 | + */ |
|
| 277 | 286 | public function setAction($action){ |
| 278 | 287 | $this->_params["action"]=$action; |
| 279 | 288 | } |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | protected $mClass="menu"; |
| 19 | 19 | protected $mTagName="div"; |
| 20 | - protected $items=array (); |
|
| 21 | - protected $_params=array("action"=>"nothing","on"=>"hover"); |
|
| 20 | + protected $items=array(); |
|
| 21 | + protected $_params=array("action"=>"nothing", "on"=>"hover"); |
|
| 22 | 22 | protected $input; |
| 23 | 23 | protected $value; |
| 24 | 24 | |
@@ -26,23 +26,23 @@ discard block |
||
| 26 | 26 | parent::__construct($identifier, "div"); |
| 27 | 27 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 28 | 28 | $this->setProperty("class", "ui dropdown"); |
| 29 | - $content=new HtmlSemDoubleElement("text-".$this->identifier,"div"); |
|
| 29 | + $content=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 30 | 30 | $content->setClass("text"); |
| 31 | 31 | $this->setValue($value); |
| 32 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 32 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 33 | 33 | $this->content=array($content); |
| 34 | 34 | $this->tagName="div"; |
| 35 | 35 | $this->addItems($items); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function addItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 39 | - $itemO=$this->beforeAddItem($item,$value,$image,$description); |
|
| 38 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 39 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 40 | 40 | $this->items[]=$itemO; |
| 41 | 41 | return $itemO; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
| 45 | - $this->addIconP($icon,$before,$labeled); |
|
| 44 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 45 | + $this->addIconP($icon, $before, $labeled); |
|
| 46 | 46 | return $this->getElementById("text-".$this->identifier, $this->content)->setWrapAfter(""); |
| 47 | 47 | } |
| 48 | 48 | |
@@ -52,26 +52,26 @@ discard block |
||
| 52 | 52 | * @param number $position |
| 53 | 53 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 54 | 54 | */ |
| 55 | - public function insertItem($item,$position=0){ |
|
| 55 | + public function insertItem($item, $position=0) { |
|
| 56 | 56 | $itemO=$this->beforeAddItem($item); |
| 57 | - $start = array_slice($this->items, 0, $position); |
|
| 58 | - $end = array_slice($this->items, $position); |
|
| 59 | - $start[] = $item; |
|
| 57 | + $start=array_slice($this->items, 0, $position); |
|
| 58 | + $end=array_slice($this->items, $position); |
|
| 59 | + $start[]=$item; |
|
| 60 | 60 | $this->items=array_merge($start, $end); |
| 61 | 61 | return $itemO; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - protected function beforeAddItem($item,$value=NULL,$image=NULL,$description=NULL){ |
|
| 64 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 65 | 65 | $itemO=$item; |
| 66 | - if(\is_array($item)){ |
|
| 66 | + if (\is_array($item)) { |
|
| 67 | 67 | $description=JArray::getValue($item, "description", 3); |
| 68 | 68 | $value=JArray::getValue($item, "value", 1); |
| 69 | 69 | $image=JArray::getValue($item, "image", 2); |
| 70 | 70 | $item=JArray::getValue($item, "item", 0); |
| 71 | 71 | } |
| 72 | - if(!$item instanceof HtmlDropdownItem){ |
|
| 73 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image,$description); |
|
| 74 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 72 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 73 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 74 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 75 | 75 | $this->addToProperty("class", "vertical"); |
| 76 | 76 | } |
| 77 | 77 | return $itemO; |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | $this->addItem($function($object)); |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - public function addInput($name){ |
|
| 88 | - if(!isset($name)) |
|
| 87 | + public function addInput($name) { |
|
| 88 | + if (!isset($name)) |
|
| 89 | 89 | $name="input-".$this->identifier; |
| 90 | 90 | $this->setAction("activate"); |
| 91 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 91 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -97,15 +97,15 @@ discard block |
||
| 97 | 97 | * @param string $icon |
| 98 | 98 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 99 | 99 | */ |
| 100 | - public function addSearchInputItem($placeHolder=NULL,$icon=NULL){ |
|
| 101 | - return $this->addItem(HtmlDropdownItem::searchInput($placeHolder,$icon)); |
|
| 100 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 101 | + return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | 105 | * Adds a divider item |
| 106 | 106 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 107 | 107 | */ |
| 108 | - public function addDividerItem(){ |
|
| 108 | + public function addDividerItem() { |
|
| 109 | 109 | return $this->addItem(HtmlDropdownItem::divider()); |
| 110 | 110 | } |
| 111 | 111 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * @param string $icon |
| 116 | 116 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 117 | 117 | */ |
| 118 | - public function addHeaderItem($caption=NULL,$icon=NULL){ |
|
| 119 | - return $this->addItem(HtmlDropdownItem::header($caption,$icon)); |
|
| 118 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 119 | + return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @param string $color |
| 126 | 126 | * @return \Ajax\semantic\html\content\HtmlDropdownItem|unknown |
| 127 | 127 | */ |
| 128 | - public function addCircularLabelItem($caption,$color){ |
|
| 128 | + public function addCircularLabelItem($caption, $color) { |
|
| 129 | 129 | return $this->addItem(HtmlDropdownItem::circular($caption, $color)); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -134,87 +134,87 @@ discard block |
||
| 134 | 134 | * @param string $image |
| 135 | 135 | * @return \Ajax\semantic\html\content\HtmlDropdownItem |
| 136 | 136 | */ |
| 137 | - public function addMiniAvatarImageItem($caption,$image){ |
|
| 137 | + public function addMiniAvatarImageItem($caption, $image) { |
|
| 138 | 138 | return $this->addItem(HtmlDropdownItem::avatar($caption, $image)); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - public function addItems($items){ |
|
| 142 | - if(JArray::isAssociative($items)){ |
|
| 143 | - foreach ($items as $k=>$v){ |
|
| 141 | + public function addItems($items) { |
|
| 142 | + if (JArray::isAssociative($items)) { |
|
| 143 | + foreach ($items as $k=>$v) { |
|
| 144 | 144 | $this->addItem($v)->setData($k); |
| 145 | 145 | } |
| 146 | - }else{ |
|
| 147 | - foreach ($items as $item){ |
|
| 146 | + } else { |
|
| 147 | + foreach ($items as $item) { |
|
| 148 | 148 | $this->addItem($item); |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - public function getItem($index){ |
|
| 153 | + public function getItem($index) { |
|
| 154 | 154 | return $this->items[$index]; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * @return int |
| 159 | 159 | */ |
| 160 | - public function count(){ |
|
| 160 | + public function count() { |
|
| 161 | 161 | return \sizeof($this->items); |
| 162 | 162 | } |
| 163 | 163 | /** |
| 164 | 164 | * @param boolean $dropdown |
| 165 | 165 | */ |
| 166 | - public function asDropdown($dropdown){ |
|
| 167 | - if($dropdown===false){ |
|
| 166 | + public function asDropdown($dropdown) { |
|
| 167 | + if ($dropdown===false) { |
|
| 168 | 168 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 169 | 169 | $dropdown="menu"; |
| 170 | - }else{ |
|
| 170 | + } else { |
|
| 171 | 171 | $dropdown="dropdown"; |
| 172 | 172 | $this->mClass="menu"; |
| 173 | 173 | } |
| 174 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 174 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function setVertical(){ |
|
| 178 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 177 | + public function setVertical() { |
|
| 178 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - public function setInline(){ |
|
| 182 | - return $this->addToPropertyCtrl("class", "inline",["inline"]); |
|
| 181 | + public function setInline() { |
|
| 182 | + return $this->addToPropertyCtrl("class", "inline", ["inline"]); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - public function setSimple(){ |
|
| 186 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 185 | + public function setSimple() { |
|
| 186 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - public function asButton($floating=false){ |
|
| 190 | - if($floating) |
|
| 189 | + public function asButton($floating=false) { |
|
| 190 | + if ($floating) |
|
| 191 | 191 | $this->addToProperty("class", "floating"); |
| 192 | 192 | $this->removePropertyValue("class", "selection"); |
| 193 | 193 | return $this->addToProperty("class", "button"); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 197 | - if(isset($name)) |
|
| 196 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 197 | + if (isset($name)) |
|
| 198 | 198 | $this->addInput($name); |
| 199 | - if($multiple) |
|
| 199 | + if ($multiple) |
|
| 200 | 200 | $this->addToProperty("class", "multiple"); |
| 201 | - if ($selection){ |
|
| 202 | - if($this->propertyContains("class", "button")===false) |
|
| 203 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 201 | + if ($selection) { |
|
| 202 | + if ($this->propertyContains("class", "button")===false) |
|
| 203 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 204 | 204 | } |
| 205 | 205 | return $this; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - public function asSearch($name=NULL,$multiple=false,$selection=true){ |
|
| 209 | - $this->asSelect($name,$multiple,$selection); |
|
| 208 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 209 | + $this->asSelect($name, $multiple, $selection); |
|
| 210 | 210 | return $this->addToProperty("class", "search"); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 214 | - if(!isset($name)) |
|
| 213 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 214 | + if (!isset($name)) |
|
| 215 | 215 | $name="select-".$this->identifier; |
| 216 | 216 | $this->input=null; |
| 217 | - if($multiple){ |
|
| 217 | + if ($multiple) { |
|
| 218 | 218 | $this->setProperty("multiple", true); |
| 219 | 219 | $this->addToProperty("class", "multiple"); |
| 220 | 220 | } |
@@ -222,37 +222,37 @@ discard block |
||
| 222 | 222 | $this->tagName="select"; |
| 223 | 223 | $this->setProperty("name", $name); |
| 224 | 224 | $this->content=null; |
| 225 | - foreach ($this->items as $item){ |
|
| 225 | + foreach ($this->items as $item) { |
|
| 226 | 226 | $item->asOption(); |
| 227 | 227 | } |
| 228 | 228 | return $this; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - public function asSubmenu($pointing=NULL){ |
|
| 231 | + public function asSubmenu($pointing=NULL) { |
|
| 232 | 232 | $this->setClass("ui dropdown link item"); |
| 233 | - if(isset($pointing)){ |
|
| 233 | + if (isset($pointing)) { |
|
| 234 | 234 | $this->setPointing($pointing); |
| 235 | 235 | } |
| 236 | 236 | return $this; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - public function setPointing($value=Direction::NONE){ |
|
| 240 | - return $this->addToPropertyCtrl("class", $value." pointing",Direction::getConstantValues("pointing")); |
|
| 239 | + public function setPointing($value=Direction::NONE) { |
|
| 240 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - public function setValue($value){ |
|
| 243 | + public function setValue($value) { |
|
| 244 | 244 | $this->value=$value; |
| 245 | 245 | return $this; |
| 246 | 246 | } |
| 247 | - private function applyValue(){ |
|
| 247 | + private function applyValue() { |
|
| 248 | 248 | $value=$this->value; |
| 249 | - if(isset($this->input) && isset($value)){ |
|
| 249 | + if (isset($this->input) && isset($value)) { |
|
| 250 | 250 | $this->input->setProperty("value", $value); |
| 251 | - }else{ |
|
| 251 | + } else { |
|
| 252 | 252 | $this->setProperty("value", $value); |
| 253 | 253 | } |
| 254 | 254 | $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
| 255 | - if(isset($textElement)) |
|
| 255 | + if (isset($textElement)) |
|
| 256 | 256 | $textElement->setContent($value); |
| 257 | 257 | return $this; |
| 258 | 258 | } |
@@ -262,28 +262,28 @@ discard block |
||
| 262 | 262 | * @see BaseHtml::run() |
| 263 | 263 | */ |
| 264 | 264 | public function run(JsUtils $js) { |
| 265 | - if($this->propertyContains("class", "simple")===false){ |
|
| 266 | - if(isset($this->_bsComponent)===false) |
|
| 267 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->_params); |
|
| 265 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 266 | + if (isset($this->_bsComponent)===false) |
|
| 267 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 268 | 268 | $this->addEventsOnRun($js); |
| 269 | 269 | return $this->_bsComponent; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - public function setCompact(){ |
|
| 273 | + public function setCompact() { |
|
| 274 | 274 | return $this->addToPropertyCtrl("class", "compact", array("compact")); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - public function setAction($action){ |
|
| 277 | + public function setAction($action) { |
|
| 278 | 278 | $this->_params["action"]=$action; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - public function setFullTextSearch($value){ |
|
| 281 | + public function setFullTextSearch($value) { |
|
| 282 | 282 | $this->_params["fullTextSearch"]=$value; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 286 | 286 | $this->applyValue(); |
| 287 | - return parent::compile($js,$view); |
|
| 287 | + return parent::compile($js, $view); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | \ No newline at end of file |
@@ -27,6 +27,9 @@ discard block |
||
| 27 | 27 | return $result; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string $key |
|
| 32 | + */ |
|
| 30 | 33 | private function addElementInContent($key, $element) { |
| 31 | 34 | if (\array_key_exists($key, $this->content) === false) { |
| 32 | 35 | $this->content[$key]=array (); |
@@ -35,6 +38,9 @@ discard block |
||
| 35 | 38 | return $element; |
| 36 | 39 | } |
| 37 | 40 | |
| 41 | + /** |
|
| 42 | + * @param string $part |
|
| 43 | + */ |
|
| 38 | 44 | private function getPart($part, $index=NULL) { |
| 39 | 45 | if (\array_key_exists($part, $this->content)) { |
| 40 | 46 | if (isset($index)) |
@@ -59,6 +65,10 @@ discard block |
||
| 59 | 65 | return $this->addElementInContent("content", $image); |
| 60 | 66 | } |
| 61 | 67 | |
| 68 | + /** |
|
| 69 | + * @param HtmlImage $visibleContent |
|
| 70 | + * @param HtmlImage $hiddenContent |
|
| 71 | + */ |
|
| 62 | 72 | public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
| 63 | 73 | $reveal=$visibleContent; |
| 64 | 74 | if (!$visibleContent instanceof HtmlReveal) { |
@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | class HtmlCard extends HtmlSemDoubleElement { |
| 18 | 18 | |
| 19 | 19 | public function __construct($identifier) { |
| 20 | - parent::__construct($identifier, "div", "ui card", array ()); |
|
| 20 | + parent::__construct($identifier, "div", "ui card", array()); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | private function createContent($content, $baseClass="content") { |
| 24 | 24 | $count=\sizeof($this->content); |
| 25 | - $result=new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content); |
|
| 25 | + $result=new HtmlCardContent("content-".$count."-".$this->identifier, $content); |
|
| 26 | 26 | $result->setClass($baseClass); |
| 27 | 27 | return $result; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | private function addElementInContent($key, $element) { |
| 31 | - if (\array_key_exists($key, $this->content) === false) { |
|
| 32 | - $this->content[$key]=array (); |
|
| 31 | + if (\array_key_exists($key, $this->content)===false) { |
|
| 32 | + $this->content[$key]=array(); |
|
| 33 | 33 | } |
| 34 | 34 | $this->content[$key][]=$element; |
| 35 | 35 | return $element; |
@@ -46,14 +46,14 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | public function addHeader($header, $niveau=4, $type="page") { |
| 48 | 48 | if (!$header instanceof HtmlHeader) { |
| 49 | - $header=new HtmlHeader("header-" . $this->identifier, $niveau, $header, $type); |
|
| 49 | + $header=new HtmlHeader("header-".$this->identifier, $niveau, $header, $type); |
|
| 50 | 50 | } |
| 51 | 51 | $this->content["header"]=$this->createContent($header); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function addImage($image, $title="") { |
| 55 | 55 | if (!$image instanceof HtmlImage) { |
| 56 | - $image=new HtmlImage("image-" . $this->identifier, $image, $title); |
|
| 56 | + $image=new HtmlImage("image-".$this->identifier, $image, $title); |
|
| 57 | 57 | } |
| 58 | 58 | $image->setClass("image"); |
| 59 | 59 | return $this->addElementInContent("content", $image); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | public function addReveal($visibleContent, $hiddenContent=NULL, $type=RevealType::FADE, $attributeType=NULL) { |
| 63 | 63 | $reveal=$visibleContent; |
| 64 | 64 | if (!$visibleContent instanceof HtmlReveal) { |
| 65 | - $reveal=new HtmlReveal("reveral-" . $this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 65 | + $reveal=new HtmlReveal("reveral-".$this->identifier, $visibleContent, $hiddenContent, $type, $attributeType); |
|
| 66 | 66 | } |
| 67 | 67 | return $this->addElementInContent("content", $reveal); |
| 68 | 68 | } |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | * @param string $asIcons |
| 92 | 92 | * @return \Ajax\semantic\html\elements\HtmlButtonGroups |
| 93 | 93 | */ |
| 94 | - public function addButtons($elements=array(), $asIcons=false){ |
|
| 95 | - $buttons=new HtmlButtonGroups("buttons-".$this->identifier,$elements,$asIcons); |
|
| 94 | + public function addButtons($elements=array(), $asIcons=false) { |
|
| 95 | + $buttons=new HtmlButtonGroups("buttons-".$this->identifier, $elements, $asIcons); |
|
| 96 | 96 | $this->addElementInContent("content", $buttons); |
| 97 | 97 | return $buttons; |
| 98 | 98 | } |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | public function addCardHeaderContent($header, $metas=array(), $description=NULL) { |
| 103 | 103 | $count=\sizeof($this->content); |
| 104 | - return $this->addElementInContent("content", new HtmlCardHeaderContent("content-" . $count . "-" . $this->identifier, $header, $metas, $description)); |
|
| 104 | + return $this->addElementInContent("content", new HtmlCardHeaderContent("content-".$count."-".$this->identifier, $header, $metas, $description)); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function addCardContent($content=array()) { |
| 108 | 108 | $count=\sizeof($this->content); |
| 109 | - return $this->addElementInContent("content", new HtmlCardContent("content-" . $count . "-" . $this->identifier, $content)); |
|
| 109 | + return $this->addElementInContent("content", new HtmlCardContent("content-".$count."-".$this->identifier, $content)); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | public function getCardContent($index=NULL) { |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::compile() |
| 133 | 133 | */ |
| 134 | 134 | public function compile(JsUtils $js=NULL, &$view=NULL) { |
| 135 | - $this->content=JArray::sortAssociative($this->content, [ "header","image","content","extra-content" ]); |
|
| 135 | + $this->content=JArray::sortAssociative($this->content, ["header", "image", "content", "extra-content"]); |
|
| 136 | 136 | return parent::compile($js, $view); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public function asLink($href="") { |
| 140 | 140 | $this->addToProperty("class", "link"); |
| 141 | - if ($href !== "") { |
|
| 141 | + if ($href!=="") { |
|
| 142 | 142 | $this->setProperty("href", $href); |
| 143 | 143 | } |
| 144 | 144 | return $this; |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | * @return $this |
| 28 | 28 | */ |
| 29 | 29 | public function setOnShow($jsCode) { |
| 30 | - $jsCode=str_ireplace("\"","%quote%", $jsCode); |
|
| 30 | + $jsCode=str_ireplace("\"", "%quote%", $jsCode); |
|
| 31 | 31 | return $this->setParam("onShow", "%function(){".$jsCode."}%"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function setExclusive($value){ |
|
| 34 | + public function setExclusive($value) { |
|
| 35 | 35 | return $this->setParam("exclusive", $value); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -40,15 +40,15 @@ discard block |
||
| 40 | 40 | * @param string $popup the css selector of the popup |
| 41 | 41 | * @return \Ajax\semantic\components\Popup |
| 42 | 42 | */ |
| 43 | - public function setPopup($popup){ |
|
| 43 | + public function setPopup($popup) { |
|
| 44 | 44 | return $this->setParam("popup", $popup); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public function setInline($value){ |
|
| 47 | + public function setInline($value) { |
|
| 48 | 48 | return $this->setParam("inline", $value); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - public function setPosition($value){ |
|
| 51 | + public function setPosition($value) { |
|
| 52 | 52 | return $this->setParam("position", $value); |
| 53 | 53 | } |
| 54 | 54 | //TODO other events implementation |
@@ -15,18 +15,18 @@ discard block |
||
| 15 | 15 | private $_hasIcon=false; |
| 16 | 16 | |
| 17 | 17 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
| 18 | - public abstract function addContent($content,$before=false); |
|
| 18 | + public abstract function addContent($content, $before=false); |
|
| 19 | 19 | |
| 20 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
| 21 | - if($this->_hasIcon===false){ |
|
| 20 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
| 21 | + if ($this->_hasIcon===false) { |
|
| 22 | 22 | $iconO=$icon; |
| 23 | - if(\is_string($icon)){ |
|
| 23 | + if (\is_string($icon)) { |
|
| 24 | 24 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 25 | 25 | } |
| 26 | 26 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
| 27 | - $this->addContent($iconO,$direction===Direction::LEFT); |
|
| 27 | + $this->addContent($iconO, $direction===Direction::LEFT); |
|
| 28 | 28 | $this->_hasIcon=true; |
| 29 | - }else{ |
|
| 29 | + } else { |
|
| 30 | 30 | $iconO=$this->getIcon(); |
| 31 | 31 | $iconO->setIcon($icon); |
| 32 | 32 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | return $iconO; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function getIcon(){ |
|
| 38 | - if(\is_array($this->content)){ |
|
| 39 | - foreach ($this->content as $item){ |
|
| 40 | - if($item instanceof HtmlIcon) |
|
| 37 | + public function getIcon() { |
|
| 38 | + if (\is_array($this->content)) { |
|
| 39 | + foreach ($this->content as $item) { |
|
| 40 | + if ($item instanceof HtmlIcon) |
|
| 41 | 41 | return $item; |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * @return \Ajax\semantic\html\collections\HtmlMenu |
| 39 | 39 | */ |
| 40 | 40 | public function setType($type="") { |
| 41 | - return $this->addToPropertyCtrl("class", $type, array ("","item","text" )); |
|
| 41 | + return $this->addToPropertyCtrl("class", $type, array("", "item", "text")); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function setActiveItem($index) { |
| 45 | 45 | $item=$this->getItem($index); |
| 46 | - if ($item !== null) { |
|
| 46 | + if ($item!==null) { |
|
| 47 | 47 | $item->addToProperty("class", "active"); |
| 48 | 48 | } |
| 49 | 49 | return $this; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | private function getItemToInsert($item) { |
| 53 | 53 | if ($item instanceof HtmlInput || $item instanceof HtmlImg || $item instanceof HtmlIcon || $item instanceof HtmlButton || ($item instanceof HtmlDropdown && $this->propertyContains("class", "vertical")===false)) { |
| 54 | - $itemO=new HtmlMenuItem("item-" . $this->identifier, $item); |
|
| 54 | + $itemO=new HtmlMenuItem("item-".$this->identifier, $item); |
|
| 55 | 55 | $item=$itemO; |
| 56 | 56 | } |
| 57 | 57 | return $item; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | private function afterInsert($item) { |
| 61 | 61 | if (!$item instanceof HtmlMenu && $item->propertyContains("class", "header")===false) |
| 62 | - $item->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 62 | + $item->addToPropertyCtrl("class", "item", array("item")); |
|
| 63 | 63 | else { |
| 64 | 64 | $this->setSecondary(); |
| 65 | 65 | } |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | public function generateMenuAsItem($menu, $header=null) { |
| 92 | 92 | $count=$this->count(); |
| 93 | - $item=new HtmlSemDoubleElement("item-" . $this->identifier . "-" . $count, "div"); |
|
| 93 | + $item=new HtmlSemDoubleElement("item-".$this->identifier."-".$count, "div"); |
|
| 94 | 94 | if (isset($header)) { |
| 95 | - $headerItem=new HtmlSemDoubleElement("item-header-" . $this->identifier . "-" . $count, "div", "header"); |
|
| 95 | + $headerItem=new HtmlSemDoubleElement("item-header-".$this->identifier."-".$count, "div", "header"); |
|
| 96 | 96 | $headerItem->setContent($header); |
| 97 | 97 | $item->addContent($headerItem); |
| 98 | 98 | $this->_itemHeader=$headerItem; |
| 99 | 99 | } |
| 100 | - if(\is_array($menu)){ |
|
| 101 | - $menu=new HtmlMenu("menu-" . $this->identifier . "-" . $count,$menu); |
|
| 100 | + if (\is_array($menu)) { |
|
| 101 | + $menu=new HtmlMenu("menu-".$this->identifier."-".$count, $menu); |
|
| 102 | 102 | } |
| 103 | 103 | $menu->setClass("menu"); |
| 104 | 104 | $item->addContent($menu); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $value=new HtmlSemDoubleElement($identifier, "a", "browse item", $value); |
| 114 | 114 | $value->addContent(new HtmlIcon("", "dropdown")); |
| 115 | 115 | $value=$this->addItem($value); |
| 116 | - $popup=new HtmlPopup($value, "popup-" . $this->identifier . "-" . $this->count(), $content); |
|
| 116 | + $popup=new HtmlPopup($value, "popup-".$this->identifier."-".$this->count(), $content); |
|
| 117 | 117 | $popup->setFlowing()->setPosition("bottom left")->setOn("click"); |
| 118 | 118 | $this->wrap("", $popup); |
| 119 | 119 | return $popup; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function addDropdownAsItem($value, $items=NULL) { |
| 123 | 123 | $dd=$value; |
| 124 | 124 | if (\is_string($value)) { |
| 125 | - $dd=new HtmlDropdown("dropdown-" . $this->identifier . "-" . $this->count(), $value, $items); |
|
| 125 | + $dd=new HtmlDropdown("dropdown-".$this->identifier."-".$this->count(), $value, $items); |
|
| 126 | 126 | } |
| 127 | 127 | $this->addItem($dd); |
| 128 | 128 | return $dd; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @see \Ajax\common\html\html5\HtmlCollection::createItem() |
| 136 | 136 | */ |
| 137 | 137 | protected function createItem($value) { |
| 138 | - $itemO=new HtmlMenuItem($this->identifier."item" . \sizeof($this->content),""); |
|
| 138 | + $itemO=new HtmlMenuItem($this->identifier."item".\sizeof($this->content), ""); |
|
| 139 | 139 | $itemO->setTagName("a"); |
| 140 | 140 | $itemO->setContent($value); |
| 141 | 141 | return $itemO; |
@@ -146,35 +146,35 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function setSecondary($value=true) { |
| 149 | - if($value) |
|
| 149 | + if ($value) |
|
| 150 | 150 | $this->addToProperty("class", "secondary"); |
| 151 | 151 | else |
| 152 | 152 | $this->removePropertyValue("class", "secondary"); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | public function setVertical() { |
| 156 | - return $this->addToPropertyCtrl("class", "vertical", array ("vertical" )); |
|
| 156 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public function setPosition($value="right") { |
| 160 | - return $this->addToPropertyCtrl("class", $value, array ("right","left" )); |
|
| 160 | + return $this->addToPropertyCtrl("class", $value, array("right", "left")); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | public function setPointing($value=Direction::NONE) { |
| 164 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 164 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | public function asTab($vertical=false) { |
| 168 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 168 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 169 | 169 | $item->setTagName("a"); |
| 170 | 170 | }); |
| 171 | - if ($vertical === true) |
|
| 171 | + if ($vertical===true) |
|
| 172 | 172 | $this->setVertical(); |
| 173 | 173 | return $this->addToProperty("class", "tabular"); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | public function asPagination() { |
| 177 | - $this->apply(function (HtmlDoubleElement &$item) { |
|
| 177 | + $this->apply(function(HtmlDoubleElement&$item) { |
|
| 178 | 178 | $item->setTagName("a"); |
| 179 | 179 | }); |
| 180 | 180 | return $this->addToProperty("class", "pagination"); |
@@ -211,10 +211,10 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function setWidth($width) { |
| 213 | 213 | if (\is_int($width)) { |
| 214 | - $width=Wide::getConstants()["W" . $width]; |
|
| 214 | + $width=Wide::getConstants()["W".$width]; |
|
| 215 | 215 | } |
| 216 | 216 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
| 217 | - return $this->addToPropertyCtrl("class", "item", array ("item" )); |
|
| 217 | + return $this->addToPropertyCtrl("class", "item", array("item")); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | public function addImage($identifier, $src="", $alt="") { |
@@ -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 | } |
| 146 | 146 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
| 9 | 9 | class HtmlMenuItem extends HtmlSemDoubleElement { |
| 10 | 10 | use MenuItemTrait; |
| 11 | 11 | public function __construct($identifier, $content) { |
| 12 | - parent::__construct($identifier,"div","item",$content); |
|
| 12 | + parent::__construct($identifier, "div", "item", $content); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - protected function initContent($content){ |
|
| 16 | - if(\is_array($content)){ |
|
| 17 | - if(JArray::isAssociative($content)===false){ |
|
| 15 | + protected function initContent($content) { |
|
| 16 | + if (\is_array($content)) { |
|
| 17 | + if (JArray::isAssociative($content)===false) { |
|
| 18 | 18 | $icon=@$content[0]; |
| 19 | 19 | $title=@$content[1]; |
| 20 | 20 | $desc=@$content[2]; |
| 21 | - }else{ |
|
| 21 | + } else { |
|
| 22 | 22 | $icon=@$content["icon"]; |
| 23 | 23 | $title=@$content["title"]; |
| 24 | 24 | $desc=@$content["description"]; |
| 25 | 25 | } |
| 26 | - if(isset($icon)===true){ |
|
| 26 | + if (isset($icon)===true) { |
|
| 27 | 27 | $this->setIcon($icon); |
| 28 | 28 | } |
| 29 | - if(isset($title)===true){ |
|
| 30 | - $this->setTitle($title,$desc); |
|
| 29 | + if (isset($title)===true) { |
|
| 30 | + $this->setTitle($title, $desc); |
|
| 31 | 31 | } |
| 32 | - }else{ |
|
| 32 | + } else { |
|
| 33 | 33 | $this->setContent($content); |
| 34 | 34 | } |
| 35 | 35 | } |