/** * Aktualizacja zapytania * * @param Base_Form_Abstract $form formularz z danymi do zapisania * @param integer $id id kontaktu do poprawienia * @return integer ilość poprawionych wierszy */ public function updateFeedback($form, $id) { $feedback = new Feedback(); $data = $feedback->findOne($id); $data->setFromArray($form->getValues()); return $data->save(); }
/** * Aktualizacja komunikatu * * @param Base_Form_Abstract $form formularz z danymi do zapisania * @param integer $id id komunikatu do poprawienia * @return integer ilość poprawionych wierszy */ public function updateMessage($form, $id) { $komunikat = new Message(); $data = $komunikat->findOne($id); $data->setFromArray($form->getValues()); return $data->save(); }
public function getValues() { $values = parent::getValues(); $tmp = array(); foreach ($values as $name => $value) { if ($value == 1) { $tmp[] = $this->cbidfromname($name); } } return $tmp; }
/** * Ustawia wartosci filtrow * * Nie wymaga przeslania danych via POST * * @param Zend_Controller_Request_Http $request * @return Logic_Search_Abstract */ public function setFilterDataFromRequest(Zend_Controller_Request_Http $request) { if (!is_object($this->_form)) { throw new Logic_Search_Exception('Nie ustanowiono obiektu formularza filtrow'); } if ($this->_form->isValid($request->getParams())) { $this->saveFilterData($this->_form->getValues()); } $this->_form->setDefaults($this->getFilterData()); return $this; }
public function getValues() { $values = parent::getValues(); $tmp = array(); foreach ($values as $name => $value) { if ($value) { $tmp_name = explode('_', $name); $tmp[$tmp_name[0]][] = $tmp_name[1]; } } return $tmp; }
/** * @param Base_Form_Abstract $form * @return mixed */ protected function _createDictionary($form) { $dictionary = new Dictionary(); $values = $form->getValues(); $new_id = $dictionary->getAdapter()->query('SELECT MAX(id)+1 as max FROM dictionary')->fetch(); $values['id'] = $new_id['max']; $val['created_by'] = Zend_Auth::getInstance()->getIdentity()->id; $data = $dictionary->createRow($values); $id = $data->save(); $logger = Zend_Registry::get('logger'); $message['messages']['Dictionary'][$id] = 'Dictionary added.'; Zend_Registry::set('logger', array_merge($logger, $message)); return $id; }
/** * @param integer $id * @param Base_Form_Abstract $form * @throws Logic_Ws_Exception * @return void */ public function updateClient($id, Base_Form_Abstract $form) { $values = $form->getValues(); $ipAddress = $values['ip_address']; unset($values['ip_address']); if (empty($values['code'])) { unset($values['code']); } $clientIpModel = new WsClientHasWsSaveip(); try { if (intval($values['shipping_type']) === Logic_Ws_ServiceSet_ServiceSet::SHIPPING_TYPE_API && !empty($values['code'])) { $values['code'] = sha1($values['code']); } $oldRow = $this->findOne($id); $oldRow->setFromArray($values); $oldRow->save(); $clientIpModel->deleteIP($id); foreach ($ipAddress as $val) { if (intval($val) > 0) { $clientIpModel->insertClientIP(array('ws_client_id' => $id, 'ws_saveip_id' => $val)); } } } catch (Exception $e) { throw new Logic_Ws_Exception($e->getMessage()); } }
public function getValues($suppressArrayNotation = true) { $values = parent::getValues($suppressArrayNotation); $values['user'] = Zend_Controller_Action_HelperBroker::getStaticHelper('IdConvert')->hexToStr($values['user']); return $values; }
/** * Aktualizacja roli i jej uprawnień * * @param Base_Form_Abstract $form formularz z danymi do zapisania * @param integer $id id edytowanej roli * @return integer liczba zmienionych wierszy */ public function updateRole($form, $id) { $roleModel = new Role(); $roleGroupModel = new RoleGroup(); $dane = $values = $form->getValues(); $subForms = $form->getSubForms(); foreach ($subForms as $subForm) { unset($dane[get_class($subForm)]); } $roleModel->getAdapter()->beginTransaction(); try { $tmp = $roleModel->update($dane, 'id = ' . $id); $roleGroupModel->delete('id_role = ' . $id); foreach ($subForms as $subForm) { $groups = $values[get_class($subForm)]; foreach ($groups['group'] as $group) { $subValues['id_group'] = $group; $subValues['id_role'] = $id; $row = $roleGroupModel->createRow($subValues); $row->save(); } } $roleModel->getAdapter()->commit(); $cm = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager'); $cache = $cm->getCache('rolecache'); $cache->clean(Zend_Cache::CLEANING_MODE_ALL); } catch (Exception $e) { $roleModel->getAdapter()->rollBack(); throw $e; } return $tmp; }
/** * Aktualizacja ról, które mają dostęp do filtra * * @param Base_Form_Abstract $form formularz z danymi do zapisania * @param integer $id id filtra * @return integer ilość poprawionych wierszy */ public function shareFilter($form, $id) { $model = new RoleFilterResource(); $values = $form->getValues(); $model->getAdapter()->beginTransaction(); $filters = $model->fetchAll('id_filter = ' . $id); foreach ($filters as $filter) { $filter->delete(); } $ret = 0; try { foreach ($values as $role_id) { $tmp = $model->createRow(array('id_filter' => $id, 'id_role' => $role_id)); $tmp->save(); $ret++; } $model->getAdapter()->commit(); $cm = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager'); $cache = $cm->getCache('rolecache'); $cache->clean(Zend_Cache::CLEANING_MODE_ALL); } catch (Exception $e) { $model->getAdapter()->rollBack(); } return $ret; }
/** * * @param Base_Form_Abstract $form * @param type $id * @throws Logic_Ws_Exception */ public function updateIP(Base_Form_Abstract $form, $id) { $values = $form->getValues(); $clients = $values['clients']; unset($values['clients']); $clientIpModel = new WsClientHasWsSaveip(); try { $oldRow = $this->findOne($id); $oldRow->setFromArray($values); $oldRow->save(); $clientIpModel->deleteClients($id); foreach ($clients as $val) { $clientIpModel->insertClientIP(array('ws_client_id' => $val, 'ws_saveip_id' => $id)); } } catch (Exception $e) { throw new Logic_Ws_Exception($e->getMessage()); } }
public function getValues($suppressArrayNotation = true) { $values = parent::getValues($suppressArrayNotation); $values['ip'] = $this->getValue('ip'); return $values; }
/** * Zapisywanie winformacji o wysyłce * @param Base_Form_Abstract $form * @return type * @throws Logic_Ws_Exception */ public function sendAndSaveComplaint(Base_Form_Abstract $form, $complaint_id) { $values = $form->getValues(); $identity = Zend_Auth::getInstance()->getIdentity(); $values['created_by'] = $identity->id; if (!empty($identity->email)) { $values['replyto'] = $identity->email; } else { throw new Logic_Ws_Exception('Replyer mail empty. Cannot send complaint!'); } $cfg = Zend_Registry::get('config'); $values['recipient_mail'] = $cfg['complaint']['recipient']; $this->sendComplaint($values, $complaint_id); $row = $this->findOne($complaint_id); $row->setFromArray(array('send_at' => date('c'), 'send_by' => $identity->id)); $id = $row->save(); }
/** * Aktualizacja zasobów(grup) dla profilu * * @param Base_Form_Abstract $form formularz z danymi do zapisania * @param integer $id id profilu * @return integer ilość poprawionych wierszy */ public function _updateGroupResource($form, $id) { $profileResourceDenyModel = new ProfileResourceDeny(); $values = $form->getValues(); $profileResourceDenyModel->delete('id_profile = ' . $id); $profileResourceDenyModel->getAdapter()->beginTransaction(); $tmp = 0; $ret = 0; try { foreach ($values['group'] as $group_id) { $tmp = $profileResourceDenyModel->insert(array('id_profile' => $id, 'id_group' => $group_id)); } $ret += $tmp; $tmp = 0; $profileResourceDenyModel->getAdapter()->commit(); $cache = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('cachemanager')->getCache('rolecache'); $cache->clean(Zend_Cache::CLEANING_MODE_ALL); } catch (Exception $e) { $profileResourceDenyModel->getAdapter()->rollBack(); } return $ret; }