phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
JsUtilsActionsTrait Class Reference
+ Inheritance diagram for JsUtilsActionsTrait:

Public Member Functions

 _add_event ($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false)
 
 _genericCallValue ($jQueryCall, $element='this', $param="", $immediatly=false)
 Execute a generic jQuery call with a value.
 
 _genericCallElement ($jQueryCall, $to='this', $element='', $immediatly=false)
 Execute a generic jQuery call with 2 elements.
 
 addClass ($element='this', $class='', $immediatly=false)
 add class to element
 
 after ($to, $element, $immediatly=false)
 Insert content, specified by the parameter, after each element in the set of matched elements.
 
 before ($to, $element, $immediatly=false)
 Insert content, specified by the parameter, before each element in the set of matched elements.
 
 attr ($element='this', $attributeName='id', $value="", $immediatly=false)
 Get or set the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.
 
 val ($element='this', $value='', $immediatly=false)
 Get or set the value of the first element in the set of matched elements or set one or more attributes for every matched element.
 
 html ($element='this', $value='', $immediatly=false)
 Get or set the html of an attribute for the first element in the set of matched elements.
 
 animate ($element='this', $params=array(), $speed='', $extra='', $immediatly=false)
 Outputs a javascript library animate event.
 
 append ($to, $element, $immediatly=false)
 Insert content, specified by the parameter $element, to the end of each element in the set of matched elements $to.
 
 prepend ($to, $element, $immediatly=false)
 Insert content, specified by the parameter $element, to the beginning of each element in the set of matched elements $to.
 
 fadeIn ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library hide action.
 
 fadeOut ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library hide action.
 
 slideUp ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library slideUp action.
 
 removeClass ($element='this', $class='', $immediatly=false)
 Execute a javascript library removeClass action.
 
 slideDown ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library slideDown action.
 
 slideToggle ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library slideToggle action.
 
 hide ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library hide action.
 
 toggle ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library toggle action.
 
 toggleClass ($element='this', $class='', $immediatly=false)
 Execute a javascript library toggle class action.
 
 trigger ($element='this', $event='click', $immediatly=false)
 Execute all handlers and behaviors attached to the matched elements for the given event.
 
 show ($element='this', $speed='', $callback='', $immediatly=false)
 Execute a javascript library show action.
 
 sortable ($element, $options=array())
 Creates a jQuery sortable.
 
 tablesorter ($table='', $options='')
 Table Sorter Plugin.
 
 condition ($condition, $jsCodeIfTrue, $jsCodeIfFalse=null, $immediatly=false)
 Allows to attach a condition.
 
 doJQuery ($element, $jqueryCall, $param="", $jsCallback="")
 Calls the JQuery callback $someThing on $element with facultative parameter $param.
 
 doJQueryDeferred ($element, $jqueryCall, $param="", $jsCallback="")
 Calls the JQuery callback $someThing on $element with facultative parameter $param.
 
 doJQueryOn ($event, $element, $elementToModify, $jqueryCall, $param="", $parameters=array())
 Calls the JQuery callback $jqueryCall on $element with facultative parameter $param in response to an event $event.
 
 exec ($js, $immediatly=false)
 Executes the code $js.
 
 execAtLast ($js)
 Executes the code $js.
 
 execOn ($event, $element, $js, $parameters=array())
 Executes the javascript code $js when $event fires on $element.
 
 setJsonToElement ($json, $elementClass="_element", $immediatly=true)
 
 setDraggable ($element, $parameters=[])
 Sets an element draggable (HTML5 drag and drop)
 
 asDropZone ($element, $jsCallback="", $parameters=[])
 Declares an element as a drop zone (HTML5 drag and drop)
 
 interval ($jsCode, $time, $globalName=null, $immediatly=true)
 Calls a function or evaluates an expression at specified intervals (in milliseconds)
 
 clearInterval ($globalName, $immediatly=true)
 Clears an existing interval.
 
 counter ($counterSelector, $value=0, $limit=0, $globalName=null, $countDown=true, $immediatly=true)
 Associates a counter to the element designated by $counterSelector Triggers the events counter-start and counter-end on finished with the parameters value and limit.
 
 counterOn ($element, $event, $counterSelector, $value=0, $limit=0, $globalName=null, $countDown=true)
 Associates a counter to the element designated by $counterSelector when $event is triggered on $element.
 
 activateLink ($target, $property='href', $href=null)
 Activates an element if it is active (add the class active)
 
 _activateLink ($target, $property='href', $href=null)
 Returns the javascript code for activate an element if it is active (add the class active)
 

Protected Member Functions

 _showHideWithEffect ($action, $element='this', $speed='', $callback='', $immediatly=false)
 show or hide with effect
 

Private Member Functions

 _validate_speed ($speed)
 Ensures the speed parameter is valid for jQuery.
 
 _doJQuery ($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false)
 Call the JQuery method $jqueryCall on $element with parameters $param.
 
 _doJQueryOn ($event, $element, $elementToModify, $jqueryCall, $param="", $preventDefault=false, $stopPropagation=false, $jsCallback="", $immediatly=true)
 

Detailed Description

Definition at line 13 of file JsUtilsActionsTrait.php.

Member Function Documentation

◆ _activateLink()

_activateLink (   $target,
  $property = 'href',
  $href = null 
)

Returns the javascript code for activate an element if it is active (add the class active)

Parameters
string$targetthe container element
string$propertydefault: href
string$hrefthe active href (if null, window.location.href is used)
Returns
string

Definition at line 820 of file JsUtilsActionsTrait.php.

◆ _add_event()

_add_event (   $element,
  $js,
  $event,
  $preventDefault = false,
  $stopPropagation = false,
  $immediatly = true,
  $listenerOn = false 
)
abstract

Reimplemented in JsUtils.

◆ _doJQuery()

_doJQuery (   $element,
  $jqueryCall,
  $param = "",
  $jsCallback = "",
  $immediatly = false 
)
private

Call the JQuery method $jqueryCall on $element with parameters $param.

Parameters
string$element
string$jqueryCall
mixed$param
string$jsCallbackjavascript code to execute after the jquery call
boolean$immediatly
Returns
string

Definition at line 501 of file JsUtilsActionsTrait.php.

◆ _doJQueryOn()

_doJQueryOn (   $event,
  $element,
  $elementToModify,
  $jqueryCall,
  $param = "",
  $preventDefault = false,
  $stopPropagation = false,
  $jsCallback = "",
  $immediatly = true 
)
private
Parameters
string$event
string$element
string$elementToModify
string$jqueryCall
string | array$param
boolean$preventDefault
boolean$stopPropagation
string$jsCallbackjavascript code to execute after the jquery call
boolean$immediatly
Returns
string

Definition at line 560 of file JsUtilsActionsTrait.php.

◆ _genericCallElement()

_genericCallElement (   $jQueryCall,
  $to = 'this',
  $element = '',
  $immediatly = false 
)

Execute a generic jQuery call with 2 elements.

Parameters
string$jQueryCall
string$to
string$element
boolean$immediatlydelayed if false
Returns
string

Definition at line 94 of file JsUtilsActionsTrait.php.

◆ _genericCallValue()

_genericCallValue (   $jQueryCall,
  $element = 'this',
  $param = "",
  $immediatly = false 
)

Execute a generic jQuery call with a value.

Parameters
string$jQueryCall
string$element
string$param
boolean$immediatlydelayed if false

Definition at line 72 of file JsUtilsActionsTrait.php.

◆ _showHideWithEffect()

_showHideWithEffect (   $action,
  $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)
protected

show or hide with effect

Parameters
string$action
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 31 of file JsUtilsActionsTrait.php.

◆ _validate_speed()

_validate_speed (   $speed)
private

Ensures the speed parameter is valid for jQuery.

Parameters
string | int$speed
Returns
string

Definition at line 49 of file JsUtilsActionsTrait.php.

◆ activateLink()

activateLink (   $target,
  $property = 'href',
  $href = null 
)

Activates an element if it is active (add the class active)

Parameters
string$targetthe container element
string$propertydefault: href
string$hrefthe active href (if null, window.location.href is used)
Returns
string

Definition at line 805 of file JsUtilsActionsTrait.php.

◆ addClass()

addClass (   $element = 'this',
  $class = '',
  $immediatly = false 
)

add class to element

Parameters
string$element
string$classto add
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 113 of file JsUtilsActionsTrait.php.

◆ after()

after (   $to,
  $element,
  $immediatly = false 
)

Insert content, specified by the parameter, after each element in the set of matched elements.

Parameters
string$to
string$element
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 126 of file JsUtilsActionsTrait.php.

◆ animate()

animate (   $element = 'this',
  $params = array (),
  $speed = '',
  $extra = '',
  $immediatly = false 
)

Outputs a javascript library animate event.

Parameters
string$elementelement
array | string$params
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$extra
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 201 of file JsUtilsActionsTrait.php.

◆ append()

append (   $to,
  $element,
  $immediatly = false 
)

Insert content, specified by the parameter $element, to the end of each element in the set of matched elements $to.

Parameters
string$to
string$element
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 237 of file JsUtilsActionsTrait.php.

◆ asDropZone()

asDropZone (   $element,
  $jsCallback = "",
  $parameters = [ ] 
)

Declares an element as a drop zone (HTML5 drag and drop)

Parameters
string$elementThe element selector
array$parametersdefault : array("attr"=>"id","stopPropagation"=>false,"immediatly"=>true,"jqueryDone"=>"append")
string$jsCallbackthe js script to call when element is dropped

Definition at line 668 of file JsUtilsActionsTrait.php.

◆ attr()

attr (   $element = 'this',
  $attributeName = 'id',
  $value = "",
  $immediatly = false 
)

Get or set the value of an attribute for the first element in the set of matched elements or set one or more attributes for every matched element.

Parameters
string$element
string$attributeName
string$value
boolean$immediatlydelayed if false

Definition at line 152 of file JsUtilsActionsTrait.php.

◆ before()

before (   $to,
  $element,
  $immediatly = false 
)

Insert content, specified by the parameter, before each element in the set of matched elements.

Parameters
string$to
string$element
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 139 of file JsUtilsActionsTrait.php.

◆ clearInterval()

clearInterval (   $globalName,
  $immediatly = true 
)

Clears an existing interval.

Parameters
string$globalNameThe interval global name
boolean$immediatlydelayed if false
Returns
string

Definition at line 712 of file JsUtilsActionsTrait.php.

◆ condition()

condition (   $condition,
  $jsCodeIfTrue,
  $jsCodeIfFalse = null,
  $immediatly = false 
)

Allows to attach a condition.

Parameters
string$condition
string$jsCodeIfTrue
string$jsCodeIfFalse
boolean$immediatlydefers the execution if set to false

Definition at line 479 of file JsUtilsActionsTrait.php.

◆ counter()

counter (   $counterSelector,
  $value = 0,
  $limit = 0,
  $globalName = null,
  $countDown = true,
  $immediatly = true 
)

Associates a counter to the element designated by $counterSelector Triggers the events counter-start and counter-end on finished with the parameters value and limit.

Parameters
string$counterSelectorSelector of the existing element wich display the counter
integer$valueThe initial value of the counter
integer$limitThe limit of the counter (minimum if countDown is true, maximum if not)
string$globalNameThe global name of the counter, to use with the clearInterval method
boolean$countDowncount down if true or elapse if false
boolean$immediatlydelayed if false
Returns
string

Definition at line 734 of file JsUtilsActionsTrait.php.

◆ counterOn()

counterOn (   $element,
  $event,
  $counterSelector,
  $value = 0,
  $limit = 0,
  $globalName = null,
  $countDown = true 
)

Associates a counter to the element designated by $counterSelector when $event is triggered on $element.

Parameters
string$elementThe triggering element
string$eventThe triggering event
string$counterSelectorSelector of the existing element wich display the counter
integer$valueThe initial value of the counter
integer$limitThe limit of the counter (minimum if countDown is true, maximum if not)
string$globalNameThe global name of the counter, to use with the clearInterval method
boolean$countDowncount down if true or elapse if false
Returns
string

Definition at line 790 of file JsUtilsActionsTrait.php.

◆ doJQuery()

doJQuery (   $element,
  $jqueryCall,
  $param = "",
  $jsCallback = "" 
)

Calls the JQuery callback $someThing on $element with facultative parameter $param.

Parameters
string$elementthe element
string$jqueryCallthe JQuery callback
mixed$paramarray or string parameters
string$jsCallbackjavascript code to execute after the jquery call
Returns
mixed

Definition at line 525 of file JsUtilsActionsTrait.php.

◆ doJQueryDeferred()

doJQueryDeferred (   $element,
  $jqueryCall,
  $param = "",
  $jsCallback = "" 
)

Calls the JQuery callback $someThing on $element with facultative parameter $param.

Parameters
string$elementthe element
string$jqueryCallthe JQuery callback
mixed$paramarray or string parameters
string$jsCallbackjavascript code to execute after the jquery call
Returns
mixed

Definition at line 542 of file JsUtilsActionsTrait.php.

◆ doJQueryOn()

doJQueryOn (   $event,
  $element,
  $elementToModify,
  $jqueryCall,
  $param = "",
  $parameters = array () 
)

Calls the JQuery callback $jqueryCall on $element with facultative parameter $param in response to an event $event.

Parameters
string$event
string$element
string$elementToModify
string$jqueryCall
string$param
array$parametersdefault : array("preventDefault"=>false,"stopPropagation"=>false,"jsCallback"=>'',"immediatly"=>true)

Definition at line 575 of file JsUtilsActionsTrait.php.

◆ exec()

exec (   $js,
  $immediatly = false 
)

Executes the code $js.

Parameters
string$jsCode to execute
boolean$immediatlydelayed if false
Returns
String

Definition at line 593 of file JsUtilsActionsTrait.php.

◆ execAtLast()

execAtLast (   $js)

Executes the code $js.

Parameters
string$jsCode to execute
boolean$immediatlydelayed if false
Returns
String

Definition at line 609 of file JsUtilsActionsTrait.php.

◆ execOn()

execOn (   $event,
  $element,
  $js,
  $parameters = array () 
)

Executes the javascript code $js when $event fires on $element.

Parameters
string$event
string$element
string$jsCode to execute
array$parametersdefault : array("preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true)
Returns
String

Definition at line 626 of file JsUtilsActionsTrait.php.

◆ fadeIn()

fadeIn (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library hide action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 267 of file JsUtilsActionsTrait.php.

◆ fadeOut()

fadeOut (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library hide action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 284 of file JsUtilsActionsTrait.php.

◆ hide()

hide (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library hide action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 367 of file JsUtilsActionsTrait.php.

◆ html()

html (   $element = 'this',
  $value = '',
  $immediatly = false 
)

Get or set the html of an attribute for the first element in the set of matched elements.

Parameters
string$element
string$value
boolean$immediatlydefers the execution if set to false

Definition at line 184 of file JsUtilsActionsTrait.php.

◆ interval()

interval (   $jsCode,
  $time,
  $globalName = null,
  $immediatly = true 
)

Calls a function or evaluates an expression at specified intervals (in milliseconds)

Parameters
string$jsCodeThe code to execute
int$timeThe time interval in milliseconds
string$globalNameThe global name of the interval, used to clear it
boolean$immediatlydelayed if false
Returns
string

Definition at line 691 of file JsUtilsActionsTrait.php.

◆ prepend()

prepend (   $to,
  $element,
  $immediatly = false 
)

Insert content, specified by the parameter $element, to the beginning of each element in the set of matched elements $to.

Parameters
string$to
string$element
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 250 of file JsUtilsActionsTrait.php.

◆ removeClass()

removeClass (   $element = 'this',
  $class = '',
  $immediatly = false 
)

Execute a javascript library removeClass action.

Parameters
string$elementelement
string$classClass to add
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 316 of file JsUtilsActionsTrait.php.

◆ setDraggable()

setDraggable (   $element,
  $parameters = [ ] 
)

Sets an element draggable (HTML5 drag and drop)

Parameters
string$elementThe element selector
array$parametersdefault : array("attr"=>"id","preventDefault"=>false,"stopPropagation"=>false,"immediatly"=>true)

Definition at line 648 of file JsUtilsActionsTrait.php.

◆ setJsonToElement()

setJsonToElement (   $json,
  $elementClass = "_element",
  $immediatly = true 
)

Definition at line 634 of file JsUtilsActionsTrait.php.

◆ show()

show (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library show action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 432 of file JsUtilsActionsTrait.php.

◆ slideDown()

slideDown (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library slideDown action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 333 of file JsUtilsActionsTrait.php.

◆ slideToggle()

slideToggle (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library slideToggle action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 350 of file JsUtilsActionsTrait.php.

◆ slideUp()

slideUp (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library slideUp action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 301 of file JsUtilsActionsTrait.php.

◆ sortable()

sortable (   $element,
  $options = array () 
)

Creates a jQuery sortable.

Parameters
string$element
array$options
Returns
string

Definition at line 443 of file JsUtilsActionsTrait.php.

◆ tablesorter()

tablesorter (   $table = '',
  $options = '' 
)

Table Sorter Plugin.

Parameters
string$tabletable name
string$optionsplugin location
Returns
string

Definition at line 466 of file JsUtilsActionsTrait.php.

◆ toggle()

toggle (   $element = 'this',
  $speed = '',
  $callback = '',
  $immediatly = false 
)

Execute a javascript library toggle action.

Parameters
string$elementelement
string$speedOne of 'slow', 'normal', 'fast', or time in milliseconds
string$callbackJavascript callback function
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 384 of file JsUtilsActionsTrait.php.

◆ toggleClass()

toggleClass (   $element = 'this',
  $class = '',
  $immediatly = false 
)

Execute a javascript library toggle class action.

Parameters
string$elementelement
string$class
boolean$immediatlydefers the execution if set to false
Returns
string

Definition at line 398 of file JsUtilsActionsTrait.php.

◆ trigger()

trigger (   $element = 'this',
  $event = 'click',
  $immediatly = false 
)

Execute all handlers and behaviors attached to the matched elements for the given event.

Parameters
string$element
string$event
boolean$immediatlydefers the execution if set to false

Definition at line 410 of file JsUtilsActionsTrait.php.

◆ val()

val (   $element = 'this',
  $value = '',
  $immediatly = false 
)

Get or set the value of the first element in the set of matched elements or set one or more attributes for every matched element.

Parameters
string$element
string$value
boolean$immediatlydefers the execution if set to false

Definition at line 172 of file JsUtilsActionsTrait.php.


The documentation for this class was generated from the following file: