/** * 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++; } } }