本文整理汇总了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;
}
示例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());
}
示例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);
}
示例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());
}
示例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");
}
示例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;
}
示例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++;
}
}
}
示例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;
}
示例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\\/\\"J\\\\"ohn Doe\\""/', $responseBody);
$this->assertNotRegExp('/<a href="[^"]+\\/author\\/\\"J\\\\"ane D\\\\"oe\\""/', $responseBody);
}