예제 #1
0
 public function testSetGetModelsNull()
 {
     $form = new Application_Form_Model_Table();
     $form->setModels(Opus_Licence::getAll());
     $this->assertNotNull($form->getModels());
     $form->setModels(null);
     $this->assertNull($form->getModels());
 }
예제 #2
0
 /**
  * Imports licenses data to Opus4
  *
  * @param Strring $data XML-String with classifications to be imported
  * @return array List of documents that have been imported
  */
 public function __construct($data)
 {
     $this->config = Zend_Registry::get('Zend_Config');
     $this->logger = Zend_Registry::get('Zend_Log');
     $this->mapping['language'] = array('old' => 'OldLanguage', 'new' => 'Language', 'config' => $this->config->migration->language);
     $this->data = $data;
     foreach (Opus_Licence::getAll() as $lic) {
         if ($lic->getSortOrder() > $this->maxSortOrder) {
             $this->maxSortOrder = $lic->getSortOrder();
         }
     }
 }
예제 #3
0
 public function testPopulateFromModel()
 {
     $form = new Admin_Form_Document_Licences();
     $document = new Opus_Document(146);
     $form->populateFromModel($document);
     $licences = Opus_Licence::getAll();
     foreach ($licences as $licence) {
         $element = $form->getElement('licence' . $licence->getId());
         // Nur Lizenz mit ID = 4 ist gesetzt fuer Dokument 146
         if ($licence->getId() == 4) {
             $this->assertEquals(4, $element->getValue(), 'Lizenz ' . $licence->getId() . ' nicht gesetzt.');
         } else {
             $this->assertEquals(0, $element->getValue(), 'Lizenz ' . $licence->getId() . ' gesetzt.');
         }
     }
 }
예제 #4
0
파일: Licences.php 프로젝트: alexukua/opus4
 /**
  * Erzeugt Checkbox Formularelemente für alle Lizenzen.
  */
 public function init()
 {
     parent::init();
     $licences = Opus_Licence::getAll();
     foreach ($licences as $licence) {
         $element = new Form_Element_Checkbox(self::ELEMENT_NAME_PREFIX . $licence->getId());
         $element->setDisableTranslator(true);
         // Lizenzen werden nicht übersetzt
         $element->setLabel($licence->getNameLong());
         $cssClass = $licence->getActive() ? self::ACTIVE_CSS_CLASS : self::INACTIVE_CSS_CLASS;
         $labelDecorator = $element->getDecorator('Label');
         $labelDecorator->setOption('class', $cssClass);
         $element->setCheckedValue($licence->getId());
         $this->addElement($element);
     }
     $this->setLegend('admin_document_section_licences');
 }
$contributor->setLastName('Smart');
$contributor->store();
$doc->addPersonContributor($contributor);
$doc->setCreatingCorporation('Walt Disney Creation Laboratories');
$doc->setContributingCorporation('Pixar Animation Studio');
$swd = $doc->addSubject()->setType('swd');
$swd->setValue('Test');
$freeSubjectDeu = $doc->addSubject()->setType('uncontrolled');
$freeSubjectDeu->setLanguage('deu')->setValue('Maustest');
$freeSubjectEng = $doc->addSubject()->setType('uncontrolled');
$freeSubjectEng->setLanguage('eng')->setValue('mouse test');
$note = $doc->addNote();
$note->setVisibility('public')->setMessage('ein Dokument, dass noch eine Bemerkung braucht, weil im Abstract nicht alles gesagt wurde...');
$noteTwo = $doc->addNote();
$noteTwo->setVisibility('private')->setMessage('und noch eine Bemerkung zum Bearbeitungsstand.');
$licences = Opus_Licence::getAll();
if (count($licences) >= 1) {
    $lic = $licences[0];
} else {
    $lic = new Opus_Licence();
    $lic->setActive(1);
    $lic->setLanguage('deu');
    $lic->setLinkLicence('http://www.test.de');
    $lic->setNameLong('Ein langer LizenzName');
    $lic->store();
}
$doc->setLicence($lic);
// check for enrichment keys before creating enrichments
$enrichmentKeys = Opus_EnrichmentKey::getAll();
$enrichmentKeyNames = array();
foreach ($enrichmentKeys as $enrichmentKey) {
예제 #6
0
 /**
  * return the available licences from registry, database or chache
  * @return <Array> languages
  */
 private function getLicences()
 {
     $licences = array();
     if (empty($this->licences)) {
         foreach ($dbLicences = Opus_Licence::getAll() as $lic) {
             if ($lic->getActive() == '1') {
                 $name = $lic->getDisplayName();
                 $id = $lic->getId();
                 $licences[$id] = $name;
             }
         }
         $this->licences = $licences;
         return $licences;
     } else {
         return $this->licences;
     }
 }
예제 #7
0
 /**
  * Tests that the sort order of the licences in the publish form matches
  * the sort order provided from the database.
  */
 public function testSortOrderOfSelectOptionForLicence()
 {
     $licences = Opus_Licence::getAll();
     $activeLicences = array();
     foreach ($licences as $licence) {
         if ($licence->getActive() == '1') {
             $activeLicences[] = $licence->getDisplayName();
         }
     }
     $val = new Publish_Model_Validation('Licence', $this->session);
     $values = $val->selectOptions();
     $this->assertEquals(count($values), count($activeLicences));
     $pos = 0;
     foreach ($values as $name) {
         $this->assertEquals($name, $activeLicences[$pos]);
         $pos++;
     }
 }
예제 #8
0
 public function testNumberLicencesAfterMigration()
 {
     $this->assertEquals(10, count(Opus_Licence::getAll()));
 }
 public function testNewActionCancel()
 {
     $this->createsModels = true;
     $modelCount = count($this->getModels());
     $post = array('NameLong' => 'TestNameLong', 'Language' => 'eng', 'LinkLicence' => 'www.example.org/licence', 'Cancel' => 'Abbrechen');
     $this->getRequest()->setPost($post)->setMethod('POST');
     $this->dispatch('/admin/licence/new');
     $this->assertRedirectTo('/admin/licence', 'Should be a redirect to index action.');
     $this->assertEquals($modelCount, count(Opus_Licence::getAll()), 'Es sollte keine neue Lizenz geben.');
 }
예제 #10
0
 public function testGetAllModels()
 {
     $licences = Opus_Licence::getAll();
     $models = $this->controller->getAllModels();
     $this->assertEquals(count($licences), count($models));
 }