/**
  * Publishes 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 clear(array $docIds = null, $userId = null, $person = null)
 {
     $logger = Zend_Registry::get('Zend_Log');
     foreach ($docIds as $docId) {
         $logger->debug('Change state to "published" for document: ' . $docId);
         $document = new Opus_Document($docId);
         $document->setServerState('published');
         $date = new Opus_Date();
         $date->setNow();
         $document->setServerDatePublished($date);
         $document->setPublishedDate($date);
         $guest_role = Opus_UserRole::fetchByName('guest');
         foreach ($document->getFile() as $file) {
             $guest_role->appendAccessFile($file->getId());
         }
         if (isset($person)) {
             $document->addPersonReferee($person);
         }
         $enrichment = $document->addEnrichment();
         $enrichment->setKeyName('review.accepted_by')->setValue($userId);
         // TODO: Put into same transaction...
         $document->store();
         $guest_role->store();
     }
     return;
 }
    echo "WARNING: myErrorHandler({$errno}, '{$errstr}', '{$errfile}', {$errline})\n";
    return true;
}
// set to the user defined error handler
$oldErrorHandler = set_error_handler("myErrorHandler");
//
// Creating document, filling static fields.
//
$doc = new Opus_Document();
$doc->setType(randString($counter++));
$doc->setServerState('published');
$doc->setServerDatePublished('01.01.1900');
$doc->setLanguage('deu' . randString($counter++));
$doc->setThesisDateAccepted('01.02.2003');
$doc->setPublishedYear('2010');
$doc->setPublishedDate('28.09.2010');
$doc->setCompletedYear('2010');
$doc->setCompletedDate('27.09.2010');
$doc->setPublisherName(randString($counter++));
$doc->setPublisherPlace(randString($counter++));
$doc->setPageNumber(randString($counter++));
$doc->setPageFirst(randString($counter++));
$doc->setPageLast(randString($counter++));
$doc->setVolume(randString($counter++));
$doc->setIssue(randString($counter++));
$doc->setCreatingCorporation(randString($counter++));
$doc->setContributingCorporation(randString($counter++));
//
// Persons
//
$submitter = new Opus_Person();
$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($instituteName)->store();
}
$doc->addCollection($instituteCollection);
$doc->setPublishedYear('2010');
$doc->setPublishedDate('2010-09-28');
$doc->setPublisherName('The Walt Disney Company');
$doc->setPublisherPlace('Burbank, CA');
$doc->setCompletedYear('2010');
$doc->setCompletedDate('2010-09-27');
$opusThreeId = $doc->addIdentifierOpus3();
$opusThreeId->setValue('1234');
// empty URN will be automaticaly replace by new URN.
$urn = $doc->addIdentifierUrn();
$urn->setValue('urn:nbn:de:kobv:nn-opus-173');
$isbn = $doc->addIdentifierIsbn();
$isbn->setValue('978-3-86680-192-9');
$issn = $doc->addIdentifierIssn();
$issn->setValue('1234-5678');
$doc->addIdentifierOpac()->setValue('OPAC-ID 001 1237890654');
// Valid Arxiv-Identifier from ArXiv.org Homepage: http://arxiv.org/help/arxiv_identifier
 * @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;
Exemple #5
0
 /**
  * Aktualisiert ein Dokument mit den Werten im Formular.
  * @param Opus_Document $document
  */
 public function updateModel($document)
 {
     // Language
     $value = $this->getElementValue(self::ELEMENT_LANGUAGE);
     $document->setLanguage($value);
     // Type
     $value = $this->getElementValue(self::ELEMENT_TYPE);
     $document->setType($value);
     $datesHelper = $this->getDatesHelper();
     // CompletedDate
     $value = $this->getElementValue(self::ELEMENT_COMPLETED_DATE);
     $date = $datesHelper->getOpusDate($value);
     $document->setCompletedDate($date);
     // CompletedYear
     $value = $this->getElementValue(self::ELEMENT_COMPLETED_YEAR);
     $document->setCompletedYear($value);
     // PublishedDate
     $value = $this->getElementValue(self::ELEMENT_PUBLISHED_DATE);
     $date = $datesHelper->getOpusDate($value);
     $document->setPublishedDate($date);
     // PublishedYear
     $value = $this->getElementValue(self::ELEMENT_PUBLISHED_YEAR);
     $document->setPublishedYear($value);
     $value = $this->getElementValue(self::ELEMENT_EMBARGO_DATE);
     $date = $datesHelper->getOpusDate($value);
     $document->setEmbargoDate($date);
 }