phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
MenuItemTrait.php
Go to the documentation of this file.
1<?php
3
10
18 abstract public function addToProperty($name, $value, $separator=" ");
19 abstract public function setClass($classNames);
20 abstract public function addIcon($icon, $before=true);
21
22 public function setContent($content){
23 if($content==="-"){
24 $this->asDivider();
25 }elseif($content==="-search-"){
26 $values=\explode(",",$content,-1);
27 $this->asSearchInput(JArray::getDefaultValue($values, 0, "Search..."),JArray::getDefaultValue($values, 1, "search"));
28 }elseif(JString::startswith($content, "-")){
29 $content=\ltrim($content,"-");
30 $this->asHeader($content);
31 }else
32 parent::setContent($content);
33 return $this;
34 }
35
41 public function asSearchInput($placeholder=NULL,$icon=NULL){
42 $this->setClass("ui icon search input");
43 $input=new HtmlInput("search-".$this->identifier);
44 if(isset($placeholder))
45 $input->setProperty("placeholder", $placeholder);
46 $this->content=$input;
47 if(isset($icon))
48 $this->addIcon($icon);
49 return $this;
50 }
51
55 public function asDivider(){
56 $this->content=NULL;
57 $this->tagName="div";
58 $this->setClass("divider");
59 return $this;
60 }
61
67 public function asHeader($caption=NULL,$icon=NULL){
68 $this->setClass("header");
69 $this->tagName="div";
70 $this->content=$caption;
71 if(isset($icon))
72 $this->addIcon($icon,Direction::LEFT);
73 return $this;
74 }
75
76 public function setPosition($direction){
77 $this->addToProperty("class",$direction);
78 }
79}
addToProperty($name, $value, $separator=" ")
asSearchInput($placeholder=NULL, $icon=NULL)