@@ -1,10 +1,10 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace Ajax\bootstrap\html\html5; |
| 3 | 3 | /** |
| 4 | - * HTML Select |
|
| 5 | - * @author jc |
|
| 6 | - * @version 1.002 |
|
| 7 | - */ |
|
| 4 | + * HTML Select |
|
| 5 | + * @author jc |
|
| 6 | + * @version 1.002 |
|
| 7 | + */ |
|
| 8 | 8 | use Ajax\bootstrap\html\base\HtmlDoubleElement; |
| 9 | 9 | |
| 10 | 10 | class HtmlOption extends HtmlDoubleElement { |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | class HtmlOption extends HtmlDoubleElement { |
| 11 | 11 | protected $value; |
| 12 | 12 | protected $selected; |
| 13 | - public function __construct($identifier,$caption,$value="") { |
|
| 13 | + public function __construct($identifier, $caption, $value="") { |
|
| 14 | 14 | parent::__construct($identifier, "option"); |
| 15 | 15 | $this->_template='<option id="%identifier%" value="%value%" %selected% %properties%>%content%</option>'; |
| 16 | 16 | $this->content=$caption; |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $this->selected=""; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function select(){ |
|
| 21 | + public function select() { |
|
| 22 | 22 | $this->selected="selected"; |
| 23 | 23 | return $this; |
| 24 | 24 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return $this->value; |
| 28 | 28 | } |
| 29 | 29 | public function setValue($value) { |
| 30 | - $this->value = $value; |
|
| 30 | + $this->value=$value; |
|
| 31 | 31 | return $this; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | private $default; |
| 17 | 17 | private $options; |
| 18 | 18 | |
| 19 | - public function __construct($identifier, $caption,$default=NULL) { |
|
| 19 | + public function __construct($identifier, $caption, $default=NULL) { |
|
| 20 | 20 | parent::__construct($identifier, "select"); |
| 21 | 21 | $this->setProperty("name", $identifier); |
| 22 | 22 | $this->setProperty("class", "form-control"); |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | $this->options=array(); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public function addOption($element,$value="",$selected=false){ |
|
| 29 | - if($element instanceof HtmlOption){ |
|
| 28 | + public function addOption($element, $value="", $selected=false) { |
|
| 29 | + if ($element instanceof HtmlOption) { |
|
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 32 | - $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
|
| 31 | + }else { |
|
| 32 | + $option=new HtmlOption($this->identifier."-".count($this->options), $element, $value); |
|
| 33 | 33 | } |
| 34 | - if($selected || $option->getValue()==$this->getProperty("value")){ |
|
| 34 | + if ($selected || $option->getValue()==$this->getProperty("value")) { |
|
| 35 | 35 | $option->select(); |
| 36 | 36 | } |
| 37 | 37 | $this->options[]=$option; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function setValue($value) { |
| 41 | - foreach ( $this->options as $option ) { |
|
| 42 | - if (strcasecmp($option->getValue(),$value)===0) { |
|
| 41 | + foreach ($this->options as $option) { |
|
| 42 | + if (strcasecmp($option->getValue(), $value)===0) { |
|
| 43 | 43 | $option->setProperty("selected", ""); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function compile(JsUtils $js=NULL, View $view=NULL) { |
| 54 | 54 | $this->content=array(); |
| 55 | - if(isset($this->default)){ |
|
| 55 | + if (isset($this->default)) { |
|
| 56 | 56 | $default=new HtmlOption("", $this->default); |
| 57 | 57 | $this->content[]=$default; |
| 58 | 58 | } |
| 59 | - foreach ($this->options as $option){ |
|
| 59 | + foreach ($this->options as $option) { |
|
| 60 | 60 | $this->content[]=$option; |
| 61 | 61 | } |
| 62 | 62 | return parent::compile($js, $view); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - public function fromArray($array){ |
|
| 66 | - if(JArray::isAssociative($array)){ |
|
| 67 | - foreach ($array as $k=>$v){ |
|
| 65 | + public function fromArray($array) { |
|
| 66 | + if (JArray::isAssociative($array)) { |
|
| 67 | + foreach ($array as $k=>$v) { |
|
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 71 | - foreach ($array as $v){ |
|
| 70 | + }else { |
|
| 71 | + foreach ($array as $v) { |
|
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $this->addOption($function($object)); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - public function setSize($size){ |
|
| 104 | + public function setSize($size) { |
|
| 105 | 105 | return $this->setProperty("size", $size); |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | public function addOption($element,$value="",$selected=false){ |
| 29 | 29 | if($element instanceof HtmlOption){ |
| 30 | 30 | $option=$element; |
| 31 | - }else{ |
|
| 31 | + } else{ |
|
| 32 | 32 | $option=new HtmlOption($this->identifier."-".count($this->options), $element,$value); |
| 33 | 33 | } |
| 34 | 34 | if($selected || $option->getValue()==$this->getProperty("value")){ |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | foreach ($array as $k=>$v){ |
| 68 | 68 | $this->addOption($v, $k); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | foreach ($array as $v){ |
| 72 | 72 | $this->addOption($v, $v); |
| 73 | 73 | } |
@@ -12,26 +12,26 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class HtmlGroupIcons extends HtmlDoubleElement { |
| 14 | 14 | |
| 15 | - public function __construct($identifier,$size="") { |
|
| 15 | + public function __construct($identifier, $size="") { |
|
| 16 | 16 | parent::__construct($identifier, "i"); |
| 17 | 17 | $this->setProperty("class", "icons"); |
| 18 | 18 | $this->setSize($size); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function setSize($size){ |
|
| 21 | + public function setSize($size) { |
|
| 22 | 22 | return $this->addToPropertyCtrl("class", $size, IconSize::getConstants()); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function addIcon($icon,$size=""){ |
|
| 25 | + public function addIcon($icon, $size="") { |
|
| 26 | 26 | $iconO=$icon; |
| 27 | - if(\is_string($icon)){ |
|
| 27 | + if (\is_string($icon)) { |
|
| 28 | 28 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 29 | 29 | $iconO->setSize($size); |
| 30 | 30 | } |
| 31 | 31 | $this->addContent($iconO); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - public function getIcon($index){ |
|
| 34 | + public function getIcon($index) { |
|
| 35 | 35 | return $this->content[$index]; |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |
@@ -47,31 +47,31 @@ discard block |
||
| 47 | 47 | * @return \Ajax\semantic\html\HtmlButton default : "" |
| 48 | 48 | */ |
| 49 | 49 | public function setStyle($cssStyle) { |
| 50 | - return $this->addToProperty("class",$cssStyle); |
|
| 50 | + return $this->addToProperty("class", $cssStyle); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function setFocusable(){ |
|
| 53 | + public function setFocusable() { |
|
| 54 | 54 | $this->setProperty("tabindex", "0"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function setAnimated($content,$animation=""){ |
|
| 57 | + public function setAnimated($content, $animation="") { |
|
| 58 | 58 | $this->setTagName("div"); |
| 59 | 59 | $this->addToProperty("class", "animated ".$animation); |
| 60 | - $visible=new HtmlDoubleElement("visible-".$this->identifier,"div"); |
|
| 60 | + $visible=new HtmlDoubleElement("visible-".$this->identifier, "div"); |
|
| 61 | 61 | $visible->setClass("visible content"); |
| 62 | 62 | $visible->setContent($this->content); |
| 63 | - $hidden=new HtmlDoubleElement("hidden-".$this->identifier,"div"); |
|
| 63 | + $hidden=new HtmlDoubleElement("hidden-".$this->identifier, "div"); |
|
| 64 | 64 | $hidden->setClass("hidden content"); |
| 65 | 65 | $hidden->setContent($content); |
| 66 | 66 | $this->content=$visible.$hidden; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - public function addIcon($icon,$before=true){ |
|
| 69 | + public function addIcon($icon, $before=true) { |
|
| 70 | 70 | $iconO=$icon; |
| 71 | - if(\is_string($icon)){ |
|
| 71 | + if (\is_string($icon)) { |
|
| 72 | 72 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
| 73 | 73 | } |
| 74 | - $this->addContent($iconO,$before); |
|
| 74 | + $this->addContent($iconO, $before); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /* |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function fromArray($array) { |
| 82 | 82 | $array=parent::fromArray($array); |
| 83 | - foreach ( $array as $key => $value ) { |
|
| 83 | + foreach ($array as $key => $value) { |
|
| 84 | 84 | $this->setProperty($key, $value); |
| 85 | 85 | } |
| 86 | 86 | return $array; |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use Ajax\common\BaseEnum; |
| 6 | 6 | |
| 7 | 7 | class Color extends BaseEnum { |
| 8 | - const RED="red",ORANGE="orange",YELLOW="yellow", |
|
| 9 | - OLIVE="olive",GREEN="green",TEAL="teal", |
|
| 10 | - BLUE="blue",VIOLET="violet",PURPLE="purple", |
|
| 11 | - PINK="pink",BROWN="brown",GREY="grey",BLACK="black"; |
|
| 8 | + const RED="red", ORANGE="orange", YELLOW="yellow", |
|
| 9 | + OLIVE="olive", GREEN="green", TEAL="teal", |
|
| 10 | + BLUE="blue", VIOLET="violet", PURPLE="purple", |
|
| 11 | + PINK="pink", BROWN="brown", GREY="grey", BLACK="black"; |
|
| 12 | 12 | } |
| 13 | 13 | \ No newline at end of file |
@@ -2,5 +2,5 @@ |
||
| 2 | 2 | namespace Ajax\semantic\html\base; |
| 3 | 3 | use Ajax\common\BaseEnum; |
| 4 | 4 | abstract class IconSize extends BaseEnum { |
| 5 | - const MINI="mini", TINY="tiny", SMALL="small", NORMAL="",LARGE="large", BIG="big", HUGE="huge", MASSIVE="massive"; |
|
| 5 | + const MINI="mini", TINY="tiny", SMALL="small", NORMAL="", LARGE="large", BIG="big", HUGE="huge", MASSIVE="massive"; |
|
| 6 | 6 | } |
| 7 | 7 | \ No newline at end of file |