本文整理汇总了PHP中Opus_Document::addEnrichment方法的典型用法代码示例。如果您正苦于以下问题:PHP Opus_Document::addEnrichment方法的具体用法?PHP Opus_Document::addEnrichment怎么用?PHP Opus_Document::addEnrichment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opus_Document
的用法示例。
在下文中一共展示了Opus_Document::addEnrichment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: storeEnrichmentKeyValue
/**
* Add the given (key,value) to the documents enrichments.
*
* @param mixed $key
* @param mixed $value
* @return Matheon_Model_Document Fluent interface.
*/
public function storeEnrichmentKeyValue($key, $value)
{
foreach ($this->_document->getEnrichment() as $e) {
if ($e->getKeyName() == $key) {
if ($e->getValue() == $value) {
return $this;
}
}
}
$this->_document->addEnrichment()->setKeyName($key)->setValue($value);
return $this;
}
示例2: array
$lic->setLanguage('deu');
$lic->setLinkLicence('http://www.test.de');
$lic->setNameLong('Ein langer LizenzName');
$lic->store();
}
$doc->setLicence($lic);
// check for enrichment keys before creating enrichments
$enrichmentKeys = Opus_EnrichmentKey::getAll();
$enrichmentKeyNames = array();
foreach ($enrichmentKeys as $enrichmentKey) {
$enrichmentKeyNames[] = $enrichmentKey->getName();
}
$missingEnrichmentKeyNames = array_diff(array('SourceSwb', 'SourceTitle', 'ClassRvk', 'ContributorsName', 'Event', 'City', 'Country'), $enrichmentKeyNames);
if (!empty($missingEnrichmentKeyNames)) {
foreach ($missingEnrichmentKeyNames as $missingEnrichmentKeyName) {
$newEnrichmentKey = new Opus_EnrichmentKey();
$newEnrichmentKey->setName($missingEnrichmentKeyName);
$newEnrichmentKey->store();
}
}
// Some Enrichment-Fields from Opus3-Migration
$doc->addEnrichment()->setKeyName('SourceSwb')->setValue('http://www.test.de');
$doc->addEnrichment()->setKeyName('SourceTitle')->setValue('Dieses Dokument ist auch erschienen als ...');
$doc->addEnrichment()->setKeyName('ClassRvk')->setValue('LI 99660');
$doc->addEnrichment()->setKeyName('ContributorsName')->setValue('John Doe (Foreword) and Jane Doe (Illustration)');
// Additional Enrichment-Fields
$doc->addEnrichment()->setKeyName('Event')->setValue('Opus4 OAI-Event');
$doc->addEnrichment()->setKeyName('City')->setValue('Opus4 OAI-City');
$doc->addEnrichment()->setKeyName('Country')->setValue('Opus4 OAI-Country');
$doc->store();
print "Document stored. ID: " . $doc->getId() . "\n";
示例3: reject
/**
* Rejects documents and adds the given Person as referee.
*
* @param array $docIds
* @param mixed $userId
* @param Opus_Person $person
*
* FIXME capture success or failure for display afterwards
*/
public function reject(array $docIds = null, $userId = null, $person = null)
{
$logger = Zend_Registry::get('Zend_Log');
foreach ($docIds as $docId) {
$logger->debug('Deleting document with id: ' . $docId);
$document = new Opus_Document($docId);
if (isset($person)) {
$document->addPersonReferee($person);
}
$enrichment = $document->addEnrichment();
$enrichment->setKeyName('review.rejected_by')->setValue($userId);
$document->delete();
}
return;
}
示例4: debugAction
public function debugAction()
{
$this->requirePrivilege('admin');
$docId = $this->_getParam('docId');
$document = new Opus_Document($docId);
$document->setServerState('unpublished');
$loggedUserModel = new Publish_Model_LoggedUser();
$loggedUserId = $loggedUserModel->getUserId();
$document->addEnrichment()->setKeyName('submitter.user_id')->setValue($loggedUserId);
$document->store();
$session = new Zend_Session_Namespace('Publish');
$session->depositConfirmDocumentId = $docId;
}
示例5: handleEnrichments
/**
*
* @param DOMNode $node
* @param Opus_Document $doc
*/
private function handleEnrichments($node, $doc)
{
foreach ($node->childNodes as $childNode) {
if ($childNode instanceof DOMElement) {
$key = trim($childNode->getAttribute('key'));
// check if enrichment key exists
try {
new Opus_EnrichmentKey($key);
} catch (Opus_Model_NotFoundException $e) {
throw new Exception('enrichment key ' . $key . ' does not exist: ' . $e->getMessage());
}
$e = $doc->addEnrichment();
$e->setKeyName($key);
$e->setValue(trim($childNode->textContent));
}
}
}