예제 #1
0
 public function getCompletedDate($yearOnly = false)
 {
     try {
         $date = $this->document->getCompletedDate();
         if (empty($date)) {
             $date = $this->document->getCompletedYear();
         }
         if ($yearOnly && !empty($date) && $date instanceof Opus_Date) {
             return htmlspecialchars($date->getYear());
         } else {
             return htmlspecialchars($date);
         }
     } catch (Exception $e) {
         return 'unknown';
     }
 }
예제 #2
0
 public function getCompletedDate($yearOnly = false)
 {
     $datesHelper = Zend_Controller_Action_HelperBroker::getStaticHelper('Dates');
     try {
         $date = $this->document->getCompletedDate();
         if (empty($date)) {
             $date = $this->document->getCompletedYear();
         }
         if (!empty($date) && $date instanceof Opus_Date) {
             if ($yearOnly) {
                 $date = $date->getYear();
             } else {
                 $date = $datesHelper->getDateString($date);
             }
         }
         return htmlspecialchars($date);
     } catch (Exception $e) {
         return 'unknown';
     }
 }
예제 #3
0
파일: General.php 프로젝트: alexukua/opus4
 /**
  * Befuellt das Formular anhand der Metadaten eines Dokuments.
  * @param Opus_Document $document
  */
 public function populateFromModel($document)
 {
     $datesHelper = $this->getDatesHelper();
     $this->getElement(self::ELEMENT_LANGUAGE)->setValue($document->getLanguage());
     $this->getElement(self::ELEMENT_TYPE)->setValue($document->getType());
     $date = $datesHelper->getDateString($document->getCompletedDate());
     $this->getElement(self::ELEMENT_COMPLETED_DATE)->setValue($date);
     $this->getElement(self::ELEMENT_COMPLETED_YEAR)->setValue($document->getCompletedYear());
     $date = $datesHelper->getDateString($document->getPublishedDate());
     $this->getElement(self::ELEMENT_PUBLISHED_DATE)->setValue($date);
     $this->getElement(self::ELEMENT_PUBLISHED_YEAR)->setValue($document->getPublishedYear());
     $date = $datesHelper->getDateString($document->getEmbargoDate());
     $this->getElement(self::ELEMENT_EMBARGO_DATE)->setValue($date);
 }