2012-10-02 10:27:57 -04:00
|
|
|
<?php
|
2012-10-02 13:13:19 -04:00
|
|
|
/**
|
|
|
|
|
* Class defined to be instanced and handle XML format messages.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @category Zend
|
|
|
|
|
* @package ProcessMaker
|
|
|
|
|
* @subpackage workflow
|
2012-10-02 17:28:12 -04:00
|
|
|
* @copyright Copyright (c) ProcessMaker Colosa Inc.
|
2012-10-02 13:13:19 -04:00
|
|
|
* @version Release: @2.0.44@
|
|
|
|
|
* @since Class available since Release 2.0.44
|
|
|
|
|
*/
|
|
|
|
|
|
2012-10-02 10:27:57 -04:00
|
|
|
require_once("FormatedMessage.php");
|
2012-10-02 13:13:19 -04:00
|
|
|
/**
|
|
|
|
|
* Class defined to be instanced and handle XML format messages.
|
|
|
|
|
*/
|
2012-10-02 10:27:57 -04:00
|
|
|
class XmlMessage extends FormatedMessage
|
|
|
|
|
{
|
2012-10-02 13:13:19 -04:00
|
|
|
/**
|
|
|
|
|
* Call the parent Curl initialization and set the type of the message
|
|
|
|
|
*/
|
|
|
|
|
public function XmlMessage()
|
|
|
|
|
{
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->type = "xml";
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Format the array parameter to a xml valid format. TODO: Need to find out a better way to do it.
|
|
|
|
|
*/
|
|
|
|
|
protected function format(array $message)
|
|
|
|
|
{
|
|
|
|
|
if (empty($message)){
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
if (is_array($message)){
|
|
|
|
|
$xml = "<?xml version='1.0'?><request>";
|
|
|
|
|
foreach($message as $index => $data)
|
|
|
|
|
{
|
|
|
|
|
$xml .= "<" . $index . ">" . $data . "</" . $index . ">";
|
|
|
|
|
}
|
|
|
|
|
$xml .= "</request>";
|
|
|
|
|
}
|
|
|
|
|
return $xml;
|
|
|
|
|
}
|
2012-10-02 10:27:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|