Пример #1
0
 /**
  * Initialisierung des Formulars mit den Werten in einer Model-Instanz.
  * @param Opus_File $file
  */
 public function populateFromModel($file)
 {
     $this->getElement(self::ELEMENT_ID)->setValue($file->getId());
     $this->getElement(self::ELEMENT_FILE_LINK)->setValue($file);
     $this->getElement(self::ELEMENT_LABEL)->setValue($file->getLabel());
     $this->getElement(self::ELEMENT_FILE_SIZE)->setValue($file->getFileSize());
     $this->getElement(self::ELEMENT_LANGUAGE)->setValue($file->getLanguage());
     $this->getElement(self::ELEMENT_COMMENT)->setValue($file->getComment());
     $this->getElement(self::ELEMENT_SERVER_DATE_SUBMITTED)->setValue($this->getView()->formatValue()->formatDate($file->getServerDateSubmitted()));
     $this->getElement(self::ELEMENT_SORT_ORDER)->setValue($file->getSortOrder());
     $visibility = array();
     if ($file->getVisibleInFrontdoor()) {
         $visibility[] = 'frontdoor';
     }
     if ($file->getVisibleInOai()) {
         $visibility[] = 'oai';
     }
     $this->getElement(self::ELEMENT_VISIBILITY)->setValue($visibility);
     $this->getElement(self::ELEMENT_ROLES)->setValue($this->getRolesForFile($file->getId()));
     $this->getSubForm(self::SUBFORM_HASHES)->populateFromModel($file);
 }
Пример #2
0
 /**
  * 
  * @param Opus_File $file
  * @return string
  */
 private function getFulltextHash($file)
 {
     $hash = '';
     try {
         $hash = $file->getRealHash('md5');
     } catch (Exception $e) {
         $this->log->err('could not compute MD5 hash for ' . $file->getPath() . ' : ' . $e);
     }
     return $file->getId() . ":" . $hash;
 }