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


PHP Opus_Document::getId方法代码示例

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


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

示例1: postStore

 /**
  * Function is only called if document was modified.
  *
  * @see {Opus_Model_Plugin_Interface::postStore}
  */
 public function postStore(Opus_Model_AbstractDb $model)
 {
     $logger = Zend_Registry::get('Zend_Log');
     if (null !== $logger) {
         $logger->debug('Opus_Document_Plugin_XmlCache::postStore() with id ' . $model->getId());
     }
     // TODO can that be eleminated? why is it necessary?
     $model = new Opus_Document($model->getId());
     $cache = new Opus_Model_Xml_Cache();
     $omx = new Opus_Model_Xml();
     // remove document from cache. This can always be done, because postStore is only called if model was modified.
     $cache->removeAllEntriesWhereDocumentId($model->getId());
     // refresh cache (TODO does it make sense?)
     $omx->setStrategy(new Opus_Model_Xml_Version1())->excludeEmptyFields()->setModel($model)->setXmlCache($cache);
     $dom = $omx->getDomDocument();
     // Skip caching of XML-Version2.
     // TODO why?
     $index_version_two = false;
     if ($index_version_two) {
         // xml version 2
         $omx = new Opus_Model_Xml();
         $omx->setStrategy(new Opus_Model_Xml_Version2())->setModel($model)->setXmlCache($cache);
         $dom = $omx->getDomDocument();
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:30,代码来源:XmlCache.php

示例2: checkPermission

 /**
  * @return boolean
  */
 private function checkPermission()
 {
     if ($this->_document->getServerState() === 'published') {
         return true;
     }
     $accessControl = Zend_Controller_Action_HelperBroker::getStaticHelper('accessControl');
     return Opus_Security_Realm::getInstance()->checkDocument($this->_document->getId()) || $accessControl->accessAllowed('documents');
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:11,代码来源:Document.php

示例3: __construct

 /**
  * Constructs wrapper around document.
  * @param Zend_View $view
  * @param int $id
  */
 public function __construct($view, $value)
 {
     $this->view = $view;
     if ($value instanceof Opus_Document) {
         $this->document = $value;
         $this->docId = $this->document->getId();
     } else {
         $this->docId = $value;
         $this->document = new Opus_Document((int) $value);
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:16,代码来源:DocumentAdapter.php

示例4: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_Document_Institute(Admin_Form_Document_Institute::ROLE_PUBLISHER);
     $doc = new Opus_Document(146);
     $publishers = $doc->getThesisPublisher();
     $publisher = $publishers[0];
     $publisherId = $publisher->getModel()->getId();
     $form->getElement('Id')->setValue($doc->getId());
     $form->getElement('Institute')->setValue($publisherId);
     $model = $form->getModel();
     $modelId = $model->getId();
     $this->assertNotNull($model);
     $this->assertNotNull($modelId);
     $this->assertEquals($doc->getId(), $modelId[0]);
     $this->assertEquals($publisherId, $modelId[1]);
     $this->assertEquals('publisher', $modelId[2]);
     $this->assertEquals($publisherId, $model->getModel()->getId());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:18,代码来源:InstituteTest.php

示例5: testIndexActionOnNonExistent

 public function testIndexActionOnNonExistent()
 {
     $doc_id = $this->_document->getId();
     $this->dispatch('/frontdoor/index/index/docId/' . $doc_id . $doc_id . '100');
     $this->assertResponseCode(404);
     $this->assertController('index');
     $this->assertAction('index');
     $response = $this->getResponse();
     $this->assertContains('<div class="frontdoor-error">', $response->getBody());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:10,代码来源:IndexControllerTest.php

示例6: fetchFile

 private function fetchFile($realm)
 {
     $targetFile = Opus_File::fetchByDocIdPathName($this->_doc->getId(), $this->_filename);
     if (is_null($targetFile)) {
         throw new Frontdoor_Model_FileNotFoundException();
     }
     if (!$this->isFileAccessAllowed($targetFile, $realm)) {
         throw new Frontdoor_Model_FileAccessNotAllowedException();
     }
     return $targetFile;
 }
开发者ID:KOBV,项目名称:opus4-matheon,代码行数:11,代码来源:File.php

示例7: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_Document_Series();
     $doc = new Opus_Document(146);
     $series = $doc->getSeries();
     $form->getElement('Id')->setValue($doc->getId());
     $form->getElement('SeriesId')->setValue($series[0]->getModel()->getId());
     $form->getElement('Number')->setValue('b');
     $form->getElement('SortOrder')->setValue(7);
     $model = $form->getModel();
     $modelId = $model->getId();
     $this->assertEquals(146, $modelId[0]);
     $this->assertEquals($series[0]->getModel()->getId(), $modelId[1]);
     $this->assertEquals('b', $model->getNumber());
     $this->assertEquals(7, $model->getDocSortOrder());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:16,代码来源:SeriesTest.php

示例8: prepareMail

 /**
  *
  * @param Opus_Document $document das Dokument auf das sich die Notifizierung bezieht
  * @param String $context Notifizierungskontext
  * @param String $url vollständiger Deeplink, der in der Mail angezeigt werden soll
  * @param boolean $notifySubmitter Wenn false, wird der Submitter nicht notifiziert
  * @param array $notifyAuthors Bitmaske, die für jeden Autor (über den Index referenziert) angibt, ob ihm/ihr eine
  *                             E-Mail gesendet werden kann (wenn false, dann wird keine Notifizierung versendet)
  */
 public function prepareMail($document, $context, $url, $notifySubmitter = true, $notifyAuthors = array())
 {
     if (!$this->validateContext($context)) {
         $this->logger->err("context {$context} is currently not supported or delivery of notification mails is not" . ' enabled for the current context');
         return;
     }
     $this->logger->info("prepare {$context} notification email for document id " . $document->getId());
     $authorAddresses = array();
     $authors = array();
     $title = "";
     $personAuthors = $document->getPersonAuthor();
     if (!empty($personAuthors)) {
         $index = 0;
         foreach ($personAuthors as $author) {
             $name = trim($author->getLastName() . ", " . $author->getFirstName());
             // TODO Komma nur wenn FirstName present
             array_push($authors, $name);
             if ($context == self::PUBLICATION) {
                 $email = trim($author->getEmail());
                 if (!empty($email) && (empty($notifyAuthors) || isset($notifyAuthors[$index]) && $notifyAuthors[$index])) {
                     array_push($authorAddresses, array("name" => $name, "address" => $email));
                 }
             }
             $index++;
         }
     }
     // TODO Funktionalität existiert bereits (Documents Helper oder so)
     $titlesMain = $document->getTitleMain();
     if (!empty($titlesMain)) {
         // ermittle (den ersten) TitleMain in Dokumentsprache
         $language = $document->getLanguage();
         foreach ($titlesMain as $titleMain) {
             if ($titleMain->getLanguage() == $language) {
                 $title = trim($titleMain->getValue());
                 break;
             }
         }
     }
     $this->scheduleNotification($this->getMailSubject($context, $document->getId(), $authors, $title), $this->getMailBody($context, $document->getId(), $authors, $title, $url), $this->getRecipients($context, $authorAddresses, $document, $notifySubmitter));
     $this->logger->info("{$context} notification mail creation was completed successfully");
 }
开发者ID:alexukua,项目名称:opus4,代码行数:50,代码来源:Notification.php

示例9: addDocumentToIndex

 /**
  * Helper method to add document to index.
  *
  * @param Opus_Document $document
  * @return void
  */
 private function addDocumentToIndex(Opus_Document $document)
 {
     $log = Zend_Registry::get('Zend_Log');
     // create job if asynchronous is set
     if (isset($this->config->runjobs->asynchronous) && $this->config->runjobs->asynchronous) {
         $log->debug(__METHOD__ . ': ' . 'Adding index job for document ' . $document->getId() . '.');
         $job = new Opus_Job();
         $job->setLabel(Opus_Job_Worker_IndexOpusDocument::LABEL);
         $job->setData(array('documentId' => $document->getId(), 'task' => 'index'));
         // skip creating job if equal job already exists
         if (true === $job->isUniqueInQueue()) {
             $job->store();
         } else {
             $log->debug(__METHOD__ . ': ' . 'Indexing job for document ' . $document->getId() . ' already exists!');
         }
     } else {
         $log->debug(__METHOD__ . ': ' . 'Index document ' . $document->getId() . '.');
         try {
             $indexer = new Opus_SolrSearch_Index_Indexer();
             $indexer->addDocumentToEntryIndex($document);
             $indexer->commit();
         } catch (Opus_SolrSearch_Index_Exception $e) {
             $log->debug(__METHOD__ . ': ' . 'Indexing document ' . $document->getId() . ' failed: ' . $e->getMessage());
         } catch (InvalidArgumentException $e) {
             $log->warn(__METHOD__ . ': ' . $e->getMessage());
         }
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:34,代码来源:Index.php

示例10: createXmlRecord

 /**
  * Create xml structure for one record
  *
  * @param  Opus_Document $document
  * @param  string        $metadataPrefix
  * @return void
  */
 private function createXmlRecord(Opus_Document $document)
 {
     $docId = $document->getId();
     $domNode = $this->getDocumentXmlDomNode($document);
     // add frontdoor url
     $this->_addFrontdoorUrlAttribute($domNode, $docId);
     // add ddb transfer element
     $this->_addDdbTransferElement($domNode, $docId);
     // add access rights to element
     $this->_addAccessRights($domNode, $document);
     // remove file elements which should not be exported through OAI
     // Iterating over DOMNodeList is only save for readonly-operations;
     // copy element-by-element before removing!
     $filenodes = $domNode->getElementsByTagName('File');
     $filenodesList = array();
     foreach ($filenodes as $filenode) {
         $filenodesList[] = $filenode;
         // add file download urls
         $this->_addFileUrlAttribute($filenode, $docId, $filenode->getAttribute('PathName'));
     }
     // remove file elements which should not be exported through OAI
     foreach ($filenodesList as $filenode) {
         if (false === $filenode->hasAttribute('VisibleInOai') or '1' !== $filenode->getAttribute('VisibleInOai')) {
             $domNode->removeChild($filenode);
         }
     }
     $node = $this->_xml->importNode($domNode, true);
     $type = $document->getType();
     $this->_addSpecInformation($node, 'doc-type:' . $type);
     $bibliography = $document->getBelongsToBibliography() == 1 ? 'true' : 'false';
     $this->_addSpecInformation($node, 'bibliography:' . $bibliography);
     $logger = $this->getLogger();
     $setSpecs = Oai_Model_SetSpec::getSetSpecsFromCollections($document->getCollection());
     foreach ($setSpecs as $setSpec) {
         if (preg_match("/^([A-Za-z0-9\\-_\\.!~\\*'\\(\\)]+)(:[A-Za-z0-9\\-_\\.!~\\*'\\(\\)]+)*\$/", $setSpec)) {
             $this->_addSpecInformation($node, $setSpec);
             continue;
         }
         $logger->info("skipping invalid setspec: " . $setSpec);
     }
     $this->_xml->documentElement->appendChild($node);
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:49,代码来源:IndexController.php

示例11: __construct

 /**
  * Oai_Model_Container constructor.
  * @param $docId
  * @param null $logger
  */
 public function __construct($docId)
 {
     $this->_doc = $this->validateId($docId);
     $this->_docId = $this->_doc->getId();
     $this->_appConfig = Application_Configuration::getInstance();
 }
开发者ID:KOBV,项目名称:opus4-matheon,代码行数:11,代码来源:Container.php

示例12: _getConfirmationForm

 /**
  * Returns form for asking yes/no question like 'Delete file?'.
  *
  * @param Opus_Document $document
  * @param string $action Target action that needs to be confirmed
  * @return Admin_Form_YesNoForm
  */
 private function _getConfirmationForm($document, $targetState)
 {
     $form = new Admin_Form_YesNoForm();
     $form->setAction($this->view->url(array('controller' => 'workflow', 'action' => 'changestate', 'targetState' => $targetState)));
     $form->setMethod('post');
     $idElement = new Zend_Form_Element_Hidden('id');
     $idElement->setValue($document->getId());
     $form->addElement($idElement);
     $config = Zend_Registry::get('Zend_Config');
     if ($targetState == 'published' && isset($config->notification->document->published->enabled) && $config->notification->document->published->enabled == 1) {
         $this->_addPublishNotificationSelection($document, $form);
     }
     return $form;
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:21,代码来源:WorkflowController.php

示例13: testIndexActionRisPrivateNote

 public function testIndexActionRisPrivateNote()
 {
     $doc = new Opus_Document(146);
     $this->dispatch('/citationExport/index/index/output/ris/docId/' . $doc->getId());
     $this->assertResponseCode(200);
     $response = $this->getResponse();
     $this->assertNotContains('N1  - Für den Admin.', $response->getBody());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:8,代码来源:IndexControllerTest.php

示例14: catch

    $d = null;
    try {
        $d = new Opus_Document($id);
    } catch (Opus_Model_NotFoundException $e) {
        // document with id $id does not exist
        continue;
    }
    $files = $d->getFile();
    if (count($files) == 0) {
        continue;
    }
    foreach ($files as $file) {
        $overallNumOfFulltexts++;
        $response = null;
        try {
            $response = $solrServer->extract($file->getPath(), array('extractOnly' => 'true', 'extractFormat' => 'text'));
        } catch (Exception $e) {
            echo "error while extracting full text for document # " . $d->getId() . " (file name : " . $file->getPath() . " )\n";
            $numOfNonExtractableFulltexts++;
            continue;
        }
        if (is_null($response->getRawResponse()) || strlen(trim($response->getRawResponse())) == 0) {
            echo "non-extractable full text for document # " . $d->getId() . " (file name: " . $file->getPath() . " )\n";
            $numOfNonExtractableFulltexts++;
        }
    }
}
echo "overall num of full texts: {$overallNumOfFulltexts}\n";
$errorRate = 100.0 * $numOfNonExtractableFulltexts / $overallNumOfFulltexts;
echo "num of non extractable full texts: {$numOfNonExtractableFulltexts} ({$errorRate} %)\n";
exit;
开发者ID:belapp,项目名称:opus4-application,代码行数:31,代码来源:get_nonextractable_docs.php

示例15: getId

 /**
  * Get current document Id.
  *
  * @return integer
  */
 public function getId()
 {
     return $this->_document->getId();
 }
开发者ID:KOBV,项目名称:opus4-matheon,代码行数:9,代码来源:Document.php


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