Beispiel #1
0
    // end onInit();
    public function onAccept()
    {
        $view = $this->getView();
        $view->setTemplate('results2.tpl');
        $results = array();
        foreach ($this->getValue() as $name => $value) {
            $results[] = array('name' => $name, 'value' => $value);
        }
        $view->results = $results;
    }
}
// end GeneralForm;
try {
    $tpl = new Opt_Class();
    $opf = new Opf_Class($tpl);
    $tpl->sourceDir = './templates/';
    $tpl->compileDir = './templates_c/';
    $tpl->compileMode = Opt_Class::CM_REBUILD;
    $tpl->stripWhitespaces = false;
    $tpl->gzipCompression = false;
    $tpl->register(Opt_Class::PHP_FUNCTION, 'dump', 'var_dump');
    $tpl->setup();
    $translate = new Opc_Translate(new Opc_Translate_Adapter_Ini(array('directory' => './lang/')));
    $translate->setLanguage('en');
    $opf->setTranslationInterface($translate);
    $view = new Opt_View('situation_5.tpl');
    $view->devFile = 'situation_5.php';
    $form = new GeneralForm('form5');
    $form->setView($view);
    $form->execute();
Beispiel #2
0
 /**
  * Initializes the form processor.
  *
  * @param String $name The form name.
  */
 public function __construct($name)
 {
     $this->_name = $name;
     Opf_Class::addForm($this);
 }
Beispiel #3
0
 /**
  * @covers Opf_Class::hasForm
  * @depends testAddForm
  */
 public function testHasForm()
 {
     $mock = $this->getMock('Opf_Form', array(), array('foo'));
     $mock->expects($this->atLeastOnce())->method('getName')->will($this->returnValue('foo'));
     Opf_Class::addForm($mock);
     $this->assertTrue(Opf_Class::hasForm('foo'));
     $this->assertFalse(Opf_Class::hasForm('bar'));
 }