PHP User::findOne Examples

PHP User::findOne - 30 examples found. These are the top rated real world PHP examples of User::findOne extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public function reminder($id_user)
 {
     $i = 0;
     if (Zend_Registry::isRegistered('Zend_Translate')) {
         $translator = Zend_Registry::get('Zend_Translate');
     }
     if (!$id_user || $id_user == null) {
         $modelReminder = new Reminder();
         $dataReminders = $modelReminder->fetchToSendEmailAll();
     } elseif ($id_user) {
         $modelReminder = new Reminder();
         $dataReminders = $modelReminder->fetchToSendEmail($id_user);
     }
     foreach ($dataReminders as $dataReminder) {
         $modelUser = new User();
         $dataUsers = $modelUser->findOne($dataReminder['created_by']);
         $userEmail = $dataUser['email'];
         $this->view->description = str_replace("ó", "ó", strip_tags($dataReminder['description']));
         $body = $this->view->render('/_mail/reminder.phtml');
         $client = new Logic_MailerAdapter();
         $client->mail($userEmail, $translator->translate('Reminder') . ' - ' . $dataReminder['title'], array('type' => 1, 'content' => $body));
         $modelReminder->setAsSent($dataReminder['id']);
         $i++;
     }
     return $i;
 }
Example #2
0
 /**
  * @param string $email
  * @return app\models\User|null User
  */
 public static function findByEmail($email)
 {
     $dbUser = User::findOne(['email' => $email]);
     if ($dbUser) {
         return UserIdent::initFromDbInstance($dbUser);
     }
     return null;
 }
Example #3
0
 public function testModel()
 {
     $this->assertEquals(User::find(1)->email, 'email1@example.com');
     $this->assertEquals(User::first()->email, 'email1@example.com');
     $this->assertEquals(User::last()->email, 'email3@example.com');
     $this->assertEquals(User::count(), 3);
     $this->assertEquals(User::findOne(['email'], ['email1@example.com'])->email, 'email1@example.com');
     $this->assertEquals(User::findOne(['first_name', 'last_name'], ['John', 'Doe'])->email, 'email1@example.com');
     $this->assertCount(3, User::all());
 }
Example #4
0
 protected function testAction()
 {
     $translate = $this->application->getBootstrap()->getResource('translate');
     $view = $this->application->getBootstrap()->getResource('view');
     $view->setScriptPath(APPLICATION_PATH . '/views/scripts');
     $u = new User();
     $u_row = $u->findOne($_SERVER['argv'][6]);
     $mailer = new Logic_Mailer($view, $translate);
     $mailer->userPass('asdf', $u_row);
 }
Example #5
0
 public static function getList()
 {
     $time = time();
     $return = [];
     foreach (self::find()->asArray()->all() as $item) {
         $user = User::findOne($item['user_id']);
         if ($user) {
             $inactiveSince = $time - $item['last_timestamp'];
             $return[] = ['firstname' => $user->firstname, 'lastname' => $user->lastname, 'email' => $user->email, 'last_timestamp' => $item['last_timestamp'], 'is_active' => $inactiveSince >= 120 ? false : true, 'inactive_since' => round($inactiveSince / 60) . ' min'];
         }
     }
     return $return;
 }
Example #6
0
 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             return \Yii::$app->mailer->compose('passwordResetToken', ['user' => $user])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ' robot'])->setTo($this->email)->setSubject(\Yii::t('app', 'Password reset for ') . \Yii::$app->cms->appName)->send();
         }
     }
     return false;
 }
Example #7
0
 public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
 {
     if ($identity = Zend_Auth::getInstance()->getIdentity()) {
         $user = new User();
         $id = $identity->id;
         $userRow = $user->findOne($id)->toArray();
         if ($userRow['tmp_password'] === true && ($request->getControllerName() != 'auth' || $request->getActionName() != 'changepassword')) {
             $conv = new Base_Controller_Action_Helper_IdConvert();
             $id = $conv->strToHex($id);
             $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
             $redirector->setGotoSimple('changepassword', 'auth', null, array('id' => $id));
         }
     }
 }
 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if ($user) {
         if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
             $user->generatePasswordResetToken();
         }
         if ($user->save()) {
             \Yii::$app->mailer->view->theme->pathMap = ArrayHelper::merge(\Yii::$app->mailer->view->theme->pathMap, ['@app/mail' => ['@skeeks/cms/mail-templates']]);
             return \Yii::$app->mailer->compose('@app/mail/password-reset-token', ['user' => $user])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ' robot'])->setTo($this->email)->setSubject(\Yii::t('skeeks/cms', 'Password reset for ') . \Yii::$app->cms->appName)->send();
         }
     }
     return false;
 }
 /**
  * Sends an email with a link, for resetting the password.
  *
  * @return boolean whether the email was send
  */
 public function sendEmail()
 {
     /* @var $user User */
     $user = User::findOne(['status' => User::STATUS_ACTIVE, 'email' => $this->email]);
     if (!$user) {
         return false;
     }
     if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
         $user->generatePasswordResetToken();
     }
     if (!$user->save()) {
         return false;
     }
     return Yii::$app->mailer->compose(['html' => 'passwordResetToken-html', 'text' => 'passwordResetToken-text'], ['user' => $user])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot'])->setTo($this->email)->setSubject('Password reset for ' . \Yii::$app->name)->send();
 }
Example #10
0
 protected function updateWsClientaction()
 {
     $sql = 'SELECT id,login,first_name,surname,email from "user" where ws_client_id is null';
     $model = new User();
     $u = $model->getAdapter()->query($sql);
     $users = $u->fetchAll();
     foreach ($users as $user) {
         $values = array();
         $clientModel = new Wsclient();
         $clientData = array('client_name' => $user['login'], 'pm_name' => $user['first_name'] . ' ' . $user['surname'], 'pm_email' => $user['email'], 'ip_address' => array());
         $newClient = $clientModel->createRow($clientData);
         $values['ws_client_id'] = $newClient->save();
         $row = $model->findOne($user['id']);
         $row->setFromArray($values);
         $row->save();
     }
 }
Example #11
0
 static function currentUser()
 {
     $cookie = new CookieSigner(Config::app()['BASE_KEY']);
     if (isset($_SESSION['userId']) && ($userId = $_SESSION['userId'])) {
         $user = new User();
         return $user->findOne($userId);
     } else {
         if ($userId = $cookie->get('userId')) {
             $user = new User();
             $user->findOne($userId);
             if ($user && $user->isAuthenticated('remember', $cookie->get('rememberToken'))) {
                 self::logIn($user);
                 return $user;
             }
         }
     }
     return null;
 }
 private function logIn()
 {
     $success = false;
     if (!empty($_POST['email']) && !empty($_POST['pass'])) {
         $user = User::findOne(['email' => $_POST['email']]);
         if ($_POST['pass'] === $user->pass) {
             $user->token = Text::generateRandomString();
             $user->save();
             setcookie('user_id', $user->id, 0, '/');
             setcookie('token', $user->token, 0, '/');
             $success = true;
         }
     }
     if ($success) {
         return $this->redirect('/admin');
     }
     return $this->redirect('/log-in?error=1');
 }
Example #13
0
 protected function buildSQl()
 {
     $select = $this->dbModelTable->select();
     $user = new User();
     if (isset($this->filterdata['deleg_no']) and !empty($this->filterdata['deleg_no'])) {
         $select->where('deleg_no = ?', $this->filterdata['deleg_no']);
     }
     if (isset($this->filterdata['employee']) and !empty($this->filterdata['employee'])) {
         $tetaId = $user->findOne($this->filterdata['employee'])->teta_id;
         $select->where('teta_id = ?', $tetaId);
     } else {
         if (isset($this->filterdata['branch']) and !empty($this->filterdata['branch'])) {
             $userRowset = $user->fetchAll('id_branch = ' . $this->filterdata['branch']);
             $inStmt = array();
             foreach ($userRowset as $row) {
                 $inStmt[] = $row->teta_id;
             }
             $select->where('teta_id IN (?)', $inStmt);
         }
     }
     return $select->__toString();
 }
 public function testSave()
 {
     $user = new User();
     $user->name = 'John Doe';
     $this->assertFalse($user->exists);
     $this->assertEquals(0, User::count());
     $this->assertEquals(null, $user->_id);
     $user->save();
     $this->assertTrue($user->exists);
     $this->assertEquals(1, User::count());
     $this->assertEquals('John Doe', $user->name);
     $this->assertInstanceOf('MongoID', $user->_id);
     $test = User::findOne(array('name' => 'John Doe'));
     $this->assertEquals($test, $user);
     // backup id
     $id = $user->_id;
     $user->name = 'Jane Doe';
     $user->save();
     $this->assertEquals('Jane Doe', $user->name);
     $this->assertEquals($id, $user->_id);
     $this->assertNotEquals($test, $user);
 }
Example #15
0
 public static function findIdentityByAccessToken($token, $type = null)
 {
     return User::findOne(['tocken' => $token]);
 }
Example #16
0
 public function getSupervisor()
 {
     $userModel = new User();
     return $userModel->findOne($this->id_supervisor);
 }
Example #17
0
 protected function getMappingUserId()
 {
     $model = new User();
     $user = $model->findOne($this->user_id);
     return $user->first_name . ' ' . $user->surname;
 }
Example #18
0
 public function actionView($id)
 {
     return User::findOne(2);
 }
Example #19
0
 public function actionIndex()
 {
     return User::findOne(2);
 }
 /**
  * Creates a new Message
  * and redirects to it.
  */
 public function actionCreate()
 {
     $userGuid = Yii::$app->request->get('userGuid');
     $model = new CreateMessage();
     // Preselect user if userGuid is given
     if ($userGuid != "") {
         $user = User::findOne(array('guid' => $userGuid));
         if (isset($user)) {
             $model->recipient = $user->guid;
         }
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         // Create new Message
         $message = new Message();
         $message->title = $model->title;
         $message->save();
         // Attach Message Entry
         $messageEntry = new MessageEntry();
         $messageEntry->message_id = $message->id;
         $messageEntry->user_id = Yii::$app->user->id;
         $messageEntry->content = $model->message;
         $messageEntry->save();
         File::attachPrecreated($messageEntry, Yii::$app->request->post('fileUploaderHiddenGuidField'));
         // Attach also Recipients
         foreach ($model->getRecipients() as $recipient) {
             $userMessage = new UserMessage();
             $userMessage->message_id = $message->id;
             $userMessage->user_id = $recipient->id;
             $userMessage->save();
         }
         // Inform recipients (We need to add all before)
         foreach ($model->getRecipients() as $recipient) {
             $message->notify($recipient);
         }
         // Attach User Message
         $userMessage = new UserMessage();
         $userMessage->message_id = $message->id;
         $userMessage->user_id = Yii::$app->user->id;
         $userMessage->is_originator = 1;
         $userMessage->last_viewed = new \yii\db\Expression('NOW()');
         $userMessage->save();
         return $this->htmlRedirect(['index', 'id' => $message->id]);
     }
     return $this->renderAjax('create', array('model' => $model));
 }
Example #21
0
 public function showuserhistoryAction()
 {
     $request = $this->getRequest();
     $id = $this->_helper->IdConvert->hexToStr($request->getParam('id'));
     $logic = new Logic_User();
     $select = $logic->getSqlToUserHistory($id);
     $paginator = new Base_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));
     $paginator->setCurrentPageNumber($request->getParam('page', 1));
     $model = new User();
     $userRow = $model->findOne($id);
     $back = new Zend_Session_Namespace('back');
     $back->referer = '/user/showuserhistory/id/' . $request->getParam('id');
     $this->view->user = $userRow;
     $this->view->paginator = $paginator;
     $this->view->headers = array('id_user', 'created_at', 'message', 'description');
 }
Example #22
0
    echo "\n\n" . $e->getMessage() . "\n\n" . $e->getUsageMessage() . "\n\n";
    exit;
}
if (isset($opts->h)) {
    echo "\n\n" . $opts->getUsageMessage() . "\n\n";
    exit;
}
if (isset($opts->app_env)) {
    defined('APPLICATION_ENV') || define('APPLICATION_ENV', $opts->app_env);
} else {
    echo "\n\nParametr app_env jest wymagany!";
    echo "\n\n" . $opts->getUsageMessage() . "\n\n";
    exit;
}
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$application->bootstrap();
$u = new User();
$u_data = $u->findOne(1)->toArray();
$storageRow = new stdClass();
foreach ($u_data as $key => $value) {
    $storageRow->{$key} = $value;
}
$auth = Zend_Auth::getInstance();
$storage = $auth->getStorage();
$o = new Branch();
$data = $o->findOne(1)->toArray();
$storageRow->jednostka = $data;
$storage->write($storageRow);
Example #23
0
 public function _delete($id, $form)
 {
     $model = new User();
     $formValues = $form->getValues();
     $data = array('ghost' => 't', 'is_locked' => 't');
     $data['timelock_start'] = $data['last_lock_at'] = new Zend_Db_Expr("NOW()");
     /* if ($formValues['blockade_start'] <= date('c')) {
        $data['last_lock_at'] = $formValues['blockade_start'];
        } else { // przyszła data blokady
        $data['timelock_start'] = $formValues['blockade_start'];
        unset($data['ghost']);
        unset($data['is_locked']);
        } */
     if ($formValues['blockade_reason'] !== '') {
         $data['lock_reason'] = $formValues['blockade_reason'];
     }
     $row = $model->findOne($id);
     $oldRow = clone $row;
     $row->setFromArray($data);
     $row->save();
     $log = Zend_Registry::get('admin_log');
     $log->userdelete(array('old' => $oldRow, 'new' => $row));
 }
Example #24
0
 /**
  * Pobranie użytkownika dla profilu
  *
  * @return Row_User
  */
 public function getUser()
 {
     $model = new User();
     return $model->findOne($this->id_user);
 }
Example #25
0
 /**
  * @inheritdoc
  */
 public static function findIdentity($id)
 {
     return User::findOne($id);
 }
Example #26
0
 /**
  * Nadpisana metoda update'u wiersza tabeli z uwzględnieniem mailera
  * @param array $data
  * @return type
  */
 public function setFromArray(array $data)
 {
     $headerMappings = $this->getHeaderMappings();
     if (isset($data['send_mail'])) {
         $this->send_mail = $data['send_mail'];
         unset($data['send_mail']);
     }
     foreach ($data as $key => $value) {
         if (isset($headerMappings[$key]['format'])) {
             switch ($headerMappings[$key]['format']) {
                 case 'currency':
                     $data[$key] = Zend_Locale_Format::getFloat($value);
                     break;
             }
         }
         if ($value == null) {
             $data[$key] = null;
         }
     }
     parent::setFromArray($data);
     if (isset($data['id_state']) && $this->send_mail) {
         $mailer = new Logic_Mailer(Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('view'), $translate);
         $userModel = new User();
         //receiver data
         if (get_called_class() === 'Row_DelegationSettlement') {
             if ($data['id_state'] == Logic_Settlements::STATE_APPROVED_2) {
                 $receiverRow = $userModel->findOne($this->settlement_by);
             } elseif (!is_null($this->created_by)) {
                 $receiverRow = $userModel->findOne($this->created_by);
             } else {
                 $receiverRow = $userModel->findOne($this->settlement_by);
             }
             $delegation = $this->findParentRow('Delegation');
         } else {
             if (get_called_class() === 'Row_Delegation') {
                 if ($data['id_state'] == Logic_Settlements::STATE_APPROVED) {
                     $receiverRow = $userModel->findOne($this->acceptance_by);
                 } else {
                     $receiverRow = $userModel->findOne($this->created_by);
                 }
                 $params['deleg_no'] = $this->deleg_no;
             } else {
                 return $this;
             }
         }
         $params['email'] = $receiverRow->email;
         //diee($params['email']);
         //sender data
         $senderRow = Zend_Auth::getInstance()->getIdentity();
         $params['user_full_name'] = $senderRow->first_name . ' ' . $senderRow->surname;
         $params['departament'] = $senderRow->department;
         $params['KOD_MPK'] = $senderRow->jednostka['symbol'];
         //email body data
         $params['id'] = $this->id;
         if (isset($data['deleg_no'])) {
             $params['deleg_no'] = $data['deleg_no'];
         } elseif (isset($this->deleg_no)) {
             $params['deleg_no'] = $this->deleg_no;
         } elseif (isset($delegation->deleg_no)) {
             $params['deleg_no'] = $delegation->deleg_no;
         }
         try {
             switch ($data['id_state']) {
                 case Logic_Settlements::STATE_ACCEPTED:
                     $mailer->acceptedByDelegation($params);
                     break;
                 case Logic_Settlements::STATE_APPROVED:
                     $mailer->acceptDelegation($params);
                     break;
                 case Logic_Settlements::STATE_APPROVED_2:
                     $mailer->settleDelegation($params);
                     break;
                 case Logic_Settlements::STATE_CORRECTION:
                     $mailer->correctDelegation($params);
                     break;
                 case Logic_Settlements::STATE_SETTLED:
                     $mailer->settledDelegation($params);
                     break;
                 case Logic_Settlements::STATE_APPROVED_ACCOUNTING:
                     $mailer->approvedDelegation($params);
                     break;
                     //                case Logic_Settlements::STATE_SETTLED
             }
         } catch (Exception $e) {
             $messenger = new Base_View_Helper_Messenger();
             $messenger->error($e->getMessage());
         }
     }
     return $this;
 }
Example #27
0
 public function getUserData()
 {
     $user = new User();
     $id = Zend_Auth::getInstance()->getIdentity()->id;
     $userRow = $user->findOne($id);
     $userRowData = $userRow->toArray();
     return $userRowData;
 }
Example #28
0
 public function getCurrentAddress($idUser = null)
 {
     if (null === $idUser) {
         $userData = Zend_Auth::getInstance()->getIdentity();
     } else {
         $user = new User();
         $userData = $user->findOne($idUser);
     }
     if (null === $userData) {
         throw new Exception('Nie udało się pobrać danych użytkownika!');
     }
     return $userData->id_address_history;
 }
Example #29
0
 /**
  *
  * @param bigint $id - id kontaktu
  * @param integer $contentType - id rodzaju akcji po ktorej wybieramy odpowiednia tresc smsa.
  * @return <type>
  *
  * Ustalamy tresc wiadomosci do sms-a.
  */
 public function getSmsDataForContent($id, $contentType, $responsible_adviser = null, $responsible_branch = null)
 {
     $modelContact = new Contact();
     $dataContact = $modelContact->findOne($id);
     /**
      * Zabezpieczenie przeciwko pustemu opiekunowi w wypadku umawiania spotkania z oddzialu przez doradce.
      */
     if ($dataContact['id_guardian'] == '') {
         $dataContact['id_guardian'] = Zend_Auth::getInstance()->getIdentity()->id;
     }
     $this->pl = array('Ą', 'ą', 'Ż', 'ż', 'ź', 'Ź', 'Ć', 'ć', 'Ń', 'ń', 'Ł', 'ł', 'Ś', 'ś', 'Ę', 'ę', 'Ó', 'ó');
     $this->notpl = array('A', 'a', 'Z', 'z', 'z', 'Z', 'C', 'c', 'N', 'n', 'L', 'l', 'S', 's', 'E', 'e', 'O', 'o');
     $modelUser = new User();
     try {
         $dataUser = $modelUser->findOne($dataContact['id_guardian']);
         $userFirstName = str_replace($this->pl, $this->notpl, $dataUser['first_name']);
         $userSurname = str_replace($this->pl, $this->notpl, $dataUser['surname']);
         $smsData['user'] = $userFirstName . ' ' . $userSurname;
         $smsData['advisor_phone'] = $dataUser['phone'];
     } catch (Exception $e) {
         throw new $e();
     }
     $formatHelper = new Base_View_Helper_Format();
     $modelMeeting = new Meeting();
     $dataMeeting = $dataContact->getNextEvent();
     $dataMeeting = $dataMeeting->toArray();
     if ($dataMeeting != null) {
         if ($dataMeeting['event_at'] != null) {
             $values['meeting_at'] = $formatHelper->Format($dataMeeting['event_at'], 'date_time_simple');
         }
     }
     $modelBranch = new Branch();
     if ($responsible_branch != "" && $responsible_branch != null) {
         $dataBranch = $modelBranch->findOne($responsible_branch);
     } else {
         $dataBranch = $modelBranch->findOne($dataMeeting['responsible_branch']);
     }
     $smsData['branch'] = str_replace($this->pl, $this->notpl, $dataBranch['city']) . ' ' . str_replace($this->pl, $this->notpl, $dataBranch['address']);
     $modelContactData = new AdditionalContactData();
     $contactSmsNumber = $modelContactData->getMainSmsNumber($id);
     $contactSmsNumber = $contactSmsNumber->toArray();
     $modelContactData = new AdditionalContactData();
     $contactMainPhoneNumber = $modelContactData->getMainCellPhone($id);
     $contactMainPhoneNumber = $contactMainPhoneNumber->toArray();
     if (isset($contactSmsNumber[0]['data'])) {
         $values['recipient_number'] = '+48' . $contactSmsNumber[0]['data'];
     } elseif (isset($contactMainPhoneNumber[0]['data'])) {
         $values['recipient_number'] = '+48' . $contactMainPhoneNumber[0]['data'];
     } else {
         $values['recipient_number'] = '+48' . $dataContact['cell_phone'];
     }
     $produkty[677] = "zalozenie dzialalnosci";
     $produkty[678] = "ksiegowosc";
     $produkty[679] = "ksiegowosc";
     $produkty[680] = "dotacje";
     $produkty[681] = "kredyt";
     $produkty[682] = "leasing";
     $produkty[683] = "program do faktur";
     $produkty[686] = "emeryture";
     $produkty[687] = "ksiegowosc";
     $produkty[688] = "ZUS";
     $sexWords[1][1] = "Chcialbym";
     $sexWords[1][2] = "probowalem";
     $sexWords[1][3] = "Chcialem";
     $sexWords[2][1] = "Chcialabym";
     $sexWords[2][2] = "probowalam";
     $sexWords[2][3] = "Chcialam";
     $translate = new Zend_View_Helper_Translate();
     $dataSpotkania = array();
     $dataSpotkania['dzienSlownie'] = $translate->translate(date('l', strtotime($values['meeting_at'])));
     $daysLong = array('poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota', 'niedziela');
     $daysShort = array('pon.', 'wto.', 'srod.', 'czwa.', 'pia.', 'sob.', 'niedz.');
     $dataSpotkania['dzienSlownie'] = str_replace($daysLong, $daysShort, $dataSpotkania['dzienSlownie']);
     $dataSpotkania['dzien'] = date('d.m.y', strtotime($values['meeting_at']));
     $dataSpotkania['godzina'] = date('G:i', strtotime($values['meeting_at']));
     $dataSpotkaniaText = $dataSpotkania['dzien'] . ' (' . $dataSpotkania['dzienSlownie'] . '), godz. ' . $dataSpotkania['godzina'];
     if ($dataContact['sex'] == 1) {
         /**
          * Wiadomosci generowane po umowieniu spotkania oraz zmianie we wczesniejszym umowieniu spotkania.
          */
         if ($contentType == 1) {
             $values['sms_content'] = "Witam, zapraszam Pana na spotkanie z Doradca Tax Care: " . $dataSpotkaniaText . ", " . $smsData['branch'] . ", " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 2) {
             if (array_key_exists($dataContact['id_product_type'], $produkty)) {
                 $values['sms_content'] = "Witam! " . $sexWords[$dataUser['sex']][3] . " sie z Panem skontaktowac w zwiazku z wyslanym zapytaniem o " . $produkty[$dataContact['id_product_type']] . ". Zapraszam do kontaktu. " . $smsData['user'] . " tel. 222620000";
             } else {
                 $values['sms_content'] = "Witam! " . $sexWords[$dataUser['sex']][3] . " sie z Panem skontaktowac w zwiazku z wyslanym zapytaniem. Zapraszam do kontaktu. " . $smsData['user'] . " tel. 222620000";
             }
         } elseif ($contentType == 3) {
             if (array_key_exists($dataContact['id_product_type'], $produkty)) {
                 $values['sms_content'] = "Witamy! W zwiazku z wyslanym zapytaniem o " . $produkty[$dataContact['id_product_type']] . " zapraszamy do kontaktu. Czekamy na telefon od Pana pod nr 222620000. Do uslyszenia. Tax Care.";
             } else {
                 $values['sms_content'] = "Witamy! W zwiazku z wyslanym zapytaniem zapraszamy do kontaktu. Czekamy na telefon od Pana pod nr 222620000. Do uslyszenia. Tax Care.";
             }
         } elseif ($contentType == 4) {
             $values['sms_content'] = "Witam, zapraszam Pana na spotkanie z Doradca Tax Care: " . $dataSpotkaniaText . ", " . $smsData['branch'] . ". " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 5) {
             //próbowałam
             $values['sms_content'] = "Witam, " . $sexWords[$dataUser['sex']][2] . " przypomniec o spotkaniu w Tax Care. Bede telefonowac w najblizszym czasie. Licze, ze sie uslyszymy. " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 6) {
             $values['sms_content'] = "Witam, przypominam, ze Doradca Tax Care bedzie czekal na Pana dnia " . $dataSpotkaniaText . ", " . $smsData['branch'] . ". " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 7) {
             $values['sms_content'] = "Witam, w zwiazku z umowionym spotkaniem " . $sexWords[$dataUser['sex']][2] . " sie z Panem skontaktowac. Prosze o kontakt pod numerem 222620000, " . $smsData['user'];
         }
     } else {
         if ($contentType == 1) {
             $values['sms_content'] = "Witam, zapraszam Pania na spotkanie z Doradca Tax Care: " . $dataSpotkaniaText . ", " . $smsData['branch'] . ", " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 2) {
             if (array_key_exists($dataContact['id_product_type'], $produkty)) {
                 $values['sms_content'] = "Witam! " . $sexWords[$dataUser['sex']][3] . " sie z Pania skontaktowac w zwiazku z wyslanym zapytaniem o " . $produkty[$dataContact['id_product_type']] . ". Zapraszam do kontaktu. " . $smsData['user'] . " tel. 222620000";
             } else {
                 $values['sms_content'] = "Witam! " . $sexWords[$dataUser['sex']][3] . " sie z Pania skontaktowac w zwiazku z wyslanym zapytaniem. Zapraszam do kontaktu. " . $smsData['user'] . " tel. 222620000";
             }
         } elseif ($contentType == 3) {
             if (array_key_exists($dataContact['id_product_type'], $produkty)) {
                 $values['sms_content'] = "Witamy! W zwiazku z wyslanym zapytaniem o " . $produkty[$dataContact['id_product_type']] . " zapraszamy do kontaktu. Czekamy na telefon od Pani pod nr 222620000. Do uslyszenia. Tax Care.";
             } else {
                 $values['sms_content'] = "Witamy! W zwiazku z wyslanym zapytaniem zapraszamy do kontaktu. Czekamy na telefon od Pani pod nr 222620000. Do uslyszenia. Tax Care.";
             }
         } elseif ($contentType == 4) {
             $values['sms_content'] = "Witam, zapraszam Pania na spotkanie z Doradca Tax Care " . $dataSpotkaniaText . ", " . $smsData['branch'] . ". " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 5) {
             $values['sms_content'] = "Witam, " . $sexWords[$dataUser['sex']][2] . " przypomniec o spotkaniu w Tax Care. Beda telefonowac w najblizszym czasie. Licze, ze sie uslyszymy. " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 6) {
             $values['sms_content'] = "Witam, przypominam, ze Doradca Tax Care bedzie czekal na Pania dnia " . $dataSpotkaniaText . ", " . $smsData['branch'] . ". " . $smsData['user'] . " tel. 222620000";
         } elseif ($contentType == 7) {
             $values['sms_content'] = "Witam, w zwiazku z umowionym spotkaniem " . $sexWords[$dataUser['sex']][2] . " sie z Pania skontaktowac. Prosze o kontakt pod numerem 222620000, " . $smsData['user'];
         }
     }
     return array('sms_content' => $values['sms_content'], 'recipient_number' => $values['recipient_number']);
 }
 /**
  * Finds the User model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return User the loaded model
  */
 protected function findModel($id)
 {
     if (($model = User::findOne($id)) !== null) {
         return $model;
     } else {
         $this->setHeader(400);
         echo json_encode(array('status' => 0, 'error_code' => 400, 'message' => 'Bad request'), JSON_PRETTY_PRINT);
         exit;
     }
 }