public function createAction() { $this->_helper->layout->setLayout('admin-simple'); $this->view->form = $form = new Ynfeedback_Form_Admin_Status_Create(); if (!$this->getRequest()->isPost()) { return; } if (!$form->isValid($this->getRequest()->getPost())) { $form->color->setValue('<input value="' . $form->getValue('color') . '" type="color" id="color" name="color"/>'); return; } $success = FALSE; $values = $form->getValues(); $db = Engine_Api::_()->getDbtable('status', 'ynfeedback')->getAdapter(); $db->beginTransaction(); try { $table = Engine_Api::_()->getDbtable('status', 'ynfeedback'); $status = $table->createRow(); $status->title = $values['title']; $status->color = $this->_getParam('color'); $status->save(); $success = TRUE; } catch (Exception $e) { $db->rollBack(); throw $e; } $db->commit(); if ($success) { return $this->_forward('success', 'utility', 'core', array('smoothboxClose' => true, 'parentRefresh' => true, 'messages' => 'Add Status sucessful.')); } }
public function init() { parent::init(); $this->setTitle('Edit Status'); $this->submit_btn->setLabel('Edit'); }