Exemplo n.º 1
0
 private function _assertPostedValue($postValue, $savedValue, $language, $frontendValue, $allowDecimals = null)
 {
     $m1 = new Kwf_Form_NumberField_TestModel();
     $form = new Kwf_Form();
     $form->setModel($m1);
     $form->setId(1);
     $nrField = $form->add(new Kwf_Form_Field_NumberField('nr', 'Number'));
     $nrField->setAllowDecimals($allowDecimals);
     $form->trlStaticExecute($language);
     $post = array($nrField->getFieldName() => $postValue);
     if ($frontendValue !== false) {
         $post[$nrField->getFieldName() . '-format'] = 'fe';
     }
     $post = $form->processInput(null, $post);
     if (!$form->validate(null, $post)) {
         $form->prepareSave(null, $post);
         $form->save(null, $post);
     }
     $testRow = $m1->getRow(1);
     $this->assertEquals($savedValue, $testRow->nr);
     $values = $form->load(null, $post);
     $this->assertEquals($values['nr'], $postValue);
     if ($frontendValue !== false) {
         $html = $nrField->getTemplateVars($values);
         $this->assertTrue(!!preg_match('#name="nr" value="(.*?)"#', $html['html'], $m));
         $this->assertEquals($frontendValue, $m[1]);
     }
 }
Exemplo n.º 2
0
 public function alterBackendOrderForm(Kwf_Form $form)
 {
     $fs = $form->add(new Kwf_Form_Container_FieldSet(trlKwf('Discount')));
     $fs->add(new Kwf_Form_Field_TextField('discount_text', trlKwf('Text')));
     $fs->add(new Kwf_Form_Field_NumberField('discount_amount', trlcKwf('Amount of Money', 'Amount')))->setComment('€')->setWidth(50);
     $fs->add(new Kwf_Form_Field_TextField('discount_comment', trlKwf('Comment')));
 }
Exemplo n.º 3
0
 public function setUp()
 {
     parent::setUp();
     $m1 = new Kwf_Model_FnF();
     $form = new Kwf_Form();
     $form->setModel($m1);
     $fs = $form->add(new Kwf_Form_Container_FieldSet('fs'))->setCheckboxToggle(true)->setCheckboxName('fs');
     $fs->add(new Kwf_Form_Field_TextField('text'))->setAllowBlank(false);
     $this->_form = $form;
 }
Exemplo n.º 4
0
 public function getPagePropertiesForm($config)
 {
     $c = $config['component'];
     if ($config['mode'] == 'add' || $c->isPage) {
         $form = Kwc_Admin::getInstance(Kwc_Abstract::getSetting($this->_class, 'masterComponentClass'))->getPagePropertiesForm($config);
         $form->setIdTemplate('{0}-child');
         $ret = new Kwf_Form();
         $ret->setModel(new Kwf_Model_FnF());
         $ret->setCreateMissingRow(true);
         $ret->add($form);
         return $ret;
     }
     return null;
 }
Exemplo n.º 5
0
 public function testFieldNamesWithFormName()
 {
     $form = new Kwf_Form();
     $form->setName('bar');
     $form->setModel(new Kwf_Model_FnF(array('data' => array(array('id' => 1, 'foo' => 2)))));
     $foo = new Kwf_Form_Field_Select('foo', 'Foo');
     $foo->setValues('/kwf/test/kwf_form_filter-field_remote/json-data');
     $foo->setAllowBlank(false);
     $foo2 = new Kwf_Form_Field_Select('foo2', 'Foo2');
     $foo2->setValues(array(1 => 'filter1', 2 => 'filter2'))->setSave(false)->setAllowBlank(false);
     $form->add(new Kwf_Form_Field_FilterField())->setFilterColumn('filter_id')->setFilteredField($foo)->setFilterField($foo2);
     $this->assertEquals('bar_foo', $foo->getFieldName());
     $this->assertEquals('bar_foo2', $foo2->getFieldName());
 }
 protected function _initFields()
 {
     parent::_initFields();
     $this->_model = new Kwf_Model_FnF();
     $this->fields->add(new Kwf_Form_Field_TextField('query', 'Query'))->setAutoComplete(false)->setHideLabel(true)->setEmptyText(trlKwfStatic('Search'))->setNamePrefix('');
     // to get "default" parameter "search" which is automatically excluded on user tracking systems
 }
Exemplo n.º 7
0
 protected function _initFields()
 {
     parent::_initFields();
     $this->add(new Kwf_Form_Field_TextField('title', trlKwf('Title')))->setAllowBlank(false)->setWidth(500);
     $this->add(new Kwf_Form_Field_TextArea('teaser', trlKwf('Teaser')))->setWidth(500)->setHeight(100);
     $this->add(new Kwf_Form_Field_DateField('date', trlKwf('Publication')))->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_Select('author_id', trlKwf('Author')))->setAllowBlank(false)->setWidth(200)->setValues(Kwf_Model_Abstract::getInstance('Kwc_Articles_Directory_AuthorsModel')->getRows());
     $v = new Zend_Validate_Regex('/^[0-9]{4}\\/[0-9]{2}$/');
     $v->setMessage(trlKwf('Please use this format -> Year / Month'), Zend_Validate_Regex::NOT_MATCH);
     $this->add(new Kwf_Form_Field_TextField('vi_nr', trlKwf('VI-Number')))->setWidth(70)->addValidator($v);
     $this->add(Kwc_Abstract_Form::createComponentFormByDbIdTemplate('article_{0}-previewImage', 'previewImage'));
     $columns = $this->add(new Kwf_Form_Container_Columns('is_top'));
     $col = $columns->add(new Kwf_Form_Container_Column());
     $col->setStyle('margin-left: 0px');
     $col->add(new Kwf_Form_Field_Checkbox('is_top_checked', trlKwf('Hot-topic')));
     $col = $columns->add(new Kwf_Form_Container_Column());
     $col->setLabelWidth(50);
     $col->add(new Kwf_Form_Field_DateField('is_top_expire', trlKwf('Ends at')));
     $this->add(new Kwf_Form_Field_Checkbox('read_required', trlKwf('Required reading')));
     $this->add(new Kwf_Form_Field_Checkbox('only_intern', trlKwf('Only intern')));
     $priority = array();
     for ($i = 1; $i <= 10; $i++) {
         $priority[$i] = $i;
     }
     $this->add(new Kwf_Form_Field_Select('priority', trlKwf('Priority')))->setAllowBlank(false)->setValues($priority)->setWidth(40)->setHelpText(trlKwfStatic('For sorting articles if they have same date'));
 }
 protected function _init()
 {
     parent::_init();
     $this->_getParentField()->add(new Kwf_Form_Field_ShowField('firstname_interface', trlKwfStatic('Firstname')))->setData(new Kwc_Newsletter_Unsubscribe_Form_RecipientData('getMailFirstname'));
     $this->_getParentField()->add(new Kwf_Form_Field_ShowField('lastname_interface', trlKwfStatic('Lastname')))->setData(new Kwc_Newsletter_Unsubscribe_Form_RecipientData('getMailLastname'));
     $this->_getParentField()->add(new Kwf_Form_Field_ShowField('email_interface', trlKwfStatic('E-Mail')))->setData(new Kwc_Newsletter_Unsubscribe_Form_RecipientData('getMailEmail'));
 }
 protected function _showForm()
 {
     $this->view->formName = $this->_form->getName();
     $this->view->method = 'post';
     $this->view->submitButtonText = trlKwf('Submit');
     $this->view->action = '';
     $values = $this->_form->load(null, $this->_getParam('formPostData'));
     $this->view->form = $this->_form->getTemplateVars($values, '', $this->view->formName . '_');
     $errors = $this->_getParam('formErrors');
     if (!$errors) {
         $errors = array();
     }
     $dec = new Kwc_Form_Decorator_Label();
     $this->view->form = $dec->processItem($this->view->form, $errors);
     $this->view->errors = Kwf_Form::formatValidationErrors($errors);
     $this->view->errorsHtml = '';
     if ($this->view->errors) {
         $this->view->errorsHtml .= '<div class="kwfUp-webStandard kwfUp-kwcFormError kwfUp-webFormError">';
         $this->view->errorsHtml .= '<p class="error">' . trlKwf('An error has occurred') . ':</p>';
         $this->view->errorsHtml .= '<ul>';
         foreach ($this->view->errors as $error) {
             $this->view->errorsHtml .= '<li>' . htmlspecialchars($error) . '</li>';
         }
         $this->view->errorsHtml .= '</ul>';
         $this->view->errorsHtml .= '</div>';
     }
 }
Exemplo n.º 10
0
 public function processInput($parentRow, $postData = array())
 {
     $id = $this->_getIdByParentRow($parentRow);
     if ($id === 0 || $id === '0' || is_null($id)) {
         $this->_newUserRow = $this->_model->createUserRow($postData[$this->getByName('email')->getFieldName()]);
     }
     return parent::processInput($parentRow, $postData);
 }
 protected function _init()
 {
     parent::_init();
     $this->_model = new Kwf_Model_FnF();
     $this->add(new Kwf_Form_Field_TextField('email', trlKwfStatic('E-Mail')))->setVtype('email')->setAutofocus(true)->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_Password('password', trlKwfStatic('Password')))->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_Checkbox('auto_login', trlKwfStatic('Auto Login')));
 }
Exemplo n.º 12
0
 public function testWithRelModel()
 {
     $m1 = new Kwf_Form_MultiCheckbox_DataModelNoRel();
     $m2 = new Kwf_Form_MultiCheckbox_RelationModelNoRel();
     $form = new Kwf_Form();
     $form->setModel($m1);
     $mcb = $form->add(new Kwf_Form_Field_MultiCheckbox($m2, 'Value', 'MultiCheck2'));
     $post = array($mcb->getFieldName() . '_1' => 1, $mcb->getFieldName() . '_2' => 0, $mcb->getFieldName() . '_3' => 0);
     $post = $form->processInput($form->getRow(), $post);
     $form->validate($form->getRow(), $post);
     $form->prepareSave(null, $post);
     $form->save(null, $post);
     $form->afterSave(null, $post);
     $rows = $m2->getRows($m2->select()->whereEquals('data_id', 1))->toArray();
     $expected = array('id' => 1, 'data_id' => 1, 'values_id' => 1);
     $this->assertEquals(1, count($rows));
     $this->assertEquals($expected, $rows[0]);
 }
Exemplo n.º 13
0
 protected function _init()
 {
     $this->setModel(new Kwf_Model_Mail(array('tpl' => 'Kwc_FormStatic_Form_Component')));
     $this->add(new Kwf_Form_Field_TextField('fullname', 'Name'))->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_TextField('email', 'E-Mail'))->setVtype('email')->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_TextField('phone', 'Telefon'))->setWidth(255);
     $this->add(new Kwf_Form_Field_TextArea('content', 'Nachricht'))->setAllowBlank(false);
     parent::_init();
 }
Exemplo n.º 14
0
 protected function _init()
 {
     parent::_init();
     $passwordField = $this->add(new Kwf_Form_Field_DoublePassword('password', trlKwfStatic('Password')));
     $validatorClass = Kwf_Registry::get('config')->user->passwordValidator;
     if ($validatorClass) {
         $passwordField->getChildren()->getByName('password')->addValidator(new $validatorClass());
     }
 }
 protected function _initFields()
 {
     parent::_initFields();
     $this->add(new Kwf_Form_Field_Radio('gender', trlKwfStatic('Gender')))->setAllowBlank(false)->setValues(array('female' => trlKwfStatic('Female'), 'male' => trlKwfStatic('Male')))->setCls('kwf-radio-group-transparent');
     $this->add(new Kwf_Form_Field_TextField('title', trlKwfStatic('Title')));
     $this->add(new Kwf_Form_Field_TextField('firstname', trlKwfStatic('Firstname')))->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_TextField('lastname', trlKwfStatic('Lastname')))->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_TextField('email', trlKwfStatic('E-Mail')))->setVtype('email')->setAllowBlank(false);
     $this->_addEmailValidator();
 }
Exemplo n.º 16
0
 protected function _initFields()
 {
     parent::_initFields();
     $this->add(new Kwf_Form_Field_TextField('title', trlKwf('Title')))->setAllowBlank(false)->setWidth(300);
     $this->add(new Kwf_Form_Field_ShowField('original_title', trlKwf('Original')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('title'));
     $this->add(new Kwf_Form_Field_TextField('place', trlKwf('Place (City)')))->setWidth(300);
     $this->add(new Kwf_Form_Field_ShowField('original_place', trlKwf('Original')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('place'));
     $this->add(new Kwf_Form_Field_TextArea('teaser', trlKwf('Teaser')))->setWidth(300)->setHeight(100);
     $this->add(new Kwf_Form_Field_ShowField('original_teaser', trlKwf('Original')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('teaser'));
 }
Exemplo n.º 17
0
 public function testUrl()
 {
     $m1 = new Kwf_Model_FnF();
     $form = new Kwf_Form();
     $form->setModel($m1);
     $field1 = $form->add(new Kwf_Form_Field_UrlField('test'));
     $post = array($field1->getFieldName() => 'http://www.örf.at');
     $post = $form->processInput($form->getRow(), $post);
     $form->validate($form->getRow(), $post);
     $form->prepareSave(null, $post);
     $form->save(null, $post);
     $row = $m1->getRow($m1->select());
     $this->assertEquals('http://www.xn--rf-eka.at', $row->test);
     $loadData = $field1->load($row);
     $this->assertEquals('http://www.örf.at', $loadData['test']);
 }
Exemplo n.º 18
0
 public function testEMail()
 {
     $m1 = new Kwf_Model_FnF();
     $form = new Kwf_Form();
     $form->setModel($m1);
     $field1 = $form->add(new Kwf_Form_Field_EMailField('test'));
     $post = array($field1->getFieldName() => 'ufx@vüvüd-planet.com');
     $post = $form->processInput($form->getRow(), $post);
     $form->validate($form->getRow(), $post);
     $form->prepareSave(null, $post);
     $form->save(null, $post);
     $row = $m1->getRow($m1->select());
     $this->assertEquals('*****@*****.**', $row->test);
     $loadData = $field1->load($row);
     $this->assertEquals('ufx@vüvüd-planet.com', $loadData['test']);
 }
 protected function _init()
 {
     parent::_init();
     $this->add(new Kwf_Form_Field_NumberField('pos', trlKwf('Position')))->setAllowDecimals(false)->setAllowNegative(false)->setWidth(50);
     $this->add(new Kwf_Form_Field_TextField('name', trlKwf('Name')))->setAllowBlank(false);
     $this->add(new Kwf_Form_Field_ColorField('color', trlKwf('Color')))->setDefaultValue('000000');
     $this->add(new Kwf_Form_Field_Select('font_weight', trlKwf('Font Weight')))->setShowNoSelection(true)->setValues(array('normal' => trlKwf('Normal'), 'bold' => trlKwf('Bold'), 'bolder' => trlKwf('Bolder'), 'lighter' => trlKwf('Lighter')));
     $this->add(new Kwf_Form_Field_Select('font_family', trlKwf('Font Family')))->setShowNoSelection(true)->setValues(array('Arial, Verdana, Helvetica, sans-serif' => 'Arial', '"Courier New", Courier, monospace' => 'Courier New', 'Times, "Times New Roman", Georgia, serif' => 'Times New Roman', 'Verdana, Arial, Helvetica, sans-serif' => 'Verdana'));
     $this->add(new Kwf_Form_Field_NumberField('font_size', trlKwf('Font size')))->setAllowNegative(false)->setAllowDecimals(false)->setWidth(50);
     $this->add(new Kwf_Form_Field_TextArea('additional', trlKwf('Additional Styles')))->setHeight(50)->setWidth(200);
 }
Exemplo n.º 20
0
 public function validate($parentRow, array $postData = array())
 {
     $ret = parent::validate($parentRow, $postData);
     if ($this->getAllowEmptyCart() !== true) {
         $row = $this->getRow($parentRow);
         if (!count($row->getChildRows('Products'))) {
             $ret[] = array('field' => null, 'messages' => array($this->getCartEmptyMessage()));
         }
     }
     return $ret;
 }
Exemplo n.º 21
0
 protected function _init()
 {
     parent::_init();
     $this->add(new Kwf_Form_Field_Password('old_password', trlKwfStatic('Current Password')))->addValidator(new Kwf_Validate_UserPassword())->setAllowBlank(false);
     $newPasswordField = $this->add(new Kwf_Form_Field_DoublePassword('new_password', trlKwfStatic('New Password')));
     $validatorClass = Kwf_Registry::get('config')->user->passwordValidator;
     if ($validatorClass) {
         $newPasswordField->getChildren()->getByName('new_password')->addValidator(new $validatorClass());
     }
     $this->add($newPasswordField);
 }
Exemplo n.º 22
0
 protected function _initFields()
 {
     parent::_initFields();
     $this->add(new Kwf_Form_Field_TextField('title', trlKwf('Title')))->setAllowBlank(false)->setWidth(500);
     $this->add(new Kwf_Form_Field_ShowField('original_title', trlKwf('Original')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('title'));
     $this->add(new Kwf_Form_Field_TextArea('teaser', trlKwf('Teaser')))->setWidth(500)->setHeight(100);
     $this->add(new Kwf_Form_Field_ShowField('original_teaser', trlKwf('Original')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('teaser'));
     $this->add(new Kwf_Form_Field_ShowField('original_date', trlKwf('Publication')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('date'))->setTpl('{value:date}');
     $this->add(new Kwf_Form_Field_ShowField('original_author_id', trlKwf('Author')))->setData(new Kwc_Articles_Detail_Trl_Data('author_id'));
     $this->add(new Kwf_Form_Field_ShowField('original_vi_nr', trlKwf('VI-Number')))->setData(new Kwf_Data_Trl_OriginalComponentFromData('vi_nr'));
     $this->add(Kwc_Abstract_Form::createChildComponentForm($this->getClass(), '-previewImage'));
 }
Exemplo n.º 23
0
 protected function _init()
 {
     $this->setModel(new Kwf_Model_FnF());
     $this->add(new Kwf_Form_Field_TextField('firstname', trlStatic('Firstname')));
     $this->add(new Kwf_Form_Field_TextField('lastname', trlStatic('Lastname')));
     $this->add(new Kwf_Form_Field_TextField('company', trlStatic('Company')));
     $this->add(new Kwf_Form_Field_TextField('firstname2', trlKwfStatic('Firstname')));
     $this->add(new Kwf_Form_Field_TextField('lastname2', trlKwfStatic('Lastname')));
     $this->add(new Kwf_Form_Field_TextField('company2', trlKwfStatic('Company')));
     $this->add(new Kwf_Form_Field_TextField('company3', trlKwfStatic('Company') . '-' . trlKwfStatic('Lastname')));
     parent::_init();
 }
Exemplo n.º 24
0
 public function jsonXlsAction()
 {
     if (!isset($this->_permissions['xls']) || !$this->_permissions['xls']) {
         throw new Kwf_Exception("XLS is not allowed.");
     }
     ini_set('memory_limit', "768M");
     set_time_limit(600);
     // 10 minuten
     $row = $this->_form->getRow();
     $primaryKey = $this->_form->getPrimaryKey();
     require_once Kwf_Config::getValue('externLibraryPath.phpexcel') . '/PHPExcel.php';
     $xls = new PHPExcel();
     $xls->getProperties()->setCreator(Kwf_Config::getValue('application.name'));
     $xls->getProperties()->setLastModifiedBy(Kwf_Config::getValue('application.name'));
     $xls->getProperties()->setTitle("KWF Excel Export");
     $xls->getProperties()->setSubject("KWF Excel Export");
     $xls->getProperties()->setDescription("KWF Excel Export");
     $xls->getProperties()->setKeywords("KWF Excel Export");
     $xls->getProperties()->setCategory("KWF Excel Export");
     $xls->setActiveSheetIndex(0);
     $sheet = $xls->getActiveSheet();
     $this->_progressBar = new Zend_ProgressBar(new Kwf_Util_ProgressBar_Adapter_Cache($this->_getParam('progressNum')), 0, count($this->_fields));
     $outputXls = $xls;
     if ($row && $primaryKey) {
         $outputXls = $this->_fillTheXlsFile($xls, $sheet);
     }
     if ($outputXls != NULL) {
         // write the file
         $objWriter = PHPExcel_IOFactory::createWriter($outputXls, 'Excel5');
     } else {
         // write the file
         $objWriter = PHPExcel_IOFactory::createWriter($xls, 'Excel5');
     }
     $downloadkey = uniqid();
     $objWriter->save('temp/' . $downloadkey . '.xls');
     $this->_progressBar->finish();
     $this->view->downloadkey = $downloadkey;
 }
Exemplo n.º 25
0
 public function __construct($name, $class)
 {
     $this->setClass($class);
     if ($class) {
         if (!$this->getModel()) {
             $model = Kwc_Abstract::createOwnModel($class);
             if ($model) {
                 $this->setModel($model);
             }
         }
         $this->setCreateMissingRow(true);
     }
     parent::__construct($name);
 }
Exemplo n.º 26
0
 public function processInput($parentRow, $postData = array())
 {
     if ($this->_model instanceof Kwf_User_EditModel) {
         $id = $this->_getIdByParentRow($parentRow);
         if ($id === 0 || $id === '0' || is_null($id)) {
             $email = null;
             if ($this->getByName('email') && isset($postData[$this->getByName('email')->getFieldName()])) {
                 $email = $postData[$this->getByName('email')->getFieldName()];
             }
             $this->_newUserRow = $this->_model->createUserRow($email);
         }
     }
     return parent::processInput($parentRow, $postData);
 }
 public function afterSave($parentRow, $postData)
 {
     parent::afterSave($parentRow, $postData);
     foreach ($this->toSaveGeneratorProperty as $i) {
         if (isset($i['row']->component_id)) {
             $id = $i['row']->component_id . '-' . $i['row']->id;
         } else {
             $id = $i['row']->id;
         }
         $data = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($id, array('ignoreVisible' => true, 'limit' => 1));
         if (!$data) {
             throw new Kwf_Exception("Didn't get data for {$id}");
         }
         $i['plugin']->saveGeneratorPropertyValue($data, $i['value']);
     }
 }
Exemplo n.º 28
0
 protected function _init()
 {
     $this->setModel(new Kwf_Model_FnF());
     $this->add(new Kwf_Form_Field_TextField('fullname', 'Name'))->setAllowBlank(false);
     $cards = $this->fields->add(new Kwf_Form_Container_Cards('type', trl('Example')));
     $cards->getCombobox()->setDefaultValue('foo');
     $card = $cards->add();
     $card->setName('foo');
     $card->setTitle('Foo');
     $card->fields->add(new Kwf_Form_Field_TextField('foo_value', trl('Foo')))->setAllowBlank(false);
     $card = $cards->add();
     $card->setName('bar');
     $card->setTitle('Bar');
     $card->fields->add(new Kwf_Form_Field_TextField('bar_value', trl('Bar')))->setAllowBlank(false);
     parent::_init();
 }
Exemplo n.º 29
0
 public function __construct($name, $class, $dbId)
 {
     parent::__construct($name);
     $model = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($class, 'categoryToItemModelName'));
     $this->setModel($model->getReferencedModel('Item'));
     $this->setIdTemplate('{0}');
     $this->setCreateMissingRow(true);
     $fs = $this->add(new Kwf_Form_Container_FieldSet(trlKwf('Categories')));
     $categoryModel = $model->getReferencedModel('Category');
     $select = $categoryModel->select()->whereEquals('component_id', $dbId)->whereNull('parent_id')->order('pos');
     $cols = $fs->add(new Kwf_Form_Container_Columns());
     foreach ($categoryModel->getRows($select) as $category) {
         $col = $cols->add();
         $s = new Kwf_Model_Select();
         $s->whereEquals('parent_id', $category->id);
         $col->add(new Kwf_Form_Field_MultiCheckbox($model, 'Category', $category->name))->setShowCheckAllLinks(false)->setValuesSelect($s);
     }
 }
Exemplo n.º 30
0
 public function jsonDeleteAction()
 {
     if (!isset($this->_permissions['delete']) || !$this->_permissions['delete']) {
         throw new Kwf_Exception('Delete is not allowed.');
     }
     $row = $this->_form->getRow();
     if (!$this->_hasPermissions($row, 'delete')) {
         throw new Kwf_Exception("Delete is not allowed for this row.");
     }
     $db = Zend_Registry::get('db');
     if ($db) {
         $db->beginTransaction();
     }
     $this->_form->delete(null);
     if ($db) {
         $db->commit();
     }
 }