@@ -6,6 +6,9 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait CheckboxTrait { |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $name |
|
| 11 | + */ |
|
| 9 | 12 | public abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
| 10 | 13 | |
| 11 | 14 | public function setType($checkboxType) { |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\base\constants\Color; |
| 7 | 7 | |
| 8 | 8 | trait BaseTrait { |
| 9 | - protected $_variations=[ ]; |
|
| 10 | - protected $_states=[ ]; |
|
| 9 | + protected $_variations=[]; |
|
| 10 | + protected $_states=[]; |
|
| 11 | 11 | protected $_baseClass; |
| 12 | 12 | |
| 13 | 13 | protected abstract function setPropertyCtrl($name, $value, $typeCtrl); |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function setVariations($variations=array()) { |
| 38 | - foreach ( $variations as $variation ) { |
|
| 38 | + foreach ($variations as $variation) { |
|
| 39 | 39 | $this->setVariation($variation); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function setStates($states=array()) { |
| 45 | - foreach ( $states as $state ) { |
|
| 45 | + foreach ($states as $state) { |
|
| 46 | 46 | $this->setState($state); |
| 47 | 47 | } |
| 48 | 48 | return $this; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | class HtmlFormCheckbox extends HtmlFormField { |
| 16 | 16 | use CheckboxTrait; |
| 17 | 17 | public function __construct($identifier, $label=NULL, $value=NULL, $type=NULL) { |
| 18 | - parent::__construct("field-".$identifier, new HtmlCheckbox($identifier,$label,$value,$type)); |
|
| 18 | + parent::__construct("field-".$identifier, new HtmlCheckbox($identifier, $label, $value, $type)); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public static function slider($identifier, $label="", $value=NULL) { |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | if (\is_string($end)) { |
| 30 | 30 | $label=$end; |
| 31 | 31 | \array_pop($fields); |
| 32 | - } else |
|
| 32 | + }else |
|
| 33 | 33 | $label=NULL; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | if (isset($label)) |
| 37 | 37 | $this->setLabel($label); |
| 38 | - foreach ( $fields as $field ) { |
|
| 38 | + foreach ($fields as $field) { |
|
| 39 | 39 | $this->addItem($field); |
| 40 | 40 | } |
| 41 | 41 | return $this; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if ($this->_equalWidth) { |
| 66 | 66 | $count=$this->count(); |
| 67 | 67 | $this->addToProperty("class", Wide::getConstants()["W".$count]." fields"); |
| 68 | - } else |
|
| 68 | + }else |
|
| 69 | 69 | $this->addToProperty("class", "fields"); |
| 70 | 70 | return parent::compile($js, $view); |
| 71 | 71 | } |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public static function radios($name, $items=array(), $label=NULL, $value=null, $type=NULL) { |
| 99 | - $fields=array (); |
|
| 99 | + $fields=array(); |
|
| 100 | 100 | $i=0; |
| 101 | - foreach ( $items as $val => $caption ) { |
|
| 101 | + foreach ($items as $val => $caption) { |
|
| 102 | 102 | $itemO=new HtmlFormRadio($name."-".$i++, $name, $caption, $val, $type); |
| 103 | 103 | if ($val===$value) { |
| 104 | 104 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | public static function checkeds($name, $items=array(), $label=NULL, $values=array(), $type=NULL) { |
| 115 | - $fields=array (); |
|
| 115 | + $fields=array(); |
|
| 116 | 116 | $i=0; |
| 117 | - foreach ( $items as $val => $caption ) { |
|
| 117 | + foreach ($items as $val => $caption) { |
|
| 118 | 118 | $itemO=new HtmlFormCheckbox($name."-".$i++, $name, $caption, $val, $type); |
| 119 | 119 | if (\array_search($val, $values)!==false) { |
| 120 | 120 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use Ajax\semantic\html\base\constants\CheckboxType; |
| 7 | 7 | |
| 8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
| 9 | - protected $_params=array (); |
|
| 9 | + protected $_params=array(); |
|
| 10 | 10 | |
| 11 | 11 | public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
| 12 | 12 | parent::__construct("ck-".$identifier, "div", "ui ".$type); |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | * @return \Ajax\semantic\html\collections\form\AbstractHtmlFormRadioCheckbox |
| 74 | 74 | */ |
| 75 | 75 | public function attachEvent($selector, $action=NULL) { |
| 76 | - if (isset($action)!==false||\is_numeric($action)===true) { |
|
| 76 | + if (isset($action)!==false || \is_numeric($action)===true) { |
|
| 77 | 77 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
| 78 | - } else { |
|
| 78 | + }else { |
|
| 79 | 79 | $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
| 80 | 80 | } |
| 81 | 81 | $js=\str_replace("%identifier%", $this->identifier, $js); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function attachEvents($events=array()) { |
| 91 | 91 | if (\is_array($events)) { |
| 92 | - foreach ( $events as $action => $selector ) { |
|
| 92 | + foreach ($events as $action => $selector) { |
|
| 93 | 93 | $this->attachEvent($selector, $action); |
| 94 | 94 | } |
| 95 | 95 | } |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
| 15 | 15 | parent::__construct("div-".$identifier, "div", "ui input"); |
| 16 | 16 | $this->content=new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder); |
| 17 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
| 18 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
| 17 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 18 | + $this->_variations=[Variation::TRANSPARENT]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function setFocus() { |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | $labelO=new HtmlLabel("label-".$this->identifier, $label); |
| 36 | 36 | if (isset($icon)) |
| 37 | 37 | $labelO->addIcon($icon); |
| 38 | - } else { |
|
| 39 | - $labelO->addToPropertyCtrl("class", "label", array ("label" )); |
|
| 38 | + }else { |
|
| 39 | + $labelO->addToPropertyCtrl("class", "label", array("label")); |
|
| 40 | 40 | } |
| 41 | 41 | $this->addToProperty("class", $direction." labeled"); |
| 42 | 42 | $this->addContent($labelO, \strstr($direction, Direction::LEFT)!==false); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | if (\is_array($value)) { |
| 22 | 22 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value[0]); |
| 23 | 23 | $item->addIcon($value[1]); |
| 24 | - } else |
|
| 24 | + }else |
|
| 25 | 25 | $item=new HtmlListItem("item-".$this->identifier."-".$count, $value); |
| 26 | 26 | return $item; |
| 27 | 27 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function asLink() { |
| 38 | - $this->addToPropertyCtrl("class", "link", array ("link" )); |
|
| 38 | + $this->addToPropertyCtrl("class", "link", array("link")); |
|
| 39 | 39 | return $this->contentAs("a"); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -71,9 +71,9 @@ discard block |
||
| 71 | 71 | $masterO->setClass("item"); |
| 72 | 72 | $this->addItem($masterO); |
| 73 | 73 | } |
| 74 | - $fields=array (); |
|
| 74 | + $fields=array(); |
|
| 75 | 75 | $i=0; |
| 76 | - foreach ( $items as $val => $caption ) { |
|
| 76 | + foreach ($items as $val => $caption) { |
|
| 77 | 77 | $itemO=new HtmlFormCheckbox($identifier."-".$i++, $caption, $val, "child"); |
| 78 | 78 | if (\array_search($val, $values)!==false) { |
| 79 | 79 | $itemO->getField()->getField()->setProperty("checked", ""); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $list=new HtmlList("", $fields); |
| 86 | 86 | $list->setClass("list"); |
| 87 | 87 | $masterO->addContent($list); |
| 88 | - } else { |
|
| 88 | + }else { |
|
| 89 | 89 | $this->addList($fields); |
| 90 | 90 | } |
| 91 | 91 | $this->_hasCheckedList=true; |