public function permissionsAction() { $request = $this->getRequest(); $id = $request->getParam('id'); $id = $this->_helper->IdConvert->hexToStr($id); if (empty($id)) { $this->_helper->messenger->error('Nie podano parametru ID'); return null; } $clientModel = new WsClient(); $data = $clientModel->findOne($id); $form = new Logic_Ws_Client_Form_Permissions($data->shipping_type); if ($this->getRequest()->isPost()) { if ($form->isCancelled($this->getRequest()->getPost())) { $this->_helper->redirector('index', null, null); return; } if ($form->isValid($request->getPost())) { $post = $request->getPost(); try { $clientModel->updatePermissionsToGroup($form, $id); $this->_helper->messenger("success", 'Zmiany w uprawnieniach zostały zapisane.'); $this->_helper->redirector('index'); return; } catch (Logic_Uzytkownik_Exception $e) { $this->_helper->messenger('error', MSG_ERROR, $e); } } } else { $depTables = array('sms' => 'WsClientHasServiceGroup', 'mail' => 'WsClientHasServiceGroup', 'sset' => 'WsClientHasServiceSet'); foreach ($depTables as $key => $table) { $select = $this->_model->getTableFromString($table)->select()->where('ghost = ?', 'FALSE'); $groups = $data->findDependentRowset($table, null, $select); $form->setDefaults($groups->toArray(), $key); } $limits = $data->findDependentRowset('WsServiceSetLimits'); $form->setLimits($limits->toArray()); } $this->view->form = $form; }