public function testOptions() { $element = $this->getElement(); $publishers = Opus_DnbInstitute::getPublishers(); $this->assertEquals(count($publishers), count($element->getMultiOptions())); $index = 0; foreach ($element->getMultiOptions() as $modelId => $label) { $this->assertEquals($publishers[$index]->getId(), $modelId); $this->assertEquals($publishers[$index]->getDisplayName(), $label); $index++; } }
public function init() { parent::init(); $this->setRequired(true); $this->setDisableTranslator(true); // publishing institutions are not translated $validator = new Zend_Validate_Int(); $validator->setMessage('validation_error_int'); $this->addValidator($validator); $options = Opus_DnbInstitute::getPublishers(); foreach ($options as $option) { $this->addMultiOption($option->getId(), $option->getDisplayName()); } }
/** * Retrieves all available ThesisGrantors or ThesisPublishers in a array. * Used for generating a select box. * * @param $grantors true -> get thesis grantors * null -> get thesis publishers * @return Array of Dnb_Institutes Objects */ private function getThesis($grantors = null) { $thesises = array(); if ($grantors === true) { $thesises = Opus_DnbInstitute::getGrantors(); } else { if (is_null($grantors)) { $thesises = Opus_DnbInstitute::getPublishers(); } } if (empty($thesises)) { return null; } $thesisList = array(); foreach ($thesises as $thesis) { $thesisList[$thesis->getId()] = $thesis->getDisplayName(); } return $thesisList; }