public function createNewModel()
 {
     $model = new Opus_DnbInstitute();
     $model->setName('TestName');
     $model->setCity('TestCity');
     $model->setDepartment('TestDepartment');
     $model->setAddress('TestAddress');
     $model->setPhone('TestPhone');
     $model->setDnbContactId('TestDnbContactId');
     $model->setIsGrantor(true);
     $model->setIsPublisher(false);
     return $model->store();
 }
Пример #2
0
 public function testPopulateFromModel()
 {
     $form = new Admin_Form_DnbInstitute();
     $model = new Opus_DnbInstitute();
     $model->setName('TestName');
     $model->setDepartment('TestDepartment');
     $model->setAddress('TestAddress');
     $model->setCity('TestCity');
     $model->setPhone('TestPhone');
     $model->setDnbContactId('TestDnbContactId');
     $model->setIsGrantor(true);
     $model->setIsPublisher(false);
     $form->populateFromModel($model);
     $this->assertEquals('TestName', $form->getElement('Name')->getValue());
     $this->assertEquals('TestDepartment', $form->getElement('Department')->getValue());
     $this->assertEquals('TestAddress', $form->getElement('Address')->getValue());
     $this->assertEquals('TestCity', $form->getElement('City')->getValue());
     $this->assertEquals('TestPhone', $form->getElement('Phone')->getValue());
     $this->assertEquals('TestDnbContactId', $form->getElement('DnbContactId')->getValue());
     $this->assertTrue($form->getElement('IsGrantor')->getValue());
     $this->assertEquals('0', $form->getElement('IsPublisher')->getValue());
     $this->assertNull($form->getElement('Id')->getValue());
 }
Пример #3
0
 /**
  * Imports Universities from Opus3 to Opus4 directly (without XML)
  * University is also a DNB Institute
  *
  * @param DOMDocument $data XML-Document to be imported
  * @return array List of documents that have been imported
  */
 protected function importUniversities($data)
 {
     $mf = $this->_config->migration->mapping->universities;
     $fp = null;
     try {
         $fp = @fopen($mf, 'w');
         if (!$fp) {
             throw new Exception("Could not create '" . $mf . "' for Universities.\n");
         }
     } catch (Exception $e) {
         $this->_logger->log($e->getMessage(), Zend_Log::ERR);
         return;
     }
     $classification = $this->transferOpusClassification($data);
     foreach ($classification as $class) {
         if (array_key_exists('universitaet_anzeige', $class) === false) {
             continue;
         }
         if (array_key_exists('universitaet', $class) === false) {
             continue;
         }
         /* Create a DNB-Institute for University */
         $uni = new Opus_DnbInstitute();
         $uni->setName($class['universitaet_anzeige']);
         $this->uniname = $class['universitaet_anzeige'];
         $uni->setAddress($class['instadresse']);
         $uni->setCity($class['univort']);
         $this->unicity = $class['univort'];
         $uni->setDnbContactId($class['ddb_idn']);
         $uni->setIsGrantor('1');
         $uni->setIsPublisher('1');
         $uni->store();
         $this->_logger->log("University imported: " . $class['universitaet_anzeige'], Zend_Log::DEBUG);
         fputs($fp, str_replace(" ", "_", $class['universitaet']) . ' ' . $uni->getId() . "\n");
     }
     fclose($fp);
 }