Exemplo n.º 1
0
 /**
  * Generates a node tree from an array and appends it to the specified document or node
  * @param object The document or node to which the child nodes should be appended
  * @param array An associative multidimensional array of elements and values
  */
 function fromArray(&$node, &$myArray)
 {
     if ($node->nodeType == DOMIT_DOCUMENT_NODE) {
         $docNode =& $node;
     } else {
         $docNode =& $node->ownerDocument;
     }
     foreach ($myArray as $key => $value) {
         if (is_array($value)) {
             //check for numeric indices
             $total = count($value);
             if ($total > 0 && isset($value[0])) {
                 for ($i = 0; $i < $total; $i++) {
                     $node->appendChild($docNode->createElement($key));
                     DOMIT_Utilities::fromArray($node->lastChild, $value[$i]);
                 }
             } else {
                 //generate child elements
                 $node->appendChild($docNode->createElement($key));
                 DOMIT_Utilities::fromArray($node->lastChild, $value);
             }
         } else {
             $node->appendChild($docNode->createElement($key));
             $node->lastChild->appendChild($docNode->createTextNode($value));
         }
     }
 }
Exemplo n.º 2
0
 /**
  * output of export
  * @return bool true/false
  */
 function output_export()
 {
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     // immer ge�ndert
     header("Cache-Control: no-cache, must-revalidate");
     // HTTP/1.1
     header("Pragma: no-cache");
     // HTTP/1.0
     header("Content-type: text/xml");
     DOMIT_Utilities::fromArray($this->xmldoc, $this->OLWebOrder);
     echo $this->xmldoc->toString(false, true);
     /*echo '<pre>';
     		print_r($orders);
     		echo '</pre>';*/
     return true;
 }