PerfMigrate.dvids.inc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * PerfGroupeNodeMigration
  4. *
  5. */
  6. class PerfDvidsNodeMigration extends PerfDNodeMigration {
  7. public function __construct() {
  8. $this->description = t('Migrate Document Video Class');
  9. $this->fields = array(
  10. 'fichiers' => t('fichiers'),
  11. 'etat_conservation' => t('etat_conservation'),
  12. );
  13. // This can also be an URL instead of a file path.
  14. $xml_folder = DRUPAL_ROOT . '/' . drupal_get_path('module', 'PerfMigrate') . '/xml/';
  15. $this->items_url = $xml_folder . 'baseperf-dvids.xml';
  16. $this->item_xpath = '/ROOT/ITEMS/DOC_AUDIOVISUEL'; // relative to document
  17. $this->destination = new MigrateDestinationNode('document_video');
  18. parent::__construct();
  19. $this->addFieldMapping('field_etat_de_conservation', 'etat_conservation')
  20. ->xpath('@ETAT_CONSERVATION');
  21. $this->addFieldMapping('field_fichiers', 'fichiers');
  22. $this->addUnmigratedDestinations(array(
  23. 'field_etat_de_conservation:language', 'field_etat_de_conservation:format',
  24. 'field_fichiers:language', 'field_fichiers:format',
  25. ));
  26. }
  27. public function prepareRow($row){
  28. parent::prepareRow($row);
  29. $xml = $row->xml;
  30. $row->fichiers .= "\n".'Fichier MP4 : '.$this->getAttribute($xml, 'FICHIER_MP4');
  31. $row->fichiers .= "\n".'Fichier FLV : '.$this->getAttribute($xml, 'FICHIER_FLV');
  32. }
  33. public function prepare($node, stdClass $row) {
  34. parent::prepare($node, $row);
  35. }
  36. }