当前位置: 首页>>代码示例>>PHP>>正文


PHP Opus_Document::getTitleMain方法代码示例

本文整理汇总了PHP中Opus_Document::getTitleMain方法的典型用法代码示例。如果您正苦于以下问题:PHP Opus_Document::getTitleMain方法的具体用法?PHP Opus_Document::getTitleMain怎么用?PHP Opus_Document::getTitleMain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Opus_Document的用法示例。


在下文中一共展示了Opus_Document::getTitleMain方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 public function indexAction()
 {
     $docId = $this->getRequest()->getParam("docId");
     if (isset($docId) === FALSE) {
         throw new Exception("docId must be set");
     }
     $this->view->docId = $docId;
     $document = new Opus_Document($docId);
     $titles = $document->getTitleMain();
     $authors = $document->getPersonAuthor();
     $session = new Zend_Session_Namespace();
     if (isset($session->language)) {
         $language = $session->language;
     } else {
         $language = 'en';
     }
     foreach ($titles as $title) {
         if ($title->getLanguage() == $language) {
             $this->view->title = $title->getValue();
         }
     }
     $authorsArray = array();
     foreach ($authors as $author) {
         $authorsArray[] = $author->getName();
     }
     $this->view->authors = implode(', ', $authorsArray);
     //get statistics from db for total count and for image tag (accessibility)
     $statistic = Opus_Statistic_LocalCounter::getInstance();
     $totalAbstractPage = $statistic->readTotal($docId, 'frontdoor');
     $totalFiles = $statistic->readTotal($docId, 'files');
     $yearAbstractPage = $statistic->readYears($docId, 'frontdoor');
     $yearFiles = $statistic->readYears($docId, 'files');
     $this->view->totalAbstractPage = $totalAbstractPage;
     $this->view->totalFiles = $totalFiles;
     $years = array_merge(array_keys($yearAbstractPage), array_keys($yearFiles));
     if (count($years) == 0) {
         $years = array(date('Y'));
     }
     foreach ($years as $year) {
         if (isset($yearFiles[$year]) === false) {
             $yearFiles[$year] = 0;
         }
         if (isset($yearAbstractPage[$year]) === false) {
             $yearAbstractPage[$year] = 0;
         }
     }
     ksort($yearFiles);
     ksort($yearAbstractPage);
     foreach (array_keys($yearAbstractPage) as $year) {
         $lines[] = $year . ': ' . $yearAbstractPage[$year] . ', ' . $yearFiles[$year];
     }
     $this->view->altTextStat = implode('; ', $lines);
 }
开发者ID:alexukua,项目名称:opus4,代码行数:53,代码来源:IndexController.php

示例2: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_Document_Title();
     $doc = new Opus_Document(146);
     $titles = $doc->getTitleMain();
     $title = $titles[0];
     $form->getElement('Id')->setValue($title->getId());
     $form->getElement('Type')->setValue('parent');
     $form->getElement('Language')->setValue('rus');
     $form->getElement('Value')->setValue('Test Title');
     $model = $form->getModel();
     $this->assertEquals($title->getId(), $model->getId());
     $this->assertEquals('parent', $model->getType());
     $this->assertEquals('rus', $model->getLanguage());
     $this->assertEquals('Test Title', $model->getValue());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:16,代码来源:TitleTest.php

示例3: getMainTitle

 /**
  * Returns title in document language.
  */
 public function getMainTitle()
 {
     $titles = $this->document->getTitleMain();
     $language = $this->document->getLanguage();
     if (count($titles) > 0) {
         foreach ($titles as $title) {
             if ($language === $title->getLanguage()) {
                 return $title->getValue();
             }
         }
         // if no title in document language ist found use first title
         return $titles[0]->getValue();
     } else {
         return Zend_Registry::get('Zend_Translate')->translate('document_no_title') . '(id = ' . $this->getDocId() . ')';
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:19,代码来源:DocumentAdapter.php

示例4: prepareMail

 /**
  *
  * @param Opus_Document $document das Dokument auf das sich die Notifizierung bezieht
  * @param String $context Notifizierungskontext
  * @param String $url vollständiger Deeplink, der in der Mail angezeigt werden soll
  * @param boolean $notifySubmitter Wenn false, wird der Submitter nicht notifiziert
  * @param array $notifyAuthors Bitmaske, die für jeden Autor (über den Index referenziert) angibt, ob ihm/ihr eine
  *                             E-Mail gesendet werden kann (wenn false, dann wird keine Notifizierung versendet)
  */
 public function prepareMail($document, $context, $url, $notifySubmitter = true, $notifyAuthors = array())
 {
     if (!$this->validateContext($context)) {
         $this->logger->err("context {$context} is currently not supported or delivery of notification mails is not" . ' enabled for the current context');
         return;
     }
     $this->logger->info("prepare {$context} notification email for document id " . $document->getId());
     $authorAddresses = array();
     $authors = array();
     $title = "";
     $personAuthors = $document->getPersonAuthor();
     if (!empty($personAuthors)) {
         $index = 0;
         foreach ($personAuthors as $author) {
             $name = trim($author->getLastName() . ", " . $author->getFirstName());
             // TODO Komma nur wenn FirstName present
             array_push($authors, $name);
             if ($context == self::PUBLICATION) {
                 $email = trim($author->getEmail());
                 if (!empty($email) && (empty($notifyAuthors) || isset($notifyAuthors[$index]) && $notifyAuthors[$index])) {
                     array_push($authorAddresses, array("name" => $name, "address" => $email));
                 }
             }
             $index++;
         }
     }
     // TODO Funktionalität existiert bereits (Documents Helper oder so)
     $titlesMain = $document->getTitleMain();
     if (!empty($titlesMain)) {
         // ermittle (den ersten) TitleMain in Dokumentsprache
         $language = $document->getLanguage();
         foreach ($titlesMain as $titleMain) {
             if ($titleMain->getLanguage() == $language) {
                 $title = trim($titleMain->getValue());
                 break;
             }
         }
     }
     $this->scheduleNotification($this->getMailSubject($context, $document->getId(), $authors, $title), $this->getMailBody($context, $document->getId(), $authors, $title, $url), $this->getRecipients($context, $authorAddresses, $document, $notifySubmitter));
     $this->logger->info("{$context} notification mail creation was completed successfully");
 }
开发者ID:alexukua,项目名称:opus4,代码行数:50,代码来源:Notification.php

示例5: renderPublishMailBody

 /**
  * Render body of notification mail.
  *
  * @param string $baseUrlServer
  * @param string $baseUrlFiles
  * @return string
  */
 public function renderPublishMailBody($baseUrlServer, $baseUrlFiles)
 {
     $baseUrlServer = preg_replace('/[\\/]+$/', '', $baseUrlServer);
     $baseUrlFiles = preg_replace('/[\\/]+$/', '', $baseUrlFiles);
     $loggedUserModel = new Publish_Model_LoggedUser();
     $person = $loggedUserModel->createPerson();
     $submitterString = '';
     if (!is_null($person) and $person->isValid()) {
         $submitterString = trim($person->getFirstName() . " " . $person->getLastName());
     }
     $titleModels = $this->_document->getTitleMain();
     $titleString = '';
     if (count($titleModels) > 0) {
         $titleString = trim($titleModels[0]->getValue());
     }
     $abstractModels = $this->_document->getTitleAbstract();
     $abstractString = '';
     if (count($abstractModels) > 0) {
         $abstractString = trim($abstractModels[0]->getValue());
     }
     $template = new Matheon_Model_Template();
     $template->template = APPLICATION_PATH . '/modules/matheon/models/confirmation-mail.template';
     return $template->render(array('baseUrlServer' => $baseUrlServer, 'baseUrlFiles' => $baseUrlFiles, 'docId' => $this->getId(), 'submitterString' => $submitterString, 'titleString' => $titleString, 'abstractString' => $abstractString, 'files' => $this->_document->getFile()));
 }
开发者ID:KOBV,项目名称:opus4-matheon,代码行数:31,代码来源:Document.php

示例6: getFrontdoorTitle

 /**
  *
  * @param Opus_Document $document
  * @return string
  */
 private function getFrontdoorTitle($document)
 {
     $titlesMain = $document->getTitleMain();
     if (count($titlesMain) == 0) {
         return '';
     }
     $docLanguage = $document->getLanguage();
     $docLanguage = is_array($docLanguage) ? $docLanguage : array($docLanguage);
     $firstNonEmptyTitle = '';
     foreach ($titlesMain as $title) {
         $titleValue = trim($title->getValue());
         if (strlen($titleValue) == 0) {
             continue;
         }
         if (in_array($title->getLanguage(), $docLanguage)) {
             return $titleValue;
         }
         if ($firstNonEmptyTitle == '') {
             $firstNonEmptyTitle = $titleValue;
         }
     }
     return $firstNonEmptyTitle;
 }
开发者ID:esmo,项目名称:opus4-application,代码行数:28,代码来源:IndexController.php

示例7: foreach

 */
/**
 *
 * Dieses Skript gibt alle IDs der Dokumente zurück, die mehr als einen Titel
 * und/oder Abstract in der Sprache des Dokuments besitzen.
 *
 * Diese Dokumente müssen aktuell manuell behandelt werden, da das Dokument
 * sonst nicht fehlerfrei indexiert werden kann (siehe OPUSVIER-2240).
 *
 */
$updateRequired = 0;
$docfinder = new Opus_DocumentFinder();
foreach ($docfinder->ids() as $docId) {
    $doc = new Opus_Document($docId);
    $numOfTitles = 0;
    foreach ($doc->getTitleMain() as $title) {
        if ($title->getLanguage() === $doc->getLanguage()) {
            $numOfTitles++;
        }
    }
    $numOfAbstracts = 0;
    foreach ($doc->getTitleAbstract() as $abstract) {
        if ($abstract->getLanguage() === $doc->getLanguage()) {
            $numOfAbstracts++;
        }
    }
    if ($numOfTitles > 1 || $numOfAbstracts > 1) {
        $msg = "document #{$docId} (";
        $opusThreeId = $doc->getIdentifierOpus3();
        if (count($opusThreeId) > 0) {
            $msg .= 'opus3id #' . $opusThreeId[0]->getValue() . ' ';
开发者ID:belapp,项目名称:opus4-application,代码行数:31,代码来源:find_docs_with_multiple_titles_or_abstracts.php

示例8: testFrontdoorTitleRespectsDocumentLanguageMultipleCandidates

 /**
  * 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());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:25,代码来源:IndexControllerTest.php


注:本文中的Opus_Document::getTitleMain方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。