当前位置: 首页>>代码示例>>PHP>>正文


PHP Emails::sendTo方法代码示例

本文整理汇总了PHP中Emails::sendTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Emails::sendTo方法的具体用法?PHP Emails::sendTo怎么用?PHP Emails::sendTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Emails的用法示例。


在下文中一共展示了Emails::sendTo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: executor

 public function executor()
 {
     $usersModel = User::model()->findAllNotificationExecutors();
     if (is_array($usersModel)) {
         foreach ($usersModel as $user) {
             foreach ($user->zakaz_executor as $zakaz) {
                 if (isset($user->profile)) {
                     $time = explode(':', $user->profile->notification_time);
                 } else {
                     $time[0] = 0;
                 }
                 if (count($time) < 2) {
                     $time[1] = 0;
                 }
                 $date = date('Y-m-d H:i', strtotime($zakaz->author_informed));
                 $date = strtotime($date) - (int) $time[0] * 60 * 60 - (int) $time[1] * 60;
                 $dateStart = strtotime(date('Y-m-d H:i', $date)) - self::INTERVAL * 60;
                 if (time() > $dateStart && time() <= $date) {
                     echo 'Email zakaz #' . $zakaz->id . "\n";
                     $templatesModel = Templates::model()->findByAttributes(array('type_id' => '32'));
                     if ($templatesModel) {
                         $email = new Emails();
                         $email->from_id = 1;
                         $email->to_id = $user->id;
                         $email->name = $user->full_name;
                         $email->sendTo($user->email, $templatesModel->title, $templatesModel->text);
                     }
                 }
                 // Send message executor, when completion of the point
                 foreach ($zakaz->parts as $stage) {
                     if (isset($user->profile)) {
                         $time = explode(':', $user->profile->notification_time);
                     } else {
                         $time[0] = 0;
                     }
                     if (count($time) < 2) {
                         $time[1] = 0;
                     }
                     $date = date('Y-m-d H:i', strtotime($stage->date));
                     $date = strtotime($date) - (int) $time[0] * 60 * 60 - (int) $time[1] * 60;
                     $dateStart = strtotime(date('Y-m-d H:i', $date)) - self::INTERVAL * 60;
                     if (time() > $dateStart && time() <= $date) {
                         echo 'Email stage zakaz #' . $stage->id . "\n";
                         $templatesModel = Templates::model()->findByAttributes(array('type_id' => '33'));
                         if ($templatesModel) {
                             $email = new Emails();
                             $email->from_id = 1;
                             $email->to_id = $user->id;
                             $email->name = $user->full_name;
                             $email->sendTo($user->email, $templatesModel->title, $templatesModel->text);
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:57,代码来源:EventsCommand.php

示例2: actionSend

 public function actionSend()
 {
     $model = new Emails();
     $this->_prepairJson();
     $orderId = $this->_request->getParam('orderId');
     $typeId = $this->_request->getParam('typeId');
     $back = $this->_request->getParam('back');
     $cost = $this->_request->getParam('cost');
     $order = Zakaz::model()->findByPk($orderId);
     $arr_type = array(Emails::TYPE_18, Emails::TYPE_19, Emails::TYPE_20, Emails::TYPE_21, Emails::TYPE_22, Emails::TYPE_23, Emails::TYPE_24);
     if (in_array($typeId, $arr_type)) {
         $user = User::model()->findByPk($order->executor);
     } else {
         $user = User::model()->findByPk($order->user_id);
     }
     $model->to_id = $user->id;
     $profile = Profile::model()->findAll("`user_id`='{$user->id}'");
     $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
     $title = $rec[0]->title;
     $model->name = $profle->firstname;
     if (strlen($model->name) < 2) {
         $model->name = $user->username;
     }
     $model->login = $user->username;
     $model->num_order = $orderId;
     $model->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
     $model->message = $rec[0]->text;
     $model->price_order = $cost;
     $this->sum_order = $cost;
     $model->sendTo($user->email, $rec[0]->text, $typeId);
     $model->save();
     /*		
     		if (!isset($back)) $back = 'index';
             $this->render($back, [
                 'model'=>$model
             ]);
     */
 }
开发者ID:kibercoder,项目名称:dipstart-development,代码行数:38,代码来源:EmailsController.php

示例3: actionSetTechSpec

 public function actionSetTechSpec()
 {
     $orderId = $_POST['orderId'];
     $val = $_POST['val'];
     $order = Zakaz::model()->findByPk($orderId);
     if (!$order) {
         throw new CHttpException(500);
     }
     $order->technicalspec = $val;
     $order->save();
     if ($val) {
         $criteria = new CDbCriteria();
         if (Company::getId()) {
             $projectFields = $order->getFields();
             if ($projectFields) {
                 foreach ($projectFields as $field) {
                     if ($field->required == ProjectField::REQUIRED_YES_REG_SPAM) {
                         $varname = $field->varname;
                         $value = $order->{$varname};
                         $criteria->addSearchCondition('profile.' . $varname, $value);
                     }
                 }
             }
         }
         $criteria->addSearchCondition('AuthAssignment.itemname', 'Corrector');
         $authors = User::model()->with('profile', 'AuthAssignment')->findAll($criteria);
         if (!empty($authors)) {
             /*$link = $this->createAbsoluteUrl('/project/chat/', ['orderId' => $orderId]);
                        $mail = new YiiMailer();
             		$mail->clearLayout();
                        $mail->setFrom(Yii::app()->params['supportEmail'], Yii::app()->name);
                        $mail->setSubject('Приглашение в проект');
             		$link = 'http://'.$_SERVER['SERVER_NAME'].'/project/chat?orderId='.$orderId;
                        $mail->setBody('<a href="'.$link.'">'.$link.'</a>');*/
             // новая рассылка
             $typeId = Emails::TYPE_26;
             $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
             foreach ($authors as $user) {
                 //$specials = explode(',',$user->profile->specials);
                 //if (!in_array($order->specials, $specials)) continue;
                 $email = new Emails();
                 $email->to_id = $user->id;
                 // to rm ??
                 $email->name = $user->full_name;
                 if (strlen($email->name) < 2) {
                     $email->name = $user->username;
                 }
                 $email->login = $user->username;
                 $email->num_order = $orderId;
                 $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
                 $specials = isset($order->specials) ? $order->specials : $order->specials2;
                 $specials = Catalog::model()->findByPk($specials);
                 $email->specialization = $specials->cat_name;
                 $email->name_order = $order->title;
                 $email->subject_order = $order->title;
                 $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $typeId);
             }
             echo 'send_email';
         } else {
             echo 'no_users';
         }
     }
     Yii::app()->end();
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:64,代码来源:ZakazController.php

示例4: register

 /**
  * Registration user
  */
 public static function register($model, $post, $role = 'Customer')
 {
     $model->attributes = $post;
     if (isset($_COOKIE['partner'])) {
         $model->pid = intval($_COOKIE['partner']);
     }
     if ($model->validate()) {
         $soucePassword = UserModule::generate_password(8);
         $model->password = UserModule::encrypting($soucePassword);
         $model->superuser = 0;
         $model->status = 1;
         if ($model->save()) {
             $AuthAssignment = new AuthAssignment();
             $AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id);
             $AuthAssignment->save();
             if ($role == 'Author') {
                 if ($model->profile == null) {
                     $profile = new Profile();
                     $profile->user_id = $model->id;
                     $profile->mailing_for_executors = 1;
                     $profile->save();
                 }
             }
             $webmasterlog = new WebmasterLog();
             $webmasterlog->pid = $model->pid;
             $webmasterlog->uid = $model->id;
             $webmasterlog->date = date("Y-m-d");
             $webmasterlog->action = WebmasterLog::REG;
             $webmasterlog->save();
             // новая служба системных сообщений
             $type_id = Emails::TYPE_11;
             $email = new Emails();
             $criteria = new CDbCriteria();
             $criteria->order = 'id DESC';
             $criteria->limit = 1;
             $user = User::model()->findAll($criteria);
             $user = $user[0];
             $email->from_id = 1;
             $email->to_id = $user->id;
             $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
             $id = Company::getId();
             $email->company = Company::getName();
             $email->name = $model->full_name;
             $email->login = $model->email;
             $email->password = $soucePassword;
             $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
             $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
             $identity = new UserIdentity($model->email, $soucePassword);
             $identity->authenticate();
             Yii::app()->user->login($identity, 0);
             //$this->redirect(Yii::app()->controller->module->returnUrl[0]);
             return true;
             //Yii::app()->end();
         } else {
             //Yii::app()->user->setFlash('reg_failed',UserModule::t("Sorry, something wrong... :("));
             //$this->refresh();
             echo 'Cant save';
             Yii::app()->end();
         }
     } else {
         return false;
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:66,代码来源:RegistrationController.php

示例5: actionRegistration

 /**
  * Registration user
  */
 public function actionRegistration()
 {
     $model = new RegistrationForm();
     if (isset($_GET['role']) && $_GET['role'] == 'Customer') {
         $role = 'Customer';
     } elseif (isset($_GET['role']) && $_GET['role'] == 'Author') {
         $role = 'Author';
     } elseif (isset($_GET['role']) && $_GET['role'] == 'Manager') {
         $role = 'Manager';
     } else {
         $role = 'Customer';
     }
     if (Yii::app()->user->id && (!Yii::app()->user->hasFlash('reg_success') && !Yii::app()->user->hasFlash('reg_failed'))) {
         $this->redirect(Yii::app()->controller->module->profileUrl);
     } else {
         if (isset($_POST['RegistrationForm'])) {
             $model->attributes = $_POST['RegistrationForm'];
             if ($model->validate()) {
                 $soucePassword = $this->generate_password(8);
                 $model->password = UserModule::encrypting($soucePassword);
                 $model->superuser = 0;
                 $model->status = 1;
                 $model->username = $model->email;
                 if ($model->save()) {
                     $AuthAssignment = new AuthAssignment();
                     $AuthAssignment->attributes = array('itemname' => $role, 'userid' => $model->id);
                     $AuthAssignment->save();
                     //$login_url = '<a href="'.$this->createAbsoluteUrl('/user/login').'">'.Yii::app()->name.'</a>';
                     //UserModule::sendMail($model->email,UserModule::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),UserModule::t("You have registred from {login_url}<br /><br />Your password: {pass}",array('{login_url}'=>$login_url, '{pass}'=>$soucePassword)));
                     // новая служба системных сообщений
                     $type_id = Emails::TYPE_11;
                     $email = new Emails();
                     $criteria = new CDbCriteria();
                     $criteria->order = 'id DESC';
                     $criteria->limit = 1;
                     $user = User::model()->findAll($criteria);
                     $user = $user[0];
                     $email->from_id = 1;
                     $email->to_id = $user->id;
                     $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
                     $title = $rec[0]->title;
                     $body = $rec[0]->text;
                     $id = Campaign::getId();
                     $email->campaign = Campaign::getName();
                     $email->name = $model->full_name;
                     $email->login = $model->username;
                     $email->password = $soucePassword;
                     $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
                     $email->sendTo($user->email, $body, $type_id);
                     $identity = new UserIdentity($model->username, $soucePassword);
                     $identity->authenticate();
                     Yii::app()->user->login($identity, 0);
                     //$this->redirect(Yii::app()->controller->module->returnUrl);
                     Yii::app()->user->setFlash('reg_success', UserModule::t("Thank you for your registration. Password has been sent to your e-mail. Please check your e-mail ({{email}}) before start.", ['{{email}}' => $model->email]));
                     $this->refresh();
                     //Yii::app()->end();
                 } else {
                     Yii::app()->user->setFlash('reg_failed', UserModule::t("Sorry, something wrong... :("));
                     $this->refresh();
                 }
             }
         }
         Yii::app()->theme = 'client';
         $this->render('/user/registration', array('model' => $model, 'role' => $role));
     }
 }
开发者ID:kibercoder,项目名称:dipstart-development,代码行数:69,代码来源:RegistrationController.php

示例6: actionStatus

 public function actionStatus()
 {
     $row = array('status_id' => Yii::app()->request->getPost('status_id'));
     $id = Yii::app()->request->getPost('id');
     $condition = array();
     $params = array();
     ZakazParts::model()->updateByPk($id, $row, $condition, $params);
     if ($row['status_id'] == 3) {
         $email = new Emails();
         $orderId = Yii::app()->request->getPost('id');
         $typeId = Emails::TYPE_14;
         $order = Zakaz::model()->findByPk($orderId);
         $user = User::model()->findByPk($order->user_id);
         $email->to_id = $user->id;
         $profile = Profile::model()->findAll("`user_id`='{$user->id}'");
         $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
         $title = $rec[0]->title;
         $email->name = $profle->firstname;
         if (strlen($email->name) < 2) {
             $email->name = $user->username;
         }
         $email->login = $user->username;
         $email->num_order = $orderId;
         $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
         $email->message = $rec[0]->text;
         echo '<br>$user->email=' . $user->email;
         $email->sendTo($user->email, $rec[0]->text, $typeId);
     }
     Yii::app()->end();
 }
开发者ID:kibercoder,项目名称:dipstart-development,代码行数:30,代码来源:ZakazController.php

示例7: yiichat_post

 public function yiichat_post($chat_id, $identity, $message, $postdata, $data)
 {
     $this->_chat_id = $chat_id;
     $this->_identity = $identity;
     $this->_data = $data;
     $message_filtered = trim($this->acceptMessage($message));
     if ($message_filtered != "") {
         $obj = array("order" => $chat_id, "sender" => $identity, "sender_role" => ProjectMessages::model()->getRoleId(User::model()->getUserRole($identity)), "date" => date('Y-m-d H:i:s'), "message" => $message_filtered);
         $order = Zakaz::model()->findByPk($chat_id);
         if (isset($postdata['index']) && $postdata['index'] == 0) {
             if ($postdata['recipient'] == 'Author') {
                 $obj['recipient'] = $order->attributes['executor'];
                 $obj['recipient_role'] = ProjectMessages::model()->getRoleId('Author');
                 if ($obj['recipient'] == 0) {
                     $obj['recipient'] = -1;
                 }
             } elseif ($postdata['recipient'] == 'Customer') {
                 $obj['recipient'] = $order->attributes['user_id'];
                 $obj['recipient_role'] = ProjectMessages::model()->getRoleId('Customer');
                 /*} elseif (isset($postdata['recipient'])){
                 		$obj['recipient'] = $postdata['recipient'];*/
             } elseif ($postdata['recipient'] == 'Corrector') {
                 $obj['recipient_role'] = ProjectMessages::model()->getRoleId('Corrector');
                 $obj['recipient'] = -2;
             } else {
                 $obj['recipient'] = 0;
             }
             $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
         } else {
             if ($postdata['recipient'] == 'no') {
                 $obj['recipient'] = 0;
                 $newid = $this->getDb()->createCommand()->update($this->getTableName(), $obj, 'id=:id', array('id' => $postdata['index']));
             } else {
                 if ($postdata['recipient'] == 'redir') {
                     $sender = ProjectMessages::model()->findByPk($postdata['index'])->senderObject->AuthAssignment['itemname'];
                     $obj['sender'] = ProjectMessages::model()->findByPk($postdata['index'])->attributes['sender'];
                     $obj['moderated'] = 1;
                     if ($sender == 'Customer') {
                         $obj['recipient'] = $order->attributes['executor'];
                     }
                     if ($sender == 'Author') {
                         $obj['recipient'] = $order->attributes['user'];
                     }
                     $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
                 } else {
                     if ($postdata['recipient'] == 'Customer') {
                         $obj['recipient'] = $order->attributes['user_id'];
                         $obj['recipient_role'] = ProjectMessages::model()->getRoleId('Customer');
                     }
                     if ($postdata['recipient'] == 'Author') {
                         $obj['recipient'] = $order->attributes['executor'];
                         $obj['recipient_role'] = ProjectMessages::model()->getRoleId('Author');
                     }
                     if ($postdata['recipient'] == 'Corrector') {
                         $obj['recipient'] = -2;
                         $obj['recipient_role'] = ProjectMessages::model()->getRoleId('Corrector');
                     }
                     if (is_numeric($postdata['recipient'])) {
                         $obj['recipient'] = $postdata['recipient'];
                         $obj['recipient_role'] = ProjectMessages::model()->findByPk($postdata['index'])->attributes['sender_role'];
                     }
                     $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
                 }
             }
         }
         // now retrieve the post
         $obj['recipient'] = User::model()->findByPk($obj['recipient']);
         if ($obj['recipient']) {
             $obj['recipient']->superuser = $obj['recipient']->getRelated('AuthAssignment');
         }
         $obj['sender'] = User::model()->findByPk($obj['sender']);
         $obj['sender']->superuser = $obj['sender']->getRelated('AuthAssignment');
         $specials = isset($order->specials) ? $order->specials : $order->specials2;
         $title = Catalog::model()->findByPk($specials)->cat_name . '. ' . $order->attributes['title'] . '. ' . Yii::t('site', 'You have received a new message.');
         $message = CHtml::link(Yii::t('site', 'Link to order page'), Yii::app()->createAbsoluteUrl('/project/chat', array('orderId' => $chat_id))) . '<br />' . $obj['message'];
         $headers = 'From: no-reply@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Reply-To: no-reply@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Content-Type: text/html; charset=utf-8;' . 'X-Mailer: PHP/' . phpversion();
         //mail($obj['recipient']->attributes['email'],$title,$message,$headers);
         /*if (User::model()->getUserRole($obj['recipient']->id)=='Customer') {
         			$type_id = Emails::TYPE_16;
         			$order->setCustomerEvents(1);
         		} else if (User::model()->getUserRole($obj['recipient']->id)=='Author') {
         			$type_id = Emails::TYPE_20;
         			$order->setExecutorEvents(2);
         		}
         		$email = new Emails;
         		$rec   = Templates::model()->findAll("`type_id`='$type_id'");
         		$email->name = $obj['recipient']->full_name;
         		if (strlen($email->name) < 2) $email->name = $obj['recipient']->username;
         		$email->num_order = $chat_id;
         		$email->message = strip_tags($obj['message']);
         		$email->page_order = 'http://'.$_SERVER['SERVER_NAME'].'/project/chat?orderId='.$chat_id;
         		$email->sendTo( $obj['recipient']->email, $rec[0]->title, $rec[0]->text, $type_id);*/
         if ($postdata['flags']) {
             foreach ($postdata['flags'] as $v) {
                 switch ($v) {
                     case 'send_sms':
                         include_once "smsc_api.php";
                         list($sms_id, $sms_cnt, $cost, $balance) = send_sms(str_replace(['+', '-'], '', $obj['recipient']->attributes['phone_number']), $obj['message']);
                         //                            list($sms_id, $sms_cnt, $cost, $balance) = send_sms(str_replace(['+','-'],'',$obj['recipient']->profile->attributes['mob_tel']), $obj['message']);
                         break;
//.........这里部分代码省略.........
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:101,代码来源:YiiChatDbHandlerBase.php

示例8: actionIndex

 /**
  *  Вывод и добавление сообщений
  */
 public function actionIndex($orderId)
 {
     $isGuest = Yii::app()->user->isGuest;
     Yii::app()->session['project_id'] = $orderId;
     if (Yii::app()->request->isAjaxRequest) {
         if (Yii::app()->request->getPost('ProjectMessages')) {
             $id = (int) $_POST['ProjectMessages']['id'];
             if ($id > 0) {
                 $model = ProjectMessages::model()->findByPk($id);
             } else {
                 $model = new ProjectMessages();
                 $model->sender = Yii::app()->user->id;
                 $model->moderated = 0;
                 $model->order = $orderId;
             }
             $post = $_POST['ProjectMessages']['message'];
             $post = str_replace("\r\n", '<br>', $post);
             $post = str_replace("\n", '<br>', $post);
             $_POST['ProjectMessages']['message'] = $post;
             $model->attributes = Yii::app()->request->getPost('ProjectMessages');
             $model->date = date('Y-m-d H:i:s');
             switch ($model->recipient) {
                 case 'manager':
                     $model->recipient = 1;
                     break;
                 case 'customer':
                     if (User::model()->isCustomer()) {
                         $model->recipient = Zakaz::model()->resetScope()->findByPk($orderId)->attributes['executor'];
                         $type_id = Emails::TYPE_20;
                     } else {
                         if (User::model()->isAuthor()) {
                             $model->recipient = Zakaz::model()->findByPk($orderId)->attributes['user_id'];
                             $type_id = Emails::TYPE_16;
                         }
                     }
                     $user = User::model()->findByPk($model->recipient);
                     $profile = Profile::model()->findAll("`user_id`='{$model->recipient}'");
                     $email = new Emails();
                     $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
                     $title = $rec[0]->title;
                     $body = $rec[0]->text;
                     $email->name = $user->full_name;
                     if (strlen($email->name) < 2) {
                         $email->name = $user->username;
                     }
                     $email->num_order = $orderId;
                     $email->message = $post;
                     $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
                     $email->sendTo($user->email, $body, $type_id);
                     break;
             }
             //print_r($model);
             //echo '<br>$model->save()='.$model->save();
             EventHelper::addMessage($orderId, $model->message);
         }
         $this->renderPartial('chat', array('orderId' => $orderId, 'isGuest' => $isGuest));
         Yii::app()->end();
     }
     $order = Zakaz::model()->resetScope()->findByPk($orderId);
     $parts = ZakazParts::model()->findAll(array('condition' => "`proj_id`='{$orderId}'"));
     if ($isGuest) {
         Yii::app()->theme = 'client';
         // если гость прошёл по ссылке на неcуществующий
         // проект, отправляем его на регистрацию
         $url = 'http://' . $_SERVER['SERVER_NAME'] . '/';
         if (!$order) {
             $this->redirect($url);
         }
         $moderate_types = EventHelper::get_moderate_types_string();
         $events = Events::model()->findAll(array('condition' => "`event_id`='{$orderId}' AND `type` in ({$moderate_types})", 'order' => 'timestamp DESC'), array(':event_id' => $orderId));
         $moderated = count($events) == 0;
         // если гость прошёл по ссылке на непромодерированный
         // проект, отправляем его на регистрацию
         if (!$moderated) {
             $this->redirect(Yii::app()->createUrl('user/login'));
         }
         //			Catalog::model()->tableName();
         //$EmptyChat = UserModule::t('EmptyChat');
         $this->render('index', array('orderId' => $orderId, 'order' => $order, 'executor' => Zakaz::getExecutor($orderId), 'moderated' => $moderated, 'isGuest' => $isGuest, 'parts' => $parts));
         Yii::app()->end();
     }
     $moderate_types = EventHelper::get_moderate_types_string();
     $events = Events::model()->findAll(array('condition' => "`event_id`='{$orderId}' AND `type` in ({$moderate_types})", 'order' => 'timestamp DESC'), array(':event_id' => $orderId));
     $moderated = count($events) == 0;
     $this->render('index', array('orderId' => $orderId, 'order' => $order, 'executor' => Zakaz::getExecutor($orderId), 'moderated' => $moderated, 'isGuest' => $isGuest, 'parts' => $parts));
 }
开发者ID:VahagnM,项目名称:dipstart-development,代码行数:89,代码来源:ChatController.php

示例9: actionRecovery

 /**
  * Recovery password
  */
 public function actionRecovery()
 {
     $form = new UserRecoveryForm();
     Yii::app()->theme = 'client';
     if (Yii::app()->user->id) {
         $this->redirect(Yii::app()->controller->module->returnUrl);
     } else {
         $email = isset($_GET['email']) ? $_GET['email'] : '';
         $activkey = isset($_GET['activkey']) ? $_GET['activkey'] : '';
         if ($email && $activkey) {
             $form2 = new UserChangePassword();
             $find = User::model()->notsafe()->findByAttributes(array('email' => $email));
             if (isset($find) && $find->activkey == $activkey) {
                 if (isset($_POST['UserChangePassword'])) {
                     $form2->attributes = $_POST['UserChangePassword'];
                     if ($form2->validate()) {
                         $find->password = Yii::app()->controller->module->encrypting($form2->password);
                         $find->activkey = Yii::app()->controller->module->encrypting(microtime() . $form2->password);
                         if ($find->status == 0) {
                             $find->status = 1;
                         }
                         $find->save();
                         Yii::app()->user->setFlash('recoveryMessage', UserModule::t("New password is saved."));
                         $this->redirect(Yii::app()->controller->module->recoveryUrl);
                     }
                 }
                 $this->render('changepassword', array('form' => $form2));
             } else {
                 Yii::app()->user->setFlash('recoveryMessage', UserModule::t("Incorrect recovery link."));
                 $this->redirect(Yii::app()->controller->module->recoveryUrl);
             }
         } else {
             if (isset($_POST['UserRecoveryForm'])) {
                 $form->attributes = $_POST['UserRecoveryForm'];
                 if ($form->validate()) {
                     $user = User::model()->notsafe()->findbyPk($form->user_id);
                     $user->activkey = UserModule::encrypting(microtime() . $user->password);
                     $user->save();
                     $activation_url = 'http://' . $_SERVER['HTTP_HOST'] . $this->createUrl(implode(Yii::app()->controller->module->recoveryUrl), array("activkey" => $user->activkey, "email" => $user->email));
                     /*
                     						$this->createUrl(implode(Yii::app()->controller->module->recoveryUrl));
                     						$subject = UserModule::t("You have requested the password recovery site {site_name}",
                     		    					array(
                     		    						'{site_name}'=>Yii::app()->name,
                     		    					));
                     		    			$message = UserModule::t("You have requested the password recovery site {site_name}. To receive a new password, go to <a href=\"{activation_url}\">{activation_url}</a>.",
                     		    					array(
                     		    						'{site_name}'=>Yii::app()->name,
                     		    						'{activation_url}'=>$activation_url,
                     		    					));
                     							
                     		    			UserModule::sendMail($user->email,$subject,$message);
                     */
                     // новая служба системных сообщений
                     $type_id = Emails::TYPE_10;
                     $email = new Emails();
                     /*$criteria = new CDbCriteria();
                     		$criteria->order = 'id DESC';
                     		$criteria->limit = 1;
                     		$user = User::model()->findAll($criteria);
                     		$user = $user[0];*/
                     $email->from_id = 1;
                     $email->to_id = $form->user_id;
                     //  = $user->id;
                     $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
                     $id = Campaign::getId();
                     $email->campaign = Campaign::getName();
                     $email->name = $user->full_name;
                     $email->login = $user->username;
                     $email->password = $soucePassword;
                     $email->page_psw = $activation_url;
                     $email->page_cabinet = 'http://' . $_SERVER['SERVER_NAME'] . '/user/profile/edit';
                     $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
                     Yii::app()->user->setFlash('recoveryMessage', UserModule::t("Please check your email. An instructions was sent to your email address."));
                     $this->refresh();
                 }
             }
             $this->render('recovery', array('form' => $form));
         }
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:84,代码来源:RecoveryController.php

示例10: actionStatus

 public function actionStatus()
 {
     $status_id = Yii::app()->request->getPost('status_id');
     $id = Yii::app()->request->getPost('id');
     if (User::model()->isAuthor() && $status_id == '+1' && $id) {
         $stage = ZakazParts::model()->findByPk($id);
         if (User::model()->isExecutor($stage->proj_id) && $stage->status_id == 1) {
             $stage->status_id = 2;
             $stage->save();
             echo $stage->status->status;
             EventHelper::stageDoneByExecutor($stage->proj_id, $stage->title);
         } else {
             echo 'Wrong base status';
         }
     } elseif (User::model()->isCustomer() && $status_id == '+1' && $id) {
         $stage = ZakazParts::model()->findByPk($id);
         if (User::model()->isOwner($stage->proj_id) && $stage->status_id == 3) {
             $stage->status_id = 4;
             $stage->save();
             //echo $stage->status->status;
             echo ProjectModule::t('Approved by me');
             EventHelper::stageDoneByCustomer($stage->proj_id, $stage->title);
         } else {
             echo 'Wrong base status';
         }
     } elseif (User::model()->isManager() && $status_id && $id) {
         $orderId = Yii::app()->request->getPost('orderId');
         $row = array('status_id' => $status_id);
         $condition = array();
         $params = array();
         ZakazParts::model()->updateByPk($id, $row, $condition, $params);
         if ((int) $status_id == 3) {
             $parts = ZakazParts::model()->findAll("`proj_id` = '{$orderId}' AND `status_id` IN (0,1,2)");
             $order = Zakaz::model()->resetScope()->findByPk($orderId);
             $subject_order = $order->title;
             $user_id = $order->user_id;
             $user = User::model()->findByPk($user_id);
             $order->setCustomerEvents(2);
             $email = new Emails();
             if (count($parts) > 0) {
                 $type_id = Emails::TYPE_14;
             } else {
                 $type_id = Emails::TYPE_15;
             }
             $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
             echo count($parts);
             $title = $rec[0]->title;
             $body = $rec[0]->text;
             $email->name = $user->full_name;
             if (strlen($email->name) < 2) {
                 $email->name = $user->username;
             }
             $email->num_order = $orderId;
             //		$model->date = date('Y-m-d H:i:s');
             $email->subject_order = $subject_order;
             $email->num_order = $orderId;
             $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
             $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
         }
     }
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:61,代码来源:ZakazPartsController.php

示例11: actionSend

 public function actionSend()
 {
     $email = new Emails();
     $this->_prepairJson();
     $orderId = $this->_request->getParam('orderId');
     $typeId = $this->_request->getParam('typeId');
     $back = $this->_request->getParam('back');
     $cost = $this->_request->getParam('cost');
     $order = Zakaz::model()->findByPk($orderId);
     $arr_type = array(Emails::TYPE_18, Emails::TYPE_19, Emails::TYPE_20, Emails::TYPE_21, Emails::TYPE_22, Emails::TYPE_23, Emails::TYPE_24);
     if (in_array($typeId, $arr_type)) {
         $user_id = $order->executor;
     } else {
         $user_id = $order->user_id;
     }
     if (!$user_id) {
         Yii::app()->end();
     }
     $user = User::model()->findByPk($user_id);
     $email->to_id = $user_id;
     $profile = Profile::model()->findAll("`user_id`='{$user_id}'");
     $rec = Templates::model()->findAll("`type_id`='{$typeId}'");
     $title = $rec[0]->title;
     $email->name = $profle->full_name;
     if (strlen($email->name) < 2) {
         $email->name = $user->username;
     }
     $email->login = $user->username;
     $email->num_order = $orderId;
     $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
     $email->message = $rec[0]->text;
     $email->price_order = $cost;
     $email->sum_order = $cost;
     $specials = Catalog::model()->findByPk($order->specials);
     $email->specialization = $specials->cat_name;
     $email->name_order = $order->title;
     $email->subject_order = $order->title;
     $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $typeId);
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:39,代码来源:EmailsController.php

示例12: actionApprove

 public function actionApprove($id)
 {
     if (!Yii::app()->request->isAjaxRequest) {
         return false;
     }
     $model = $this->loadModel($id);
     $model->scenario = 'approve';
     if (!$model->isAllowedAdd()) {
         echo CJSON::encode(array('error' => array('text' => array(ProjectModule::t('You are not allowed to change!')))));
         Yii::app()->end();
     }
     if (isset($_REQUEST['moderate'])) {
         $model->moderate = !$model->isModerate() ? '1' : '0';
         $model->date_update = date('Y-m-d H:i:s');
         if (ProjectChanges::approveAllowed()) {
             $model->date_moderate = date('Y-m-d H:i:s');
             if ($model->moderate) {
                 $orderId = $model->project_id;
                 $order = Zakaz::model()->findByPk($orderId);
                 $user = User::model()->findByPk($order->executor);
                 $type_id = Emails::TYPE_23;
                 $email = new Emails();
                 $rec = Templates::model()->findAll("`type_id`='{$type_id}'");
                 $email->name = $user->full_name;
                 if (strlen($email->name) < 2) {
                     $email->name = $user->username;
                 }
                 $email->num_order = $orderId;
                 $email->page_order = 'http://' . $_SERVER['SERVER_NAME'] . '/project/chat?orderId=' . $orderId;
                 $email->sendTo($user->email, $rec[0]->title, $rec[0]->text, $type_id);
             }
         }
         if ($model->save(false)) {
             if ($model->moderate == 1 && $order) {
                 $order->setExecutorEvents(4);
             }
             echo CJSON::encode(array('success' => true, 'approve' => $model->isModerate() ? 'true' : 'false'));
             Yii::app()->end();
         }
     }
     echo CJSON::encode(array('error' => array('text' => array('Данные не переданы!'))));
     Yii::app()->end();
 }
开发者ID:akoch-ov,项目名称:dipstart-development,代码行数:43,代码来源:ChangesController.php


注:本文中的Emails::sendTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。