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


PHP Opus_Document::getPersonAuthor方法代码示例

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


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

示例1: getAuthors

 /**
  * Returns all authors for the given document. Returns an empty array in case
  * no authors exists.
  *
  * @return array An array of authors for the given document.
  */
 public function getAuthors()
 {
     $authors = array();
     foreach ($this->_document->getPersonAuthor() as $author) {
         $authorId = $author->getId();
         array_push($authors, array('id' => $authorId[0], 'name' => $author->getName(), 'mail' => $author->getEmail(), 'allowMail' => $author->getAllowEmailContact()));
     }
     return $authors;
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:15,代码来源:Authors.php

示例2: testGetModel

 public function testGetModel()
 {
     $form = new Admin_Form_PersonLink();
     $this->assertNull($form->getModel());
     $document = new Opus_Document(250);
     $authors = $document->getPersonAuthor();
     $this->assertEquals(3, count($authors));
     $form->populateFromModel($authors[0]);
     $this->assertEquals($authors[0], $form->getModel());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:10,代码来源:PersonLinkTest.php

示例3: 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

示例4: testGetLinkModel

 public function testGetLinkModel()
 {
     $form = new Admin_Form_Document_Person();
     $document = new Opus_Document(146);
     $authors = $document->getPersonAuthor();
     $form->populateFromModel($authors[0]);
     $form->getElement('Role')->setValue(null);
     // nicht teil des POST beim Metadaten-Formular
     $person = $form->getLinkModel(146, 'author');
     $this->assertEquals($person->getId(), $authors[0]->getId());
     $this->assertNotNull($person->getModel());
     $this->assertEquals('author', $person->getRole());
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:13,代码来源:PersonTest.php

示例5: 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

示例6: getAuthors

 /**
  * Return list of authors.
  * @return array
  */
 public function getAuthors()
 {
     if ($this->authors) {
         return $this->authors;
     }
     try {
         $c = count($this->document->getPersonAuthor());
     } catch (Exception $e) {
         $c = 0;
     }
     $authors = array();
     for ($counter = 0; $counter < $c; $counter++) {
         $name = $this->document->getPersonAuthor($counter)->getName();
         $firstName = $this->document->getPersonAuthor($counter)->getFirstName();
         $lastName = $this->document->getPersonAuthor($counter)->getLastName();
         $author = array();
         $author['name'] = htmlspecialchars($name);
         $author['url'] = $this->getAuthorUrl($firstName . ' ' . $lastName);
         $authors[$counter] = $author;
     }
     $this->authors = $authors;
     return $authors;
 }
开发者ID:alexukua,项目名称:opus4,代码行数:27,代码来源:DocumentAdapter.php

示例7: _addPublishNotificationSelection

 /**
  * add a checkbox for each PersonSubmitter and PersonAuthor (used to select
  * recipients for publish notification email)
  *
  * @param Opus_Document $document
  * @param Zend_Form $form
  *
  */
 private function _addPublishNotificationSelection($document, $form)
 {
     $form->addElement('hidden', 'plaintext', array('description' => '<br/><p><strong>' . $this->view->translate('admin_workflow_notification_headline') . '</strong></p>' . '<p>' . $this->view->translate('admin_workflow_notification_description') . '</p>', 'ignore' => true, 'decorators' => array(array('Description', array('escape' => false, 'tag' => '')))));
     $submitters = $document->getPersonSubmitter();
     if (!is_null($submitters) && count($submitters) > 0) {
         $label = $this->view->translate('admin_workflow_notification_submitter') . ' ' . trim($submitters[0]->getLastName()) . ", " . trim($submitters[0]->getFirstName());
         $element = null;
         if (trim($submitters[0]->getEmail()) == '') {
             // email notification is not possible since no email address is specified for submitter
             $label .= ' (' . $this->view->translate('admin_workflow_notification_noemail') . ')';
             $element = new Zend_Form_Element_Checkbox('submitter', array('checked' => false, 'disabled' => true, 'label' => $label));
             $element->getDecorator('Label')->setOption('class', 'notification-option option-not-available');
         } else {
             $label .= ' (' . trim($submitters[0]->getEmail()) . ')';
             $element = new Zend_Form_Element_Checkbox('submitter', array('checked' => true, 'label' => $label));
             $element->getDecorator('Label')->setOption('class', 'notification-option');
         }
         $form->addElement($element);
     }
     $authors = $document->getPersonAuthor();
     if (!is_null($authors)) {
         $index = 1;
         foreach ($authors as $author) {
             $id = 'author_' . $index;
             $label = $index . '. ' . $this->view->translate('admin_workflow_notification_author') . ' ' . trim($author->getLastName()) . ", " . trim($author->getFirstName());
             $element = null;
             if (trim($author->getEmail()) == '') {
                 // email notification is not possible since no email address is specified for author
                 $label .= ' (' . $this->view->translate('admin_workflow_notification_noemail') . ')';
                 $element = new Zend_Form_Element_Checkbox($id, array('checked' => false, 'disabled' => true, 'label' => $label));
                 $element->getDecorator('Label')->setOption('class', 'notification-option option-not-available');
             } else {
                 $label .= ' (' . trim($author->getEmail()) . ')';
                 $element = new Zend_Form_Element_Checkbox($id, array('checked' => true, 'label' => 'foo', 'label' => $label));
                 $element->getDecorator('Label')->setOption('class', 'notification-option');
             }
             $form->addElement($element);
             $index++;
         }
     }
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:49,代码来源:WorkflowController.php

示例8: getFormForSorting

 protected function getFormForSorting()
 {
     $form = new Admin_Form_Document_PersonRole('author');
     $document = new Opus_Document(250);
     $authors = $document->getPersonAuthor();
     $authorId0 = $authors[0]->getModel()->getId();
     // 310
     $authorId1 = $authors[1]->getModel()->getId();
     // 311
     $authorId2 = $authors[2]->getModel()->getId();
     // 312
     $form->populateFromModel($document);
     $this->verifyExpectedOrder($form, array(310, 311, 312));
     return $form;
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:15,代码来源:PersonRoleTest.php

示例9: testUrlEncodedAuthorNamesDoc150

 /**
  * Regression test for OPUSVIER-2435
  */
 public function testUrlEncodedAuthorNamesDoc150()
 {
     $d = new Opus_Document(150);
     $firstNames = array();
     $lastNames = array();
     foreach ($d->getPersonAuthor() as $author) {
         $firstNames[] = $author->getFirstName();
         $lastNames[] = $author->getLastName();
     }
     $this->assertContains('J\\"ohn', $firstNames, "testdata changed!");
     $this->assertContains('J\\"ane', $firstNames, "testdata changed!");
     $this->assertContains('D\\"oe', $lastNames, "testdata changed!");
     $this->dispatch('/frontdoor/index/index/docId/150');
     $responseBody = $this->getResponse()->getBody();
     $this->assertRegExp('/<a href="[^"]+\\/author\\/J%5C%22ohn\\+Doe"/', $responseBody);
     $this->assertRegExp('/<a href="[^"]+\\/author\\/J%5C%22ane\\+D%5C%22oe"/', $responseBody);
     $this->assertNotRegExp('/<a href="[^"]+\\/author\\/\\&quot;J\\\\&quot;ohn Doe\\&quot;"/', $responseBody);
     $this->assertNotRegExp('/<a href="[^"]+\\/author\\/\\&quot;J\\\\&quot;ane D\\\\&quot;oe\\&quot;"/', $responseBody);
 }
开发者ID:belapp,项目名称:opus4-application,代码行数:22,代码来源:IndexControllerTest.php


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