Skip to content

Latest commit

 

History

History
173 lines (105 loc) · 3.6 KB

DataProcessor-Documentation.pod

File metadata and controls

173 lines (105 loc) · 3.6 KB

Class DataProcessor Documentation

Description

Class DataProcessor - XML Generator for DHTMLX

construct

$dataprocessor = new DataProcessor( set encoding, default utf-8 )

$dataprocessor = new DataProcessor;

or

$dataprocessor = new DataProcessor('iso-8859-1');

action

$dataprocessor->action( array( 'key attribute' => 'value attribute' ) )

$dataprocessor->action(
    array(
        "type" => "inserted",
        "sid" => 2,
        "tid" => 2
    )
);
  

inserted

$dataprocessor->inserted( 'sid', 'tid', optional array( 'key attribute' => 'value attribute' ) )

$dataprocessor->inserted(2, 2, array("details" => "foo"));

updated

$dataprocessor->updated( 'sid', 'tid', optional array( 'key attribute' => 'value attribute' ) )

$dataprocessor->updated(20, 20, array("extra" => "bar"));

deleted

$dataprocessor->deleted( 'sid', 'tid', optional array( 'key attribute' => 'value attribute' ) )

$dataprocessor->deleted(8, 8);

invalid

$dataprocessor->invalid( 'sid', 'message', optional array( 'key attribute' => 'value attribute' ) )

$dataprocessor->invalid(10, 'Data in first column is not valid');

error

$dataprocessor->error( 'sid', 'tid', optional array( 'key attribute' => 'value attribute' ) )

$dataprocessor->error(3, 3);

header

$dataprocessor->header()

$dataprocessor->header();

return

header("Content-type: application/xml; charset=utf-8");

result

$dataprocessor->result()

echo $dataprocessor->result();

Print XML

Examples

Example 1

<?php
include_once 'DHX.php';

$dataprocessor = new DataProcessor;

$dataprocessor->action(
    array(
        "type" => "inserted",
        "sid" => 2,
        "tid" => 2
    )
);

$dataprocessor->header();
echo $dataprocessor->result();
?>

Result

<?xml version="1.0" encoding="utf-8"?>
<data>
    <action type="inserted" sid="2" tid="2"/>
</data>

Example 2

<?php
include_once 'DHX.php';

$dataprocessor = new DataProcessor;

$dataprocessor->inserted(15, 15, array("details" => "successfully added"));

$dataprocessor->header();
echo $dataprocessor->result();
?>

Result

<?xml version="1.0" encoding="utf-8"?>
<data>
    <action type="inserted" sid="15" tid="15">successfully added</action>
</data>

Example 3

<?php
include_once 'DHX.php';

$dataprocessor = new DataProcessor('iso-8859-1');

$dataprocessor->invalid(300, "Data in first column is not valid");

$dataprocessor->header();
echo $dataprocessor->result();
?>

Result

<?xml version="1.0" encoding="iso-8859-1"?>
<data>
    <action type="invalid" sid="300" message="Data in first column is not valid"/>
</data>

Example 4

<?php
include_once 'DHX.php';

$dataprocessor = new DataProcessor('iso-8859-1');

$dataprocessor->updated(132, 132, array("extra" => "new value for first column"));

$dataprocessor->header();
echo $dataprocessor->result();
?>

Result

<?xml version="1.0" encoding="iso-8859-1"?>
<data>
    <action type="updated" sid="132" tid="132" extra="new value for first column"/>
</data>

Author

Lucas Tiago de Moraes

Support

Group DHTMLX Facebook