本文整理汇总了PHP中Opus_Document::getEnrichment方法的典型用法代码示例。如果您正苦于以下问题:PHP Opus_Document::getEnrichment方法的具体用法?PHP Opus_Document::getEnrichment怎么用?PHP Opus_Document::getEnrichment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opus_Document
的用法示例。
在下文中一共展示了Opus_Document::getEnrichment方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$document = $this->createTestDocument();
$document->setServerState('unpublished');
$document->setPersonReferee(array());
$document->setEnrichment(array());
$this->documentId = $document->store();
$document = new Opus_Document($this->documentId);
$this->assertEquals(0, count($document->getPersonReferee()));
$this->assertEquals(0, count($document->getEnrichment()));
}
示例2: 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;
}
示例3: 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()));
}
示例4: getSubmitter
public function getSubmitter()
{
$return = array();
foreach ($this->document->getEnrichment() as $e) {
if ($e->getKeyName() != 'submitter.user_id') {
continue;
}
$user_id = $e->getValue();
$account = new Opus_Account($user_id);
$return[$account->getId()] = strtolower($account->getLogin());
}
return $return;
}
示例5: testGetModel
public function testGetModel()
{
$form = new Admin_Form_Document_Enrichment();
$document = new Opus_Document(146);
$enrichments = $document->getEnrichment();
$enrichment = $enrichments[0];
$keyNames = $enrichment->getField('KeyName')->getDefault();
$keyName = $keyNames[1]->getName();
// Geht davon aus, dass mindestens 2 Enrichment Keys existieren
$form->getElement('Id')->setValue($enrichment->getId());
$form->getElement('KeyName')->setValue($keyName);
$form->getElement('Value')->setValue('Test Enrichment Value');
$model = $form->getModel();
$this->assertEquals($enrichment->getId(), $model->getId());
$this->assertEquals($keyName, $model->getKeyName());
$this->assertEquals('Test Enrichment Value', $model->getValue());
}
示例6: testRejectDocumentWoPerson
public function testRejectDocumentWoPerson()
{
$helper = new Review_Model_ClearDocumentsHelper();
$helper->reject(array($this->documentId), 23);
$document = new Opus_Document($this->documentId);
$this->assertNotEquals('published', $document->getServerState());
$this->assertEquals(0, count($document->getPersonReferee()));
$enrichments = $document->getEnrichment();
$this->assertEquals(1, count($enrichments));
$this->assertEquals(23, $enrichments[0]->getValue());
}
示例7: ucfirst
exit;
} else {
$enrichmentField = $options['enrichment'];
}
$getType = 'getTitle' . ucfirst(strtolower($options['type']));
$addType = 'addTitle' . ucfirst(strtolower($options['type']));
if ($dryrun) {
_log("TEST RUN: NO DATA WILL BE MODIFIED");
}
$docFinder = new Opus_DocumentFinder();
$docIds = $docFinder->setEnrichmentKeyExists($enrichmentField)->ids();
_log(count($docIds) . " documents found");
foreach ($docIds as $docId) {
$doc = new Opus_Document($docId);
if ($doc->getType() == $doctype || $doctype == '') {
$enrichments = $doc->getEnrichment();
foreach ($enrichments as $enrichment) {
$enrichmentArray = $enrichment->toArray();
if ($enrichmentArray['KeyName'] == $enrichmentField) {
$titles = $doc->{$getType}();
if (count($titles) > 0) {
_log('Title ' . ucfirst(strtolower($options['type'])) . ' already exists for Document #' . $docId . '. Skipping.. ');
} else {
$title = $doc->{$addType}();
$title->setValue($enrichmentArray['Value']);
if (!$dryrun) {
$doc->store();
}
_log('Document #' . $docId . ' updated');
}
}