Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: None  |  size: 1.12 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. public function editAction()
  2.     {
  3.         $form = new Application_Form_DeliveryOptions();
  4.         $form->submit->setLabel('Save');
  5.         $this->view->form = $form;
  6.  
  7.  
  8.         if($this->getRequest()->isPost()){
  9.                 $formData = $this->getRequest()->getPost();
  10.                 if($form->isValid($formData)){
  11.                         $id = (int)$form->getValue('id');
  12.                         $option_name = $form->getValue('option_name');
  13.                         $option_value = $form->getValue('option_value');
  14.                         $options = new Application_Model_DbTable_DeliveryOptions();
  15.                         $options->updateOption($id, $option_name, $option_value);
  16.                         $this->_helper->redirector('index');
  17.                 }else{
  18.                         $form->populate($formData);
  19.                 }
  20.         }else{
  21.                 $id = $this->_getParam('id',0);
  22.                 if($id >0) {
  23.                         $options = new Application_Model_DbTable_DeliveryOptions();
  24.                         $form->populate($options->getOption($id));
  25.                 }
  26.         }
  27.     }