/** * 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(); }
/** * 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(); }
/** * @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; }
public function setDefaults(array $defaults) { parent::setDefaults($defaults); if ($this->_edit) { $this->getElement('mpk_code_view')->setValue($this->getElement('mpk_code')->getValue()); } }
public function isValid($data) { $isValid = parent::isValid($data); if (empty($data['phone_number']) && empty($data['sms_id']) && (empty($data['date_until']) || empty($data['date_from']))) { $this->addErrorMessage('"Data do" i "Data od" sa wymagane jeżeli nie podasz "SMS ID" lub Numeru telefonu'); return false; } if (empty($data['sms_id']) && empty($data['phone_number'])) { try { $dateCheck = new Zend_Date($data['date_from']); if (!$dateCheck->isEarlier($data['date_until']) and 0 != strcmp($data['date_from'], $data['date_until'])) { $isValid = false; $this->addErrorMessage('"Data do" nie może być wcześniejsza niż "Data od"!'); } $dateSub = new Zend_Date($data['date_until']); $config = Zend_Registry::get('config'); if ($dateSub->sub($dateCheck)->toValue('DD') > $config['search']['mail']['filter']['interval']) { $isValid = false; $this->addErrorMessage('Maksymalny okres z jakiego można wyszukiwać dane to ' . $config['search']['sms']['filter']['interval'] . ' dni'); } } catch (Exception $ex) { $this->addErrorMessage($ex->getMessage()); $isValid = false; } } return $isValid; }
/** * * @param type $options * @param type $backendApplicationId * @param array $appEnvs Tablica instancji na których mają być ustawione limity */ public function __construct($options = null, $backendApplicationId = 0, array $appEnvs = array(), $edit = false) { if (empty($appEnvs)) { $this->_appEnvs = Logic_Ws_Service::getServiceAppEnvs(); } $this->_edit = $edit; parent::__construct($options, $backendApplicationId); }
public function setDefaults(array $defaults) { if ($this->_edit) { $this->getElement('code')->setRequired(false); unset($defaults['code']); } parent::setDefaults($defaults); }
public function getValue($name) { $value = parent::getValue($name); if ($name === 'ip') { $value = explode(PHP_EOL, $value); } return $value; }
public function setDefaults($formDefaults, $subFormDefaults) { $subForms = $this->getSubForms(); foreach ($subForms as $subForm) { $subForm->setDefaults($subFormDefaults); } return parent::setDefaults($formDefaults); }
public function isValid($data) { $return = parent::isValid($data); if ($this->getElement('new_password')->getValue() != $this->getElement('retype_new_password')->getValue()) { $this->getElement('retype_new_password')->addError("Inconsistent with new password"); $return = false; } return $return; }
public function isValid($data) { $this->isValidPartial($data); $passErrors = $this->getElement("ldapPassword")->getErrors(); if (!empty($passErrors)) { $this->getElement("login")->clearValidators(); } return parent::isValid($data); }
public function isValid($data) { $valid = parent::isValid($data); if (empty($data['phone']) && empty($data['email'])) { $this->addErrorMessage('Należy podać numer telefonu bądź adres email'); $valid = false; } return $valid; }
public function isValid($data) { if (in_array(Logic_Ws_ServiceSet_ServiceSet::SHIPPING_TYPE_HTTP, $data['shipping_type'])) { $this->getElement('delimiter')->setRequired(true); $this->getElement('file_type')->setRequired(true); if ($data['file_type'] != Logic_Ws_ServiceSet_ServiceSet::TYPE_ANY) { $this->getElement('message')->setRequired(true); } } return parent::isValid($data); }
/** * 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 isValid($data) { $valid = parent::isValid($data); $date1 = new Zend_Date($data['valid_since']); $date2 = new Zend_Date($data['valid_until']); if ($date1->isLater($date2)) { $this->addError('Nieprawidłowy przedział dat.'); $valid = false; } return $valid; }
public function isValid($data) { $valid = parent::isValid($data); if (!empty($data['send_start']) && !empty($data['send_end'])) { if (strtotime($data['send_start']) >= strtotime($data['send_end'])) { $this->getElement('send_end')->addError('Data do musi być późniejsza niż data od'); $valid = false; } } return $valid; }
public function setDefaults(array $defaults) { if (is_array($defaults) && !empty($defaults) && is_array($defaults[0]) && !empty($defaults[0])) { foreach ($defaults as $key => $row) { $defaults['entry_' . $row['id_entry']] = $row['entry']; unset($defaults[$key]); } $this->preValidation($defaults); } parent::setDefaults($defaults); }
public function getValues() { $values = parent::getValues(); $tmp = array(); foreach ($values as $name => $value) { if ($value == 1) { $tmp[] = $this->cbidfromname($name); } } return $tmp; }
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; }
public function __construct($options = null) { $dict = new Base_Dictionary(); $profileModel = new Profile(); $profilesTmp = $profileModel->fetchAll(array('ghost = false')); $profiles = array(); foreach ($profilesTmp as $profile) { $profiles[$profile->getId()] = $profile->getUser()->login . ' - ' . $profile->getBranch()->web_name; } $this->fromProfile = $this->toProfile = $profiles; // $this->branches = $oddzialModel->fetchAll(array('ghost = false'))->toArray(); parent::__construct($options); }
public function isValid($data) { $maskModel = new WsServiceSmsMask(); $isValid = parent::isValid($data); if ($isValid) { $validMasks = $maskModel->getMaskForServices($data['ws_service_id'], $data['id_mask']); if ($validMasks->count() !== count($data['ws_service_id'])) { $isValid = false; $this->setErrors(array("Wybrana usługa nie obsługuje wybranego nadpisu")); } } return $isValid; }
public function isValid($data) { $isValid = parent::isValid($data); if ($isValid) { $model = new WsTemplate(); $hash = new Logic_Filter_StringToHash(); $template = $model->getTemplateNewest($hash->filter($data['template_name'])); if ($template !== null) { $isValid = FALSE; $this->template_name->addError("Szablon o takiej nazwie już istnieje"); } } return $isValid; }
public function isValid($data) { $phoneCol = $data['phone_heders']; $emailCol = $data['email_heders']; if (!empty($phoneCol) && !empty($emailCol)) { $validator = new Logic_Validate_NotEqual($phoneCol); $validator->setMessage("Kolumna z adresami email musi być inna niż z numerami telefonów"); $this->getElement('phone_heders')->setAttrib('options', array($phoneCol => $phoneCol)); $this->getElement('email_heders')->setAttrib('options', array($emailCol => $emailCol))->addValidator($validator); } $isValid = parent::isValid($data); $certFileName = $this->_receiveFiles('addressbook_import_csv'); return $isValid; }
public function __construct($type, $options = null) { $this->type = $type; if ($this->type === Logic_Ws_ServiceSet_ServiceSet::SHIPPING_TYPE_API) { unset($this->namespace['sset']); } $sms = new WsServiceSmsGroup(); $this->sms = $sms->fetchAll(array('ghost = false'), array('name ASC'))->toArray(); $mail = new WsServiceMailGroup(); $this->mail = $mail->fetchAll(array('ghost = false'), array('name ASC'))->toArray(); $sset = new WsServiceSet(); $this->sset = $sset->fetchAll(array('ghost = false', 'status = ' . Logic_Ws_ServiceSet_ServiceSet::STATE_ACTIVE), array('code_name ASC'))->toArray(); parent::__construct($options); }
public function isValid($data) { $isValid = parent::isValid($data); if (!empty($data['date_for']) && !empty($data['date_to'])) { $date = new Zend_Date(); $date2 = clone $date; $date->setDate($data['date_for'], 'YYYY-MM-dd')->getTimestamp(); $date2->setDate($data['date_to'], 'YYYY-MM-dd')->getTimestamp(); if ($date->isLater($date2)) { $isValid = false; $this->getElement('date_to')->addError("Data do nie może być wcześniejsza niż data od"); } } return $isValid; }
public function isValid($data) { $valid = parent::isValid($data); if ($data['timeblock_end'] !== '') { if (strtotime($data['timeblock_end']) <= strtotime($data['timeblock_start'])) { $this->getElement('timeblock_end')->addError('Data końca blokady musi być późniejsza niż data jej początku'); $valid = false; } } if ($data['timeblock_start'] !== '') { if (strtotime($data['timeblock_start']) < strtotime(date('Y-m-d'))) { $this->getElement('timeblock_start')->addError('Data początku blokady nie może być przeszła'); $valid = false; } } return $valid; }
/** * Walidacja poprawności parametrów * @param array $data */ public function isValid($data) { $isValid = parent::isValid($data); $wsServiceSmsModel = new WsServiceSms(); $wsServiceSmsRow = $wsServiceSmsModel->findOne($data['service_id']); foreach (array('crt', 'pem') as $type) { $this->getElement($type)->addFilter(new Zend_Filter_File_Rename(array('target' => $wsServiceSmsRow->service_login . ".{$type}"))); $certFileName[$type] = $this->_receiveFiles($type); } try { Logic_Ws_Cert::isCertificateValid($certFileName['crt']); } catch (Exception $exc) { $this->getElement('crt')->addError($exc->getMessage()); $isValid = false; } return $isValid; }
public function isValid($data) { $valid = parent::isValid($data); if ($valid) { if (strtotime($data['timelock_start']) < strtotime(date('Y-m-d'))) { $valid = false; $this->getElement('timelock_start')->addError('Data nie może być w ustawiona wprzeszłości'); } if (strtotime($data['timelock_end']) < strtotime(date('Y-m-d'))) { $valid = false; $this->getElement('timelock_end')->addError('Data nie może być w ustawiona wprzeszłości'); } if (strtotime($data['timelock_end']) < strtotime($data['zablokowane_czasowo_start'])) { $valid = false; $this->getElement('timelock_end')->addError('Data końca blokady nie może być w ustawiona przed datą rozpoczęcia blokady'); } } return $valid; }
public function isValid($data) { $serviceSetmodel = new WsServiceSet(); $serviceSetInfo = $serviceSetmodel->getSet($data['ws_service_set_id']); if ($serviceSetInfo === null) { $this->setErrorMessages(array('Brak danych o wysyłce')); } $isValid = parent::isValid($data); if ($isValid) { $this->_receiveFiles('addressbook_import_csv'); if ($serviceSetInfo->file_type == Logic_Ws_ServiceSet_ServiceSet::TYPE_VAR) { $tagsValidator = $this->tagsValidator($data, $serviceSetInfo); if (!empty($tagsValidator)) { $isValid = false; $this->setErrorMessages($tagsValidator); } } } return $isValid; }
public function isValid($data) { $isValid = parent::isValid($data); if ($isValid) { $date = new Zend_Date(); $date2 = clone $date; $date->set($data['date_for'], 'YYYY-MM-dd'); $date2->set($data['date_to'], 'YYYY-MM-dd'); if ($date->getDate()->isLater($date2->getDate())) { $isValid = false; $this->getElement('date_to')->addError('Data do musi być późniejsza niż Data od'); } else { $date->addDay(31); if ($date->getDate()->isEarlier($date2->getDate())) { $isValid = false; $this->getElement('date_to')->addError('Wygenerowanie raportu możliwe jest za dowolny okres obejmujący max 31 dni'); } } } return $isValid; }