Open Journal Systems  3.3.0
JSONMessage Class Reference

Public Member Functions

 __construct ($status=true, $content='', $elementId='0', $additionalAttributes=null)
 
 getAdditionalAttributes ()
 
 getContent ()
 
 getElementId ()
 
 getEvents ()
 
 getStatus ()
 
 getString ()
 
 setAdditionalAttributes ($additionalAttributes)
 
 setContent ($content)
 
 setElementId ($elementId)
 
 setEvent ($eventName, $eventData=null)
 
 setGlobalEvent ($eventName, $eventData=array())
 
 setStatus ($status)
 

Data Fields

 $_additionalAttributes
 
 $_content
 
 $_elementId
 
 $_events
 
 $_status
 

Detailed Description

Class to represent a JSON (Javascript Object Notation) message.

Definition at line 18 of file JSONMessage.inc.php.

Constructor & Destructor Documentation

◆ __construct()

JSONMessage::__construct (   $status = true,
  $content = '',
  $elementId = '0',
  $additionalAttributes = null 
)

Constructor.

Parameters
$statusboolean The status of an event (e.g. false if form validation fails).
$contentMixed The message to be delivered back to the calling script.
$elementIdstring The DOM element to be replaced.
$additionalAttributesarray Additional data to be returned.

Definition at line 56 of file JSONMessage.inc.php.

References setAdditionalAttributes(), setContent(), setElementId(), and setStatus().

Member Function Documentation

◆ getAdditionalAttributes()

JSONMessage::getAdditionalAttributes ( )

Get the additionalAttributes array

Returns
array

Definition at line 161 of file JSONMessage.inc.php.

References $_additionalAttributes.

Referenced by getString().

◆ getContent()

JSONMessage::getContent ( )

Get the content string

Returns
mixed

Definition at line 87 of file JSONMessage.inc.php.

References $_content.

Referenced by getString().

◆ getElementId()

JSONMessage::getElementId ( )

Get the elementId string

Returns
string

Definition at line 103 of file JSONMessage.inc.php.

References $_elementId.

Referenced by getString().

◆ getEvents()

JSONMessage::getEvents ( )

Get the events to trigger with this JSON message

Returns
array

Definition at line 153 of file JSONMessage.inc.php.

References $_events.

Referenced by getString().

◆ getStatus()

JSONMessage::getStatus ( )

Get the status string

Returns
string

Definition at line 70 of file JSONMessage.inc.php.

References $_status.

Referenced by getString().

◆ getString()

JSONMessage::getString ( )

Construct a JSON string to use for AJAX communication

Returns
string

Definition at line 178 of file JSONMessage.inc.php.

References getAdditionalAttributes(), getContent(), getElementId(), getEvents(), and getStatus().

◆ setAdditionalAttributes()

JSONMessage::setAdditionalAttributes (   $additionalAttributes)

Set the additionalAttributes array

Parameters
$additionalAttributesarray

Definition at line 169 of file JSONMessage.inc.php.

Referenced by __construct().

◆ setContent()

JSONMessage::setContent (   $content)

Set the content data

Parameters
$contentmixed

Definition at line 95 of file JSONMessage.inc.php.

Referenced by __construct().

◆ setElementId()

JSONMessage::setElementId (   $elementId)

Set the elementId string

Parameters
$elementIdstring

Definition at line 111 of file JSONMessage.inc.php.

Referenced by __construct().

◆ setEvent()

JSONMessage::setEvent (   $eventName,
  $eventData = null 
)

Set the event to trigger with this JSON message

Parameters
$eventNamestring
$eventDatamixed

Definition at line 121 of file JSONMessage.inc.php.

Referenced by setGlobalEvent().

◆ setGlobalEvent()

JSONMessage::setGlobalEvent (   $eventName,
  $eventData = array() 
)

Set a global event to trigger with this JSON message

This is a wrapper for the setEvent method.

Global events are triggered on the global event router instead of being triggered directly on the handler. They are intended for broadcasting updates from one handler to other handlers.

Parameters
$eventNamestring
$eventDataarray Global event data must be an assoc array

Definition at line 143 of file JSONMessage.inc.php.

References setEvent().

◆ setStatus()

JSONMessage::setStatus (   $status)

Set the status string

Parameters
$statusstring

Definition at line 78 of file JSONMessage.inc.php.

Referenced by __construct().

Field Documentation

◆ $_additionalAttributes

array JSONMessage::$_additionalAttributes

Set of additional attributes for special cases.

Definition at line 47 of file JSONMessage.inc.php.

Referenced by getAdditionalAttributes().

◆ $_content

Mixed JSONMessage::$_content

The message to be delivered back to the calling script.

Definition at line 29 of file JSONMessage.inc.php.

Referenced by getContent().

◆ $_elementId

string JSONMessage::$_elementId

ID for DOM element that will be replaced.

Definition at line 35 of file JSONMessage.inc.php.

Referenced by getElementId().

◆ $_events

array JSONMessage::$_events

List of JS events generated on the server side.

Definition at line 41 of file JSONMessage.inc.php.

Referenced by getEvents().

◆ $_status

string JSONMessage::$_status

The status of an event (e.g. false if form validation fails).

Definition at line 23 of file JSONMessage.inc.php.

Referenced by getStatus().


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