@@ -8,17 +8,17 @@ |
||
| 8 | 8 | class HtmlFormInput extends HtmlFormField { |
| 9 | 9 | use TextFieldsTrait; |
| 10 | 10 | |
| 11 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
| 12 | - if(!isset($placeholder) && $type==="text") |
|
| 11 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 12 | + if (!isset($placeholder) && $type==="text") |
|
| 13 | 13 | $placeholder=$label; |
| 14 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
| 14 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
| 15 | 15 | $this->_identifier=$identifier; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function getDataField(){ |
|
| 19 | - $field= $this->getField(); |
|
| 18 | + public function getDataField() { |
|
| 19 | + $field=$this->getField(); |
|
| 20 | 20 | //TODO check getField |
| 21 | - if($field instanceof HtmlInput) |
|
| 21 | + if ($field instanceof HtmlInput) |
|
| 22 | 22 | $field=$field->getDataField(); |
| 23 | 23 | return $field; |
| 24 | 24 | } |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | class HtmlFormTextarea extends HtmlFormField { |
| 10 | 10 | use TextFieldsTrait; |
| 11 | 11 | |
| 12 | - public function __construct($identifier, $label=NULL,$value=NULL,$placeholder=NULL,$rows=NULL) { |
|
| 13 | - if(!isset($placeholder)) |
|
| 12 | + public function __construct($identifier, $label=NULL, $value=NULL, $placeholder=NULL, $rows=NULL) { |
|
| 13 | + if (!isset($placeholder)) |
|
| 14 | 14 | $placeholder=$label; |
| 15 | - parent::__construct("field-".$identifier, new HtmlTextarea($identifier,$value,$placeholder,$rows), $label); |
|
| 15 | + parent::__construct("field-".$identifier, new HtmlTextarea($identifier, $value, $placeholder, $rows), $label); |
|
| 16 | 16 | $this->_identifier=$identifier; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * Defines the textarea row count |
| 21 | 21 | * @param int $count |
| 22 | 22 | */ |
| 23 | - public function setRows($count){ |
|
| 23 | + public function setRows($count) { |
|
| 24 | 24 | $this->getField()->setRows($count); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | return $this->content["field"]; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - public function setName($name){ |
|
| 32 | - $this->getDataField()->setProperty("name",$name); |
|
| 31 | + public function setName($name) { |
|
| 32 | + $this->getDataField()->setProperty("name", $name); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -7,26 +7,26 @@ |
||
| 7 | 7 | |
| 8 | 8 | class HtmlFormDropdown extends HtmlFormField { |
| 9 | 9 | |
| 10 | - public function __construct($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false,$associative=true) { |
|
| 11 | - parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier,$value,$items,$associative))->asSelect($identifier,$multiple), $label); |
|
| 10 | + public function __construct($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false, $associative=true) { |
|
| 11 | + parent::__construct("field-".$identifier, (new HtmlDropdown("dropdown-".$identifier, $value, $items, $associative))->asSelect($identifier, $multiple), $label); |
|
| 12 | 12 | $this->_identifier=$identifier; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - public function setItems($items){ |
|
| 15 | + public function setItems($items) { |
|
| 16 | 16 | return $this->getField()->setItems($items); |
| 17 | 17 | } |
| 18 | - public function addItem($item,$value=NULL,$image=NULL){ |
|
| 19 | - return $this->getField()->addItem($item,$value,$image); |
|
| 18 | + public function addItem($item, $value=NULL, $image=NULL) { |
|
| 19 | + return $this->getField()->addItem($item, $value, $image); |
|
| 20 | 20 | } |
| 21 | - public static function multipleDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$associative=true){ |
|
| 22 | - return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative); |
|
| 21 | + public static function multipleDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $associative=true) { |
|
| 22 | + return new HtmlFormDropdown($identifier, $items, $label, $value, true, $associative); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function getDataField(){ |
|
| 25 | + public function getDataField() { |
|
| 26 | 26 | return $this->getField()->getInput(); |
| 27 | 27 | } |
| 28 | - public function asSelect($name=NULL,$multiple=false,$selection=true){ |
|
| 29 | - $this->getField()->asSelect($name,$multiple,$selection); |
|
| 28 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 29 | + $this->getField()->asSelect($name, $multiple, $selection); |
|
| 30 | 30 | return $this; |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -10,14 +10,14 @@ discard block |
||
| 10 | 10 | use Ajax\JsUtils; |
| 11 | 11 | |
| 12 | 12 | class HtmlInput extends HtmlSemDoubleElement { |
| 13 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
| 13 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
| 14 | 14 | |
| 15 | 15 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
| 16 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
| 16 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
| 17 | 17 | $this->_identifier=$identifier; |
| 18 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
| 19 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
| 20 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
| 18 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
| 19 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
| 20 | + $this->_variations=[Variation::TRANSPARENT]; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | public function getField() { |
@@ -37,11 +37,11 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | public function run(JsUtils $js) { |
| 39 | 39 | $result=parent::run($js); |
| 40 | - $result->attach("#" . $this->getDataField()->getIdentifier()); |
|
| 40 | + $result->attach("#".$this->getDataField()->getIdentifier()); |
|
| 41 | 41 | return $result; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function setTransparent(){ |
|
| 44 | + public function setTransparent() { |
|
| 45 | 45 | return $this->addToProperty("class", "transparent"); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | \ No newline at end of file |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | * @property SimpleExtComponent $_bsComponent |
| 12 | 12 | * @property string identifier |
| 13 | 13 | */ |
| 14 | -trait BaseHtmlEventsTrait{ |
|
| 14 | +trait BaseHtmlEventsTrait { |
|
| 15 | 15 | |
| 16 | - protected $_events=array (); |
|
| 16 | + protected $_events=array(); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $event |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | * @return \Ajax\common\html\BaseHtml |
| 24 | 24 | */ |
| 25 | 25 | public function addEvent($event, $jsCode, $stopPropagation=false, $preventDefault=false) { |
| 26 | - if ($stopPropagation === true) { |
|
| 27 | - $jsCode=Javascript::$stopPropagation . $jsCode; |
|
| 26 | + if ($stopPropagation===true) { |
|
| 27 | + $jsCode=Javascript::$stopPropagation.$jsCode; |
|
| 28 | 28 | } |
| 29 | - if ($preventDefault === true) { |
|
| 30 | - $jsCode=Javascript::$preventDefault . $jsCode; |
|
| 29 | + if ($preventDefault===true) { |
|
| 30 | + $jsCode=Javascript::$preventDefault.$jsCode; |
|
| 31 | 31 | } |
| 32 | 32 | return $this->_addEvent($event, $jsCode); |
| 33 | 33 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (\is_array($this->_events[$event])) { |
| 43 | 43 | $this->_events[$event][]=$jsCode; |
| 44 | 44 | } else { |
| 45 | - $this->_events[$event]=array ($this->_events[$event],$jsCode ); |
|
| 45 | + $this->_events[$event]=array($this->_events[$event], $jsCode); |
|
| 46 | 46 | } |
| 47 | 47 | } else { |
| 48 | 48 | $this->_events[$event]=$jsCode; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | return $this->onClick($jsCode); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function onCreate($jsCode){ |
|
| 73 | - if(isset($this->_events["_create"])){ |
|
| 72 | + public function onCreate($jsCode) { |
|
| 73 | + if (isset($this->_events["_create"])) { |
|
| 74 | 74 | $this->_events["_create"][]=$jsCode; |
| 75 | - }else{ |
|
| 75 | + } else { |
|
| 76 | 76 | $this->_events["_create"]=[$jsCode]; |
| 77 | 77 | } |
| 78 | 78 | return $this; |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | public function addEventsOnRun(JsUtils $js=NULL) { |
| 82 | 82 | $this->_eventsOnCreate($js); |
| 83 | 83 | if (isset($this->_bsComponent)) { |
| 84 | - foreach ( $this->_events as $event => $jsCode ) { |
|
| 84 | + foreach ($this->_events as $event => $jsCode) { |
|
| 85 | 85 | $code=$jsCode; |
| 86 | 86 | if (\is_array($jsCode)) { |
| 87 | 87 | $code=""; |
| 88 | - foreach ( $jsCode as $jsC ) { |
|
| 88 | + foreach ($jsCode as $jsC) { |
|
| 89 | 89 | if ($jsC instanceof AjaxCall) { |
| 90 | - $code.="\n" . $jsC->compile($js); |
|
| 90 | + $code.="\n".$jsC->compile($js); |
|
| 91 | 91 | } else { |
| 92 | - $code.="\n" . $jsC; |
|
| 92 | + $code.="\n".$jsC; |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | } elseif ($jsCode instanceof AjaxCall) { |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | $this->_bsComponent->addEvent($event, $code); |
| 99 | 99 | } |
| 100 | - $this->_events=array (); |
|
| 100 | + $this->_events=array(); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - protected function _eventsOnCreate(JsUtils $js=NULL){ |
|
| 105 | - if(isset($this->_events["_create"])){ |
|
| 104 | + protected function _eventsOnCreate(JsUtils $js=NULL) { |
|
| 105 | + if (isset($this->_events["_create"])) { |
|
| 106 | 106 | $create=$this->_events["_create"]; |
| 107 | - if(\is_array($create)){ |
|
| 107 | + if (\is_array($create)) { |
|
| 108 | 108 | $create=\implode("", $create); |
| 109 | 109 | } |
| 110 | - if(isset($js) && $create!=="") |
|
| 111 | - $js->exec($create,true); |
|
| 110 | + if (isset($js) && $create!=="") |
|
| 111 | + $js->exec($create, true); |
|
| 112 | 112 | unset($this->_events["_create"]); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @return BaseHtml |
| 123 | 123 | */ |
| 124 | 124 | public function _ajaxOn($operation, $event, $url, $responseElement="", $parameters=array()) { |
| 125 | - $params=array ("url" => $url,"responseElement" => $responseElement ); |
|
| 125 | + $params=array("url" => $url, "responseElement" => $responseElement); |
|
| 126 | 126 | $params=array_merge($params, $parameters); |
| 127 | 127 | $this->_addEvent($event, new AjaxCall($operation, $params)); |
| 128 | 128 | return $this; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function jsDoJquery($jqueryCall, $param="") { |
| 158 | - return "$('#" . $this->identifier . "')." . $jqueryCall . "(" . Javascript::prep_value($param) . ");"; |
|
| 158 | + return "$('#".$this->identifier."').".$jqueryCall."(".Javascript::prep_value($param).");"; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function executeOnRun($jsCode) { |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function jsToggle($value) { |
| 178 | - return $this->jsDoJquery("toggle",$value); |
|
| 178 | + return $this->jsDoJquery("toggle", $value); |
|
| 179 | 179 | } |
| 180 | 180 | } |