phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
JsUtilsEventsTrait.php
Go to the documentation of this file.
1<?php
2
3namespace Ajax\common\traits;
4
6
13 protected $jquery_events = [
14 'bind',
15 'blur',
16 'change',
17 'click',
18 'dblclick',
19 'delegate',
20 'die',
21 'error',
22 'focus',
23 'focusin',
24 'focusout',
25 'hover',
26 'keydown',
27 'keypress',
28 'keyup',
29 'live',
30 'load',
31 'mousedown',
32 'mousseenter',
33 'mouseleave',
34 'mousemove',
35 'mouseout',
36 'mouseover',
37 'mouseup',
38 'off',
39 'on',
40 'one',
41 'ready',
42 'resize',
43 'scroll',
44 'select',
45 'submit',
46 'toggle',
47 'trigger',
48 'triggerHandler',
49 'undind',
50 'undelegate',
51 'unload'
52 ];
53
54 abstract public function _add_event($element, $js, $event, $preventDefault = false, $stopPropagation = false, $immediatly = true, $listenerOn=false);
55
65 public function blur($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
66 return $this->_add_event ( $element, $js, 'blur', $preventDefault, $stopPropagation, true, $listenerOn );
67 }
68
81 public function change($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
82 return $this->_add_event ( $element, $js, 'change', $preventDefault, $stopPropagation, true, $listenerOn );
83 }
84
99 public function click($element = 'this', $js = '', $ret_false = TRUE, $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
100 if (! is_array ( $js )) {
101 $js = array (
102 $js
103 );
104 }
105
106 if ($ret_false) {
107 $js [] = "return false;";
108 }
109
110 return $this->_add_event ( $element, $js, 'click', $preventDefault, $stopPropagation, true, $listenerOn );
111 }
112
125 public function contextmenu($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
126 return $this->_add_event ( $element, $js, 'contextmenu', $preventDefault, $stopPropagation, true, $listenerOn );
127 }
128
141 public function dblclick($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
142 return $this->_add_event ( $element, $js, 'dblclick', $preventDefault, $stopPropagation, true, $listenerOn );
143 }
144
154 public function error($element = 'this', $js = '') {
155 return $this->_add_event ( $element, $js, 'error' );
156 }
157
170 public function focus($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
171 return $this->_add_event ( $element, $js, 'focus', $preventDefault, $stopPropagation, true, $listenerOn );
172 }
173
184 public function hover($element = 'this', $over = '', $out = '') {
185 $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";
186 $this->jquery_code_for_compile [] = $event;
187 return $event;
188 }
189
202 public function keydown($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
203 return $this->_add_event ( $element, $js, 'keydown', $preventDefault, $stopPropagation, true, $listenerOn );
204 }
205
218 public function keypress($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
219 return $this->_add_event ( $element, $js, 'keypress', $preventDefault, $stopPropagation, true, $listenerOn );
220 }
221
234 public function keyup($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
235 return $this->_add_event ( $element, $js, 'keyup', $preventDefault, $stopPropagation, true, $listenerOn );
236 }
237
250 public function load($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
251 return $this->_add_event ( $element, $js, 'load', $preventDefault, $stopPropagation, true, $listenerOn );
252 }
253
266 public function mousedown($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
267 return $this->_add_event ( $element, $js, 'mousedown', $preventDefault, $stopPropagation, true, $listenerOn );
268 }
269
282 public function mouseout($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
283 return $this->_add_event ( $element, $js, 'mouseout', $preventDefault, $stopPropagation, true, $listenerOn );
284 }
285
298 public function mouseleave($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
299 return $this->_add_event ( $element, $js, 'mouseleave', $preventDefault, $stopPropagation, true, $listenerOn );
300 }
301
314 public function mouseenter($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
315 return $this->_add_event ( $element, $js, 'mouseenter', $preventDefault, $stopPropagation, true, $listenerOn );
316 }
317
330 public function mouseover($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
331 return $this->_add_event ( $element, $js, 'mouseover', $preventDefault, $stopPropagation, true, $listenerOn );
332 }
333
346 public function mouseup($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
347 return $this->_add_event ( $element, $js, 'mouseup', $preventDefault, $stopPropagation, true, $listenerOn );
348 }
349
362 public function unload($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
363 return $this->_add_event ( $element, $js, 'unload', $preventDefault, $stopPropagation, true, $listenerOn );
364 }
365
366 // --------------------------------------------------------------------
379 public function resize($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
380 return $this->_add_event ( $element, $js, 'resize', $preventDefault, $stopPropagation, true, $listenerOn );
381 }
382
383 // --------------------------------------------------------------------
396 public function scroll($element = 'this', $js = '', $preventDefault = false, $stopPropagation = false, $listenerOn=false) {
397 return $this->_add_event ( $element, $js, 'scroll', $preventDefault, $stopPropagation, true, $listenerOn );
398 }
399}
blur($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library blur event.
mouseenter($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library mouseenter event.
click($element='this', $js='', $ret_false=TRUE, $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library click event.
mouseover($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library mouseover event.
dblclick($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library dblclick event.
keydown($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library keydown event.
hover($element='this', $over='', $out='')
Outputs a javascript library hover event.
change($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library change event.
keypress($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library keypress event.
scroll($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library scroll event.
unload($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library unload event.
mousedown($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library mousedown event.
_add_event($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false)
mouseup($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library mouseup event.
mouseout($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library mouseout event.
focus($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library focus event.
error($element='this', $js='')
Outputs a javascript library error event.
keyup($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library keydown event.
load($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library load event.
mouseleave($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library mouseleave event.
contextmenu($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library contextmenu event.
resize($element='this', $js='', $preventDefault=false, $stopPropagation=false, $listenerOn=false)
Outputs a javascript library resize event.