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


PHP Opus_Document类代码示例

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


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

示例1: testCreate

 public function testCreate()
 {
     $this->markTestIncomplete('No hash in test data.');
     $doc = new Opus_Document(91);
     $files = $doc->getFiles();
     $file = $files[0];
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:7,代码来源:HashTest.php

示例2: 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

示例3: seriesNumber

 /**
  * Returns the number of a document in a series.
  * @param Opus_Document $document
  * @param Opus_Series $series
  * @return string
  */
 public function seriesNumber($document, $series)
 {
     foreach ($document->getSeries() as $linkedSeries) {
         if ($linkedSeries->getModel()->getId() === $series->getId()) {
             return htmlspecialchars($linkedSeries->getNumber());
         }
     }
     return '';
 }
开发者ID:alexukua,项目名称:opus4,代码行数:15,代码来源:SeriesNumber.php

示例4: testUpdateModel

 /**
  * Dieser Test soll sicherstellen, das updateModel überschrieben wurde und das Dokument in Ruhe lässt.
  */
 public function testUpdateModel()
 {
     $form = new Admin_Form_Document_SubjectType('swd');
     // Formular ohne Schlagwörter
     $document = new Opus_Document(200);
     $this->assertEquals(2, count($document->getSubject()));
     $form->updateModel($document);
     // würde normalerweise alle Subjects löschen, wurde aber überschrieben
     $this->assertEquals(2, count($document->getSubject()));
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:13,代码来源:SubjectTypeTest.php

示例5: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_PersonLink();
     $this->assertNull($form->getModel());
     $document = new Opus_Document(250);
     $authors = $document->getPersonAuthor();
     $this->assertEquals(3, count($authors));
     $form->populateFromModel($authors[0]);
     $this->assertEquals($authors[0], $form->getModel());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:10,代码来源:PersonLinkTest.php

示例6: updateModel

 /**
  * Sammelt Schlagwoerter von Unterformularen ein und aktualisiert Dokument.
  * @param Opus_Document $document
  */
 public function updateModel($document)
 {
     $subforms = $this->getSubForms();
     $subjects = array();
     foreach ($subforms as $subform) {
         $subjectsWithType = $subform->getSubFormModels();
         $subjects = array_merge($subjects, $subjectsWithType);
     }
     $document->setSubject($subjects);
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:14,代码来源:Subjects.php

示例7: tearDown

 public function tearDown()
 {
     if ($this->documentImported) {
         $ids = Opus_Document::getAllIds();
         $last_id = array_pop($ids);
         $doc = new Opus_Document($last_id);
         $doc->deletePermanent();
     }
     parent::tearDown();
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:10,代码来源:MetadataImportTest.php

示例8: testKeepDocumentNewerThan3Days

 public function testKeepDocumentNewerThan3Days()
 {
     $this->changeDocumentDateModified(2);
     $this->executeScript('cron-db-clean-temporary.php');
     try {
         $doc = new Opus_Document($this->doc->getId());
         $doc->deletePermanent();
     } catch (Opus_Model_NotFoundException $e) {
         $this->fail("expected existing document.");
     }
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:11,代码来源:DbCleanTemporaryTest.php

示例9: loadDocument

 /**
  * Load initialized document object (and check document status).
  *
  * @param type $documentId
  * @return Opus_Document
  * @throws Publish_Model_Exception 
  */
 public function loadDocument($documentId)
 {
     if (!isset($documentId) or !preg_match('/^\\d+$/', $documentId)) {
         throw new Publish_Model_Exception('Invalid document ID given');
     }
     $this->document = new Opus_Document($documentId);
     if ($this->document->getServerState() !== self::DOCUMENT_STATE) {
         throw new Publish_Model_Exception('Document->ServerState mismatch!');
     }
     return $this->document;
 }
开发者ID:alexukua,项目名称:opus4,代码行数:18,代码来源:DocumentWorkflow.php

示例10: indexAction

 public function indexAction()
 {
     $docId = $this->getRequest()->getParam("docId");
     if (isset($docId) === FALSE) {
         throw new Exception("docId must be set");
     }
     $this->view->docId = $docId;
     $document = new Opus_Document($docId);
     $titles = $document->getTitleMain();
     $authors = $document->getPersonAuthor();
     $session = new Zend_Session_Namespace();
     if (isset($session->language)) {
         $language = $session->language;
     } else {
         $language = 'en';
     }
     foreach ($titles as $title) {
         if ($title->getLanguage() == $language) {
             $this->view->title = $title->getValue();
         }
     }
     $authorsArray = array();
     foreach ($authors as $author) {
         $authorsArray[] = $author->getName();
     }
     $this->view->authors = implode(', ', $authorsArray);
     //get statistics from db for total count and for image tag (accessibility)
     $statistic = Opus_Statistic_LocalCounter::getInstance();
     $totalAbstractPage = $statistic->readTotal($docId, 'frontdoor');
     $totalFiles = $statistic->readTotal($docId, 'files');
     $yearAbstractPage = $statistic->readYears($docId, 'frontdoor');
     $yearFiles = $statistic->readYears($docId, 'files');
     $this->view->totalAbstractPage = $totalAbstractPage;
     $this->view->totalFiles = $totalFiles;
     $years = array_merge(array_keys($yearAbstractPage), array_keys($yearFiles));
     if (count($years) == 0) {
         $years = array(date('Y'));
     }
     foreach ($years as $year) {
         if (isset($yearFiles[$year]) === false) {
             $yearFiles[$year] = 0;
         }
         if (isset($yearAbstractPage[$year]) === false) {
             $yearAbstractPage[$year] = 0;
         }
     }
     ksort($yearFiles);
     ksort($yearAbstractPage);
     foreach (array_keys($yearAbstractPage) as $year) {
         $lines[] = $year . ': ' . $yearAbstractPage[$year] . ', ' . $yearFiles[$year];
     }
     $this->view->altTextStat = implode('; ', $lines);
 }
开发者ID:alexukua,项目名称:opus4,代码行数:53,代码来源:IndexController.php

示例11: testStoreEnrichmentKeyValueSkipDuplicate

 public function testStoreEnrichmentKeyValueSkipDuplicate()
 {
     $doc = $this->createTestDocument();
     $docId = $doc->store();
     $this->assertEquals(0, count($doc->getEnrichment()));
     $mmd = new Matheon_Model_Document($docId);
     $mmd->storeEnrichmentKeyValue('reviewer.user_id', 123);
     $mmd->storeEnrichmentKeyValue('reviewer.user_id', 124);
     $mmd->storeEnrichmentKeyValue('reviewer.user_id', 123);
     $mmd->store();
     $doc = new Opus_Document($docId);
     $this->assertEquals(2, count($doc->getEnrichment()));
 }
开发者ID:KOBV,项目名称:opus4-matheon,代码行数:13,代码来源:DocumentTest.php

示例12: testGetLinkModel

 public function testGetLinkModel()
 {
     $form = new Admin_Form_Document_Person();
     $document = new Opus_Document(146);
     $authors = $document->getPersonAuthor();
     $form->populateFromModel($authors[0]);
     $form->getElement('Role')->setValue(null);
     // nicht teil des POST beim Metadaten-Formular
     $person = $form->getLinkModel(146, 'author');
     $this->assertEquals($person->getId(), $authors[0]->getId());
     $this->assertNotNull($person->getModel());
     $this->assertEquals('author', $person->getRole());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:13,代码来源:PersonTest.php

示例13: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_Document_Abstract();
     $doc = new Opus_Document(146);
     $abstracts = $doc->getTitleAbstract();
     $abstract = $abstracts[0];
     $form->getElement('Id')->setValue($abstract->getId());
     $form->getElement('Language')->setValue('eng');
     $form->getElement('Value')->setValue('Test Zusammenfassung!');
     $model = $form->getModel();
     $this->assertEquals($abstract->getId(), $model->getId());
     $this->assertEquals('eng', $model->getLanguage());
     $this->assertEquals('Test Zusammenfassung!', $model->getValue());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:14,代码来源:AbstractTest.php

示例14: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_Document_Note();
     $doc = new Opus_Document(146);
     $notes = $doc->getNote();
     $note = $notes[0];
     $form->getElement('Id')->setValue($note->getId());
     $form->getElement('Visibility')->setChecked(true);
     $form->getElement('Message')->setValue('Test Message');
     $model = $form->getModel();
     $this->assertEquals($note->getId(), $model->getId());
     $this->assertEquals('public', $model->getVisibility());
     $this->assertEquals('Test Message', $model->getMessage());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:14,代码来源:NoteTest.php

示例15: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_Document_Title();
     $doc = new Opus_Document(146);
     $titles = $doc->getTitleMain();
     $title = $titles[0];
     $form->getElement('Id')->setValue($title->getId());
     $form->getElement('Type')->setValue('parent');
     $form->getElement('Language')->setValue('rus');
     $form->getElement('Value')->setValue('Test Title');
     $model = $form->getModel();
     $this->assertEquals($title->getId(), $model->getId());
     $this->assertEquals('parent', $model->getType());
     $this->assertEquals('rus', $model->getLanguage());
     $this->assertEquals('Test Title', $model->getValue());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:16,代码来源:TitleTest.php


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