当前位置: 首页>>代码示例>>PHP>>正文


PHP ContentModel::getPidFromIdentifier方法代码示例

本文整理汇总了PHP中ContentModel::getPidFromIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP ContentModel::getPidFromIdentifier方法的具体用法?PHP ContentModel::getPidFromIdentifier怎么用?PHP ContentModel::getPidFromIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentModel的用法示例。


在下文中一共展示了ContentModel::getPidFromIdentifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleForm

 function handleForm(&$form_values)
 {
     $errorMessage = NULL;
     module_load_include('php', 'Fedora_Repository', 'CollectionClass');
     module_load_include('php', 'Fedora_Repository', 'ContentModel');
     module_load_include('php', 'fedora_repository', 'api/fedora_item');
     $content_model_pid = ContentModel::getPidFromIdentifier($form_values['models']);
     $content_model_dsid = ContentModel::getDSIDFromIdentifier($form_values['models']);
     $collectionHelper = new CollectionClass();
     $startTime = time();
     $collection_pid = $form_values['collection_pid'];
     $this->parse_refworks_item($form_values);
     $this->security_helper = new SecurityClass();
     $collection_item = new Fedora_Item($collection_pid);
     $this->collection_policy_stream = $collection_item->get_datastream_dissemination('CHILD_SECURITY');
     if (empty($this->collection_policy_stream)) {
         $this->collection_policy_stream = file_get_contents(drupal_get_path('module', 'fedora_repository') . '/policies/noObjectEditPolicy.xml');
     }
     $success = 0;
     $errors = 0;
     foreach ($this->referencelist as $reference) {
         $dom = new DomDocument("1.0", "UTF-8");
         $dom->substituteEntities = FALSE;
         $dom->formatOutput = true;
         $pid = $collectionHelper->getNextPid($collection_pid, $content_model_dsid);
         $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
         $qdc_element = $this->createQDCStream($dom, $rootElement, $reference);
         if (!$qdc_element) {
             drupal_set_message(t('Error Create DC for Refworks'), 'error');
             continue;
         }
         $item_title = '';
         foreach ($reference->t1 as $value) {
             $item_title .= ' --- ' . $value;
         }
         $this->createStandardFedoraStuff($form_values, $dom, $rootElement, $reference);
         $rootElement->appendChild($qdc_element);
         //create relationships
         $this->createRelationShips($form_values, $dom, $rootElement, $pid);
         //create dublin core
         $this->createFedoraDataStreams($form_values, $dom, $rootElement, $reference);
         if (!empty($this->collection_policy_stream)) {
             $this->create_security_policies($dom, $rootElement, $reference);
         }
         $params = array('objectXML' => $dom->saveXML(), 'format' => 'info:fedora/fedora-system:FOXML-1.1', 'logMessage' => "Fedora Object Ingested");
         try {
             $soapHelper = new ConnectionHelper();
             $client = $soapHelper->getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'));
             if ($client == null) {
                 drupal_set_message(t('Error Getting Soap Client.'), 'error');
                 watchdog(t("FEDORA_REPOSITORY"), t("Error Getting SOAP client") . $e, null, WATCHDOG_ERROR);
                 return;
             }
             $object = $client->__soapCall('ingest', array($params));
             watchdog(t("FEDORA_REPOSITORY"), t("Successfully added repository item ") . $pid . ' - ' . $item_title, null, WATCHDOG_INFO);
             $deleteFiles = $form_values['delete_file'];
             //remove files from drupal file system
             if ($deleteFiles > 0) {
                 unlink($form_values['fullpath']);
             }
         } catch (exception $e) {
             $errors++;
             $errorMessage = 'yes';
             //drupal_set_message(t('Error Ingesting Object! Check Drupal watchdog logs for more info' . $e->getMessage()), 'error');
             watchdog(t("FEDORA_REPOSITORY"), t("Error during ingest") . $item_title . ' ' . $e, null, WATCHDOG_ERROR);
             //return ' ';
         }
         $success++;
     }
     if (isset($errorMessage)) {
         drupal_set_message(t('Error Ingesting one or more records! Check Drupal watchdog logs for more info'), 'error');
     }
     $endTime = time();
     drupal_set_message(t('Successfull ingest of %success records.  %errors records failed.  Ingest took %seconds seconds', array('%success' => $success - $errors, '%errors' => $errors, '%seconds' => $endTime - $startTime)), 'info');
     //drupal_set_message(t('ingest took %seconds ',array('%seconds'=>$endTime-$startTime)),'info');
 }
开发者ID:ratzeni,项目名称:islandora,代码行数:83,代码来源:Refworks.php


注:本文中的ContentModel::getPidFromIdentifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。