Пример #1
0
 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++;
     }
 }
Пример #2
0
 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());
     }
 }
Пример #3
0
 /**
  * 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;
 }