/**
  * Standard constructor
  * @param string Path to file on harddisk.
  */
 function ImportMSOffice($filename)
 {
     FileManipulation::FileManipulation($filename);
     $this->setFileType();
 }
 function handleBookForm($form_values)
 {
     global $base_url;
     //		print_r($form_values);
     //		exit;
     module_load_include('php', 'Fedora_Repository', 'api/fedora_item');
     module_load_include('php', 'Fedora_Repository', 'epistemetec/plugins/FileManipulation');
     $dom = new DomDocument("1.0", "UTF-8");
     $dom->formatOutput = true;
     $pid = $form_values['pid'];
     $title = $form_values['gen_collection'];
     $rootElement = $dom->createElement("foxml:digitalObject");
     $rootElement->setAttribute('VERSION', '1.1');
     $rootElement->setAttribute('PID', "{$pid}");
     $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#");
     $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
     $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd");
     $dom->appendChild($rootElement);
     //create standard fedora stuff
     $this->createStandardFedoraStuff($form_values, $dom, $rootElement);
     //create relationships
     $this->createRelationShips($form_values, $dom, $rootElement);
     //create dublin core
     $myForm = array();
     $myForm['dc:title'] = $title;
     $this->createQDCStream($myForm, $dom, $rootElement);
     //create mag metadata
     //module_load_include('php', 'Fedora_Repository', 'plugins/EpistemetecImageManipulation');
     //		$image = new EpistemetecImageManipulation();
     //		$image->getMetadata($form_values);
     //		//$form_values['dru_nid'] = $base_url . '/node/' . $this->createNode($pid, $title);
     $file = new FileManipulation();
     $list = $file->manipulateZip($form_values['ingest-file-location']);
     $ccks = array();
     module_load_include('php', 'Fedora_Repository', 'epistemetec/plugins/Node');
     $node = new EpistemetecNode();
     $ccks = $node->hashCCK($form_values);
     $form_values['dru_nid'] = $base_url . '/node/' . $node->createNode($ccks, ITEM_DL);
     $this->createBookStream($form_values, $dom, $rootElement);
     //drupal_set_message($form_values['ingest-file-location']);
     if (!empty($form_values['ingest-file-location'])) {
         $this->createFedoraDataStreams($form_values, $dom, $rootElement);
     }
     $collectionPid = $form_values['collection_pid'];
     $this->createPolicy($collectionPid, &$dom, &$rootElement);
     try {
         $object = Fedora_Item::ingest_from_FOXML($dom);
         if (!empty($object->pid)) {
             drupal_set_message("Item " . l($object->pid, 'fedora/repository/' . $object->pid) . " created successfully.", "status");
             //TODO: creare qui il nuovo nodo drupal e caricare il valore del pid in un campo CCK
         }
         if (!empty($_SESSION['fedora_ingest_files'])) {
             foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) {
                 file_delete($createdFile);
             }
         }
         file_delete($form_values['ingest-file-location']);
     } catch (exception $e) {
         node_delete($nid);
         drupal_set_message(t('Error Ingesting Object! ') . $e->getMessage(), 'error');
         watchdog(t("Fedora_Repository"), t("Error Ingesting Object!") . $e->getMessage(), NULL, WATCHDOG_ERROR);
         return;
     }
     $object = new Fedora_Item($pid);
     $path = drupal_get_path('module', 'Fedora_Repository');
     $stream = file_get_contents($path . "/epistemetec/xml/BOOK_COLLECTION_VIEW.xml");
     $object->add_datastream_from_string($stream, "COLLECTION_VIEW", "Collection View");
     $temp = explode(" ", $list[0]);
     $file = $temp[sizeof($temp) - 1];
     $image = new EpistemetecImageManipulation();
     $image = imageapi_image_open($file);
     imageapi_image_scale($image, 120, 120);
     $file = $file . "_TN";
     imageapi_image_close($image, $file);
     $object->add_datastream_from_file($file, "TN", "Thumbnail");
     $stream = $this->ingestPage($list, $form_values);
     $object->add_datastream_from_string($stream, "STRU", "Struttura Libro");
 }
 /**
  * standard constructor
  * @param string filename
  */
 function ImportText($filename)
 {
     FileManipulation::FileManipulation($filename);
 }
Example #4
0
 function handleVideoForm($form_values)
 {
     global $base_url;
     module_load_include('php', 'Fedora_Repository', 'api/fedora_item');
     $dom = new DomDocument("1.0", "UTF-8");
     $dom->formatOutput = true;
     $pid = $form_values['pid'];
     $title = $form_values['vid_nomenclature'];
     $rootElement = $dom->createElement("foxml:digitalObject");
     $rootElement->setAttribute('VERSION', '1.1');
     $rootElement->setAttribute('PID', "{$pid}");
     $rootElement->setAttribute('xmlns:foxml', "info:fedora/fedora-system:def/foxml#");
     $rootElement->setAttribute('xmlns:xsi', "http://www.w3.org/2001/XMLSchema-instance");
     $rootElement->setAttribute('xsi:schemaLocation', "info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd");
     $dom->appendChild($rootElement);
     //create standard fedora stuff
     $this->createStandardFedoraStuff($form_values, $dom, $rootElement);
     //create relationships
     $this->createRelationShips($form_values, $dom, $rootElement);
     //create dublin core
     $myForm = array();
     $myForm['dc:title'] = $title;
     $this->createQDCStream($myForm, $dom, $rootElement);
     //create mag metadata
     module_load_include('php', 'Fedora_Repository', 'epistemetec/plugins/FileManipulation');
     $audio = new FileManipulation();
     $audio->getVideoMetadata($form_values);
     $ccks = array();
     module_load_include('php', 'Fedora_Repository', 'epistemetec/plugins/Node');
     $node = new EpistemetecNode();
     $ccks = $node->hashCCK($form_values, VIDEO_DL);
     $nid = $node->createNode($ccks, ITEM_DL);
     $form_values['dru_nurl'] = $base_url . '/node/' . $nid;
     $form_values['dru_nid'] = $nid;
     //$form_values['dru_nid'] = $base_url . '/node/' . $node->createNode($ccks, ITEM_DL);
     $this->createMAGStream($form_values, $dom, $rootElement, 'video');
     if (!empty($form_values['ingest-file-location'])) {
         $this->createFedoraDataStreams($form_values, $dom, $rootElement);
     }
     $collectionPid = $form_values['collection_pid'];
     $this->createPolicy($collectionPid, &$dom, &$rootElement);
     try {
         $object = Fedora_Item::ingest_from_FOXML($dom);
         $path = drupal_get_path('module', 'Fedora_Repository');
         $file = $path . "/epistemetec/files/cover-video.png";
         $object->add_datastream_from_file($file, "TN", "Thumbnail");
         if (!empty($object->pid)) {
             drupal_set_message("Item " . l($object->pid, 'fedora/repository/' . $object->pid) . " created successfully.", "status");
             //TODO: creare qui il nuovo nodo drupal e caricare il valore del pid in un campo CCK
         }
         if (!empty($_SESSION['fedora_ingest_files'])) {
             foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) {
                 file_delete($createdFile);
             }
         }
         file_delete($form_values['ingest-file-location']);
         $node->addNodeReference($ccks);
     } catch (exception $e) {
         node_delete($nid);
         drupal_set_message(t('Error Ingesting Object! ') . $e->getMessage(), 'error');
         watchdog(t("Fedora_Repository"), t("Error Ingesting Object!") . $e->getMessage(), NULL, WATCHDOG_ERROR);
         return;
     }
 }
 /**
  * standard constructor
  * @param string filename
  */
 function ImportHTML($filename)
 {
     FileManipulation::FileManipulation($filename);
 }