@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | abstract class AbstractCheckbox extends HtmlSemDoubleElement { |
| 9 | 9 | |
| 10 | - protected $_params = []; |
|
| 10 | + protected $_params=[]; |
|
| 11 | 11 | |
| 12 | - public function __construct($identifier, $name = NULL, $label = NULL, $value = NULL, $inputType = "checkbox", $type = "checkbox") { |
|
| 13 | - parent::__construct("ck-" . $identifier, "div", "ui " . $type); |
|
| 14 | - $this->_identifier = $identifier; |
|
| 15 | - $field = new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
|
| 12 | + public function __construct($identifier, $name=NULL, $label=NULL, $value=NULL, $inputType="checkbox", $type="checkbox") { |
|
| 13 | + parent::__construct("ck-".$identifier, "div", "ui ".$type); |
|
| 14 | + $this->_identifier=$identifier; |
|
| 15 | + $field=new \Ajax\common\html\html5\HtmlInput($identifier, $inputType, $value); |
|
| 16 | 16 | $field->setProperty("name", $name); |
| 17 | 17 | $this->setField($field); |
| 18 | 18 | if (isset($label)) |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | $this->setLibraryId($identifier); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - public function setChecked($value = true) { |
|
| 24 | - if ($value === true) { |
|
| 23 | + public function setChecked($value=true) { |
|
| 24 | + if ($value===true) { |
|
| 25 | 25 | $this->getField()->setProperty("checked", "checked"); |
| 26 | 26 | } else { |
| 27 | 27 | $this->getField()->removeProperty("checked"); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | return $this; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function forceValue($value = 'true') { |
|
| 32 | + public function forceValue($value='true') { |
|
| 33 | 33 | $this->getField()->forceValue($value); |
| 34 | 34 | return $this; |
| 35 | 35 | } |
@@ -38,21 +38,21 @@ discard block |
||
| 38 | 38 | return $this->addToPropertyCtrl("class", $checkboxType, CheckboxType::getConstants()); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function setLabel($label, $value = null) { |
|
| 42 | - $labelO = $label; |
|
| 41 | + public function setLabel($label, $value=null) { |
|
| 42 | + $labelO=$label; |
|
| 43 | 43 | if (\is_string($label)) { |
| 44 | - $labelO = new HtmlSemDoubleElement("", "label", ""); |
|
| 44 | + $labelO=new HtmlSemDoubleElement("", "label", ""); |
|
| 45 | 45 | $labelO->setContent($label); |
| 46 | 46 | $labelO->setProperty("for", $this->getField() |
| 47 | 47 | ->getIdentifier()); |
| 48 | 48 | if (isset($value)) |
| 49 | 49 | $labelO->setProperty("data-value", $value); |
| 50 | 50 | } |
| 51 | - $this->content["label"] = $labelO; |
|
| 51 | + $this->content["label"]=$labelO; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function setField($field) { |
| 55 | - $this->content["field"] = $field; |
|
| 55 | + $this->content["field"]=$field; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * puts the label before or behind |
| 79 | 79 | */ |
| 80 | 80 | public function swapLabel() { |
| 81 | - $label = $this->getLabel(); |
|
| 81 | + $label=$this->getLabel(); |
|
| 82 | 82 | unset($this->content["label"]); |
| 83 | - $this->content["label"] = $label; |
|
| 83 | + $this->content["label"]=$label; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function setReadonly() { |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | * action to execute : check, uncheck or NULL for toggle |
| 98 | 98 | * @return AbstractCheckbox |
| 99 | 99 | */ |
| 100 | - public function attachEvent($selector, $action = NULL) { |
|
| 101 | - if (isset($action) || \is_numeric($action) === true) { |
|
| 102 | - $js = '$("#%identifier%").checkbox("attach events", "' . $selector . '", "' . $action . '");'; |
|
| 100 | + public function attachEvent($selector, $action=NULL) { |
|
| 101 | + if (isset($action) || \is_numeric($action)===true) { |
|
| 102 | + $js='$("#%identifier%").checkbox("attach events", "'.$selector.'", "'.$action.'");'; |
|
| 103 | 103 | } else { |
| 104 | - $js = '$("#%identifier%").checkbox("attach events", "' . $selector . '");'; |
|
| 104 | + $js='$("#%identifier%").checkbox("attach events", "'.$selector.'");'; |
|
| 105 | 105 | } |
| 106 | - $js = \str_replace("%identifier%", $this->identifier, $js); |
|
| 106 | + $js=\str_replace("%identifier%", $this->identifier, $js); |
|
| 107 | 107 | return $this->executeOnRun($js); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * associative array of events to attach ex : ["#bt-toggle","check"=>"#bt-check","uncheck"=>"#bt-uncheck"] |
| 115 | 115 | * @return AbstractCheckbox |
| 116 | 116 | */ |
| 117 | - public function attachEvents($events = array()) { |
|
| 117 | + public function attachEvents($events=array()) { |
|
| 118 | 118 | if (\is_array($events)) { |
| 119 | 119 | foreach ($events as $action => $selector) { |
| 120 | 120 | $this->attachEvent($selector, $action); |
@@ -128,23 +128,23 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | public function setOnChecked($jsCode) { |
| 131 | - $this->_params["onChecked"] = $jsCode; |
|
| 131 | + $this->_params["onChecked"]=$jsCode; |
|
| 132 | 132 | return $this; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | public function setOnUnchecked($jsCode) { |
| 136 | - $this->_params["onUnchecked"] = $jsCode; |
|
| 136 | + $this->_params["onUnchecked"]=$jsCode; |
|
| 137 | 137 | return $this; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | public function setOnChange($jsCode) { |
| 141 | - $this->_params["onChange"] = $jsCode; |
|
| 141 | + $this->_params["onChange"]=$jsCode; |
|
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | public function run(JsUtils $js) { |
| 146 | - if (! isset($this->_bsComponent)) |
|
| 147 | - $this->_bsComponent = $js->semantic()->checkbox("#" . $this->identifier, $this->_params); |
|
| 146 | + if (!isset($this->_bsComponent)) |
|
| 147 | + $this->_bsComponent=$js->semantic()->checkbox("#".$this->identifier, $this->_params); |
|
| 148 | 148 | return parent::run($js); |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -13,17 +13,17 @@ discard block |
||
| 13 | 13 | use Ajax\service\JArray; |
| 14 | 14 | |
| 15 | 15 | class HtmlDropdown extends HtmlSemDoubleElement { |
| 16 | - use FieldTrait,LabeledIconTrait { |
|
| 16 | + use FieldTrait, LabeledIconTrait { |
|
| 17 | 17 | addIcon as addIconP; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - protected $mClass = "menu"; |
|
| 20 | + protected $mClass="menu"; |
|
| 21 | 21 | |
| 22 | - protected $mTagName = "div"; |
|
| 22 | + protected $mTagName="div"; |
|
| 23 | 23 | |
| 24 | - protected $items = array(); |
|
| 24 | + protected $items=array(); |
|
| 25 | 25 | |
| 26 | - protected $_params = array( |
|
| 26 | + protected $_params=array( |
|
| 27 | 27 | "action" => "nothing", |
| 28 | 28 | "on" => "hover", |
| 29 | 29 | "showOnFocus" => true |
@@ -37,26 +37,26 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected $_multiple; |
| 39 | 39 | |
| 40 | - public function __construct($identifier, $value = "", $items = array(), $associative = true) { |
|
| 40 | + public function __construct($identifier, $value="", $items=array(), $associative=true) { |
|
| 41 | 41 | parent::__construct($identifier, "div"); |
| 42 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdown.php'; |
|
| 42 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdown.php'; |
|
| 43 | 43 | $this->setProperty("class", "ui dropdown"); |
| 44 | - $this->_multiple = false; |
|
| 45 | - $content = []; |
|
| 44 | + $this->_multiple=false; |
|
| 45 | + $content=[]; |
|
| 46 | 46 | if ($value instanceof HtmlSemDoubleElement) { |
| 47 | - $text = $value; |
|
| 47 | + $text=$value; |
|
| 48 | 48 | } else { |
| 49 | - $text = new HtmlSemDoubleElement("text-" . $this->identifier, "div"); |
|
| 49 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 50 | 50 | $text->setClass("text"); |
| 51 | 51 | $this->setValue($value); |
| 52 | 52 | } |
| 53 | - $content = [ |
|
| 53 | + $content=[ |
|
| 54 | 54 | "text" => $text |
| 55 | 55 | ]; |
| 56 | - $content["arrow"] = new HtmlIcon($identifier . "-icon", "dropdown"); |
|
| 57 | - $this->content = $content; |
|
| 58 | - $this->tagName = "div"; |
|
| 59 | - $this->_associative = $associative; |
|
| 56 | + $content["arrow"]=new HtmlIcon($identifier."-icon", "dropdown"); |
|
| 57 | + $this->content=$content; |
|
| 58 | + $this->tagName="div"; |
|
| 59 | + $this->_associative=$associative; |
|
| 60 | 60 | $this->addItems($items); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -68,16 +68,16 @@ discard block |
||
| 68 | 68 | return $this->input; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function addItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
| 72 | - $itemO = $this->beforeAddItem($item, $value, $image, $description); |
|
| 73 | - $this->items[] = $itemO; |
|
| 71 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 72 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 73 | + $this->items[]=$itemO; |
|
| 74 | 74 | return $itemO; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function addIcon($icon, $before = true, $labeled = false) { |
|
| 77 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 78 | 78 | $this->removeArrow(); |
| 79 | 79 | $this->addIconP($icon, $before, $labeled); |
| 80 | - $elm = $this->getElementById("text-" . $this->identifier, $this->content); |
|
| 80 | + $elm=$this->getElementById("text-".$this->identifier, $this->content); |
|
| 81 | 81 | if (isset($elm)) { |
| 82 | 82 | $elm->setWrapAfter(""); |
| 83 | 83 | } |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function addIcons($icons) { |
| 88 | - $count = $this->count(); |
|
| 89 | - for ($i = 0; $i < \sizeof($icons) && $i < $count; $i ++) { |
|
| 88 | + $count=$this->count(); |
|
| 89 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 90 | 90 | $this->getItem($i)->addIcon($icons[$i]); |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -98,32 +98,32 @@ discard block |
||
| 98 | 98 | * @param int $position |
| 99 | 99 | * @return HtmlDropdownItem |
| 100 | 100 | */ |
| 101 | - public function insertItem($item, $position = 0) { |
|
| 102 | - $itemO = $this->beforeAddItem($item); |
|
| 103 | - $start = array_slice($this->items, 0, $position); |
|
| 104 | - $end = array_slice($this->items, $position); |
|
| 105 | - $start[] = $item; |
|
| 106 | - $this->items = array_merge($start, $end); |
|
| 101 | + public function insertItem($item, $position=0) { |
|
| 102 | + $itemO=$this->beforeAddItem($item); |
|
| 103 | + $start=array_slice($this->items, 0, $position); |
|
| 104 | + $end=array_slice($this->items, $position); |
|
| 105 | + $start[]=$item; |
|
| 106 | + $this->items=array_merge($start, $end); |
|
| 107 | 107 | return $itemO; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | protected function removeArrow() { |
| 111 | - if (\sizeof($this->content) > 1) { |
|
| 111 | + if (\sizeof($this->content)>1) { |
|
| 112 | 112 | unset($this->content["arrow"]); |
| 113 | - $this->content = \array_values($this->content); |
|
| 113 | + $this->content=\array_values($this->content); |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - protected function beforeAddItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
| 118 | - $itemO = $item; |
|
| 117 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 118 | + $itemO=$item; |
|
| 119 | 119 | if (\is_array($item)) { |
| 120 | - $description = JArray::getValue($item, "description", 3); |
|
| 121 | - $value = JArray::getValue($item, "value", 1); |
|
| 122 | - $image = JArray::getValue($item, "image", 2); |
|
| 123 | - $item = JArray::getValue($item, "item", 0); |
|
| 120 | + $description=JArray::getValue($item, "description", 3); |
|
| 121 | + $value=JArray::getValue($item, "value", 1); |
|
| 122 | + $image=JArray::getValue($item, "image", 2); |
|
| 123 | + $item=JArray::getValue($item, "item", 0); |
|
| 124 | 124 | } |
| 125 | - if (! $item instanceof HtmlDropdownItem) { |
|
| 126 | - $itemO = new HtmlDropdownItem("dd-item-" . $this->identifier . "-" . \sizeof($this->items), $item, $value, $image, $description); |
|
| 125 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 126 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 127 | 127 | } elseif ($itemO instanceof HtmlDropdownItem) { |
| 128 | 128 | $this->addToProperty("class", "vertical"); |
| 129 | 129 | } |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | public function addInput($name) { |
| 142 | - if (! isset($name)) |
|
| 143 | - $name = "input-" . $this->identifier; |
|
| 142 | + if (!isset($name)) |
|
| 143 | + $name="input-".$this->identifier; |
|
| 144 | 144 | $this->setAction("activate"); |
| 145 | - $this->input = new HtmlInput($name, "hidden"); |
|
| 146 | - $this->input->setIdentifier("input-" . $this->identifier); |
|
| 145 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 146 | + $this->input->setIdentifier("input-".$this->identifier); |
|
| 147 | 147 | return $this->input; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @param string $icon |
| 155 | 155 | * @return HtmlDropdownItem |
| 156 | 156 | */ |
| 157 | - public function addSearchInputItem($placeHolder = NULL, $icon = NULL) { |
|
| 157 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 158 | 158 | return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @param string $icon |
| 175 | 175 | * @return HtmlDropdownItem |
| 176 | 176 | */ |
| 177 | - public function addHeaderItem($caption = NULL, $icon = NULL) { |
|
| 177 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 178 | 178 | return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
| 179 | 179 | } |
| 180 | 180 | |
@@ -219,12 +219,12 @@ discard block |
||
| 219 | 219 | * @return $this |
| 220 | 220 | */ |
| 221 | 221 | public function setPropertyValues($property, $values) { |
| 222 | - $i = 0; |
|
| 223 | - if (\is_array($values) === false) { |
|
| 224 | - $values = \array_fill(0, $this->count(), $values); |
|
| 222 | + $i=0; |
|
| 223 | + if (\is_array($values)===false) { |
|
| 224 | + $values=\array_fill(0, $this->count(), $values); |
|
| 225 | 225 | } |
| 226 | 226 | foreach ($values as $value) { |
| 227 | - $c = $this->items[$i ++]; |
|
| 227 | + $c=$this->items[$i++]; |
|
| 228 | 228 | if (isset($c)) { |
| 229 | 229 | $c->setProperty($property, $value); |
| 230 | 230 | } else { |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | * @param boolean $dropdown |
| 259 | 259 | */ |
| 260 | 260 | public function asDropdown($dropdown) { |
| 261 | - if ($dropdown === false) { |
|
| 262 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdownMenu.php'; |
|
| 263 | - $dropdown = "menu"; |
|
| 261 | + if ($dropdown===false) { |
|
| 262 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
|
| 263 | + $dropdown="menu"; |
|
| 264 | 264 | } else { |
| 265 | - $dropdown = "dropdown"; |
|
| 266 | - $this->mClass = "menu"; |
|
| 265 | + $dropdown="dropdown"; |
|
| 266 | + $this->mClass="menu"; |
|
| 267 | 267 | } |
| 268 | 268 | return $this->addToPropertyCtrl("class", $dropdown, array( |
| 269 | 269 | "menu", |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | )); |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | - public function asButton($floating = false) { |
|
| 292 | + public function asButton($floating=false) { |
|
| 293 | 293 | $this->removeArrow(); |
| 294 | 294 | if ($floating) |
| 295 | 295 | $this->addToProperty("class", "floating"); |
@@ -297,15 +297,15 @@ discard block |
||
| 297 | 297 | return $this->addToProperty("class", "button"); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - public function asSelect($name = NULL, $multiple = false, $selection = true) { |
|
| 301 | - $this->_multiple = $multiple; |
|
| 300 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 301 | + $this->_multiple=$multiple; |
|
| 302 | 302 | if (isset($name)) |
| 303 | 303 | $this->addInput($name); |
| 304 | 304 | if ($multiple) { |
| 305 | 305 | $this->addToProperty("class", "multiple"); |
| 306 | 306 | } |
| 307 | 307 | if ($selection) { |
| 308 | - if ($this->propertyContains("class", "button") === false) |
|
| 308 | + if ($this->propertyContains("class", "button")===false) |
|
| 309 | 309 | $this->addToPropertyCtrl("class", "selection", array( |
| 310 | 310 | "selection" |
| 311 | 311 | )); |
@@ -313,31 +313,31 @@ discard block |
||
| 313 | 313 | return $this; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - public function asSearch($name = NULL, $multiple = false, $selection = true) { |
|
| 316 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 317 | 317 | $this->asSelect($name, $multiple, $selection); |
| 318 | 318 | return $this->addToProperty("class", "search"); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - public function setSelect($name = NULL, $multiple = false) { |
|
| 322 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
| 323 | - if (! isset($name)) |
|
| 324 | - $name = "select-" . $this->identifier; |
|
| 325 | - $this->input = null; |
|
| 321 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 322 | + $this->_template='<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
| 323 | + if (!isset($name)) |
|
| 324 | + $name="select-".$this->identifier; |
|
| 325 | + $this->input=null; |
|
| 326 | 326 | if ($multiple) { |
| 327 | 327 | $this->setProperty("multiple", true); |
| 328 | 328 | $this->addToProperty("class", "multiple"); |
| 329 | 329 | } |
| 330 | 330 | $this->setAction("activate"); |
| 331 | - $this->tagName = "select"; |
|
| 331 | + $this->tagName="select"; |
|
| 332 | 332 | $this->setProperty("name", $name); |
| 333 | - $this->content = null; |
|
| 333 | + $this->content=null; |
|
| 334 | 334 | foreach ($this->items as $item) { |
| 335 | 335 | $item->asOption(); |
| 336 | 336 | } |
| 337 | 337 | return $this; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - public function asSubmenu($pointing = NULL) { |
|
| 340 | + public function asSubmenu($pointing=NULL) { |
|
| 341 | 341 | $this->setClass("ui dropdown link item"); |
| 342 | 342 | if (isset($pointing)) { |
| 343 | 343 | $this->setPointing($pointing); |
@@ -345,29 +345,29 @@ discard block |
||
| 345 | 345 | return $this; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | - public function setPointing($value = Direction::NONE) { |
|
| 349 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 348 | + public function setPointing($value=Direction::NONE) { |
|
| 349 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | public function setValue($value) { |
| 353 | - $this->value = $value; |
|
| 353 | + $this->value=$value; |
|
| 354 | 354 | return $this; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | public function setDefaultText($text) { |
| 358 | - $this->content["text"] = new HtmlSemDoubleElement("", "div", "default text", $text); |
|
| 358 | + $this->content["text"]=new HtmlSemDoubleElement("", "div", "default text", $text); |
|
| 359 | 359 | return $this; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | private function applyValue() { |
| 363 | - $value = $this->value; |
|
| 363 | + $value=$this->value; |
|
| 364 | 364 | if (isset($this->input) && isset($value)) { |
| 365 | 365 | $this->input->setProperty("value", $value); |
| 366 | 366 | } else { |
| 367 | 367 | $this->setProperty("value", $value); |
| 368 | 368 | } |
| 369 | - $textElement = $this->getElementById("text-" . $this->identifier, $this->content); |
|
| 370 | - if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple) |
|
| 369 | + $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
|
| 370 | + if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple) |
|
| 371 | 371 | $textElement->setContent($value); |
| 372 | 372 | return $this; |
| 373 | 373 | } |
@@ -377,9 +377,9 @@ discard block |
||
| 377 | 377 | * @see BaseHtml::run() |
| 378 | 378 | */ |
| 379 | 379 | public function run(JsUtils $js) { |
| 380 | - if ($this->propertyContains("class", "simple") === false) { |
|
| 381 | - if (isset($this->_bsComponent) === false) { |
|
| 382 | - $this->_bsComponent = $js->semantic()->dropdown("#" . $this->identifier, $this->_params); |
|
| 380 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 381 | + if (isset($this->_bsComponent)===false) { |
|
| 382 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 383 | 383 | $this->_bsComponent->setItemSelector(".item"); |
| 384 | 384 | } |
| 385 | 385 | $this->addEventsOnRun($js); |
@@ -394,31 +394,31 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | public function setAction($action) { |
| 397 | - $this->_params["action"] = $action; |
|
| 397 | + $this->_params["action"]=$action; |
|
| 398 | 398 | return $this; |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | public function setOn($on) { |
| 402 | - $this->_params["on"] = $on; |
|
| 402 | + $this->_params["on"]=$on; |
|
| 403 | 403 | return $this; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | public function setShowOnFocus($value) { |
| 407 | - $this->_params["showOnFocus"] = $value; |
|
| 407 | + $this->_params["showOnFocus"]=$value; |
|
| 408 | 408 | return $this; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | public function setAllowAdditions($value) { |
| 412 | - $this->_params["allowAdditions"] = $value; |
|
| 412 | + $this->_params["allowAdditions"]=$value; |
|
| 413 | 413 | return $this; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | public function setFullTextSearch($value) { |
| 417 | - $this->_params["fullTextSearch"] = $value; |
|
| 417 | + $this->_params["fullTextSearch"]=$value; |
|
| 418 | 418 | return $this; |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 421 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 422 | 422 | $this->applyValue(); |
| 423 | 423 | return parent::compile($js, $view); |
| 424 | 424 | } |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | return $this->input; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | - public function setIcon($icon = "dropdown") { |
|
| 431 | - $this->content["arrow"] = new HtmlIcon($this->identifier . "-icon", $icon); |
|
| 430 | + public function setIcon($icon="dropdown") { |
|
| 431 | + $this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon); |
|
| 432 | 432 | return $this; |
| 433 | 433 | } |
| 434 | 434 | |
| 435 | - public function jsAddItem($caption, $value = null) { |
|
| 436 | - $value = $value ?? $caption; |
|
| 437 | - $js = "var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}"; |
|
| 435 | + public function jsAddItem($caption, $value=null) { |
|
| 436 | + $value=$value ?? $caption; |
|
| 437 | + $js="var first=$('#{$this->identifier} .item').first();if(first!=undefined){var newItem =first.clone();first.parent().append(newItem);newItem.html({$caption});newItem.attr('data-value',{$value}).removeClass('active filtered');}"; |
|
| 438 | 438 | return $js; |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | public function setClearable($value) { |
| 442 | - $this->_params["clearable"] = $value; |
|
| 442 | + $this->_params["clearable"]=$value; |
|
| 443 | 443 | return $this; |
| 444 | 444 | } |
| 445 | 445 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * Parameters addedValue, addedText, $addedChoice |
| 449 | 449 | */ |
| 450 | 450 | public function setOnAdd($jsCode) { |
| 451 | - $this->_params["onAdd"] = $jsCode; |
|
| 451 | + $this->_params["onAdd"]=$jsCode; |
|
| 452 | 452 | return $this; |
| 453 | 453 | } |
| 454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * Parameters removedValue, removedText, $removedChoice |
| 458 | 458 | */ |
| 459 | 459 | public function setOnRemove($jsCode) { |
| 460 | - $this->_params["onRemove"] = $jsCode; |
|
| 460 | + $this->_params["onRemove"]=$jsCode; |
|
| 461 | 461 | return $this; |
| 462 | 462 | } |
| 463 | 463 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | protected $_placeholder; |
| 11 | 11 | |
| 12 | - public function __construct($identifier, $type = "text", $value = NULL, $placeholder = NULL) { |
|
| 12 | + public function __construct($identifier, $type="text", $value=NULL, $placeholder=NULL) { |
|
| 13 | 13 | parent::__construct($identifier, "input"); |
| 14 | 14 | $this->setProperty("name", $identifier); |
| 15 | 15 | $this->setValue($value); |
@@ -27,23 +27,23 @@ discard block |
||
| 27 | 27 | return $this->setProperty("type", $value); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function forceValue($value = 'true') { |
|
| 31 | - $this->wrap('<input type="hidden" value="false" name="' . $this->identifier . '"/>'); |
|
| 30 | + public function forceValue($value='true') { |
|
| 31 | + $this->wrap('<input type="hidden" value="false" name="'.$this->identifier.'"/>'); |
|
| 32 | 32 | $this->setValue($value); |
| 33 | 33 | return $this; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function setPlaceholder($value) { |
| 37 | 37 | if (JString::isNotNull($value)) |
| 38 | - $this->_placeholder = $value; |
|
| 38 | + $this->_placeholder=$value; |
|
| 39 | 39 | return $this; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 43 | - $value = $this->_placeholder; |
|
| 42 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 43 | + $value=$this->_placeholder; |
|
| 44 | 44 | if (JString::isNull($value)) { |
| 45 | 45 | if (JString::isNotNull($this->getProperty("name"))) |
| 46 | - $value = \ucfirst($this->getProperty("name")); |
|
| 46 | + $value=\ucfirst($this->getProperty("name")); |
|
| 47 | 47 | } |
| 48 | 48 | $this->setProperty("placeholder", $value); |
| 49 | 49 | return parent::compile($js, $view); |