public function populateFromModel($file) { foreach ($file->getHashValue() as $hashValue) { $hash = new Admin_Model_Hash($file, $hashValue); $hashType = $hash->getHashType(); if (!empty($hashType)) { $signType = $hash->getSignatureType(); switch ($signType) { case 'gpg': break; default: $this->addHashElement($file, $hashValue); break; } } } }
public function render($content) { $element = $this->getElement(); if (!$element instanceof Application_Form_Element_FileHash) { return $content; } $view = $element->getView(); if (!$view instanceof Zend_View_Interface) { return $content; } $file = $element->getFile(); $hash = new Admin_Model_Hash($file, $element->getValue()); $hashSoll = $hash->getSoll(); $hashIst = $hash->getIst(); if ($hashSoll != $hashIst) { $markup = '<div class="textarea hashsoll"><span class="hash-label">' . $view->translate('frontdoor_fixpoint') . ':</span>' . htmlspecialchars($hashSoll) . '</div>'; $markup .= $view->formHidden($element->getFullyQualifiedName() . '[Soll]', $hashSoll); $markup .= '<div class="textarea hashist"><span class="hash-label">' . $view->translate('frontdoor_current') . ':</span>'; if (strlen(trim($hashIst)) !== 0) { $markup .= htmlspecialchars($hashIst) . '</div>'; $markup .= $view->formHidden($element->getFullyQualifiedName() . '[Ist]', $hashIst); } else { if ($file->exists() && !$file->canVerify()) { $markup .= $view->translate('frontdoor_file_too_big') . '</div>'; } else { $markup .= $view->translate('frontdoor_checksum_not_verified') . '</div>'; } } } else { $markup = '<div class="textarea hashsoll">' . htmlspecialchars($hashSoll) . '</div>'; $markup .= $view->formHidden($element->getFullyQualifiedName() . '[Soll]', $hashSoll); } switch ($this->getPlacement()) { case self::PREPEND: return $markup . $content; case self::APPEND: default: return $content . $markup; } }