public function testTranslationOfOpusEnrichmentFields() { $model = new Opus_Enrichment(); $fieldNames = $model->describe(); foreach ($fieldNames as $name) { $key = $this->helper->getKeyForField('Opus_Enrichment', $name); $this->assertTrue($this->translate->isTranslated($key), 'Translation key \'' . $key . '\' is missing.'); } }
/** * Formats value that is instance of Opus_Model_Abstract. * @param Opus_Model_Abstract $field * @param string Name of model for field (default = null) * @return string Formatted output */ public function formatModel($field, $model = null) { if ($field instanceof Opus_Date) { return $this->formatDate($field); } else { $modelClass = $field->getValueModelClass(); $this->getLogger()->debug('Formatting field ' . $field->getName()); if (!empty($modelClass)) { switch ($modelClass) { case 'Opus_Date': return $this->formatDate($field->getValue()); case 'Opus_DnbInstitute': $value = $field->getValue(); if (isset($value[0])) { return $value[0]->getName(); } else { // Should never happen (DNB Institute without name), // but in case it does: return 'ERROR: DNB institute without name.'; } default: // Should never happen, but in case it does: $this->getLogger()->err(__CLASS__ . ' Trying to format unknown model ' . $modelClass); return 'ERROR: Unknown model class (see log).'; } } else { if ($field->isSelection()) { Application_Form_Element_Language::getLanguageList(); // initializes language list translations $value = $field->getValue(); $key = $this->_translation->getKeyForValue($model, $field->getName(), $value); return $this->view->translate($key); } else { if ($field->isCheckbox()) { if ($field->getValue()) { $key = 'Field_Value_True'; } else { $key = 'Field_Value_False'; } return $this->view->translate($key); } else { return $field->getValue(); } } } } }