@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function __construct(JsUtils $js) { |
| 9 | 9 | parent::__construct($js); |
| 10 | - $this->uiName = "dropdown"; |
|
| 10 | + $this->uiName="dropdown"; |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function setOnAdd($value) { |
| 59 | - $this->params["onAdd"] = "%function(addedValue, addedText, \$addedChoice){" . $value . "}%"; |
|
| 59 | + $this->params["onAdd"]="%function(addedValue, addedText, \$addedChoice){".$value."}%"; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function setOnRemove($value) { |
| 63 | - $this->params["onRemove"] = "%function(removedValue, removedText, \$removedChoice){" . $value . "}%"; |
|
| 63 | + $this->params["onRemove"]="%function(removedValue, removedText, \$removedChoice){".$value."}%"; |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -13,17 +13,17 @@ discard block |
||
| 13 | 13 | use Ajax\common\html\HtmlDoubleElement; |
| 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,28 +37,28 @@ 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 (isset($value)) { |
| 47 | 47 | if ($value instanceof HtmlSemDoubleElement) { |
| 48 | - $text = $value; |
|
| 48 | + $text=$value; |
|
| 49 | 49 | } else { |
| 50 | - $text = new HtmlSemDoubleElement("text-" . $this->identifier, "div"); |
|
| 50 | + $text=new HtmlSemDoubleElement("text-".$this->identifier, "div"); |
|
| 51 | 51 | $text->setClass("text"); |
| 52 | 52 | $this->setValue($value); |
| 53 | 53 | } |
| 54 | - $content = [ |
|
| 54 | + $content=[ |
|
| 55 | 55 | "text" => $text |
| 56 | 56 | ]; |
| 57 | 57 | } |
| 58 | - $content["arrow"] = new HtmlIcon($identifier . "-icon", "dropdown"); |
|
| 59 | - $this->content = $content; |
|
| 60 | - $this->tagName = "div"; |
|
| 61 | - $this->_associative = $associative; |
|
| 58 | + $content["arrow"]=new HtmlIcon($identifier."-icon", "dropdown"); |
|
| 59 | + $this->content=$content; |
|
| 60 | + $this->tagName="div"; |
|
| 61 | + $this->_associative=$associative; |
|
| 62 | 62 | $this->addItems($items); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | return $this->input; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function addItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
| 74 | - $itemO = $this->beforeAddItem($item, $value, $image, $description); |
|
| 75 | - $this->items[] = $itemO; |
|
| 73 | + public function addItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 74 | + $itemO=$this->beforeAddItem($item, $value, $image, $description); |
|
| 75 | + $this->items[]=$itemO; |
|
| 76 | 76 | return $itemO; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function addIcon($icon, $before = true, $labeled = false) { |
|
| 79 | + public function addIcon($icon, $before=true, $labeled=false) { |
|
| 80 | 80 | $this->removeArrow(); |
| 81 | 81 | $this->addIconP($icon, $before, $labeled); |
| 82 | - $elm = $this->getElementById("text-" . $this->identifier, $this->content); |
|
| 82 | + $elm=$this->getElementById("text-".$this->identifier, $this->content); |
|
| 83 | 83 | if (isset($elm)) { |
| 84 | 84 | $elm->setWrapAfter(""); |
| 85 | 85 | } |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | public function addIcons($icons) { |
| 90 | - $count = $this->count(); |
|
| 91 | - for ($i = 0; $i < \sizeof($icons) && $i < $count; $i ++) { |
|
| 90 | + $count=$this->count(); |
|
| 91 | + for ($i=0; $i<\sizeof($icons) && $i<$count; $i++) { |
|
| 92 | 92 | $this->getItem($i)->addIcon($icons[$i]); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -100,32 +100,32 @@ discard block |
||
| 100 | 100 | * @param int $position |
| 101 | 101 | * @return HtmlDropdownItem |
| 102 | 102 | */ |
| 103 | - public function insertItem($item, $position = 0) { |
|
| 104 | - $itemO = $this->beforeAddItem($item); |
|
| 105 | - $start = array_slice($this->items, 0, $position); |
|
| 106 | - $end = array_slice($this->items, $position); |
|
| 107 | - $start[] = $item; |
|
| 108 | - $this->items = array_merge($start, $end); |
|
| 103 | + public function insertItem($item, $position=0) { |
|
| 104 | + $itemO=$this->beforeAddItem($item); |
|
| 105 | + $start=array_slice($this->items, 0, $position); |
|
| 106 | + $end=array_slice($this->items, $position); |
|
| 107 | + $start[]=$item; |
|
| 108 | + $this->items=array_merge($start, $end); |
|
| 109 | 109 | return $itemO; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | protected function removeArrow() { |
| 113 | - if (\sizeof($this->content) > 1) { |
|
| 113 | + if (\sizeof($this->content)>1) { |
|
| 114 | 114 | unset($this->content["arrow"]); |
| 115 | - $this->content = \array_values($this->content); |
|
| 115 | + $this->content=\array_values($this->content); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - protected function beforeAddItem($item, $value = NULL, $image = NULL, $description = NULL) { |
|
| 120 | - $itemO = $item; |
|
| 119 | + protected function beforeAddItem($item, $value=NULL, $image=NULL, $description=NULL) { |
|
| 120 | + $itemO=$item; |
|
| 121 | 121 | if (\is_array($item)) { |
| 122 | - $description = JArray::getValue($item, "description", 3); |
|
| 123 | - $value = JArray::getValue($item, "value", 1); |
|
| 124 | - $image = JArray::getValue($item, "image", 2); |
|
| 125 | - $item = JArray::getValue($item, "item", 0); |
|
| 122 | + $description=JArray::getValue($item, "description", 3); |
|
| 123 | + $value=JArray::getValue($item, "value", 1); |
|
| 124 | + $image=JArray::getValue($item, "image", 2); |
|
| 125 | + $item=JArray::getValue($item, "item", 0); |
|
| 126 | 126 | } |
| 127 | - if (! $item instanceof HtmlDropdownItem) { |
|
| 128 | - $itemO = new HtmlDropdownItem("dd-item-" . $this->identifier . "-" . \sizeof($this->items), $item, $value, $image, $description); |
|
| 127 | + if (!$item instanceof HtmlDropdownItem) { |
|
| 128 | + $itemO=new HtmlDropdownItem("dd-item-".$this->identifier."-".\sizeof($this->items), $item, $value, $image, $description); |
|
| 129 | 129 | } elseif ($itemO instanceof HtmlDropdownItem) { |
| 130 | 130 | $this->addToProperty("class", "vertical"); |
| 131 | 131 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function addInput($name) { |
| 144 | - if (! isset($name)) |
|
| 145 | - $name = "input-" . $this->identifier; |
|
| 144 | + if (!isset($name)) |
|
| 145 | + $name="input-".$this->identifier; |
|
| 146 | 146 | $this->setAction("activate"); |
| 147 | - $this->input = new HtmlInput($name, "hidden"); |
|
| 148 | - $this->input->setIdentifier("input-" . $this->identifier); |
|
| 147 | + $this->input=new HtmlInput($name, "hidden"); |
|
| 148 | + $this->input->setIdentifier("input-".$this->identifier); |
|
| 149 | 149 | return $this->input; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param string $icon |
| 157 | 157 | * @return HtmlDropdownItem |
| 158 | 158 | */ |
| 159 | - public function addSearchInputItem($placeHolder = NULL, $icon = NULL) { |
|
| 159 | + public function addSearchInputItem($placeHolder=NULL, $icon=NULL) { |
|
| 160 | 160 | return $this->addItem(HtmlDropdownItem::searchInput($placeHolder, $icon)); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param string $icon |
| 177 | 177 | * @return HtmlDropdownItem |
| 178 | 178 | */ |
| 179 | - public function addHeaderItem($caption = NULL, $icon = NULL) { |
|
| 179 | + public function addHeaderItem($caption=NULL, $icon=NULL) { |
|
| 180 | 180 | return $this->addItem(HtmlDropdownItem::header($caption, $icon)); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -221,12 +221,12 @@ discard block |
||
| 221 | 221 | * @return $this |
| 222 | 222 | */ |
| 223 | 223 | public function setPropertyValues($property, $values) { |
| 224 | - $i = 0; |
|
| 225 | - if (\is_array($values) === false) { |
|
| 226 | - $values = \array_fill(0, $this->count(), $values); |
|
| 224 | + $i=0; |
|
| 225 | + if (\is_array($values)===false) { |
|
| 226 | + $values=\array_fill(0, $this->count(), $values); |
|
| 227 | 227 | } |
| 228 | 228 | foreach ($values as $value) { |
| 229 | - $c = $this->items[$i ++]; |
|
| 229 | + $c=$this->items[$i++]; |
|
| 230 | 230 | if (isset($c)) { |
| 231 | 231 | $c->setProperty($property, $value); |
| 232 | 232 | } else { |
@@ -260,12 +260,12 @@ discard block |
||
| 260 | 260 | * @param boolean $dropdown |
| 261 | 261 | */ |
| 262 | 262 | public function asDropdown($dropdown) { |
| 263 | - if ($dropdown === false) { |
|
| 264 | - $this->_template = include dirname(__FILE__) . '/../templates/tplDropdownMenu.php'; |
|
| 265 | - $dropdown = "menu"; |
|
| 263 | + if ($dropdown===false) { |
|
| 264 | + $this->_template=include dirname(__FILE__).'/../templates/tplDropdownMenu.php'; |
|
| 265 | + $dropdown="menu"; |
|
| 266 | 266 | } else { |
| 267 | - $dropdown = "dropdown"; |
|
| 268 | - $this->mClass = "menu"; |
|
| 267 | + $dropdown="dropdown"; |
|
| 268 | + $this->mClass="menu"; |
|
| 269 | 269 | } |
| 270 | 270 | return $this->addToPropertyCtrl("class", $dropdown, array( |
| 271 | 271 | "menu", |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | )); |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - public function asButton($floating = false) { |
|
| 294 | + public function asButton($floating=false) { |
|
| 295 | 295 | $this->removeArrow(); |
| 296 | 296 | if ($floating) |
| 297 | 297 | $this->addToProperty("class", "floating"); |
@@ -299,15 +299,15 @@ discard block |
||
| 299 | 299 | return $this->addToProperty("class", "button"); |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - public function asSelect($name = NULL, $multiple = false, $selection = true) { |
|
| 303 | - $this->_multiple = $multiple; |
|
| 302 | + public function asSelect($name=NULL, $multiple=false, $selection=true) { |
|
| 303 | + $this->_multiple=$multiple; |
|
| 304 | 304 | if (isset($name)) |
| 305 | 305 | $this->addInput($name); |
| 306 | 306 | if ($multiple) { |
| 307 | 307 | $this->addToProperty("class", "multiple"); |
| 308 | 308 | } |
| 309 | 309 | if ($selection) { |
| 310 | - if ($this->propertyContains("class", "button") === false) |
|
| 310 | + if ($this->propertyContains("class", "button")===false) |
|
| 311 | 311 | $this->addToPropertyCtrl("class", "selection", array( |
| 312 | 312 | "selection" |
| 313 | 313 | )); |
@@ -315,31 +315,31 @@ discard block |
||
| 315 | 315 | return $this; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - public function asSearch($name = NULL, $multiple = false, $selection = true) { |
|
| 318 | + public function asSearch($name=NULL, $multiple=false, $selection=true) { |
|
| 319 | 319 | $this->asSelect($name, $multiple, $selection); |
| 320 | 320 | return $this->addToProperty("class", "search"); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - public function setSelect($name = NULL, $multiple = false) { |
|
| 324 | - $this->_template = '<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
| 325 | - if (! isset($name)) |
|
| 326 | - $name = "select-" . $this->identifier; |
|
| 327 | - $this->input = null; |
|
| 323 | + public function setSelect($name=NULL, $multiple=false) { |
|
| 324 | + $this->_template='<%tagName% id="%identifier%" %properties%>%items%</%tagName%>'; |
|
| 325 | + if (!isset($name)) |
|
| 326 | + $name="select-".$this->identifier; |
|
| 327 | + $this->input=null; |
|
| 328 | 328 | if ($multiple) { |
| 329 | 329 | $this->setProperty("multiple", true); |
| 330 | 330 | $this->addToProperty("class", "multiple"); |
| 331 | 331 | } |
| 332 | 332 | $this->setAction("activate"); |
| 333 | - $this->tagName = "select"; |
|
| 333 | + $this->tagName="select"; |
|
| 334 | 334 | $this->setProperty("name", $name); |
| 335 | - $this->content = null; |
|
| 335 | + $this->content=null; |
|
| 336 | 336 | foreach ($this->items as $item) { |
| 337 | 337 | $item->asOption(); |
| 338 | 338 | } |
| 339 | 339 | return $this; |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - public function asSubmenu($pointing = NULL) { |
|
| 342 | + public function asSubmenu($pointing=NULL) { |
|
| 343 | 343 | $this->setClass("ui dropdown link item"); |
| 344 | 344 | if (isset($pointing)) { |
| 345 | 345 | $this->setPointing($pointing); |
@@ -347,28 +347,28 @@ discard block |
||
| 347 | 347 | return $this; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - public function setPointing($value = Direction::NONE) { |
|
| 351 | - return $this->addToPropertyCtrl("class", $value . " pointing", Direction::getConstantValues("pointing")); |
|
| 350 | + public function setPointing($value=Direction::NONE) { |
|
| 351 | + return $this->addToPropertyCtrl("class", $value." pointing", Direction::getConstantValues("pointing")); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | public function setValue($value) { |
| 355 | - $this->value = $value; |
|
| 355 | + $this->value=$value; |
|
| 356 | 356 | return $this; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | public function setDefaultText($text) { |
| 360 | - $this->content["text"] = new HtmlSemDoubleElement("", "div", "default text", $text); |
|
| 360 | + $this->content["text"]=new HtmlSemDoubleElement("", "div", "default text", $text); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | private function applyValue() { |
| 364 | - $value = $this->value; |
|
| 364 | + $value=$this->value; |
|
| 365 | 365 | if (isset($this->input) && isset($value)) { |
| 366 | 366 | $this->input->setProperty("value", $value); |
| 367 | 367 | } else { |
| 368 | 368 | $this->setProperty("value", $value); |
| 369 | 369 | } |
| 370 | - $textElement = $this->getElementById("text-" . $this->identifier, $this->content); |
|
| 371 | - if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && ! $this->_multiple) |
|
| 370 | + $textElement=$this->getElementById("text-".$this->identifier, $this->content); |
|
| 371 | + if (isset($textElement) && ($textElement instanceof HtmlDoubleElement) && !$this->_multiple) |
|
| 372 | 372 | $textElement->setContent($value); |
| 373 | 373 | return $this; |
| 374 | 374 | } |
@@ -378,9 +378,9 @@ discard block |
||
| 378 | 378 | * @see BaseHtml::run() |
| 379 | 379 | */ |
| 380 | 380 | public function run(JsUtils $js) { |
| 381 | - if ($this->propertyContains("class", "simple") === false) { |
|
| 382 | - if (isset($this->_bsComponent) === false) { |
|
| 383 | - $this->_bsComponent = $js->semantic()->dropdown("#" . $this->identifier, $this->_params); |
|
| 381 | + if ($this->propertyContains("class", "simple")===false) { |
|
| 382 | + if (isset($this->_bsComponent)===false) { |
|
| 383 | + $this->_bsComponent=$js->semantic()->dropdown("#".$this->identifier, $this->_params); |
|
| 384 | 384 | $this->_bsComponent->setItemSelector(".item"); |
| 385 | 385 | } |
| 386 | 386 | $this->addEventsOnRun($js); |
@@ -395,26 +395,26 @@ discard block |
||
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | public function setAction($action) { |
| 398 | - $this->_params["action"] = $action; |
|
| 398 | + $this->_params["action"]=$action; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | public function setOn($on) { |
| 402 | - $this->_params["on"] = $on; |
|
| 402 | + $this->_params["on"]=$on; |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | public function setShowOnFocus($value) { |
| 406 | - $this->_params["showOnFocus"] = $value; |
|
| 406 | + $this->_params["showOnFocus"]=$value; |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | public function setAllowAdditions($value) { |
| 410 | - $this->_params["allowAdditions"] = $value; |
|
| 410 | + $this->_params["allowAdditions"]=$value; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | public function setFullTextSearch($value) { |
| 414 | - $this->_params["fullTextSearch"] = $value; |
|
| 414 | + $this->_params["fullTextSearch"]=$value; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - public function compile(JsUtils $js = NULL, &$view = NULL) { |
|
| 417 | + public function compile(JsUtils $js=NULL, &$view=NULL) { |
|
| 418 | 418 | $this->applyValue(); |
| 419 | 419 | return parent::compile($js, $view); |
| 420 | 420 | } |
@@ -423,19 +423,19 @@ discard block |
||
| 423 | 423 | return $this->input; |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - public function setIcon($icon = "dropdown") { |
|
| 427 | - $this->content["arrow"] = new HtmlIcon($this->identifier . "-icon", $icon); |
|
| 426 | + public function setIcon($icon="dropdown") { |
|
| 427 | + $this->content["arrow"]=new HtmlIcon($this->identifier."-icon", $icon); |
|
| 428 | 428 | return $this; |
| 429 | 429 | } |
| 430 | 430 | |
| 431 | - public function jsAddItem($caption, $value = null) { |
|
| 432 | - $value = $value ?? $caption; |
|
| 433 | - $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');}"; |
|
| 431 | + public function jsAddItem($caption, $value=null) { |
|
| 432 | + $value=$value ?? $caption; |
|
| 433 | + $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');}"; |
|
| 434 | 434 | return $js; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | public function setClearable($value) { |
| 438 | - $this->_params["clearable"] = $value; |
|
| 438 | + $this->_params["clearable"]=$value; |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | * Parameters addedValue, addedText, $addedChoice |
| 444 | 444 | */ |
| 445 | 445 | public function setOnAdd($jsCode) { |
| 446 | - $this->_params["onAdd"] = $jsCode; |
|
| 446 | + $this->_params["onAdd"]=$jsCode; |
|
| 447 | 447 | return $this; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | * Parameters removedValue, removedText, $removedChoice |
| 453 | 453 | */ |
| 454 | 454 | public function setOnRemove($jsCode) { |
| 455 | - $this->_params["onRemove"] = $jsCode; |
|
| 455 | + $this->_params["onRemove"]=$jsCode; |
|
| 456 | 456 | return $this; |
| 457 | 457 | } |
| 458 | 458 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | trait JsUtilsEventsTrait { |
| 12 | 12 | |
| 13 | - protected $jquery_events = array( |
|
| 13 | + protected $jquery_events=array( |
|
| 14 | 14 | "bind", |
| 15 | 15 | "blur", |
| 16 | 16 | "change", |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | "unload" |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true); |
|
| 54 | + abstract public function _add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true); |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Outputs a javascript library blur event |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * code to execute |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function blur($element = 'this', $js = '') { |
|
| 65 | + public function blur($element='this', $js='') { |
|
| 66 | 66 | return $this->_add_event($element, $js, 'blur'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * @param boolean $stopPropagation |
| 78 | 78 | * @return string |
| 79 | 79 | */ |
| 80 | - public function change($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) { |
|
| 80 | + public function change($element='this', $js='', $preventDefault=false, $stopPropagation=false) { |
|
| 81 | 81 | return $this->_add_event($element, $js, 'change', $preventDefault, $stopPropagation); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | * @param boolean $stopPropagation |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDefault = false, $stopPropagation = false) { |
|
| 98 | - if (! is_array($js)) { |
|
| 99 | - $js = array( |
|
| 97 | + public function click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false) { |
|
| 98 | + if (!is_array($js)) { |
|
| 99 | + $js=array( |
|
| 100 | 100 | $js |
| 101 | 101 | ); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if ($ret_false) { |
| 105 | - $js[] = "return false;"; |
|
| 105 | + $js[]="return false;"; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | return $this->_add_event($element, $js, 'click', $preventDefault, $stopPropagation); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * code to execute |
| 118 | 118 | * @return string |
| 119 | 119 | */ |
| 120 | - public function contextmenu($element = 'this', $js = '') { |
|
| 120 | + public function contextmenu($element='this', $js='') { |
|
| 121 | 121 | return $this->_add_event($element, $js, 'contextmenu'); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * code to execute |
| 131 | 131 | * @return string |
| 132 | 132 | */ |
| 133 | - public function dblclick($element = 'this', $js = '') { |
|
| 133 | + public function dblclick($element='this', $js='') { |
|
| 134 | 134 | return $this->_add_event($element, $js, 'dblclick'); |
| 135 | 135 | } |
| 136 | 136 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * code to execute |
| 144 | 144 | * @return string |
| 145 | 145 | */ |
| 146 | - public function error($element = 'this', $js = '') { |
|
| 146 | + public function error($element='this', $js='') { |
|
| 147 | 147 | return $this->_add_event($element, $js, 'error'); |
| 148 | 148 | } |
| 149 | 149 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * code to execute |
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | - public function focus($element = 'this', $js = '') { |
|
| 159 | + public function focus($element='this', $js='') { |
|
| 160 | 160 | return $this->_add_event($element, $js, 'focus'); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -170,9 +170,9 @@ discard block |
||
| 170 | 170 | * code for mouse out |
| 171 | 171 | * @return string |
| 172 | 172 | */ |
| 173 | - public function hover($element = 'this', $over, $out) { |
|
| 174 | - $event = "\n\t$(" . Javascript::prep_element($element) . ").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; |
|
| 175 | - $this->jquery_code_for_compile[] = $event; |
|
| 173 | + public function hover($element='this', $over, $out) { |
|
| 174 | + $event="\n\t$(".Javascript::prep_element($element).").hover(\n\t\tfunction()\n\t\t{\n\t\t\t{$over}\n\t\t}, \n\t\tfunction()\n\t\t{\n\t\t\t{$out}\n\t\t});\n"; |
|
| 175 | + $this->jquery_code_for_compile[]=$event; |
|
| 176 | 176 | return $event; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * code to execute |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
| 188 | - public function keydown($element = 'this', $js = '') { |
|
| 188 | + public function keydown($element='this', $js='') { |
|
| 189 | 189 | return $this->_add_event($element, $js, 'keydown'); |
| 190 | 190 | } |
| 191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * code to execute |
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | - public function keypress($element = 'this', $js = '') { |
|
| 201 | + public function keypress($element='this', $js='') { |
|
| 202 | 202 | return $this->_add_event($element, $js, 'keypress'); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * code to execute |
| 212 | 212 | * @return string |
| 213 | 213 | */ |
| 214 | - public function keyup($element = 'this', $js = '') { |
|
| 214 | + public function keyup($element='this', $js='') { |
|
| 215 | 215 | return $this->_add_event($element, $js, 'keyup'); |
| 216 | 216 | } |
| 217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * code to execute |
| 225 | 225 | * @return string |
| 226 | 226 | */ |
| 227 | - public function load($element = 'this', $js = '') { |
|
| 227 | + public function load($element='this', $js='') { |
|
| 228 | 228 | return $this->_add_event($element, $js, 'load'); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * code to execute |
| 238 | 238 | * @return string |
| 239 | 239 | */ |
| 240 | - public function mousedown($element = 'this', $js = '') { |
|
| 240 | + public function mousedown($element='this', $js='') { |
|
| 241 | 241 | return $this->_add_event($element, $js, 'mousedown'); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * code to execute |
| 251 | 251 | * @return string |
| 252 | 252 | */ |
| 253 | - public function mouseout($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) { |
|
| 253 | + public function mouseout($element='this', $js='', $preventDefault=false, $stopPropagation=false) { |
|
| 254 | 254 | return $this->_add_event($element, $js, 'mouseout', $preventDefault, $stopPropagation); |
| 255 | 255 | } |
| 256 | 256 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | * code to execute |
| 264 | 264 | * @return string |
| 265 | 265 | */ |
| 266 | - public function mouseleave($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) { |
|
| 266 | + public function mouseleave($element='this', $js='', $preventDefault=false, $stopPropagation=false) { |
|
| 267 | 267 | return $this->_add_event($element, $js, 'mouseleave', $preventDefault, $stopPropagation); |
| 268 | 268 | } |
| 269 | 269 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * code to execute |
| 277 | 277 | * @return string |
| 278 | 278 | */ |
| 279 | - public function mouseenter($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false) { |
|
| 279 | + public function mouseenter($element='this', $js='', $preventDefault=false, $stopPropagation=false) { |
|
| 280 | 280 | return $this->_add_event($element, $js, 'mouseenter', $preventDefault, $stopPropagation); |
| 281 | 281 | } |
| 282 | 282 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * code to execute |
| 290 | 290 | * @return string |
| 291 | 291 | */ |
| 292 | - public function mouseover($element = 'this', $js = '') { |
|
| 292 | + public function mouseover($element='this', $js='') { |
|
| 293 | 293 | return $this->_add_event($element, $js, 'mouseover'); |
| 294 | 294 | } |
| 295 | 295 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * code to execute |
| 303 | 303 | * @return string |
| 304 | 304 | */ |
| 305 | - public function mouseup($element = 'this', $js = '') { |
|
| 305 | + public function mouseup($element='this', $js='') { |
|
| 306 | 306 | return $this->_add_event($element, $js, 'mouseup'); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * code to execute |
| 316 | 316 | * @return string |
| 317 | 317 | */ |
| 318 | - public function unload($element = 'this', $js = '') { |
|
| 318 | + public function unload($element='this', $js='') { |
|
| 319 | 319 | return $this->_add_event($element, $js, 'unload'); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * code to execute |
| 330 | 330 | * @return string |
| 331 | 331 | */ |
| 332 | - public function resize($element = 'this', $js = '') { |
|
| 332 | + public function resize($element='this', $js='') { |
|
| 333 | 333 | return $this->_add_event($element, $js, 'resize'); |
| 334 | 334 | } |
| 335 | 335 | |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * code to execute |
| 344 | 344 | * @return string |
| 345 | 345 | */ |
| 346 | - public function scroll($element = 'this', $js = '') { |
|
| 346 | + public function scroll($element='this', $js='') { |
|
| 347 | 347 | return $this->_add_event($element, $js, 'scroll'); |
| 348 | 348 | } |
| 349 | 349 | } |