@@ -81,6 +81,9 @@ discard block |
||
| 81 | 81 | $this->addItems($function($object)); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | + /** |
|
| 85 | + * @param \Closure $callBack |
|
| 86 | + */ |
|
| 84 | 87 | public function apply($callBack){ |
| 85 | 88 | foreach ($this->content as $item){ |
| 86 | 89 | $callBack($item); |
@@ -96,7 +99,7 @@ discard block |
||
| 96 | 99 | } |
| 97 | 100 | /** |
| 98 | 101 | * The item factory |
| 99 | - * @param string|HtmlDoubleElement $value |
|
| 102 | + * @param string $value |
|
| 100 | 103 | */ |
| 101 | 104 | protected abstract function createItem($value); |
| 102 | 105 | } |
| 103 | 106 | \ No newline at end of file |
@@ -7,29 +7,29 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | abstract class HtmlCollection extends HtmlDoubleElement { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$tagName="div"){ |
|
| 11 | - parent::__construct($identifier,$tagName); |
|
| 10 | + public function __construct($identifier, $tagName="div") { |
|
| 11 | + parent::__construct($identifier, $tagName); |
|
| 12 | 12 | $this->content=array(); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function addItems($items){ |
|
| 16 | - if(JArray::isAssociative($items)){ |
|
| 17 | - foreach ($items as $k=>$v){ |
|
| 18 | - $this->addItem([$k,$v]); |
|
| 15 | + public function addItems($items) { |
|
| 16 | + if (JArray::isAssociative($items)) { |
|
| 17 | + foreach ($items as $k=>$v) { |
|
| 18 | + $this->addItem([$k, $v]); |
|
| 19 | 19 | } |
| 20 | - }else{ |
|
| 21 | - foreach ($items as $item){ |
|
| 20 | + }else { |
|
| 21 | + foreach ($items as $item) { |
|
| 22 | 22 | $this->addItem($item); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public function setItems($items){ |
|
| 27 | + public function setItems($items) { |
|
| 28 | 28 | $this->content=$items; |
| 29 | 29 | return $this; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function getItems(){ |
|
| 32 | + public function getItems() { |
|
| 33 | 33 | return $this->content; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @param HtmlDoubleElement|string $item |
| 39 | 39 | * @return \Ajax\common\html\HtmlDoubleElement |
| 40 | 40 | */ |
| 41 | - public function addItem($item){ |
|
| 41 | + public function addItem($item) { |
|
| 42 | 42 | $itemO=$item; |
| 43 | - if(\is_object($item)===false){ |
|
| 43 | + if (\is_object($item)===false) { |
|
| 44 | 44 | $itemO=$this->createItem($item); |
| 45 | 45 | } |
| 46 | 46 | $this->addContent($itemO); |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | return $this; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function removeItem($index){ |
|
| 69 | + public function removeItem($index) { |
|
| 70 | 70 | return array_splice($this->content, $index, 1); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function count(){ |
|
| 73 | + public function count() { |
|
| 74 | 74 | return \sizeof($this->content); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | $this->addItems($function($object)); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - public function apply($callBack){ |
|
| 85 | - foreach ($this->content as $item){ |
|
| 84 | + public function apply($callBack) { |
|
| 85 | + foreach ($this->content as $item) { |
|
| 86 | 86 | $callBack($item); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | foreach ($items as $k=>$v){ |
| 18 | 18 | $this->addItem([$k,$v]); |
| 19 | 19 | } |
| 20 | - }else{ |
|
| 20 | + } else{ |
|
| 21 | 21 | foreach ($items as $item){ |
| 22 | 22 | $this->addItem($item); |
| 23 | 23 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * @return \Ajax\common\html\HtmlDoubleElement |
| 54 | 54 | */ |
| 55 | 55 | public function getItem($index) { |
| 56 | - if (is_int($index)) |
|
| 57 | - return $this->content[$index]; |
|
| 58 | - else { |
|
| 56 | + if (is_int($index)) { |
|
| 57 | + return $this->content[$index]; |
|
| 58 | + } else { |
|
| 59 | 59 | $elm=$this->getElementById($index, $this->content); |
| 60 | 60 | return $elm; |
| 61 | 61 | } |
@@ -9,6 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class HtmlLabel extends HtmlSemDoubleElement { |
| 11 | 11 | |
| 12 | + /** |
|
| 13 | + * @param string $identifier |
|
| 14 | + */ |
|
| 12 | 15 | public function __construct($identifier,$caption="",$tagName="div") { |
| 13 | 16 | parent::__construct($identifier,$tagName); |
| 14 | 17 | $this->setProperty("class", "ui label"); |
@@ -16,7 +19,6 @@ discard block |
||
| 16 | 19 | } |
| 17 | 20 | |
| 18 | 21 | /** |
| 19 | - * @param string $side |
|
| 20 | 22 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 21 | 23 | */ |
| 22 | 24 | public function setPointing($value=Pointing::POINTING){ |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class HtmlLabel extends HtmlSemDoubleElement { |
| 11 | 11 | |
| 12 | - public function __construct($identifier,$caption="",$tagName="div") { |
|
| 13 | - parent::__construct($identifier,$tagName); |
|
| 12 | + public function __construct($identifier, $caption="", $tagName="div") { |
|
| 13 | + parent::__construct($identifier, $tagName); |
|
| 14 | 14 | $this->setProperty("class", "ui label"); |
| 15 | 15 | $this->content=$caption; |
| 16 | 16 | } |
@@ -19,26 +19,26 @@ discard block |
||
| 19 | 19 | * @param string $side |
| 20 | 20 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 21 | 21 | */ |
| 22 | - public function setPointing($value=Pointing::POINTING){ |
|
| 23 | - return $this->addToPropertyCtrl("class", $value,Pointing::getConstants()); |
|
| 22 | + public function setPointing($value=Pointing::POINTING) { |
|
| 23 | + return $this->addToPropertyCtrl("class", $value, Pointing::getConstants()); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * @param string $side |
| 28 | 28 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 29 | 29 | */ |
| 30 | - public function toCorner($side="left"){ |
|
| 31 | - return $this->addToPropertyCtrl("class", $side." corner",array("right corner","left corner")); |
|
| 30 | + public function toCorner($side="left") { |
|
| 31 | + return $this->addToPropertyCtrl("class", $side." corner", array("right corner", "left corner")); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 36 | 36 | */ |
| 37 | - public function asTag(){ |
|
| 37 | + public function asTag() { |
|
| 38 | 38 | return $this->addToProperty("class", "tag"); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setBasic(){ |
|
| 41 | + public function setBasic() { |
|
| 42 | 42 | return $this->addToProperty("class", "basic"); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -49,17 +49,17 @@ discard block |
||
| 49 | 49 | * @param string $before |
| 50 | 50 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 51 | 51 | */ |
| 52 | - public function addImage($src,$alt="",$before=true){ |
|
| 52 | + public function addImage($src, $alt="", $before=true) { |
|
| 53 | 53 | $this->addToProperty("class", "image"); |
| 54 | - return $this->addContent(new HtmlImg("image-".$this->identifier,$src,$alt),$before); |
|
| 54 | + return $this->addContent(new HtmlImg("image-".$this->identifier, $src, $alt), $before); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @param string $detail |
| 59 | 59 | * @return \Ajax\common\html\HtmlDoubleElement |
| 60 | 60 | */ |
| 61 | - public function addDetail($detail){ |
|
| 62 | - $div=new HtmlDoubleElement("detail-".$this->identifier,$this->tagName); |
|
| 61 | + public function addDetail($detail) { |
|
| 62 | + $div=new HtmlDoubleElement("detail-".$this->identifier, $this->tagName); |
|
| 63 | 63 | $div->setClass("detail"); |
| 64 | 64 | $div->setContent($detail); |
| 65 | 65 | $this->addContent($div); |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | namespace Ajax\semantic\html\base; |
| 3 | 3 | use Ajax\common\BaseEnum; |
| 4 | 4 | abstract class Size extends BaseEnum { |
| 5 | - const MASSIVE="massive",HUGE="huge",BIG="big",LARGE="large",MEDIUM="",SMALL="small",MINI="mini",TINY="tiny"; |
|
| 5 | + const MASSIVE="massive", HUGE="huge", BIG="big", LARGE="large", MEDIUM="", SMALL="small", MINI="mini", TINY="tiny"; |
|
| 6 | 6 | } |
| 7 | 7 | \ No newline at end of file |
@@ -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 | } |
| 39 | 39 | \ No newline at end of file |
@@ -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 | } |
| 45 | 45 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class HtmlPopup extends HtmlSemDoubleElement { |
| 11 | 11 | private $params; |
| 12 | 12 | private $_container; |
| 13 | - public function __construct(BaseHtml $container,$identifier, $content="") { |
|
| 13 | + public function __construct(BaseHtml $container, $identifier, $content="") { |
|
| 14 | 14 | parent::__construct($identifier, "div"); |
| 15 | 15 | $this->_container=$container; |
| 16 | 16 | $this->setClass("ui popup"); |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | $this->params=array("on"=>"click"); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function setFlowing(){ |
|
| 21 | + public function setFlowing() { |
|
| 22 | 22 | return $this->addToProperty("class", "flowing"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function setBasic(){ |
|
| 25 | + public function setBasic() { |
|
| 26 | 26 | return $this->addToProperty("class", "basic"); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | * {@inheritDoc} |
| 31 | 31 | * @see \Ajax\semantic\html\base\HtmlSemDoubleElement::run() |
| 32 | 32 | */ |
| 33 | - public function run(JsUtils $js){ |
|
| 33 | + public function run(JsUtils $js) { |
|
| 34 | 34 | $this->params["popup"]="#".$this->identifier; |
| 35 | - $js->semantic()->popup("#".$this->_container->getIdentifier(),$this->params); |
|
| 35 | + $js->semantic()->popup("#".$this->_container->getIdentifier(), $this->params); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 15 | 15 | protected $mClass="menu"; |
| 16 | 16 | protected $mTagName="div"; |
| 17 | - protected $items=array (); |
|
| 17 | + protected $items=array(); |
|
| 18 | 18 | protected $params=array("action"=>"select"); |
| 19 | 19 | protected $input; |
| 20 | 20 | |
@@ -22,40 +22,40 @@ discard block |
||
| 22 | 22 | parent::__construct($identifier, "div"); |
| 23 | 23 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
| 24 | 24 | $this->setProperty("class", "ui dropdown"); |
| 25 | - $content=new HtmlSemDoubleElement("","div"); |
|
| 25 | + $content=new HtmlSemDoubleElement("", "div"); |
|
| 26 | 26 | $content->setClass("text"); |
| 27 | 27 | $content->setContent($value); |
| 28 | - $content->wrap("",new HtmlIcon("", "dropdown")); |
|
| 28 | + $content->wrap("", new HtmlIcon("", "dropdown")); |
|
| 29 | 29 | $this->content=array($content); |
| 30 | 30 | $this->tagName="div"; |
| 31 | 31 | $this->addItems($items); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 34 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 35 | 35 | $itemO=$item; |
| 36 | - if(\is_object($item)===false){ |
|
| 37 | - $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
|
| 38 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 36 | + if (\is_object($item)===false) { |
|
| 37 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image); |
|
| 38 | + }elseif ($itemO instanceof HtmlDropdownItem) { |
|
| 39 | 39 | $this->addToProperty("class", "vertical"); |
| 40 | 40 | } |
| 41 | 41 | $this->items[]=$itemO; |
| 42 | 42 | return $itemO; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public function addInput($name){ |
|
| 46 | - if(!isset($name)) |
|
| 45 | + public function addInput($name) { |
|
| 46 | + if (!isset($name)) |
|
| 47 | 47 | $name="input-".$this->identifier; |
| 48 | 48 | $this->setAction("activate"); |
| 49 | - $this->input=new HtmlInput($name,"hidden"); |
|
| 49 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - public function addItems($items){ |
|
| 53 | - if(JArray::isAssociative($items)){ |
|
| 54 | - foreach ($items as $k=>$v){ |
|
| 52 | + public function addItems($items) { |
|
| 53 | + if (JArray::isAssociative($items)) { |
|
| 54 | + foreach ($items as $k=>$v) { |
|
| 55 | 55 | $this->addItem($v)->setData($k); |
| 56 | 56 | } |
| 57 | - }else{ |
|
| 58 | - foreach ($items as $item){ |
|
| 57 | + }else { |
|
| 58 | + foreach ($items as $item) { |
|
| 59 | 59 | $this->addItem($item); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -64,51 +64,51 @@ discard block |
||
| 64 | 64 | /** |
| 65 | 65 | * @param boolean $dropdown |
| 66 | 66 | */ |
| 67 | - public function asDropdown($dropdown){ |
|
| 68 | - if($dropdown===false){ |
|
| 67 | + public function asDropdown($dropdown) { |
|
| 68 | + if ($dropdown===false) { |
|
| 69 | 69 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 70 | 70 | $dropdown="menu"; |
| 71 | - }else{ |
|
| 71 | + }else { |
|
| 72 | 72 | $dropdown="dropdown"; |
| 73 | 73 | $this->mClass="menu"; |
| 74 | 74 | } |
| 75 | - return $this->addToPropertyCtrl("class", $dropdown,array("menu","dropdown")); |
|
| 75 | + return $this->addToPropertyCtrl("class", $dropdown, array("menu", "dropdown")); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function setVertical(){ |
|
| 79 | - return $this->addToPropertyCtrl("class", "vertical",array("vertical")); |
|
| 78 | + public function setVertical() { |
|
| 79 | + return $this->addToPropertyCtrl("class", "vertical", array("vertical")); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function setSimple(){ |
|
| 83 | - return $this->addToPropertyCtrl("class", "simple",array("simple")); |
|
| 82 | + public function setSimple() { |
|
| 83 | + return $this->addToPropertyCtrl("class", "simple", array("simple")); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public function asButton($floating=false){ |
|
| 87 | - if($floating) |
|
| 86 | + public function asButton($floating=false) { |
|
| 87 | + if ($floating) |
|
| 88 | 88 | $this->addToProperty("class", "floating"); |
| 89 | 89 | return $this->addToProperty("class", "button"); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 93 | - if(isset($name)) |
|
| 92 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 93 | + if (isset($name)) |
|
| 94 | 94 | $this->addInput($name); |
| 95 | - if($multiple) |
|
| 95 | + if ($multiple) |
|
| 96 | 96 | $this->addToProperty("class", "multiple"); |
| 97 | 97 | if ($selection) |
| 98 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 98 | + $this->addToPropertyCtrl("class", "selection", array("selection")); |
|
| 99 | 99 | return $this; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - public function asSearch($name=NULL,$multiple=false,$selection=false){ |
|
| 103 | - $this->asSelect($name,$multiple,$selection); |
|
| 102 | + public function asSearch($name=NULL, $multiple=false, $selection=false) { |
|
| 103 | + $this->asSelect($name, $multiple, $selection); |
|
| 104 | 104 | return $this->addToProperty("class", "search"); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - public function setSelect($name=NULL,$multiple=false){ |
|
| 108 | - if(!isset($name)) |
|
| 107 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 108 | + if (!isset($name)) |
|
| 109 | 109 | $name="select-".$this->identifier; |
| 110 | 110 | $this->input=null; |
| 111 | - if($multiple){ |
|
| 111 | + if ($multiple) { |
|
| 112 | 112 | $this->setProperty("multiple", true); |
| 113 | 113 | $this->addToProperty("class", "multiple"); |
| 114 | 114 | } |
@@ -116,28 +116,28 @@ discard block |
||
| 116 | 116 | $this->tagName="select"; |
| 117 | 117 | $this->setProperty("name", $name); |
| 118 | 118 | $this->content=null; |
| 119 | - foreach ($this->items as $item){ |
|
| 119 | + foreach ($this->items as $item) { |
|
| 120 | 120 | $item->asOption(); |
| 121 | 121 | } |
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - public function asSubmenu($pointing=NULL){ |
|
| 125 | + public function asSubmenu($pointing=NULL) { |
|
| 126 | 126 | $this->setClass("ui dropdown link item"); |
| 127 | - if(isset($pointing)){ |
|
| 127 | + if (isset($pointing)) { |
|
| 128 | 128 | $this->setPointing($pointing); |
| 129 | 129 | } |
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function setPointing($value=Pointing::POINTING){ |
|
| 134 | - return $this->addToPropertyCtrl("class", $value,Pointing::getConstants()); |
|
| 133 | + public function setPointing($value=Pointing::POINTING) { |
|
| 134 | + return $this->addToPropertyCtrl("class", $value, Pointing::getConstants()); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - public function setValue($value){ |
|
| 138 | - if(isset($this->input)){ |
|
| 137 | + public function setValue($value) { |
|
| 138 | + if (isset($this->input)) { |
|
| 139 | 139 | $this->input->setProperty("value", $value); |
| 140 | - }else{ |
|
| 140 | + }else { |
|
| 141 | 141 | $this->setProperty("value", $value); |
| 142 | 142 | } |
| 143 | 143 | return $this; |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | * @see BaseHtml::run() |
| 149 | 149 | */ |
| 150 | 150 | public function run(JsUtils $js) { |
| 151 | - if($this->propertyContains("class", "simple")===false){ |
|
| 152 | - $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier,$this->params); |
|
| 151 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 152 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->params); |
|
| 153 | 153 | $this->addEventsOnRun($js); |
| 154 | 154 | return $this->_bsComponent; |
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - public function setAction($action){ |
|
| 158 | + public function setAction($action) { |
|
| 159 | 159 | $this->params["action"]=$action; |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | \ No newline at end of file |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $itemO=$item; |
| 36 | 36 | if(\is_object($item)===false){ |
| 37 | 37 | $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items),$item,$value,$image); |
| 38 | - }elseif($itemO instanceof HtmlDropdownItem){ |
|
| 38 | + } elseif($itemO instanceof HtmlDropdownItem){ |
|
| 39 | 39 | $this->addToProperty("class", "vertical"); |
| 40 | 40 | } |
| 41 | 41 | $this->items[]=$itemO; |
@@ -43,8 +43,9 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | public function addInput($name){ |
| 46 | - if(!isset($name)) |
|
| 47 | - $name="input-".$this->identifier; |
|
| 46 | + if(!isset($name)) { |
|
| 47 | + $name="input-".$this->identifier; |
|
| 48 | + } |
|
| 48 | 49 | $this->setAction("activate"); |
| 49 | 50 | $this->input=new HtmlInput($name,"hidden"); |
| 50 | 51 | } |
@@ -54,7 +55,7 @@ discard block |
||
| 54 | 55 | foreach ($items as $k=>$v){ |
| 55 | 56 | $this->addItem($v)->setData($k); |
| 56 | 57 | } |
| 57 | - }else{ |
|
| 58 | + } else{ |
|
| 58 | 59 | foreach ($items as $item){ |
| 59 | 60 | $this->addItem($item); |
| 60 | 61 | } |
@@ -68,7 +69,7 @@ discard block |
||
| 68 | 69 | if($dropdown===false){ |
| 69 | 70 | $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
| 70 | 71 | $dropdown="menu"; |
| 71 | - }else{ |
|
| 72 | + } else{ |
|
| 72 | 73 | $dropdown="dropdown"; |
| 73 | 74 | $this->mClass="menu"; |
| 74 | 75 | } |
@@ -84,18 +85,22 @@ discard block |
||
| 84 | 85 | } |
| 85 | 86 | |
| 86 | 87 | public function asButton($floating=false){ |
| 87 | - if($floating) |
|
| 88 | - $this->addToProperty("class", "floating"); |
|
| 88 | + if($floating) { |
|
| 89 | + $this->addToProperty("class", "floating"); |
|
| 90 | + } |
|
| 89 | 91 | return $this->addToProperty("class", "button"); |
| 90 | 92 | } |
| 91 | 93 | |
| 92 | 94 | public function asSelect($name=NULL,$multiple=false,$selection=true){ |
| 93 | - if(isset($name)) |
|
| 94 | - $this->addInput($name); |
|
| 95 | - if($multiple) |
|
| 96 | - $this->addToProperty("class", "multiple"); |
|
| 97 | - if ($selection) |
|
| 98 | - $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 95 | + if(isset($name)) { |
|
| 96 | + $this->addInput($name); |
|
| 97 | + } |
|
| 98 | + if($multiple) { |
|
| 99 | + $this->addToProperty("class", "multiple"); |
|
| 100 | + } |
|
| 101 | + if ($selection) { |
|
| 102 | + $this->addToPropertyCtrl("class", "selection",array("selection")); |
|
| 103 | + } |
|
| 99 | 104 | return $this; |
| 100 | 105 | } |
| 101 | 106 | |
@@ -105,8 +110,9 @@ discard block |
||
| 105 | 110 | } |
| 106 | 111 | |
| 107 | 112 | public function setSelect($name=NULL,$multiple=false){ |
| 108 | - if(!isset($name)) |
|
| 109 | - $name="select-".$this->identifier; |
|
| 113 | + if(!isset($name)) { |
|
| 114 | + $name="select-".$this->identifier; |
|
| 115 | + } |
|
| 110 | 116 | $this->input=null; |
| 111 | 117 | if($multiple){ |
| 112 | 118 | $this->setProperty("multiple", true); |
@@ -137,7 +143,7 @@ discard block |
||
| 137 | 143 | public function setValue($value){ |
| 138 | 144 | if(isset($this->input)){ |
| 139 | 145 | $this->input->setProperty("value", $value); |
| 140 | - }else{ |
|
| 146 | + } else{ |
|
| 141 | 147 | $this->setProperty("value", $value); |
| 142 | 148 | } |
| 143 | 149 | return $this; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public static function getConstants() { |
| 15 | 15 | if (self::$constCacheArray==NULL) { |
| 16 | - self::$constCacheArray=[ ]; |
|
| 16 | + self::$constCacheArray=[]; |
|
| 17 | 17 | } |
| 18 | 18 | $calledClass=get_called_class(); |
| 19 | 19 | if (!array_key_exists($calledClass, self::$constCacheArray)) { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | return self::$constCacheArray [$calledClass]; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public static function getConstantValues(){ |
|
| 26 | + public static function getConstantValues() { |
|
| 27 | 27 | return \array_values(self::getConstants()); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | $this->setClass("ui image"); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - public function setCircular(){ |
|
| 14 | + public function setCircular() { |
|
| 15 | 15 | return $this->addToProperty("class", "circular"); |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |