function removeAction() { $id = $this->getRequest()->getParam('id', false); $csrf = $this->getRequest()->getParam('csrf', false); if ($id === false) { $this->_helper->flashMessenger(X_Env::_('p_profiles_err_invaliddata')); $this->_helper->redirector('index', 'profiles'); } $profile = new Application_Model_Profile(); Application_Model_ProfilesMapper::i()->find($id, $profile); if (is_null($profile->getId())) { $this->_helper->flashMessenger(X_Env::_('p_profiles_err_invaliddata')); $this->_helper->redirector('index', 'profiles'); } $form = new X_Form(); $form->setMethod(Zend_Form::METHOD_POST)->setAction($this->_helper->url('remove', 'profiles', 'default', array('id' => $profile->getId()))); $form->addElement('hash', 'csrf', array('salt' => __CLASS__, 'ignore' => true, 'required' => false)); $form->addElement('hidden', 'id', array('ignore' => true, 'required' => false)); $form->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('confirm'))); $form->addDisplayGroup(array('submit', 'csrf', 'id'), 'buttons', array('decorators' => $form->getDefaultButtonsDisplayGroupDecorators())); // execute delete and redirect to index if ($form->isValid($this->getRequest()->getPost())) { try { Application_Model_ProfilesMapper::i()->delete($profile); $this->_helper->flashMessenger(X_Env::_('p_profiles_delete_done')); } catch (Exception $e) { $this->_helper->flashMessenger(X_Env::_('p_profiles_err_db')); } $this->_helper->redirector('index', 'profiles'); } $form->setDefault('id', $profile->getId()); $this->view->form = $form; $this->view->profile = $profile; }
function __construct($options = null) { parent::__construct($options); }
function __construct($configs = array(), $options = null) { $this->configs = $configs; parent::__construct($options); }
function confirmAction() { $path = X_Env::decode($this->getRequest()->getParam('path', null)); $type = $this->getRequest()->getParam('type', null); $form = new X_Form(); $form->setMethod(Zend_Form::METHOD_POST)->setAction($this->_helper->url('delete', 'fsthumbs')); $form->addElement('hash', 'csrf', array('salt' => __CLASS__, 'ignore' => true, 'required' => false)); $form->addElement('hidden', 'path', array('ignore' => true, 'required' => false)); $form->addElement('hidden', 'type', array('ignore' => true, 'required' => false)); $form->addElement('submit', 'submit', array('ignore' => true, 'label' => X_Env::_('confirm'))); $form->addDisplayGroup(array('submit', 'csrf', 'id'), 'buttons', array('decorators' => $form->getDefaultButtonsDisplayGroupDecorators())); $form->setDefault('path', X_Env::encode($path))->setDefault('type', $type); $this->view->type = $type; $this->view->path = $path; $this->view->form = $form; $this->view->messages = $this->_helper->flashMessenger->getMessages(); }