The PHP API

You will find here the detailed API of the Atlas toolkit for PHP. The API overview contains also useful information about the API.

Static functions of the Atlas class

launch

function launch( string $newSessionAction, $type = null )

Launches the server. newSessionAction is the value returned by below getAction(...) function when a new session is launched.

type can be:

  • empty or XDHq.DEFAULT to launch the default interface (desktop one),
  • XDHq.DESKTOP to launch the desktop interface,
  • XDHq.WEB to launch the web interface.

NOTA: in some examples, a launch function with extraneous parameters is used. For your own developments, you don't need to give this extraneous parameters.

AtlasTree class

AtlasTree constructor

It takes no parameter.

popTag

function popTag()

Closes the tag previously opened by pushTag(...), and the parent one becomes the current one.

pushTag

function pushTag( string $name )

Create a new tag of name name as child of the current one, and becomes the current one.

putAttribute

function putAttribute( string $name, string $value )

Add attribute of name name and value value to the current tag.

putValue

function putValue( string $value )

Set value as value for the current tag.

AtlasDOM class

This class contains the data for each users' session, and functions to manipulate the DOM displayed by the web browser.

Global

DOM constructor

Takes no parameter.

alert

function alert( string $message )

Displays an alert box with the string message as message.

confirm

function confirm( string $message )

Displays a confirmation dialog box with message as message. The returned value is true when the user clicks the OK button, and false when the user clicks the cancel button.

focus

function focus( string $id )

Gives the focus to element of id id.

getAction

function getAction( &$id )

When an event occurs, returns the corresponding action (as defined in the data-xdh-event(s) attributes). id is the id of the element on which the event occurs. This function is blocking.

Attribute

getAttribute

function getAttribute( string $id, string $name )

Returns the value of the attribute named name of the element of id id.

removeAttribute

function removeAttribute( string $id, string $name )

Removes attribute named name from element of id id.

setAttribute

function setAttribute( string $id, string $name, string $value ) 

Set value as value for the attribute named name of the element of id id.

Class

Following methods allows to handle classes (the CSS related class attributes of HTML tags), by respectively add, remove or toggle (i.e. adds if not present, otherwise removes) a class to elements identified by their ids (the content of the id attribute from HTML tags).

idsAndClasses must have following form:

[
    "id1" => "class1",
    "id2" => "class2",
    "id3" => "class3",
    ...
]

addClass

function addClass( string $id, string $class  )

addClasses

function addClasses( array $idsAndClasses )

removeClass

function removeClass( string $id, string $class  )

removeClasses

function removeClasses( array $idsAndClasses )

toggleClass

function toggleClass( string $id, string $class  )

toggleClasses

function toggleClasses( array $idsAndClasses )

Content

getContent

function getContent( string $id )

Retrieve the content of the element of id id.

getContents

function getContents( array $ids )

Retrieves the content of the elements of ids ids in the same order.

setContent

function setContent( string $id, string $content )

Set the content of element of id id to value.

setContents

function setContents( array $idsAndContents )

Set the content of all element which id are in idsAndContents to corresponding content.

idsAndContents must have following form:

[
    "id1" => "content1",
    "id2" => "content2",
    "id3" => "content3",
    ...
]

Element

enableElement

function enableElements( array $ids )

Enable element of id id.

enableElements

function enableElements( array $ids )

Enable element of ids ids.

disableElement

function disableElement( string $id ) {

Disable element of if id.

disableElements

function disableElements( array $ids )

Disable element of ids ids (array of strings).

Layout

setLayout

function setLayout(string  $id, AtlasTree $tree, string $xslFilename )

Replaces the content of element with string id as id with the result of the transformation of the XSL file with name xslFilename applied to the tree instance of a Tree class (see above).

If id is an empty string, the content of the entire document is replaced by the resulting transformation.

Property

getProperty

function getProperty( string $id, string $name )

Returns the value of property named name of the element of id id.

setProperty

function setProperty( string $id, string $name, string $value )

Set value as value for the property named name of the element of id id.

Widget

dressWidgets

function dressWidgets( string $id )

Create the widget for each elements which are children of the element of id id and which have a data-xdh-widget attribute.

If id is an empty string, the entire document is handled.