コード例 #1
0
ファイル: situation_5.php プロジェクト: OPL/Open-Power-Forms
    // 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();
コード例 #2
0
ファイル: Form.php プロジェクト: OPL/Open-Power-Forms
 /**
  * Initializes the form processor.
  *
  * @param String $name The form name.
  */
 public function __construct($name)
 {
     $this->_name = $name;
     Opf_Class::addForm($this);
 }
コード例 #3
0
ファイル: ClassTest.php プロジェクト: OPL/Open-Power-Forms
 /**
  * @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'));
 }