Commit 71caf371 authored by Олег Гиммельшпах's avatar Олег Гиммельшпах

Merge branch 'master' of git.task-on.com:ktask/task-on.com

parents eb7eb0ba 7c6c53a9
...@@ -161,6 +161,9 @@ class Conditions { ...@@ -161,6 +161,9 @@ class Conditions {
// Привели массив в понятный вид // Привели массив в понятный вид
$conditionsArray=[]; $conditionsArray=[];
foreach($conditions as $i=>$condition) { foreach($conditions as $i=>$condition) {
$object=Conditions::init()->getConditionById($condition->condition_id);
if ($object->recall===false)
return false;
$conditionsArray[$i][] = $condition; $conditionsArray[$i][] = $condition;
} // На выходе получаем массив необходимого формата } // На выходе получаем массив необходимого формата
// Обрабатываем отформатированный массив // Обрабатываем отформатированный массив
......
...@@ -9,6 +9,8 @@ use common\modules\triggers\components\conditions\vendor\ConditionInterface; ...@@ -9,6 +9,8 @@ use common\modules\triggers\components\conditions\vendor\ConditionInterface;
class CheckUserToRegistration extends ConditionBase implements ConditionInterface{ class CheckUserToRegistration extends ConditionBase implements ConditionInterface{
const CONDITION_ID = 6; const CONDITION_ID = 6;
public $recall=false;
public $name = 'Пользователь зарегистрировался'; public $name = 'Пользователь зарегистрировался';
/** /**
......
...@@ -7,6 +7,8 @@ use yii\helpers\Html; ...@@ -7,6 +7,8 @@ use yii\helpers\Html;
class ConditionBase { class ConditionBase {
protected static $conditionClass; protected static $conditionClass;
public $recall = true;
public $name; public $name;
public $config = []; public $config = [];
......
...@@ -214,18 +214,26 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -214,18 +214,26 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
* @return string * @return string
*/ */
public function initAction($params=array()){ public function initAction($params=array()){
$email = (!Yii::$app->user->isGuest) ? Yii::$app->user->identity->email : null; $templateData = [];
if ($email===null && array_key_exists('email', $params))
if (array_key_exists('email', $params))
$email = $params['email']; $email = $params['email'];
else elseif(empty($email) && !Yii::$app->user->isGuest) {
$email = Yii::$app->user->identity->email;
} else {
return 'Email not found'; return 'Email not found';
}
$user = User::findOne(['email' => $email]);
$templateData['user_fio'] = (!is_null($user)) ? $user->fio : '';
/** @var \DateTime $time_now */ /** @var \DateTime $time_now */
$time_now=new \DateTime(); $time_now=new \DateTime();
/** @var MessageTemplate $templateModel */ /** @var MessageTemplate $templateModel */
$templateModel = MessageTemplate::findOne($this->message_template_id); $templateModel = MessageTemplate::findOne($this->message_template_id);
/** @var Templates $template */ /** @var Templates $template */
$template = new Templates($this->message_template_id); $template = new Templates($this->message_template_id, $templateData);
$sender = new UnisenderAPI(); $sender = new UnisenderAPI();
// Create the send list // Create the send list
$newList = $sender->createList(); $newList = $sender->createList();
......
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
use \common\components\UnisenderAPI; use \common\components\UnisenderAPI;
use \yii\helpers\Json; use \yii\helpers\Json;
$email = 'bystrov@kupitsite.ru'; $template = new \common\modules\messageTemplate\components\Templates(3, ['user_fio' => 'qwerty']);
var_dump($template->getTemplate());
$sender = new UnisenderAPI(); //$email = 'bystrov@kupitsite.ru';
$sender->validateSender('subscribe@task-on.com');
//$sender = new UnisenderAPI();
//$sender->validateSender('subscribe@task-on.com');
// Create the send list // Create the send list
//$newList = $sender->createList(); //$newList = $sender->createList();
//$newListObject=Json::decode($newList); //$newListObject=Json::decode($newList);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment