public function editAction() { $identi = $this->auth->getStorage()->read(); if ($identi != false && $identi != null) { $role = $identi->role; if ($this->isAllow($role)) { $id_personal = (int) $this->params()->fromRoute('id_personal', 0); $cliente = $this->getClientesTable()->getUsuario($id_personal); $form = new ClientesForm(); $form->bind($cliente); $form->get('submit')->setAttribute('value', 'Edit'); $request = $this->getRequest(); if ($request->isPost()) { $form->setInputFilter($cliente->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $this->getClientesTable()->updateUsuario($cliente); // Redirect to list of albums return $this->redirect()->toRoute('clientes'); } } return array('id_personal' => $id_personal, 'form' => $form); } else { return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/clientes/clientes/listar'); } } else { return $this->redirect()->toUrl($this->getRequest()->getBaseUrl() . '/clientes/clientes/login'); } }
public function editAction() { $id_personal = (int) $this->params()->fromRoute('id_personal', 0); $cliente = $this->getClientesTable()->getUsuario($id_personal); $form = new ClientesForm(); $form->bind($cliente); $form->get('submit')->setAttribute('value', 'Edit'); $request = $this->getRequest(); if ($request->isPost()) { $form->setInputFilter($cliente->getInputFilter()); $form->setData($request->getPost()); if ($form->isValid()) { $this->getClientesTable()->updateUsuario($cliente); // Redirect to list of albums return $this->redirect()->toRoute('clientes'); } } return array('id_personal' => $id_personal, 'form' => $form); }