public function preDispatch() { $model = Kwf_Model_Abstract::getInstance('Kwf_Form_MultiCheckbox_DataModel'); $model->setData(array(array('id' => 1))); $this->_model = $model; parent::preDispatch(); }
public function preDispatch() { parent::preDispatch(); $gen = Kwf_Component_Generator_Abstract::getInstance($this->_getParam('class'), 'detail'); $this->_form->setId($this->_getParam('componentId') . $gen->getIdSeparator() . $this->_getParam('id')); $this->_form->setCreateMissingRow(true); }
protected function _beforeSave(Kwf_Model_Row_Interface $row) { parent::_beforeSave($row); if ($this->_getParam('avoid_mailsend')) { $row->setSendMails(false); } }
protected function _beforeInsert(Kwf_Model_Row_Interface $row) { parent::_beforeInsert($row); $row->status = 'ordered'; $row->checkout_component_id = $this->_getParam('componentId'); $row->cart_component_class = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'))->parent->componentClass; }
protected function _hasPermissions($row, $action) { if (isset($row->component_id) && $row->component_id != $this->_getParam('componentId')) { return false; } return parent::_hasPermissions($row, $action); }
protected function _initFields() { parent::_initFields(); $authedUser = Kwf_Registry::get('userModel')->getAuthedUser(); $hasPassword = false; $allowPassword = true; foreach (Kwf_Registry::get('userModel')->getAuthMethods() as $auth) { if ($auth instanceof Kwf_User_Auth_Interface_Password) { $hasPassword = true; } if ($auth instanceof Kwf_User_Auth_Interface_Redirect) { if (!$auth->allowPasswordForUser($authedUser) && $allowPassword) { $allowPassword = false; } } } if ($hasPassword && $allowPassword) { $fs = $this->_form->add(new Kwf_Form_Container_FieldSet(trlKwf('Change password'))); $fs->setLabelWidth(130); $passwordField = $fs->add(new Kwf_Form_Field_Password('password1', trlKwf('Change password'))); $validatorClass = Kwf_Registry::get('config')->user->passwordValidator; if ($validatorClass) { $passwordField->addValidator(new $validatorClass()); } $fs->add(new Kwf_Form_Field_Password('password2', trlKwf('Repeat password'))); } }
protected function _beforeSave(Kwf_Model_Row_Interface $row) { parent::_beforeSave($row); if ($row->status == 'start') { $row->start_date = null; } }
protected function _initFields() { parent::_initFields(); $this->_form->setId(1); $this->_form->add(new Kwf_Form_Field_File('WelcomeImage', trlKwf('Welcome-Image'))); $this->_form->add(new Kwf_Form_Field_File('LoginImage', trlKwf('Login-Image'))); $this->_form->add(new Kwf_Form_Field_HtmlEditor('content', 'Content'))->setEnableLinks(false)->setEnableFont(false); }
protected function _initFields() { parent::_initFields(); $this->_form->add(new Kwf_Form_Field_ShowField('code', trlKwf('Code'))); $this->_form->add(new Kwf_Form_Field_NumberField('amount', trlcKwf('Amount of Money', 'Amount')))->setWidth(50)->setComment('€'); $this->_form->add(new Kwf_Form_Field_DateField('date', trlKwf('Date')))->setDefaultValue(date('Y-m-d')); $this->_form->add(new Kwf_Form_Field_TextArea('comment', trlKwf('Comment')))->setWidth(250)->setHeight(70); }
protected function _beforeSave(Kwf_Model_Row_Interface $row) { parent::_beforeSave($row); foreach ($this->_colNames as $colName) { if (!$row->{$colName}) { unset($row->{$colName}); } } }
protected function _beforeInsert(Kwf_Model_Row_Interface $row) { parent::_beforeInsert($row); $row->subscribe_date = date('Y-m-d H:i:s'); if ($row->getModel()->hasColumn('activated')) { $row->activated = 1; } $row->newsletter_component_id = $this->_getParam('newsletterComponentId'); }
public function jsonSaveAction() { parent::jsonSaveAction(); $session = new Kwf_Session_Namespace('Kwf_AutoForm_Test'); if ($session->count == 0) { $session->count++; throw new Kwf_Exception('error'); } }
public function indexAction() { parent::indexAction(); $this->view->assign(Kwc_Admin::getInstance($this->_getParam('class'))->getExtConfig()); $this->view->baseParams = array('id' => $this->_getParam('componentId'), 'componentId' => $this->_getParam('componentId')); if ($this->getRequest()->module == 'component_test' && isset($this->view->controllerUrl)) { $this->view->controllerUrl = str_replace('/admin/component/edit/', '/kwf/componentedittest/' . Kwf_Component_Data_Root::getComponentClass() . '/', $this->view->controllerUrl); } }
protected function _beforeInsert(Kwf_Model_Row_Interface $row) { parent::_beforeInsert($row); $row->customer_id = $this->_getParam('customer_id'); $authedUser = Kwf_Registry::get('userModel')->getAuthedUser(); if ($authedUser) { $row->insert_uid = $authedUser->id; } }
public function init() { if ($this->_getParam('testDb')) { Kwf_Test_SeparateDb::setDbAndCreateCookie($this->_getParam('testDb')); } else { Kwf_Test_SeparateDb::setDbFromCookie(); } parent::init(); }
protected function _hasPermissions($row, $action) { $ret = Kwf_Controller_Action_Auto_Form::_hasPermissions($row, $action); if ($ret) { $c = Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'), array('ignoreVisible' => true, 'limit' => 1)); if ($row->newsletter_component_id != $c->parent->dbId) { return false; } } return $ret; }
protected function _hasPermissions($row, $action) { $ret = parent::_hasPermissions($row, $action); $acl = Zend_Registry::get('acl'); if ($ret) { foreach (Kwf_Component_Data_Root::getInstance()->getComponentsByDbId($row->domain_component_id, array('limit' => 1)) as $d) { if (!$acl->getComponentAcl()->isAllowed(Kwf_Registry::get('userModel')->getAuthedUser(), $d)) { $ret = false; break; } } } return $ret; }
protected function _beforeInsert(Kwf_Model_Row_Interface $row) { parent::_beforeInsert($row); if (!$row->tag) { $row->tag = 'span'; } $pattern = Kwc_Abstract::getSetting($this->_getParam('componentClass'), 'stylesIdPattern'); if ($pattern) { //todo: wenns irgendwann berechtigungen gibt hier auch überprüfen ob der aktuelle //user diese componentClass & component_id bearbeiten darf if (preg_match('#' . $pattern . '#', $this->_getParam('componentId'), $m)) { $row->ownStyles = $m[0]; } } }
protected function _beforeSave(Kwf_Model_Row_Interface $row) { parent::_beforeSave($row); $mail = new Kwf_Mail(); $user = Kwf_Registry::get('userModel')->getAuthedUser(); $mail->setReturnPath('noreply@' . preg_replace('#^www\\.#', '', Kwf_Config::getValue('server.domain'))); $mail->setFrom($user->email, $user->__toString()); foreach (Kwf_Registry::get('config')->developers as $dev) { if (isset($dev->sendClearCacheReport) && $dev->sendClearCacheReport) { $mail->addTo($dev->email); } } $mail->setSubject('Clear Cache Report. Affected: ' . $row->clear_cache_affected); $mail->setBodyText("Clear Cache Report\n\n" . "Web: " . Kwf_Registry::get('config')->application->name . " (" . Kwf_Registry::get('config')->application->id . ")\n" . "User: "******"\n" . "Time: " . date("d.m.Y, H:i:s") . "\n\n" . "Affected component / part:\n" . $row->clear_cache_affected . "\n\n" . "Steps to reproduce / description:\n" . $row->clear_cache_comment . "\n"); $mail->send(); $row->clear_cache_affected = ''; $row->clear_cache_comment = ''; }
protected function _initFields() { parent::_initFields(); $form = $this->_form; $form->add(new Kwf_Form_Field_ShowField('date', trlKwf('Time')))->setTpl('{value:localizedDatetime}'); $form->add(new Kwf_Form_Field_ShowField('type', trlKwf('Type'))); $form->add(new Kwf_Form_Field_ShowField('exception', 'Exception')); $form->add(new Kwf_Form_Field_ShowField('message', trlKwf('Message'))); $form->add(new Kwf_Form_Field_ShowField('thrown', 'Thrown')); $form->add(new Kwf_Form_Field_ShowField('exception_detail', trlKwf('Detail')))->setTpl('<pre>{value:nl2Br}</pre>'); $form->add(new Kwf_Form_Field_ShowField('request_uri', 'Uri'))->setTpl('{value:clickableLink}'); $form->add(new Kwf_Form_Field_ShowField('useragent', 'User Agent')); $form->add(new Kwf_Form_Field_ShowField('http_referer', 'Referer'))->setTpl('{value:clickableLink}'); $form->add(new Kwf_Form_Field_ShowField('user', trlKwf('User'))); $form->add(new Kwf_Form_Field_ShowField('get', '$_GET'))->setTpl('<pre>{value:nl2Br}</pre>'); $form->add(new Kwf_Form_Field_ShowField('post', '$_POST'))->setTpl('<pre>{value:nl2Br}</pre>'); $form->add(new Kwf_Form_Field_ShowField('files', '$_FILES'))->setTpl('<pre>{value:nl2Br}</pre>'); $form->add(new Kwf_Form_Field_ShowField('session', '$_SESSION'))->setTpl('<pre>{value:nl2Br}</pre>'); $form->add(new Kwf_Form_Field_ShowField('server', '$_SERVER'))->setTpl('<pre>{value:nl2Br}</pre>'); }
protected function _getWhere() { $ret = parent::_getWhere(); $ret['id = ?'] = $this->_getParam('id'); return $ret; }
public function indexAction() { parent::indexAction(); $this->view->assetsPackage = new Kwf_Assets_Package_TestPackage('Kwf_Form_FileUpload'); $this->view->viewport = 'Kwf.Test.Viewport'; }
public function indexAction() { parent::indexAction(); $this->view->xtype = 'kwf.autoformex'; }
public function jsonSaveAction() { parent::jsonSaveAction(); //don't send added id because we use a FnF model where this entry can't get edited anyway unset($this->view->data['addedId']); }
public function preDispatch() { $categoryToItemModel = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting($this->_getParam('class'), 'categoryToItemModelName')); $this->_model = $categoryToItemModel->getReferencedModel('Category'); parent::preDispatch(); }
protected function _initFields() { parent::_initFields(); $this->_form = new Kwc_Root_Category_Trl_GeneratorForm(null, $this->_getParam('class')); $this->_form->setId($this->_getParam('id')); }
public function preDispatch() { $this->_model = Kwf_Model_Abstract::getInstance('Kwf_Form_MultiFields_TestModel1'); parent::preDispatch(); }
protected function _beforeInsert(Kwf_Model_Row_Interface $row) { parent::_beforeInsert($row); $row->customer_id = $this->_getParam('customer_id'); }
protected function _beforeValidate(array $postData) { parent::_beforeValidate($postData); //don't save hidden forms if ($this->_componentField) { $component = $postData[$this->_componentField->getFieldName()]; $formsForComponent = $this->_componentField->getFormsForComponent(); $visibleForms = $formsForComponent[$component]; foreach ($this->_dynamicForms as $f) { if (!in_array($f->getName(), $visibleForms)) { $this->_form->fields->remove($f); } } } }