Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
NativeXmlRepresentationFilter.inc.php
1 <?php
2 
16 import('lib.pkp.plugins.importexport.native.filter.NativeImportFilter');
17 
23  function NativeXmlRepresentationFilter($filterGroup) {
24  $this->setDisplayName('Native XML representation import');
25  parent::NativeImportFilter($filterGroup);
26  }
27 
28  //
29  // Implement template methods from PersistableFilter
30  //
34  function getClassName() {
35  return 'lib.pkp.plugins.importexport.native.filter.NativeXmlRepresentationFilter';
36  }
37 
38 
44  function handleElement($node) {
45  $deployment = $this->getDeployment();
46  $context = $deployment->getContext();
47  $submission = $deployment->getSubmission();
48  assert(is_a($submission, 'Submission'));
49 
50  // Create the data object
51  $representationDao = Application::getRepresentationDAO();
52  $representation = $representationDao->newDataObject();
53  $representation->setSubmissionId($submission->getId());
54 
55  // Handle metadata in subelements. Look for the 'name' and 'seq' elements.
56  // All other elements are handled by subclasses.
57  for ($n = $node->firstChild; $n !== null; $n=$n->nextSibling) if (is_a($n, 'DOMElement')) switch($n->tagName) {
58  case 'name': $representation->setName($n->textContent, $n->getAttribute('locale')); break;
59  case 'seq': $representation->setSeq($n->textContent); break;
60 
61  }
62 
63  return $representation; // database insert is handled by sub class.
64  }
65 }
66 
67 ?>
static getRepresentationDAO()
setDisplayName($displayName)
Definition: Filter.inc.php:140
Base class that converts a Native XML document to a set of authors.
Base class that converts a Native XML document to a DataObject.