class Response

Traits

Properties

string $sContentType The response type
array $aCommands The commands that will be sent to the browser in the response

Methods

string
getVersion()

Get the Jaxon library version number

from Config
void
setOption(string $sName, mixed $sValue)

Set the value of a config option

from Config
void
setOptions(array $aOptions, string $sKeys = '')

Set the values of an array of config options

from Config
mixed
getOption(string $sName, mixed $xDefault = null)

Get the value of a config option

from Config
bool
hasOption(string $sName)

Check the presence of a config option

from Config
array
getOptionNames(string $sPrefix)

Get the names of the options matching a given prefix

from Config
Config
newConfig()

Create a new the config manager

from Config
object
getPluginManager()

Get the plugin manager

from Manager
null|Response
plugin(string $sName)

Provides access to registered response plugins

object
getRequestManager()

Get the request manager

from Manager
object
getResponseManager()

Get the response manager

from Manager
void
addEventListener(EventListener $xEventListener)

Register an event listener.

from Manager
object
getResponse()

Get the Global Response object

from Manager
newResponse()

Create a new Jaxon response object

from Manager
string
trans(string $sText, array $aPlaceHolders = array(), string $sLanguage = null)

Get a translated string

__construct()

No description

string
getContentType()

Get the content type, which is always set to 'application/json'

string
getCharacterEncoding()

Get the configured character encoding

Element
jq(string $sSelector = '', string $sContext = '')

Create a JQuery Element with a given selector, and link it to the current response.

Element
jQuery(string $sSelector = '', string $sContext = '')

Create a JQuery Element with a given selector, and link it to the current response.

__get(string $sPluginName)

Magic PHP function

addCommand(array $aAttributes, mixed $mData)

Add a response command to the array of commands that will be sent to the browser

clearCommands()

Clear all the commands already added to the response

addPluginCommand(Plugin $xPlugin, array $aAttributes, mixed $mData)

Add a response command that is generated by a plugin

void
appendResponse(Response $mCommands, boolean $bBefore = false)

Merge the response commands from the specified object with the response commands in this object

confirmCommands(integer $iCmdNumber, string $sMessage)

Response command that prompts user with [ok] [cancel] style message box

assign(string $sTarget, string $sAttribute, string $sData)

Add a command to assign the specified value to the given element's attribute

html(string $sTarget, string $sData)

Add a command to assign the specified HTML content to the given element

append(string $sTarget, string $sAttribute, string $sData)

Add a command to append the specified data to the given element's attribute

prepend(string $sTarget, string $sAttribute, string $sData)

Add a command to prepend the specified data to the given element's attribute

replace(string $sTarget, string $sAttribute, string $sSearch, string $sData)

Add a command to replace a specified value with another value within the given element's attribute

clear(string $sTarget, string $sAttribute)

Add a command to clear the specified attribute of the given element

contextAssign(string $sAttribute, string $sData)

Add a command to assign a value to a member of a javascript object (or element) that is specified by the context member of the request

contextAppend(string $sAttribute, string $sData)

Add a command to append a value onto the specified member of the javascript context object (or element) specified by the context member of the request

contextPrepend(string $sAttribute, string $sData)

Add a command to prepend the speicified data to the given member of the current javascript object specified by context in the current request

contextClear(string $sAttribute)

Add a command to to clear the value of the attribute specified in the sAttribute parameter

alert(string $sMessage)

Add a command to display an alert message to the user

debug(string $sMessage)

Add a command to display a debug message to the user

redirect(string $sURL, integer $iDelay)

Add a command to ask the browser to navigate to the specified URL

script(string $sJS)

Add a command to execute a portion of javascript on the browser

call(string $sFunc)

Add a command to call the specified javascript function with the given (optional) parameters

remove(string $sTarget)

Add a command to remove an element from the document

create(string $sParent, string $sTag, string $sId)

Add a command to create a new element on the browser

insert(string $sBefore, string $sTag, string $sId)

Add a command to insert a new element just prior to the specified element

insertAfter(string $sAfter, string $sTag, string $sId)

Add a command to insert a new element after the specified

createInput(string $sParent, string $sType, string $sName, string $sId)

Add a command to create an input element on the browser

insertInput(string $sBefore, string $sType, string $sName, string $sId)

Add a command to insert a new input element preceding the specified element

insertInputAfter(string $sAfter, string $sType, string $sName, string $sId)

Add a command to insert a new input element after the specified element

setEvent(string $sTarget, string $sEvent, string $sScript)

Add a command to set an event handler on the browser

onClick(string $sTarget, string $sScript)

Add a command to set a click handler on the browser

addHandler(string $sTarget, string $sEvent, string $sHandler)

Add a command to install an event handler on the specified element

removeHandler(string $sTarget, string $sEvent, string $sHandler)

Add a command to remove an event handler from an element

setFunction(string $sFunction, string $sArgs, string $sScript)

Add a command to construct a javascript function on the browser

wrapFunction(string $sFunction, string $sArgs, array $aScripts, string $sReturnValueVar)

Add a command to construct a wrapper function around an existing javascript function on the browser

includeScript($sFileName, $sType = null, $sId = null)

Add a command to load a javascript file on the browser

includeScriptOnce($sFileName, $sType = null, $sId = null)

Add a command to include a javascript file on the browser if it has not already been loaded

removeScript(string $sFileName, string $sUnload = '')

Add a command to remove a SCRIPT reference to a javascript file on the browser

includeCSS(string $sFileName, string $sMedia = null)

Add a command to include a LINK reference to the specified CSS file on the browser.

removeCSS($sFileName, $sMedia = null)

Add a command to remove a LINK reference to a CSS file on the browser

waitForCSS(integer $iTimeout = 600)

Add a command to make Jaxon pause while the CSS files are loaded

waitFor(string $script, integer $tenths)

Add a command to make Jaxon to delay execution of the response commands until a specified condition is met

sleep(integer $tenths)

Add a command to make Jaxon to pause execution of the response commands, returning control to the browser so it can perform other commands asynchronously.

domStartResponse()

Add a command to start a DOM response

domCreateElement(string $variable, string $tag)

Add a command to create a DOM element

domSetAttribute(string $variable, string $key, string $value)

Add a command to set an attribute on a DOM element

domRemoveChildren(string $parent, string $skip = null, string $remove = null)

Add a command to remove children from a DOM element

domAppendChild(string $parent, string $variable)

Add a command to append a child to a DOM element

domInsertBefore(string $target, string $variable)

Add a command to insert a DOM element before another

domInsertAfter(string $target, string $variable)

Add a command to insert a DOM element after another

domAppendText(string $parent, string $text)

Add a command to append a text to a DOM element

domEndResponse()

Add a command to end a DOM response

integer
getCommandCount()

Get the number of commands in the response

setReturnValue(mixed $value)

Stores a value that will be passed back as part of the response

void
sendHeaders()

Used internally to generate the response headers

string
getOutput()

Return the output, generated from the commands added to the response, that will be sent to the browser

void
printOutput()

Print the output, generated from the commands added to the response, that will be sent to the browser

Details

in Config at line line 24
string getVersion()

Get the Jaxon library version number

Return Value

string The version number

in Config at line line 37
void setOption(string $sName, mixed $sValue)

Set the value of a config option

Parameters

string $sName The option name
mixed $sValue The option value

Return Value

void

in Config at line line 50
void setOptions(array $aOptions, string $sKeys = '')

Set the values of an array of config options

Parameters

array $aOptions The config options
string $sKeys The keys of the options in the array

Return Value

void

in Config at line line 63
mixed getOption(string $sName, mixed $xDefault = null)

Get the value of a config option

Parameters

string $sName The option name
mixed $xDefault The default value, to be returned if the option is not defined

Return Value

mixed The option value, or null if the option is unknown

in Config at line line 75
bool hasOption(string $sName)

Check the presence of a config option

Parameters

string $sName The option name

Return Value

bool True if the option exists, and false if not

in Config at line line 87
array getOptionNames(string $sPrefix)

Get the names of the options matching a given prefix

Parameters

string $sPrefix The prefix to match

Return Value

array The options matching the prefix

in Config at line line 97
Config newConfig()

Create a new the config manager

Return Value

Config The config manager

in Manager at line line 27
object getPluginManager()

Get the plugin manager

Return Value

object The plugin manager

at line line 101
null|Response plugin(string $sName)

Provides access to registered response plugins

Pass the plugin name as the first argument and the plugin object will be returned. You can then access the methods of the plugin directly.

Parameters

string $sName The name of the plugin

Return Value

null|Response

in Manager at line line 49
object getRequestManager()

Get the request manager

Return Value

object The request manager

in Manager at line line 59
object getResponseManager()

Get the response manager

Return Value

object The response manager

in Manager at line line 69
void addEventListener(EventListener $xEventListener)

Register an event listener.

Parameters

EventListener $xEventListener

Return Value

void

in Manager at line line 79
object getResponse()

Get the Global Response object

Return Value

object The Global Response object

in Manager at line line 89
Response newResponse()

Create a new Jaxon response object

Return Value

Response The new Jaxon response object

in Translator at line line 30
string trans(string $sText, array $aPlaceHolders = array(), string $sLanguage = null)

Get a translated string

Parameters

string $sText The key of the translated string
array $aPlaceHolders The placeholders of the translated string
string $sLanguage The language of the translated string

Return Value

string The translated string

at line line 66
__construct()

at line line 76
string getContentType()

Get the content type, which is always set to 'application/json'

Return Value

string

at line line 86
string getCharacterEncoding()

Get the configured character encoding

Return Value

string

at line line 122
Element jq(string $sSelector = '', string $sContext = '')

Create a JQuery Element with a given selector, and link it to the current response.

This is a shortcut to the JQuery plugin.

Parameters

string $sSelector The jQuery selector
string $sContext A context associated to the selector

Return Value

Element

at line line 137
Element jQuery(string $sSelector = '', string $sContext = '')

Create a JQuery Element with a given selector, and link it to the current response.

This is a shortcut to the JQuery plugin.

Parameters

string $sSelector The jQuery selector
string $sContext A context associated to the selector

Return Value

Element

at line line 151
Response __get(string $sPluginName)

Magic PHP function

Used to permit plugins to be called as if they where native members of the Response instance.

Parameters

string $sPluginName The name of the plugin

Return Value

Response

at line line 164
Response addCommand(array $aAttributes, mixed $mData)

Add a response command to the array of commands that will be sent to the browser

Parameters

array $aAttributes Associative array of attributes that will describe the command
mixed $mData The data to be associated with this command

Return Value

Response

at line line 205
Response clearCommands()

Clear all the commands already added to the response

Return Value

Response

at line line 221
Response addPluginCommand(Plugin $xPlugin, array $aAttributes, mixed $mData)

Add a response command that is generated by a plugin

Parameters

Plugin $xPlugin The plugin object
array $aAttributes The attributes for this response command
mixed $mData The data to be sent with this command

Return Value

Response

at line line 236
void appendResponse(Response $mCommands, boolean $bBefore = false)

Merge the response commands from the specified object with the response commands in this object

Parameters

Response $mCommands The object
boolean $bBefore Add the new commands to the beginning of the list

Return Value

void

at line line 282
Response confirmCommands(integer $iCmdNumber, string $sMessage)

Response command that prompts user with [ok] [cancel] style message box

If the user clicks cancel, the specified number of response commands following this one, will be skipped.

Parameters

integer $iCmdNumber The number of commands to skip upon cancel
string $sMessage The message to display to the user

Return Value

Response

at line line 302
Response assign(string $sTarget, string $sAttribute, string $sData)

Add a command to assign the specified value to the given element's attribute

Parameters

string $sTarget The id of the html element on the browser
string $sAttribute The attribute to be assigned
string $sData The value to be assigned to the attribute

Return Value

Response

at line line 324
Response html(string $sTarget, string $sData)

Add a command to assign the specified HTML content to the given element

This is a shortcut for assign() on the innerHTML attribute.

Parameters

string $sTarget The id of the html element on the browser
string $sData The value to be assigned to the attribute

Return Value

Response

at line line 338
Response append(string $sTarget, string $sAttribute, string $sData)

Add a command to append the specified data to the given element's attribute

Parameters

string $sTarget The id of the element to be updated
string $sAttribute The name of the attribute to be appended to
string $sData The data to be appended to the attribute

Return Value

Response

at line line 359
Response prepend(string $sTarget, string $sAttribute, string $sData)

Add a command to prepend the specified data to the given element's attribute

Parameters

string $sTarget The id of the element to be updated
string $sAttribute The name of the attribute to be prepended to
string $sData The value to be prepended to the attribute

Return Value

Response

at line line 381
Response replace(string $sTarget, string $sAttribute, string $sSearch, string $sData)

Add a command to replace a specified value with another value within the given element's attribute

Parameters

string $sTarget The id of the element to update
string $sAttribute The attribute to be updated
string $sSearch The needle to search for
string $sData The data to use in place of the needle

Return Value

Response

at line line 404
Response clear(string $sTarget, string $sAttribute)

Add a command to clear the specified attribute of the given element

Parameters

string $sTarget The id of the element to be updated.
string $sAttribute The attribute to be cleared

Return Value

Response

at line line 420
Response contextAssign(string $sAttribute, string $sData)

Add a command to assign a value to a member of a javascript object (or element) that is specified by the context member of the request

The object is referenced using the 'this' keyword in the sAttribute parameter.

Parameters

string $sAttribute The attribute to be updated
string $sData The value to assign

Return Value

Response

at line line 442
Response contextAppend(string $sAttribute, string $sData)

Add a command to append a value onto the specified member of the javascript context object (or element) specified by the context member of the request

The object is referenced using the 'this' keyword in the sAttribute parameter.

Parameters

string $sAttribute The attribute to be appended to
string $sData The value to append

Return Value

Response

at line line 464
Response contextPrepend(string $sAttribute, string $sData)

Add a command to prepend the speicified data to the given member of the current javascript object specified by context in the current request

The object is access via the 'this' keyword in the sAttribute parameter.

Parameters

string $sAttribute The attribute to be updated
string $sData The value to be prepended

Return Value

Response

at line line 485
Response contextClear(string $sAttribute)

Add a command to to clear the value of the attribute specified in the sAttribute parameter

The member is access via the 'this' keyword and can be used to update a javascript object specified by context in the request parameters.

Parameters

string $sAttribute The attribute to be cleared

Return Value

Response

at line line 497
Response alert(string $sMessage)

Add a command to display an alert message to the user

Parameters

string $sMessage The message to be displayed

Return Value

Response

at line line 514
Response debug(string $sMessage)

Add a command to display a debug message to the user

Parameters

string $sMessage The message to be displayed

Return Value

Response

at line line 532
Response redirect(string $sURL, integer $iDelay)

Add a command to ask the browser to navigate to the specified URL

Parameters

string $sURL The relative or fully qualified URL
integer $iDelay Number of seconds to delay before the redirect occurs

Return Value

Response

at line line 585
Response script(string $sJS)

Add a command to execute a portion of javascript on the browser

The script runs in it's own context, so variables declared locally, using the 'var' keyword, will no longer be available after the call. To construct a variable that will be accessable globally, even after the script has executed, leave off the 'var' keyword.

Parameters

string $sJS The script to execute

Return Value

Response

at line line 602
Response call(string $sFunc)

Add a command to call the specified javascript function with the given (optional) parameters

Parameters

string $sFunc The name of the function to call

Return Value

Response

at line line 622
Response remove(string $sTarget)

Add a command to remove an element from the document

Parameters

string $sTarget The id of the element to be removed

Return Value

Response

at line line 642
Response create(string $sParent, string $sTag, string $sId)

Add a command to create a new element on the browser

Parameters

string $sParent The id of the parent element
string $sTag The tag name to be used for the new element
string $sId The id to assign to the new element

Return Value

Response

at line line 663
Response insert(string $sBefore, string $sTag, string $sId)

Add a command to insert a new element just prior to the specified element

Parameters

string $sBefore The id of the element used as a reference point for the insertion
string $sTag The tag name to be used for the new element
string $sId The id to assign to the new element

Return Value

Response

at line line 684
Response insertAfter(string $sAfter, string $sTag, string $sId)

Add a command to insert a new element after the specified

Parameters

string $sAfter The id of the element used as a reference point for the insertion
string $sTag The tag name to be used for the new element
string $sId The id to assign to the new element

Return Value

Response

at line line 706
Response createInput(string $sParent, string $sType, string $sName, string $sId)

Add a command to create an input element on the browser

Parameters

string $sParent The id of the parent element
string $sType The type of the new input element
string $sName The name of the new input element
string $sId The id of the new element

Return Value

Response

at line line 729
Response insertInput(string $sBefore, string $sType, string $sName, string $sId)

Add a command to insert a new input element preceding the specified element

Parameters

string $sBefore The id of the element to be used as the reference point for the insertion
string $sType The type of the new input element
string $sName The name of the new input element
string $sId The id of the new element

Return Value

Response

at line line 752
Response insertInputAfter(string $sAfter, string $sType, string $sName, string $sId)

Add a command to insert a new input element after the specified element

Parameters

string $sAfter The id of the element to be used as the reference point for the insertion
string $sType The type of the new input element
string $sName The name of the new input element
string $sId The id of the new element

Return Value

Response

at line line 774
Response setEvent(string $sTarget, string $sEvent, string $sScript)

Add a command to set an event handler on the browser

Parameters

string $sTarget The id of the element that contains the event
string $sEvent The name of the event
string $sScript The javascript to execute when the event is fired

Return Value

Response

at line line 794
Response onClick(string $sTarget, string $sScript)

Add a command to set a click handler on the browser

Parameters

string $sTarget The id of the element that contains the event
string $sScript The javascript to execute when the event is fired

Return Value

Response

at line line 810
Response addHandler(string $sTarget, string $sEvent, string $sHandler)

Add a command to install an event handler on the specified element

You can add more than one event handler to an element's event using this method.

Parameters

string $sTarget The id of the element
string $sEvent The name of the event
string $sHandler The javascript function to call when the event is fired

Return Value

Response

at line line 831
Response removeHandler(string $sTarget, string $sEvent, string $sHandler)

Add a command to remove an event handler from an element

Parameters

string $sTarget The id of the element
string $sEvent The name of the event
string $sHandler The javascript function called when the event is fired

Return Value

Response

at line line 852
Response setFunction(string $sFunction, string $sArgs, string $sScript)

Add a command to construct a javascript function on the browser

Parameters

string $sFunction The name of the function to construct
string $sArgs Comma separated list of parameter names
string $sScript The javascript code that will become the body of the function

Return Value

Response

at line line 879
Response wrapFunction(string $sFunction, string $sArgs, array $aScripts, string $sReturnValueVar)

Add a command to construct a wrapper function around an existing javascript function on the browser

Parameters

string $sFunction The name of the existing function to wrap
string $sArgs The comma separated list of parameters for the function
array $aScripts An array of javascript code snippets that will be used to build the body of the function The first piece of code specified in the array will occur before the call to the original function, the second will occur after the original function is called.
string $sReturnValueVar The name of the variable that will retain the return value from the call to the original function

Return Value

Response

at line line 900
Response includeScript($sFileName, $sType = null, $sId = null)

Add a command to load a javascript file on the browser

Parameters

$sFileName
$sType
$sId

Return Value

Response

at line line 921
Response includeScriptOnce($sFileName, $sType = null, $sId = null)

Add a command to include a javascript file on the browser if it has not already been loaded

Parameters

$sFileName
$sType
$sId

Return Value

Response

at line line 944
Response removeScript(string $sFileName, string $sUnload = '')

Add a command to remove a SCRIPT reference to a javascript file on the browser

Optionally, you can call a javascript function just prior to the file being unloaded (for cleanup).

Parameters

string $sFileName The relative or fully qualified URI of the javascript file
string $sUnload Name of a javascript function to call prior to unlaoding the file

Return Value

Response

at line line 965
Response includeCSS(string $sFileName, string $sMedia = null)

Add a command to include a LINK reference to the specified CSS file on the browser.

This will cause the browser to load and apply the style sheet.

Parameters

string $sFileName The relative or fully qualified URI of the css file
string $sMedia The media type of the CSS file. Defaults to 'screen'

Return Value

Response

at line line 984
Response removeCSS($sFileName, $sMedia = null)

Add a command to remove a LINK reference to a CSS file on the browser

This causes the browser to unload the style sheet, effectively removing the style changes it caused.

Parameters

$sFileName
$sMedia

Return Value

Response

at line line 1009
Response waitForCSS(integer $iTimeout = 600)

Add a command to make Jaxon pause while the CSS files are loaded

The browser is not typically a multi-threading application, with regards to javascript code. Therefore, the CSS files included or removed with includeCSS> and removeCSS> respectively, will not be loaded or removed until the browser regains control from the script. This command returns control back to the browser and pauses the execution of the response until the CSS files, included previously, are loaded.

Parameters

integer $iTimeout The number of 1/10ths of a second to pause before timing out and continuing with the execution of the response commands

Return Value

Response

at line line 1034
Response waitFor(string $script, integer $tenths)

Add a command to make Jaxon to delay execution of the response commands until a specified condition is met

Note, this returns control to the browser, so that other script operations can execute. Jaxon will continue to monitor the specified condition and, when it evaulates to true, will continue processing response commands.

Parameters

string $script A piece of javascript code that evaulates to true or false
integer $tenths The number of 1/10ths of a second to wait before timing out and continuing with the execution of the response commands.

Return Value

Response

at line line 1055
Response sleep(integer $tenths)

Add a command to make Jaxon to pause execution of the response commands, returning control to the browser so it can perform other commands asynchronously.

After the specified delay, Jaxon will continue execution of the response commands.

Parameters

integer $tenths The number of 1/10ths of a second to sleep

Return Value

Response

at line line 1071
Response domStartResponse()

Add a command to start a DOM response

Return Value

Response

at line line 1084
Response domCreateElement(string $variable, string $tag)

Add a command to create a DOM element

Parameters

string $variable The DOM element name (id or class)
string $tag The HTML tag of the new DOM element

Return Value

Response

at line line 1104
Response domSetAttribute(string $variable, string $key, string $value)

Add a command to set an attribute on a DOM element

Parameters

string $variable The DOM element name (id or class)
string $key The name of the attribute
string $value The value of the attribute

Return Value

Response

at line line 1125
Response domRemoveChildren(string $parent, string $skip = null, string $remove = null)

Add a command to remove children from a DOM element

Parameters

string $parent The DOM parent element
string $skip The ??
string $remove The ??

Return Value

Response

at line line 1146
Response domAppendChild(string $parent, string $variable)

Add a command to append a child to a DOM element

Parameters

string $parent The DOM parent element
string $variable The DOM element name (id or class)

Return Value

Response

at line line 1165
Response domInsertBefore(string $target, string $variable)

Add a command to insert a DOM element before another

Parameters

string $target The DOM target element
string $variable The DOM element name (id or class)

Return Value

Response

at line line 1184
Response domInsertAfter(string $target, string $variable)

Add a command to insert a DOM element after another

Parameters

string $target The DOM target element
string $variable The DOM element name (id or class)

Return Value

Response

at line line 1203
Response domAppendText(string $parent, string $text)

Add a command to append a text to a DOM element

Parameters

string $parent The DOM parent element
string $text The HTML text to append

Return Value

Response

at line line 1219
Response domEndResponse()

Add a command to end a DOM response

Return Value

Response

at line line 1229
integer getCommandCount()

Get the number of commands in the response

Return Value

integer

at line line 1244
Response setReturnValue(mixed $value)

Stores a value that will be passed back as part of the response

When making synchronous requests, the calling javascript can obtain this value immediately as the return value of the <jaxon.call> javascript function

Parameters

mixed $value Any value

Return Value

Response

at line line 1255
void sendHeaders()

Used internally to generate the response headers

Return Value

void

at line line 1281
string getOutput()

Return the output, generated from the commands added to the response, that will be sent to the browser

Return Value

string

at line line 1304
void printOutput()

Print the output, generated from the commands added to the response, that will be sent to the browser

Return Value

void