public function exportFullHistory(SimpleXMLElement $artifact_xml, Tracker_Artifact_Changeset $changeset)
 {
     $changeset_xml = $artifact_xml->addChild('changeset');
     $this->user_xml_exporter->exportUserByUserId($changeset->getSubmittedBy(), $changeset_xml, 'submitted_by');
     $submitted_on = $changeset_xml->addChild('submitted_on', date('c', $changeset->getSubmittedOn()));
     $submitted_on->addAttribute('format', 'ISO8601');
     $comments_node = $changeset_xml->addChild('comments');
     if ($changeset->getComment()) {
         $changeset->getComment()->exportToXML($comments_node);
     }
     $this->values_exporter->exportChangedFields($artifact_xml, $changeset_xml, $changeset->getArtifact(), $changeset->getValues());
 }
 public function export(SimpleXMLElement $artifact_xml, SimpleXMLElement $changeset_xml, Tracker_Artifact $artifact, Tracker_Artifact_ChangesetValue $changeset_value)
 {
     $field_change = $this->createFieldChangeNodeInChangesetNode($changeset_value, $changeset_xml);
     $bind_type = $changeset_value->getField()->getBind()->getType();
     $field_change->addAttribute('bind', $bind_type);
     $values = $changeset_value->getValue();
     if (empty($values)) {
         $field_change->addChild('value');
     } elseif ($bind_type === Tracker_FormElement_Field_List_Bind_Users::TYPE) {
         foreach ($values as $value) {
             $this->user_xml_exporter->exportUserByUserId($value, $field_change, 'value');
         }
     } else {
         array_walk($values, array($this, 'appendValueToFieldChangeNode'), $field_change);
     }
 }
 public function exportToXML(SimpleXMLElement $comments_node)
 {
     $comment_node = $comments_node->addChild('comment');
     $user_xml_exporter = new UserXMLExporter(UserManager::instance());
     $user_xml_exporter->exportUserByUserId($this->submitted_by, $comment_node, 'submitted_by');
     $submitted_on_node = $comment_node->addChild('submitted_on', date('c', $this->submitted_on));
     $submitted_on_node->addAttribute('format', 'ISO8601');
     $cdata_factory = new XML_SimpleXMLCDATAFactory();
     $cdata_factory->insert($comment_node, 'body', $this->body);
     $comment_node->body['format'] = $this->bodyFormat;
 }
 private function appendUserValueToFieldChangeNode($value, $index, SimpleXMLElement $field_xml)
 {
     $xml_user_exporter = new UserXMLExporter(UserManager::instance());
     $xml_user_exporter->exportUserByUserId($value, $field_xml, 'value');
 }
 public function exportToXML(SimpleXMLElement $comments_node, UserXMLExporter $user_xml_exporter)
 {
     $comment_node = $comments_node->addChild('comment');
     $user_xml_exporter->exportUserByUserId($this->submitted_by, $comment_node, 'submitted_by');
     $submitted_on_node = $comment_node->addChild('submitted_on', date('c', $this->submitted_on));
     $submitted_on_node->addAttribute('format', 'ISO8601');
     $cdata_factory = new XML_SimpleXMLCDATAFactory();
     $comment_escaped = $this->getCommentBodyWithEscapedCrossReferences();
     $cdata_factory->insert($comment_node, 'body', $comment_escaped);
     $comment_node->body['format'] = $this->bodyFormat;
 }
 private function appendUserValueToFieldChangeNode($value, SimpleXMLElement $field_xml)
 {
     $user_id = $this->getUserIdFromValue($value);
     $this->user_xml_exporter->exportUserByUserId($user_id, $field_xml, 'value');
 }
 /**
  * Transforms Bind into a SimpleXMLElement
  *
  * @param SimpleXMLElement $root        the node to which the Bind is attached (passed by reference)
  * @param array            &$xmlMapping the array of mapping XML ID => real IDs
  */
 public function exportToXml(SimpleXMLElement $root, &$xmlMapping, $project_export_context)
 {
     if ($this->value_function) {
         $child = $root->addChild('items');
         foreach ($this->value_function as $vf) {
             if ($vf) {
                 $child->addChild('item')->addAttribute('label', $vf);
             }
         }
         if ($project_export_context) {
             $default_values_root = $root->addChild('default_values');
             foreach ($this->default_values as $user_id => $default_value) {
                 $user_xml_exporter = new UserXMLExporter(UserManager::instance());
                 $user_xml_exporter->exportUserByUserId($user_id, $default_values_root, 'value');
             }
         }
     }
 }