/** * Look in the content model for rules to run on the specified datastream. * * @param string $pid * @param string $dsid * @return boolean */ function get_and_do_datastream_rules($pid, $dsid, $file = '') { if (!user_access('ingest new fedora objects')) { drupal_set_message(t('You do not have permission to add datastreams.')); return FALSE; } $collection_object = new CollectionClass(); $content_model_list = $this->get_content_models_list($pid); foreach ($content_model_list as $content_model) { $content_model_xml = $this->getStream($content_model, variable_get('Islandora_Content_Model_DSID', 'ISLANDORACM'), 1); if (!empty($content_model_xml->display_in_fieldset->datastream)) { foreach ($content_model_xml->display_in_fieldset->datastream as $datastream) { if ($datastream['id'] == $dsid) { $collection_object->callMethods($file, $datastream->add_datastream_method); break; } } } if (!empty($_SESSION['fedora_ingest_files'])) { foreach ($_SESSION['fedora_ingest_files'] as $dsid => $createdFile) { $file_obj = new stdClass(); // $file->uid = $user->uid; $file_obj->status = 0; $file_obj->filename = substr($createdFile, strrpos($createdFile, '/')); $file_obj->filepath = $createdFile; $file_obj->filemime = file_get_mimetype($createdFile); $this->addStream($pid, $dsid, $file_obj); file_delete($createdFile); } $_SESSION['fedora_ingest_files'] = ''; } } }