phpMv  -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
JsUtils Class Reference
+ Inheritance diagram for JsUtils:
+ Collaboration diagram for JsUtils:

Public Member Functions

 inline ($script, $cdata=true)
 
 getUrl ($url)
 
 addViewElement ($identifier, $content, &$view)
 
 createScriptVariable (&$view, $view_var, $output)
 
 forward ($initialController, $controller, $action, $params=array())
 
 renderContent ($initialControllerInstance, $viewName, $params=NULL)
 
 fromDispatcher ($dispatcher)
 
 renderView ($viewName, $parameters=[], $asString=false)
 Performs jQuery compilation and displays a view. More...
 
 renderComponent (BaseHtml $component, bool $asString=false)
 Compile and render a component. More...
 
 renderDefaultView ($parameters=[], $asString=false)
 Performs jQuery compilation and displays the default view. More...
 
 execJSFromFile ($jsFile, $parameters=[], $immediatly=true)
 Loads and eventually executes a jsFile with php parameters, using the default template engine. More...
 
 ajaxValidationRule (string $ruleName, string $checkUrl, string $params='{_value:value}', string $method='post')
 Adds a new semantic validation ajax rule. More...
 
 checkValidationRule ($callback)
 Checks a validation rule declared with . More...
 
 applyInverted ()
 
- Public Member Functions inherited from JsUtils
 getUrl ($url)
 Generates an URL Used internally by phpMv. More...
 
 addViewElement ($identifier, $content, &$view)
 Adds the array of controls q in the $view element Used internally by phpMv. More...
 
 createScriptVariable (&$view, $view_var, $output)
 Creates the script variable script_foot Used internally by phpMv. More...
 
 forward ($initialController, $controller, $action, $params)
 Forwards to. More...
 
 renderContent ($initialControllerInstance, $viewName, $params=NULL)
 render the content of an existing view : $viewName and set the response to the modal content Used internally by phpMv More...
 
 fromDispatcher ($dispatcher)
 Collects url parts from the request dispatcher : controllerName, actionName, parameters Used internally by phpMv. More...
 
 ui (JqueryUI $ui=NULL)
 getter or setter of the jQuery-UI variable More...
 
 bootstrap (Bootstrap $bootstrap=NULL)
 getter or setter of the Twitter Bootstrap variable More...
 
 semantic (Semantic $semantic=NULL)
 getter or setter of the Semantic-UI variable More...
 
 config ($config=NULL)
 
 __construct ($params=array(), $injected=NULL)
 
 __set ($property, $value)
 
 getParam ($key)
 
 output ($array_js)
 Outputs the called javascript to the screen. More...
 
 compile (&$view=NULL, $view_var='script_foot', $script_tags=TRUE)
 gather together all script needing to be output More...
 
 clear_compile ()
 Clears the array of script events collected for output. More...
 
 getScript ($offset=0)
 
 scriptCount ()
 
 inline ($script, $cdata=TRUE)
 Outputs a <script> tag. More...
 
 generate_json ($result=NULL, $match_array_type=FALSE)
 Can be passed a database result or associative array and returns a JSON formatted string. More...
 
 _prep_args ($result, $is_key=FALSE)
 Ensures a standard json value and escapes values. More...
 
 _add_event ($element, $js, $event, $preventDefault=false, $stopPropagation=false, $immediatly=true, $listenerOn=false)
 Constructs the syntax for an event, and adds to into the array for compilation. More...
 
 getInjected ()
 
 setParam (string $param, $value)
 

Static Public Member Functions

static diSemantic ($controller, $options=[ 'defer'=> true, 'gc'=> true])
 Returns an instance of JsUtils initialized with Semantic (for di injection) More...
 
static diBootstrap ($controller, $options=[ 'defer'=> true, 'gc'=> true])
 Returns an instance of JsUtils initialized with Bootstrap (for di injection) More...
 

Protected Member Functions

 _open_script ($src='')
 Outputs an opening <script> More...
 
- Protected Member Functions inherited from JsUtils
 initialize ()
 To override for special initialization of the component. More...
 

Additional Inherited Members

- Protected Attributes inherited from JsUtils
 $params
 
 $injected
 
 $_ui
 
 $_bootstrap
 
 $_semantic
 
 $config
 

Detailed Description

Definition at line 11 of file JsUtils.php.

Member Function Documentation

◆ _open_script()

_open_script (   $src = '')
protected

Outputs an opening <script>

Parameters
string$src
Returns
string

Definition at line 19 of file JsUtils.php.

◆ addViewElement()

addViewElement (   $identifier,
  $content,
$view 
)

Definition at line 41 of file JsUtils.php.

◆ ajaxValidationRule()

ajaxValidationRule ( string  $ruleName,
string  $checkUrl,
string  $params = '{_value:value}',
string  $method = 'post' 
)

Adds a new semantic validation ajax rule.

To use with in controllers.

Parameters
string$ruleName
string$checkUrl
string$params
string$method
Returns
void

Definition at line 174 of file JsUtils.php.

◆ applyInverted()

applyInverted ( )

Definition at line 193 of file JsUtils.php.

◆ checkValidationRule()

checkValidationRule (   $callback)

Checks a validation rule declared with .

Parameters
$callbacka callback using the value to validate : function($value){}
Returns
void

Definition at line 183 of file JsUtils.php.

◆ createScriptVariable()

createScriptVariable ( $view,
  $view_var,
  $output 
)

Definition at line 50 of file JsUtils.php.

◆ diBootstrap()

static diBootstrap (   $controller,
  $options = [ 'defer' =,
true  ,
'gc'  ,
true]   
)
static

Returns an instance of JsUtils initialized with Bootstrap (for di injection)

Parameters
\Ubiquity\controllers\Controller$controller
array$options
Returns

Definition at line 155 of file JsUtils.php.

◆ diSemantic()

static diSemantic (   $controller,
  $options = [ 'defer' =,
true  ,
'gc'  ,
true]   
)
static

Returns an instance of JsUtils initialized with Semantic (for di injection)

Parameters
\Ubiquity\controllers\Controller$controller
array$options
Returns

Definition at line 138 of file JsUtils.php.

◆ execJSFromFile()

execJSFromFile (   $jsFile,
  $parameters = [],
  $immediatly = true 
)

Loads and eventually executes a jsFile with php parameters, using the default template engine.

Parameters
string$jsFile
array$parameters
boolean$immediatly
Returns
string|null
Exceptions

Definition at line 120 of file JsUtils.php.

◆ forward()

forward (   $initialController,
  $controller,
  $action,
  $params = array() 
)

Definition at line 54 of file JsUtils.php.

◆ fromDispatcher()

fromDispatcher (   $dispatcher)

Definition at line 62 of file JsUtils.php.

◆ getUrl()

getUrl (   $url)

Definition at line 37 of file JsUtils.php.

◆ inline()

inline (   $script,
  $cdata = true 
)

Definition at line 29 of file JsUtils.php.

◆ renderComponent()

renderComponent ( BaseHtml  $component,
bool  $asString = false 
)

Compile and render a component.

Parameters
BaseHtml$component
bool$asString
Returns
mixed
Exceptions

Definition at line 93 of file JsUtils.php.

◆ renderContent()

renderContent (   $initialControllerInstance,
  $viewName,
  $params = NULL 
)

Definition at line 58 of file JsUtils.php.

◆ renderDefaultView()

renderDefaultView (   $parameters = [],
  $asString = false 
)

Performs jQuery compilation and displays the default view.

Parameters
mixed$parametersVariable or associative array to pass to the view
If a variable is passed, it will have the name $ data </ b> in the view,
If an associative array is passed, the view retrieves variables from the table's key names
boolean$asString If true, the view is not displayed but returned as a string (usable in a variable)

Definition at line 107 of file JsUtils.php.

◆ renderView()

renderView (   $viewName,
  $parameters = [],
  $asString = false 
)

Performs jQuery compilation and displays a view.

Parameters
string$viewName
mixed$parametersVariable or associative array to pass to the view
If a variable is passed, it will have the name $ data </ b> in the view,
If an associative array is passed, the view retrieves variables from the table's key names
boolean$asString If true, the view is not displayed but returned as a string (usable in a variable)

Definition at line 76 of file JsUtils.php.


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