本文整理汇总了PHP中Opus_Document::addCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Opus_Document::addCollection方法的具体用法?PHP Opus_Document::addCollection怎么用?PHP Opus_Document::addCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opus_Document
的用法示例。
在下文中一共展示了Opus_Document::addCollection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: randString
$institutesRole->setName('institutes' . randString($counter++) . rand())->setOaiName('institutes' . randString($counter++) . rand())->setPosition(1)->setVisible(1)->setVisibleBrowsingStart(1)->setDisplayBrowsing('Name')->setVisibleFrontdoor(1)->setDisplayFrontdoor('Name')->setVisibleOai('Name')->setDisplayOai('Name')->store();
$instituteName = 'Institut für empirische Forschung ' . randString($counter++);
$instituteCollections = Opus_Collection::fetchCollectionsByRoleName($institutesRole->getId(), $instituteName);
if (count($instituteCollections) >= 1) {
$instituteCollection = $instituteCollections[0];
} else {
$rootCollection = $institutesRole->getRootCollection();
if (is_null($rootCollection) === true) {
$rootCollection = $institutesRole->addRootCollection();
$rootCollection->setVisible(1)->store();
$institutesRole->store();
}
$instituteCollection = $rootCollection->addLastChild();
$instituteCollection->setVisible(1)->setName(randString($counter++))->store();
}
$doc->addCollection($instituteCollection);
//
// Identifiers
//
$oldOpusId = $doc->addIdentifierOpus3();
$oldOpusId->setValue(randString($counter++));
// empty URN will be automaticaly replace by new URN.
$urn = $doc->addIdentifierUrn();
$urn->setValue('urn:nbn:de:kobv:nn-opus-173:' . randString($counter++));
$isbn = $doc->addIdentifierIsbn();
$isbn->setValue('978-3-86680-192-9');
$issn = $doc->addIdentifierIssn();
$issn->setValue('1234-5678');
$doc->addIdentifierOpac()->setValue(randString($counter++));
//
// DnbInstitutes
示例2: addDocument
public function addDocument($documentId)
{
if (is_null($documentId)) {
throw new Admin_ModelException('missing document id');
}
$document = null;
try {
$document = new Opus_Document($documentId);
} catch (Opus_Model_Exception $e) {
throw new Admin_Model_Exception('invalid document id');
}
$document->addCollection($this->_collection);
$document->store();
}
示例3: rand
* @copyright Copyright (c) 2008-2011, OPUS 4 development team
* @license http://www.gnu.org/licenses/gpl.html General Public License
* @version $Id$
*/
/**
* script to create 10000 documents, e.g., for performance testing
*/
for ($i = 1; $i < 10000; $i++) {
$d = new Opus_Document();
$d->setServerState('published');
$d->setType('preprint');
$d->setLanguage('deu');
$title = $d->addTitleMain();
$title->setLanguage('deu');
$title->setValue('title-' . rand());
$date = new Opus_Date();
$date->setNow();
$date->setYear(1990 + $i % 23);
$d->setPublishedDate($date);
$p = new Opus_Person();
$p->setFirstName("foo-" . $i % 7);
$p->setLastName("bar-" . $i % 5);
$p = $d->addPersonAuthor($p);
$c = new Opus_Collection(15990 + $i % 103);
$d->addCollection($c);
$s = $d->addSubject()->setType('ddc');
$s->setValue($i % 97);
$docId = $d->store();
echo "docId: {$docId}\n";
}
exit;
示例4: handleCollections
/**
*
* @param DOMNode $node
* @param Opus_Document $doc
*/
private function handleCollections($node, $doc)
{
foreach ($node->childNodes as $childNode) {
if ($childNode instanceof DOMElement) {
$collectionId = trim($childNode->getAttribute('id'));
// check if collection with given id exists
try {
$c = new Opus_Collection($collectionId);
$doc->addCollection($c);
} catch (Opus_Model_NotFoundException $e) {
throw new Exception('collection id ' . $collectionId . ' does not exist: ' . $e->getMessage());
}
}
}
}