Exemplo n.º 1
0
 /**
  * @return void
  */
 public function editAction()
 {
     $request = $this->getRequest();
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     $form = new Logic_Ws_Sms_Blacklist_Form_Generic();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             try {
                 $values = $form->getValues();
                 if (!empty($values['ws_service_id'])) {
                     foreach ($values['ws_service_id'] as $service) {
                         $val['ws_service_id'] = $service;
                         $val['number_comment'] = $values['number_comment'];
                         $val['phone_number'] = $values['phone_number'];
                         $this->_model->editBlackList($id, $val);
                     }
                 } else {
                     $this->_model->editBlackList($id, $values);
                 }
                 $this->_helper->messenger->success();
                 $this->_helper->redirector('index');
                 return;
             } catch (Logic_Exception $e) {
                 $this->_helper->messenger->error();
             }
         }
     } else {
         $form->setDefaults($this->_model->getRecord($id));
     }
     $this->view->form = $form;
 }