Example #1
0
 public function testPopulateFromModel()
 {
     $form = new Admin_Form_Document_Files();
     $document = new Opus_Document(84);
     $this->assertEquals(1, count($form->getSubForms()));
     $form->populateFromModel($document);
     $this->assertEquals(3, count($form->getSubForms()));
     $this->assertNotNull($form->getSubForm('File0'));
     $this->assertInstanceOf('Admin_Form_Document_File', $form->getSubForm('File0'));
     $this->assertNotNull($form->getSubForm('File0')->getModel());
     $this->assertNotNull($form->getSubForm('File1'));
     $this->assertInstanceOf('Admin_Form_Document_File', $form->getSubForm('File1'));
     $this->assertNotNull($form->getSubForm('File1')->getModel());
 }
Example #2
0
 /**
  * Bereitet Formular fuer Anzeige als View vor.
  *
  * Fuegt Unterformular fuer Dateien hinzu. Dateien sind nicht Teil des Metadaten-Formulars, werden aber in der
  * Metadaten-Übersicht mit aufgelistet.
  */
 public function prepareRenderingAsView()
 {
     parent::prepareRenderingAsView();
     if (!is_null($this->document)) {
         if (count($this->document->getFile()) > 0) {
             $subform = new Admin_Form_Document_Files();
             $subform->populateFromModel($this->document);
             $this->addSubForm($subform, 'Files');
         }
     }
 }