Exemple #1
0
 /**
  * Get an XML representation of the data
  * @param boolean $as_node.  Defaults to true if true, then we return DOMNode otherwise we return string representation of the generate node
  * @param DOMNode $append_node.  If DOMNode then XMLData is appended onto the given node.
  * @param boolean $include_children.  Defaults to false
  * @param mixed $fields.  Defaults to false.  If it is an array, it is the list of the fields we should populate get the representation for.
  */
 public function getXMLRepresentation($as_node = true, $append_node = null, $fields = false, $include_children = false)
 {
     $cont_node = parent::getXMLRepresentation(true, $append_node, $fields);
     if ($this->parentIsSet()) {
         $cont_node->setAttribute('parent_form', $this->getParentForm());
         $cont_node->setAttribute('parent_id', $this->getParentID());
     }
     $cont_node->setAttribute('created', $this->createdField->getDBValue());
     $cont_node->setAttribute('modified', $this->lastModifiedField->getDBValue());
     $doc = $cont_node->ownerDocument;
     if ($include_children) {
         foreach ($this->getChildForms() as $child_form) {
             $this->populateChildren($child_form);
             foreach ($this->getChildren($child_form) as $obj) {
                 $obj->getXMLRepresentation(true, $cont_node, true);
             }
         }
     }
     if ($as_node) {
         return $cont_node;
     } else {
         return $doc->saveXML($cont_node);
     }
 }