@@ -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 |
@@ -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 |
@@ -20,6 +20,9 @@ |
||
20 | 20 | protected $_tabsType="tabs"; |
21 | 21 | protected $stacked=""; |
22 | 22 | |
23 | + /** |
|
24 | + * @param string $identifier |
|
25 | + */ |
|
23 | 26 | public function __construct($identifier, $tagName="ul") { |
24 | 27 | parent::__construct($identifier, $tagName); |
25 | 28 | $this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%"; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | protected $_equalWidth; |
15 | 15 | protected $_name; |
16 | 16 | |
17 | - public function __construct($identifier, $fields=array(),$equalWidth=true) { |
|
17 | + public function __construct($identifier, $fields=array(), $equalWidth=true) { |
|
18 | 18 | parent::__construct($identifier, "div"); |
19 | 19 | $this->_equalWidth=$equalWidth; |
20 | 20 | $this->addItems($fields); |
@@ -24,35 +24,35 @@ discard block |
||
24 | 24 | * @param string|HtmlSemDoubleElement $label |
25 | 25 | * @return \Ajax\semantic\html\base\HtmlSemDoubleElement |
26 | 26 | */ |
27 | - public function setLabel($label){ |
|
27 | + public function setLabel($label) { |
|
28 | 28 | $labelO=$label; |
29 | - if(\is_string($label)){ |
|
30 | - $labelO=new HtmlSemDoubleElement("","label","",$label); |
|
29 | + if (\is_string($label)) { |
|
30 | + $labelO=new HtmlSemDoubleElement("", "label", "", $label); |
|
31 | 31 | } |
32 | - $this->insertItem($labelO,0); |
|
32 | + $this->insertItem($labelO, 0); |
|
33 | 33 | return $labelO; |
34 | 34 | } |
35 | 35 | |
36 | - public function compile(JsUtils $js=NULL,View $view=NULL){ |
|
37 | - if($this->_equalWidth){ |
|
36 | + public function compile(JsUtils $js=NULL, View $view=NULL) { |
|
37 | + if ($this->_equalWidth) { |
|
38 | 38 | $count=$this->count(); |
39 | 39 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
40 | 40 | }else |
41 | - $this->addToProperty("class","fields"); |
|
42 | - return parent::compile($js,$view); |
|
41 | + $this->addToProperty("class", "fields"); |
|
42 | + return parent::compile($js, $view); |
|
43 | 43 | } |
44 | 44 | |
45 | - public function setWidth($index,$width){ |
|
45 | + public function setWidth($index, $width) { |
|
46 | 46 | $this->_equalWidth=false; |
47 | 47 | return $this->getItem($index)->setWidth($width); |
48 | 48 | } |
49 | 49 | |
50 | - public function setInline(){ |
|
50 | + public function setInline() { |
|
51 | 51 | $this->_equalWidth=false; |
52 | 52 | $this->addToProperty("class", "inline"); |
53 | 53 | } |
54 | 54 | |
55 | - public function setGrouped(){ |
|
55 | + public function setGrouped() { |
|
56 | 56 | $this->_equalWidth=false; |
57 | 57 | $this->addToProperty("class", "grouped"); |
58 | 58 | } |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | return $this; |
67 | 67 | } |
68 | 68 | |
69 | - public static function radios($name,$items=array(),$label=NULL){ |
|
69 | + public static function radios($name, $items=array(), $label=NULL) { |
|
70 | 70 | $fields=array(); |
71 | 71 | $i=0; |
72 | - foreach ($items as $item){ |
|
73 | - $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
|
72 | + foreach ($items as $item) { |
|
73 | + $fields[]=new HtmlFormRadio($name."-".$i++, $name, $item, $item); |
|
74 | 74 | } |
75 | - $radios=new HtmlFormFields("fields-".$name,$fields); |
|
76 | - if(isset($label)) |
|
75 | + $radios=new HtmlFormFields("fields-".$name, $fields); |
|
76 | + if (isset($label)) |
|
77 | 77 | $radios->setLabel($label)->setProperty("for", $name); |
78 | 78 | return $radios; |
79 | 79 | } |
@@ -37,8 +37,9 @@ discard block |
||
37 | 37 | if($this->_equalWidth){ |
38 | 38 | $count=$this->count(); |
39 | 39 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
40 | - }else |
|
41 | - $this->addToProperty("class","fields"); |
|
40 | + } else { |
|
41 | + $this->addToProperty("class","fields"); |
|
42 | + } |
|
42 | 43 | return parent::compile($js,$view); |
43 | 44 | } |
44 | 45 | |
@@ -73,8 +74,9 @@ discard block |
||
73 | 74 | $fields[]=new HtmlFormRadio($name."-".$i++,$name,$item,$item); |
74 | 75 | } |
75 | 76 | $radios=new HtmlFormFields("fields-".$name,$fields); |
76 | - if(isset($label)) |
|
77 | - $radios->setLabel($label)->setProperty("for", $name); |
|
77 | + if(isset($label)) { |
|
78 | + $radios->setLabel($label)->setProperty("for", $name); |
|
79 | + } |
|
78 | 80 | return $radios; |
79 | 81 | } |
80 | 82 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | class HtmlInput extends HtmlSingleElement { |
9 | 9 | |
10 | - public function __construct($identifier,$type="text",$value=NULL,$placeholder=NULL) { |
|
10 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
11 | 11 | parent::__construct($identifier, "input"); |
12 | 12 | $this->setProperty("name", $identifier); |
13 | 13 | $this->setValue($value); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
19 | + if (isset($value)) |
|
20 | 20 | $this->setProperty("value", $value); |
21 | 21 | return $this; |
22 | 22 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | return $this->setProperty("type", $value); |
26 | 26 | } |
27 | 27 | |
28 | - public function setPlaceholder($value){ |
|
29 | - if(JString::isNotNull($value)) |
|
28 | + public function setPlaceholder($value) { |
|
29 | + if (JString::isNotNull($value)) |
|
30 | 30 | $this->setProperty("placeholder", $value); |
31 | 31 | return $this; |
32 | 32 | } |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | } |
17 | 17 | |
18 | 18 | public function setValue($value) { |
19 | - if(isset($value)) |
|
20 | - $this->setProperty("value", $value); |
|
19 | + if(isset($value)) { |
|
20 | + $this->setProperty("value", $value); |
|
21 | + } |
|
21 | 22 | return $this; |
22 | 23 | } |
23 | 24 | |
@@ -26,8 +27,9 @@ discard block |
||
26 | 27 | } |
27 | 28 | |
28 | 29 | public function setPlaceholder($value){ |
29 | - if(JString::isNotNull($value)) |
|
30 | - $this->setProperty("placeholder", $value); |
|
30 | + if(JString::isNotNull($value)) { |
|
31 | + $this->setProperty("placeholder", $value); |
|
32 | + } |
|
31 | 33 | return $this; |
32 | 34 | } |
33 | 35 | } |
34 | 36 | \ No newline at end of file |
@@ -7,17 +7,17 @@ |
||
7 | 7 | |
8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
9 | 9 | |
10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false) { |
|
11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items))->asSelect($identifier,$multiple), $label); |
|
10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items))->asSelect($identifier, $multiple), $label); |
|
12 | 12 | } |
13 | 13 | |
14 | - public function setItems($items){ |
|
14 | + public function setItems($items) { |
|
15 | 15 | return $this->getField()->setItems($items); |
16 | 16 | } |
17 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
18 | - return $this->getField()->addItem($item,$value,$image); |
|
17 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
18 | + return $this->getField()->addItem($item, $value, $image); |
|
19 | 19 | } |
20 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL){ |
|
21 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true); |
|
20 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL) { |
|
21 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true); |
|
22 | 22 | } |
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | use Ajax\service\JArray; |
6 | 6 | trait FieldsTrait { |
7 | - protected function createItem($value){ |
|
8 | - if(\is_array($value)){ |
|
9 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
7 | + protected function createItem($value) { |
|
8 | + if (\is_array($value)) { |
|
9 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
10 | 10 | return $itemO; |
11 | 11 | }else |
12 | 12 | return new HtmlFormInput($value); |
@@ -8,7 +8,8 @@ |
||
8 | 8 | if(\is_array($value)){ |
9 | 9 | $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
10 | 10 | return $itemO; |
11 | - }else |
|
12 | - return new HtmlFormInput($value); |
|
11 | + } else { |
|
12 | + return new HtmlFormInput($value); |
|
13 | + } |
|
13 | 14 | } |
14 | 15 | } |
15 | 16 | \ No newline at end of file |
@@ -12,21 +12,21 @@ |
||
12 | 12 | */ |
13 | 13 | class HtmlFormCheckbox extends HtmlFormInput { |
14 | 14 | |
15 | - public function __construct($identifier, $label=NULL,$value=NULL,$type=NULL) { |
|
15 | + public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
16 | 16 | parent::__construct($identifier, $label, "checkbox", $value=NULL); |
17 | - if(isset($label)){ |
|
17 | + if (isset($label)) { |
|
18 | 18 | $this->swapLabel(); |
19 | 19 | $label=$this->getLabel(); |
20 | 20 | $label->setClass="hidden"; |
21 | - $label->setProperty("tabindex",0); |
|
21 | + $label->setProperty("tabindex", 0); |
|
22 | 22 | } |
23 | 23 | $this->setClass("ui checkbox"); |
24 | - if(isset($type)) |
|
24 | + if (isset($type)) |
|
25 | 25 | $this->setType($type); |
26 | - $this->wrap("<div class='field'>","</div>"); |
|
26 | + $this->wrap("<div class='field'>", "</div>"); |
|
27 | 27 | } |
28 | 28 | |
29 | - public function setType($checkboxType){ |
|
29 | + public function setType($checkboxType) { |
|
30 | 30 | return $this->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants()); |
31 | 31 | } |
32 | 32 | } |
33 | 33 | \ No newline at end of file |
@@ -21,8 +21,9 @@ |
||
21 | 21 | $label->setProperty("tabindex",0); |
22 | 22 | } |
23 | 23 | $this->setClass("ui checkbox"); |
24 | - if(isset($type)) |
|
25 | - $this->setType($type); |
|
24 | + if(isset($type)) { |
|
25 | + $this->setType($type); |
|
26 | + } |
|
26 | 27 | $this->wrap("<div class='field'>","</div>"); |
27 | 28 | } |
28 | 29 |
@@ -5,5 +5,5 @@ |
||
5 | 5 | use Ajax\common\BaseEnum; |
6 | 6 | |
7 | 7 | abstract class CheckboxType extends BaseEnum { |
8 | - const STANDARD="",TOGGLE="toggle",SLIDER="slider"; |
|
8 | + const STANDARD="", TOGGLE="toggle", SLIDER="slider"; |
|
9 | 9 | } |
10 | 10 | \ No newline at end of file |
@@ -9,10 +9,10 @@ |
||
9 | 9 | * @author jc |
10 | 10 | * @version 1.001 |
11 | 11 | */ |
12 | -abstract class HtmlSemCollection extends HtmlCollection{ |
|
12 | +abstract class HtmlSemCollection extends HtmlCollection { |
|
13 | 13 | use BaseTrait; |
14 | - public function __construct( $identifier, $tagName="div",$baseClass=""){ |
|
15 | - parent::__construct( $identifier, $tagName); |
|
14 | + public function __construct($identifier, $tagName="div", $baseClass="") { |
|
15 | + parent::__construct($identifier, $tagName); |
|
16 | 16 | $this->_baseClass=$baseClass; |
17 | 17 | $this->setClass($baseClass); |
18 | 18 | } |