forked from koala-framework/koala-framework
/
TestController.php
49 lines (42 loc) · 1.54 KB
/
TestController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
class Kwf_Form_Cards_TestController extends Kwf_Controller_Action_Auto_Form
{
protected $_modelName = 'Kwf_Form_Cards_TopModel';
protected $_permissions = array('save', 'add');
protected $_buttons = array('save');
protected $_temp = "";
protected function _initFields()
{
$cards = $this->_form->add(new Kwf_Form_Container_Cards('type', trlKwf('Type')))
->setValues(array('foo', 'bar'));
$form = new Kwf_Form_Cards_Foo();
$card = $cards->add();
$title = "foo";
$title = str_replace('.', ' ', $title);
$card->setTitle($title);
$card->setName("foo");
if ($form) $card->add($form)->setServiceType('foo');
$form = new Kwf_Form_Cards_Bar();
$card = $cards->add();
$title = "bar";
$title = str_replace('.', ' ', $title);
$card->setTitle($title);
$card->setName("bar");
if ($form) $card->add($form)->setServiceType('bar');
}
public function indexAction()
{
$config = array();
$config['baseParams']['id'] = $this->_getParam('id');
$config['controllerUrl'] = $this->getRequest()->getPathInfo();
$config['assetsPackage'] = new Kwf_Assets_Package_TestPackage('Kwf_Form_Cards');
$this->view->ext('Kwf.Auto.FormPanel', $config, 'Kwf.Test.Viewport');
}
public function getModelDataAction()
{
$model = Kwf_Model_Abstract::getInstance('Kwf_Form_Cards_TopModel');
$row = $model->getRow(1);
echo $row->firstname;
exit;
}
}