protected function _setupValidators() { $rowSet = $this->_service->findDependentRowset('WsServiceValidator', null, $this->_service->select()->where('ghost = ?', 'FALSE')); foreach ($rowSet as $row) { if (class_exists($row->validator_name)) { $validator = $this->_createValidatorInstance($row->validator_name, $row->getValidatorParams()); } $this->addValidator($validator); } }
public function resendAction() { $request = $this->getRequest(); $id = $this->_helper->IdConvert->hexToStr($request->getParam('id')); try { $sms = $this->_model->fetchRow($this->_model->select()->where('id = ?', $id)); $sms = $this->_model->fetchRow($this->_model->select()->from(array('ss' => 'sms.blacklist_storage'))->setIntegrityCheck(false)->joinLeft(array('sr' => 'ws.recipient_sms'), 'ss.sms_recipient_id=sr.id', array('phone_number'))->where('ss.id = ?', $id)); $this->sendSms($sms->ws_service_id, $sms->phone_number, $sms->content_sms); $this->_model->update(array('ghost' => true), $this->_model->getAdapter()->quoteInto('id = ?', $id)); $this->_helper->messenger->success(); $this->_helper->redirector('index'); return; } catch (Logic_Ws_Exception $e) { $this->_helper->error(MSG_ERROR, $e); } }
/** * Dodaje do whitelist wiele numerow telefonow * * Format parsowanego bloku tekstu: * XXAAABBBCCC OPIS-KOMENTARZ * XXAAABBBCCC OPIS-KOMENTARZ * XXAAABBBCCC OPIS-KOMENTARZ * * @return void */ public function addmanyAction() { $form = new Logic_Ws_Sms_Blacklist_Form_Many(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { try { $validator = new Logic_Validate_NumberMobilePhone(); $values = $form->getValues(); $report = ''; $numbers = explode("\n", $values['params']); foreach ($numbers as $val) { $number = ''; $comment = ''; $val = trim($val); if ($val == '') { continue; } if (stripos($val, ' ')) { $number = substr($val, 0, stripos($val, ' ')); $comment = substr($val, stripos($val, ' ')); } else { $number = $val; } $report .= ' ' . $number . ' - '; if (!$validator->isValid($number)) { $report .= "nie poprawny format numeru;"; continue; } if ($this->_model->fetchRow($this->_model->select()->where('phone_number = ?', $number))) { $report .= "obecny na liście;"; continue; } $this->_model->insert(array('phone_number' => trim($number), 'number_comment' => trim($comment))); $report .= "dodany poprawnie;"; } $this->_helper->messenger->success($report); $this->_helper->redirector('index'); return; } catch (Logic_Ws_Exception $e) { $this->_helper->messenger->error($e->getMessage()); } catch (Logic_Exception $e) { $this->_helper->messenger->error(); } } } $this->view->form = $form; }