@@ -8,53 +8,53 @@ |
||
8 | 8 | use Ajax\semantic\html\base\constants\Variation; |
9 | 9 | use Ajax\semantic\html\base\traits\IconTrait; |
10 | 10 | |
11 | -class HtmlInput extends HtmlSemDoubleElement{ |
|
11 | +class HtmlInput extends HtmlSemDoubleElement { |
|
12 | 12 | use IconTrait; |
13 | - public function __construct($identifier,$type="text",$value="",$placeholder=""){ |
|
14 | - parent::__construct("div-".$identifier,"div","ui input"); |
|
15 | - $this->content=new \Ajax\common\html\html5\HtmlInput($identifier,$type,$value,$placeholder); |
|
16 | - $this->_states=[State::DISABLED,State::FOCUS,State::ERROR]; |
|
13 | + public function __construct($identifier, $type="text", $value="", $placeholder="") { |
|
14 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
15 | + $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
|
16 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
17 | 17 | $this->_variations=[Variation::TRANSPARENT]; |
18 | 18 | } |
19 | 19 | |
20 | - public function setFocus(){ |
|
20 | + public function setFocus() { |
|
21 | 21 | $this->addToProperty("class", State::FOCUS); |
22 | 22 | } |
23 | 23 | |
24 | - public function addLoading(){ |
|
25 | - if($this->_hasIcon===false){ |
|
24 | + public function addLoading() { |
|
25 | + if ($this->_hasIcon===false) { |
|
26 | 26 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
27 | 27 | } |
28 | 28 | return $this->addToProperty("class", State::LOADING); |
29 | 29 | } |
30 | 30 | |
31 | - public function addLabel($label,$direction=Direction::LEFT,$icon=NULL){ |
|
31 | + public function addLabel($label, $direction=Direction::LEFT, $icon=NULL) { |
|
32 | 32 | $labelO=$label; |
33 | - if(\is_object($label)===false){ |
|
34 | - $labelO=new HtmlLabel("label-".$this->identifier,$label); |
|
35 | - if(isset($icon)) |
|
33 | + if (\is_object($label)===false) { |
|
34 | + $labelO=new HtmlLabel("label-".$this->identifier, $label); |
|
35 | + if (isset($icon)) |
|
36 | 36 | $labelO->addIcon($icon); |
37 | - }else{ |
|
37 | + }else { |
|
38 | 38 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
39 | 39 | } |
40 | 40 | $this->addToProperty("class", $direction." labeled"); |
41 | - $this->addContent($labelO,\strstr($direction,Direction::LEFT)!==false); |
|
41 | + $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
|
42 | 42 | return $labelO; |
43 | 43 | } |
44 | 44 | |
45 | - public function addLabelToCorner($label,$direction=Direction::LEFT,$icon=NULL){ |
|
46 | - return $this->addLabel($label,$direction." corner",$icon)->toCorner($direction); |
|
45 | + public function addLabelToCorner($label, $direction=Direction::LEFT, $icon=NULL) { |
|
46 | + return $this->addLabel($label, $direction." corner", $icon)->toCorner($direction); |
|
47 | 47 | } |
48 | 48 | |
49 | - public function addAction($action,$direction=Direction::LEFT,$icon=NULL,$labeled=false){ |
|
49 | + public function addAction($action, $direction=Direction::LEFT, $icon=NULL, $labeled=false) { |
|
50 | 50 | $actionO=$action; |
51 | - if(\is_object($action)===false){ |
|
52 | - $actionO=new HtmlButton("action-".$this->identifier,$action); |
|
53 | - if(isset($icon)) |
|
54 | - $actionO->addIcon($icon,true,$labeled); |
|
51 | + if (\is_object($action)===false) { |
|
52 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
53 | + if (isset($icon)) |
|
54 | + $actionO->addIcon($icon, true, $labeled); |
|
55 | 55 | } |
56 | 56 | $this->addToProperty("class", $direction." action"); |
57 | - $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
|
57 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
58 | 58 | return $actionO; |
59 | 59 | } |
60 | 60 |
@@ -32,9 +32,10 @@ discard block |
||
32 | 32 | $labelO=$label; |
33 | 33 | if(\is_object($label)===false){ |
34 | 34 | $labelO=new HtmlLabel("label-".$this->identifier,$label); |
35 | - if(isset($icon)) |
|
36 | - $labelO->addIcon($icon); |
|
37 | - }else{ |
|
35 | + if(isset($icon)) { |
|
36 | + $labelO->addIcon($icon); |
|
37 | + } |
|
38 | + } else{ |
|
38 | 39 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
39 | 40 | } |
40 | 41 | $this->addToProperty("class", $direction." labeled"); |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | $actionO=$action; |
51 | 52 | if(\is_object($action)===false){ |
52 | 53 | $actionO=new HtmlButton("action-".$this->identifier,$action); |
53 | - if(isset($icon)) |
|
54 | - $actionO->addIcon($icon,true,$labeled); |
|
54 | + if(isset($icon)) { |
|
55 | + $actionO->addIcon($icon,true,$labeled); |
|
56 | + } |
|
55 | 57 | } |
56 | 58 | $this->addToProperty("class", $direction." action"); |
57 | 59 | $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Emphasis extends BaseEnum { |
8 | - const PRIMARY="primary",SECONDARY="secondary",TERTIARY="tertiary"; |
|
8 | + const PRIMARY="primary", SECONDARY="secondary", TERTIARY="tertiary"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -20,21 +20,21 @@ |
||
20 | 20 | public static function getDefaultValue($array, $key, $default) { |
21 | 21 | if (array_key_exists($key, $array)) { |
22 | 22 | return $array [$key]; |
23 | - } else |
|
23 | + }else |
|
24 | 24 | return $default; |
25 | 25 | } |
26 | 26 | |
27 | - public static function implode($glue,$pieces){ |
|
27 | + public static function implode($glue, $pieces) { |
|
28 | 28 | $result=""; |
29 | - if(\is_array($glue)){ |
|
29 | + if (\is_array($glue)) { |
|
30 | 30 | $size=\sizeof($pieces); |
31 | - if($size>0){ |
|
32 | - for($i=0;$i<$size-1;$i++){ |
|
31 | + if ($size>0) { |
|
32 | + for ($i=0; $i<$size-1; $i++) { |
|
33 | 33 | $result.=$pieces[$i].@$glue[$i]; |
34 | 34 | } |
35 | 35 | $result.=$pieces[$size-1]; |
36 | 36 | } |
37 | - }else{ |
|
37 | + }else { |
|
38 | 38 | $result=\implode($glue, $pieces); |
39 | 39 | } |
40 | 40 | return $result; |
@@ -13,15 +13,17 @@ discard block |
||
13 | 13 | return $array [$key]; |
14 | 14 | } |
15 | 15 | $values=array_values($array); |
16 | - if ($pos<sizeof($values)) |
|
17 | - return $values [$pos]; |
|
16 | + if ($pos<sizeof($values)) { |
|
17 | + return $values [$pos]; |
|
18 | + } |
|
18 | 19 | } |
19 | 20 | |
20 | 21 | public static function getDefaultValue($array, $key, $default) { |
21 | 22 | if (array_key_exists($key, $array)) { |
22 | 23 | return $array [$key]; |
23 | - } else |
|
24 | - return $default; |
|
24 | + } else { |
|
25 | + return $default; |
|
26 | + } |
|
25 | 27 | } |
26 | 28 | |
27 | 29 | public static function implode($glue,$pieces){ |
@@ -34,7 +36,7 @@ discard block |
||
34 | 36 | } |
35 | 37 | $result.=$pieces[$size-1]; |
36 | 38 | } |
37 | - }else{ |
|
39 | + } else{ |
|
38 | 40 | $result=\implode($glue, $pieces); |
39 | 41 | } |
40 | 42 | return $result; |
@@ -13,17 +13,17 @@ |
||
13 | 13 | * @param boolean $labeled |
14 | 14 | * @return \Ajax\semantic\html\elements\HtmlIcon |
15 | 15 | */ |
16 | - public function addIcon($icon,$before=true,$labeled=false){ |
|
16 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
17 | 17 | $iconO=$icon; |
18 | - if(\is_string($icon)){ |
|
18 | + if (\is_string($icon)) { |
|
19 | 19 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
20 | 20 | } |
21 | - if($labeled!==false){ |
|
22 | - $direction=($before===true)?Direction::LEFT:Direction::RIGHT; |
|
21 | + if ($labeled!==false) { |
|
22 | + $direction=($before===true) ? Direction::LEFT : Direction::RIGHT; |
|
23 | 23 | $this->addToProperty("class", $direction." labeled icon"); |
24 | 24 | $this->tagName="div"; |
25 | 25 | } |
26 | - $this->addContent($iconO,$before); |
|
26 | + $this->addContent($iconO, $before); |
|
27 | 27 | return $iconO; |
28 | 28 | } |
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -5,8 +5,8 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class Color extends BaseEnum { |
8 | - const STANDARD="",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 STANDARD="", 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 |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | * @param string $action one of "select","auto","activate","combo","nothing","hide" |
18 | 18 | * @return \Ajax\semantic\components\Dropdown |
19 | 19 | */ |
20 | - public function setAction($action){ |
|
21 | - return $this->setParamCtrl("action", $action,array("select","auto","activate","combo","nothing","hide")); |
|
20 | + public function setAction($action) { |
|
21 | + return $this->setParamCtrl("action", $action, array("select", "auto", "activate", "combo", "nothing", "hide")); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * @param string $event Event used to trigger dropdown (Hover, Click, Custom Event) |
27 | 27 | * @return \Ajax\semantic\components\Dropdown |
28 | 28 | */ |
29 | - public function setOn($event){ |
|
29 | + public function setOn($event) { |
|
30 | 30 | return $this->setParam("on", $event); |
31 | 31 | } |
32 | 32 | |
33 | - public function setFullTextSearch($value){ |
|
33 | + public function setFullTextSearch($value) { |
|
34 | 34 | return $this->setParam("fullTextSearch", $value); |
35 | 35 | } |
36 | 36 | } |
37 | 37 | \ No newline at end of file |