ona  18.1.1
About: OpenNetAdmin provides a database managed inventory of your IP network (with Web and CLI interface).
  Fossies Dox: ona-18.1.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

xajaxResponse Class Reference

Public Member Functions

 xajaxResponse ($sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bOutputEntities=false)
 
 setCharEncoding ($sEncoding)
 
 outputEntitiesOn ()
 
 outputEntitiesOff ()
 
 addConfirmCommands ($iCmdNumber, $sMessage)
 
 addAssign ($sTarget, $sAttribute, $sData)
 
 addAppend ($sTarget, $sAttribute, $sData)
 
 addPrepend ($sTarget, $sAttribute, $sData)
 
 addReplace ($sTarget, $sAttribute, $sSearch, $sData)
 
 addClear ($sTarget, $sAttribute)
 
 addAlert ($sMsg)
 
 addRedirect ($sURL)
 
 addScript ($sJS)
 
 addScriptCall ()
 
 addRemove ($sTarget)
 
 addCreate ($sParent, $sTag, $sId, $sType="")
 
 addInsert ($sBefore, $sTag, $sId)
 
 addInsertAfter ($sAfter, $sTag, $sId)
 
 addCreateInput ($sParent, $sType, $sName, $sId)
 
 addInsertInput ($sBefore, $sType, $sName, $sId)
 
 addInsertInputAfter ($sAfter, $sType, $sName, $sId)
 
 addEvent ($sTarget, $sEvent, $sScript)
 
 addHandler ($sTarget, $sEvent, $sHandler)
 
 addRemoveHandler ($sTarget, $sEvent, $sHandler)
 
 addIncludeScript ($sFileName)
 
 getXML ()
 
 loadXML ($mXML)
 
 _cmdXML ($aAttributes, $sData)
 
 _buildObjXml ($var)
 

Public Attributes

 $xml
 
 $sEncoding
 
 $bOutputEntities
 

Detailed Description

Definition at line 68 of file xajaxResponse.inc.php.

Member Function Documentation

◆ _buildObjXml()

xajaxResponse::_buildObjXml (   $var)

Recursively serializes a data structure in XML so it can be sent to the client. It could be thought of as the opposite of xajax::_parseObjXml().

@access private

Parameters
mixeddata structure to serialize to XML
Returns
string serialized XML

Definition at line 561 of file xajaxResponse.inc.php.

Referenced by addScriptCall().

◆ _cmdXML()

xajaxResponse::_cmdXML (   $aAttributes,
  $sData 
)

Generates XML from command data

@access private

Parameters
arrayassociative array of attributes
stringdata
Returns
string XML command

Definition at line 529 of file xajaxResponse.inc.php.

References $xml.

Referenced by addAlert(), addAppend(), addAssign(), addConfirmCommands(), addCreate(), addCreateInput(), addEvent(), addHandler(), addIncludeScript(), addInsert(), addInsertAfter(), addInsertInput(), addInsertInputAfter(), addPrepend(), addRemove(), addRemoveHandler(), addReplace(), addScript(), and addScriptCall().

◆ addAlert()

xajaxResponse::addAlert (   $sMsg)

Adds an alert command message to the XML response.

Usage: $objResponse->addAlert("This is important information");

Parameters
stringthe text to be displayed in the Javascript alert box

Definition at line 239 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addAppend()

xajaxResponse::addAppend (   $sTarget,
  $sAttribute,
  $sData 
)

Adds an append command message to the XML response.

Usage: $objResponse->addAppend("contentDiv", "innerHTML", "Some New Text");

Parameters
stringcontains the id of an HTML element
stringthe part of the element you wish to modify ("innerHTML", "value", etc.)
stringthe data you want to append to the end of the attribute

Definition at line 179 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addAssign()

xajaxResponse::addAssign (   $sTarget,
  $sAttribute,
  $sData 
)

Adds an assign command message to the XML response.

Usage: $objResponse->addAssign("contentDiv", "innerHTML", "Some Text");

Parameters
stringcontains the id of an HTML element
stringthe part of the element you wish to modify ("innerHTML", "value", etc.)
stringthe data you want to set the attribute to

Definition at line 164 of file xajaxResponse.inc.php.

References _cmdXML().

Referenced by addClear().

◆ addClear()

xajaxResponse::addClear (   $sTarget,
  $sAttribute 
)

Adds a clear command message to the XML response.

Usage: $objResponse->addClear("contentDiv", "innerHTML");

Parameters
stringcontains the id of an HTML element
stringthe part of the element you wish to clear ("innerHTML", "value", etc.)

Definition at line 227 of file xajaxResponse.inc.php.

References addAssign().

◆ addConfirmCommands()

xajaxResponse::addConfirmCommands (   $iCmdNumber,
  $sMessage 
)

Adds a confirm commands command message to the XML response.

Usage: $objResponse->addConfirmCommands(1, "Do you want to preview the new data?");

Parameters
integerthe number of commands to skip if the user presses Cancel in the browsers's confirm dialog
stringthe message to show in the browser's confirm dialog

Definition at line 149 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addCreate()

xajaxResponse::addCreate (   $sParent,
  $sTag,
  $sId,
  $sType = "" 
)

Adds a create element command message to the XML response.

Usage: $objResponse->addCreate("parentDiv", "h3", "myid");

Parameters
stringcontains the id of an HTML element to to which the new element will be appended.
stringthe tag to be added
stringthe id to be assigned to the new element
stringdeprecated, use the addCreateInput() method instead

Definition at line 325 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addCreateInput()

xajaxResponse::addCreateInput (   $sParent,
  $sType,
  $sName,
  $sId 
)

Adds a create input command message to the XML response.

Usage: $objResponse->addCreateInput("form1", "text", "username", "input1");

Parameters
stringcontains the id of an HTML element to which the new input will be appended
stringthe type of input to be created (text, radio, checkbox, etc.)
stringthe name to be assigned to the new input and the variable name when it is submitted
stringthe id to be assigned to the new input

Definition at line 378 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addEvent()

xajaxResponse::addEvent (   $sTarget,
  $sEvent,
  $sScript 
)

Adds an event command message to the XML response.

Usage: $objResponse->addEvent("contentDiv", "onclick", "alert(\'Hello World\');");

Parameters
stringcontains the id of an HTML element
stringthe event you wish to set ("onclick", "onmouseover", etc.)
stringthe Javascript string you want the event to invoke

Definition at line 428 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addHandler()

xajaxResponse::addHandler (   $sTarget,
  $sEvent,
  $sHandler 
)

Adds a handler command message to the XML response.

Usage: $objResponse->addHandler("contentDiv", "onclick", "content_click");

Parameters
stringcontains the id of an HTML element
stringthe event you wish to set ("onclick", "onmouseover", etc.)
stringthe name of a Javascript function that will handle the event. Multiple handlers can be added for the same event

Definition at line 443 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addIncludeScript()

xajaxResponse::addIncludeScript (   $sFileName)

Adds an include script command message to the XML response.

Usage: $objResponse->addIncludeScript("functions.js");

Parameters
stringURL of the Javascript file to include

Definition at line 471 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addInsert()

xajaxResponse::addInsert (   $sBefore,
  $sTag,
  $sId 
)

Adds a insert element command message to the XML response.

Usage: $objResponse->addInsert("childDiv", "h3", "myid");

Parameters
stringcontains the id of the child before which the new element will be inserted
stringthe tag to be added
stringthe id to be assigned to the new element

Definition at line 345 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addInsertAfter()

xajaxResponse::addInsertAfter (   $sAfter,
  $sTag,
  $sId 
)

Adds a insert element command message to the XML response.

Usage: $objResponse->addInsertAfter("childDiv", "h3", "myid");

Parameters
stringcontains the id of the child after which the new element will be inserted
stringthe tag to be added
stringthe id to be assigned to the new element

Definition at line 360 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addInsertInput()

xajaxResponse::addInsertInput (   $sBefore,
  $sType,
  $sName,
  $sId 
)

Adds an insert input command message to the XML response.

Usage: $objResponse->addInsertInput("input5", "text", "username", "input1");

Parameters
stringcontains the id of the child before which the new element will be inserted
stringthe type of input to be created (text, radio, checkbox, etc.)
stringthe name to be assigned to the new input and the variable name when it is submitted
stringthe id to be assigned to the new input

Definition at line 396 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addInsertInputAfter()

xajaxResponse::addInsertInputAfter (   $sAfter,
  $sType,
  $sName,
  $sId 
)

Adds an insert input command message to the XML response.

Usage: $objResponse->addInsertInputAfter("input7", "text", "email", "input2");

Parameters
stringcontains the id of the child after which the new element will be inserted
stringthe type of input to be created (text, radio, checkbox, etc.)
stringthe name to be assigned to the new input and the variable name when it is submitted
stringthe id to be assigned to the new input

Definition at line 414 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addPrepend()

xajaxResponse::addPrepend (   $sTarget,
  $sAttribute,
  $sData 
)

Adds an prepend command message to the XML response.

Usage: $objResponse->addPrepend("contentDiv", "innerHTML", "Some Starting Text");

Parameters
stringcontains the id of an HTML element
stringthe part of the element you wish to modify ("innerHTML", "value", etc.)
stringthe data you want to prepend to the beginning of the attribute

Definition at line 195 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addRedirect()

xajaxResponse::addRedirect (   $sURL)

Uses the addScript() method to add a Javascript redirect to another URL.

Usage: $objResponse->addRedirect("http://www.xajaxproject.org");

Parameters
stringthe URL to redirect the client browser to

Definition at line 251 of file xajaxResponse.inc.php.

References addScript().

◆ addRemove()

xajaxResponse::addRemove (   $sTarget)

Adds a remove element command message to the XML response.

Usage: $objResponse->addRemove("Div2");

Parameters
stringcontains the id of an HTML element to be removed

Definition at line 309 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addRemoveHandler()

xajaxResponse::addRemoveHandler (   $sTarget,
  $sEvent,
  $sHandler 
)

Adds a remove handler command message to the XML response.

Usage: $objResponse->addRemoveHandler("contentDiv", "onclick", "content_click");

Parameters
stringcontains the id of an HTML element
stringthe event you wish to remove ("onclick", "onmouseover", etc.)
stringthe name of a Javascript handler function that you want to remove

Definition at line 459 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addReplace()

xajaxResponse::addReplace (   $sTarget,
  $sAttribute,
  $sSearch,
  $sData 
)

Adds a replace command message to the XML response.

Usage: $objResponse->addReplace("contentDiv", "innerHTML", "text", "<b>text</b>");

Parameters
stringcontains the id of an HTML element
stringthe part of the element you wish to modify ("innerHTML", "value", etc.)
stringthe string to search for
stringthe string to replace the search string when found in the attribute

Definition at line 212 of file xajaxResponse.inc.php.

References _cmdXML().

◆ addScript()

xajaxResponse::addScript (   $sJS)

Adds a Javascript command message to the XML response.

Usage: $objResponse->addScript("var x = prompt('get some text');");

Parameters
stringcontains Javascript code to be executed

Definition at line 282 of file xajaxResponse.inc.php.

References _cmdXML().

Referenced by addRedirect().

◆ addScriptCall()

xajaxResponse::addScriptCall ( )

Adds a Javascript function call command message to the XML response.

Usage: $objResponse->addScriptCall("myJSFunction", "arg 1", "arg 2", 12345);

Parameters
string$sFuncthe name of a Javascript function
mixed$args,...optional arguments to pass to the Javascript function

Definition at line 295 of file xajaxResponse.inc.php.

References _buildObjXml(), and _cmdXML().

◆ getXML()

xajaxResponse::getXML ( )

Returns the XML to be returned from your function to the xajax processor on your page. Since xajax 0.2, you can also return an xajaxResponse object from your function directly, and xajax will automatically request the XML using this method call.

Usage: return $objResponse->getXML();

Returns
string response XML data

Definition at line 486 of file xajaxResponse.inc.php.

◆ loadXML()

xajaxResponse::loadXML (   $mXML)

Adds the commands of the provided response XML output to this response object

Usage: $r1 = $objResponse1->getXML(); $objResponse2->loadXML($r1); return $objResponse2->getXML();

Parameters
stringthe response XML (returned from a getXML() method) to add to the end of this response object

Definition at line 508 of file xajaxResponse.inc.php.

◆ outputEntitiesOff()

xajaxResponse::outputEntitiesOff ( )

Tells the response object to output special characters intact. (default behavior)

Definition at line 135 of file xajaxResponse.inc.php.

◆ outputEntitiesOn()

xajaxResponse::outputEntitiesOn ( )

Tells the response object to convert special characters to HTML entities automatically (only works if the mb_string extension is available).

Definition at line 126 of file xajaxResponse.inc.php.

◆ setCharEncoding()

xajaxResponse::setCharEncoding (   $sEncoding)

Sets the character encoding for the response based on $sEncoding, which is a string containing the character encoding to use. You don't need to use this method normally, since the character encoding for the response gets set automatically based on the XAJAX_DEFAULT_CHAR_ENCODING constant.

Parameters
string

Definition at line 117 of file xajaxResponse.inc.php.

References $sEncoding.

Referenced by xajaxResponse().

◆ xajaxResponse()

xajaxResponse::xajaxResponse (   $sEncoding = XAJAX_DEFAULT_CHAR_ENCODING,
  $bOutputEntities = false 
)

#-The constructor's main job is to set the character encoding for the response.

Note: to change the character encoding for all of the responses, set the XAJAX_DEFAULT_ENCODING constant before you instantiate xajax.

Parameters
stringcontains the character encoding string to use
booleanlets you set if you want special characters in the output converted to HTML entities

Definition at line 102 of file xajaxResponse.inc.php.

References $bOutputEntities, and setCharEncoding().

Member Data Documentation

◆ $bOutputEntities

xajaxResponse::$bOutputEntities

Definition at line 85 of file xajaxResponse.inc.php.

Referenced by xajaxResponse().

◆ $sEncoding

xajaxResponse::$sEncoding

Definition at line 80 of file xajaxResponse.inc.php.

Referenced by setCharEncoding().

◆ $xml

xajaxResponse::$xml

Definition at line 76 of file xajaxResponse.inc.php.

Referenced by _cmdXML().


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