* @version $Id$ */ $doc = new Opus_Document(); $doc->setType('all'); $doc->setServerState('published'); $doc->setServerDatePublished('1900-01-01'); // damn API. $doc->addPersonSubmiter() doesn't work for link models! // -> we should change this in 4.x $submitter = new Opus_Person(); $submitter->setFirstName('Donald')->setLastName('Duck')->setEmail('*****@*****.**')->setDateOfBirth('1920-03-13')->setPlaceOfBirth('Entenhausen'); $doc->addPersonSubmitter($submitter); $author = new Opus_Person(); $author->setFirstName('Daniel')->setLastName('Düsentrieb')->setAcademicTitle('Dr.-Ing.'); $doc->addPersonAuthor($author); $doc->setLanguage('deu'); $titleMain = $doc->addTitleMain(); $titleMain->setValue('Dokument zur empirischen Unterschung der OAI-Schnittstelle'); $titleMain->setLanguage('deu'); $titleMainEng = $doc->addTitleMain(); $titleMainEng->setValue('Document for empirical testing OAI interface'); $titleMainEng->setLanguage('eng'); $abstract = $doc->addTitleAbstract(); $abstract->setValue('Dokument, dass alle Daten enhält, um testen zu können, wie die OAI-Schnittstelle sie ausgibt.'); $abstract->setLanguage('deu'); $titleSub = $doc->addTitleSub(); $titleSub->setValue('Beispielhaft erleutert an OPUS 4.0.0'); $titleSub->setLanguage('deu'); $titleAdditional = $doc->addTitleAdditional(); $titleAdditional->setValue('OAI-Schnittstellen empirisch testen am Beispiel von OPUS 4.0'); $titleAdditional->setLanguage('deu'); $titleParent = $doc->addTitleParent();
* * @category Application * @author Thoralf Klein <*****@*****.**> * @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();
* @version $Id: create_all_fields_document.php 13048 2014-04-08 15:18:31Z mlang $ */ $doc = new Opus_Document(); $doc->setType('all'); $doc->setServerState('published'); $doc->setServerDatePublished('1900-01-01'); // damn API. $doc->addPersonSubmiter() doesn't work for link models! // -> we should change this in 4.x $submitter = new Opus_Person(); $submitter->setFirstName('Donald')->setLastName('Duck')->setEmail('*****@*****.**')->setDateOfBirth('1920-03-13')->setPlaceOfBirth('Entenhausen'); $doc->addPersonSubmitter($submitter); $author = new Opus_Person(); $author->setFirstName('Daniel')->setLastName('Düsentrieb')->setAcademicTitle('Dr.-Ing.'); $doc->addPersonAuthor($author); $doc->setLanguage('deu'); $titleMain = $doc->addTitleMain(); $titleMain->setValue('Dokument zur empirischen Unterschung der OAI-Schnittstelle'); $titleMain->setLanguage('deu'); $titleMain2 = $doc->addTitleMain(); $titleMain2->setValue('Document for empirical testing OAI interface'); $titleMain2->setLanguage('eng'); $abstract = $doc->addTitleAbstract(); $abstract->setValue('Dokument, dass alle Daten enhält, um testen zu können, wie die OAI-Schnittstelle sie ausgibt.'); $abstract->setLanguage('deu'); $titleSub = $doc->addTitleSub(); $titleSub->setValue('Beispielhaft erleutert an OPUS 4.0.0'); $titleSub->setLanguage('deu'); $titleAdditional = $doc->addTitleAdditional(); $titleAdditional->setValue('OAI-Schnittstellen empirisch testen am Beispiel von OPUS 4.0'); $titleAdditional->setLanguage('deu'); $titleParent = $doc->addTitleParent();
/** * Regression test for OPUSVIER-2165 * * if database contains more than one title in the document's language, * the first title is used as page title */ public function testFrontdoorTitleRespectsDocumentLanguageMultipleCandidates() { $d = new Opus_Document(146); $lang = $d->getLanguage(); $d->setLanguage('deu'); $titles = $d->getTitleMain(); $d->addTitleMain()->setValue('VBOK')->setLanguage('deu'); $d->store(); $this->dispatch('/frontdoor/index/index/docId/146'); // restore language // restore titles $d = new Opus_Document(146); $d->setLanguage($lang); $d->setTitleMain($titles); $d->store(); $this->assertNotContains('<title>OPUS 4 | COLN</title>', $this->getResponse()->getBody()); $this->assertNotContains('<title>OPUS 4 | VBOK</title>', $this->getResponse()->getBody()); $this->assertContains('<title>OPUS 4 | KOBV</title>', $this->getResponse()->getBody()); }
/** * * @param DOMNode $node * @param Opus_Document $doc */ private function handleTitleMain($node, $doc) { foreach ($node->childNodes as $childNode) { if ($childNode instanceof DOMElement) { $t = $doc->addTitleMain(); $t->setValue(trim($childNode->textContent)); $t->setLanguage(trim($childNode->getAttribute('language'))); } } }