Commit 5978dccd authored by Shakarim Sapa's avatar Shakarim Sapa

- Добавлены корректировки в get-теры базовых классов;

- Добавлен класс условия отвечающего за переход по ссылке;
- Добавлен метод возвращающий управляющие элементы условия;
- Добавлены необходимые для работы свойства в модель класса trigger;
parent ac1fcf72
......@@ -85,4 +85,19 @@ class Conditions {
}
return null;
}
/**
* @return string
*/
public function getControlArea(){
$html = '<div class="conditions-block"></div>';
$html .= '<div class="btn-group" role="group">';
$html .= '<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="glyphicon glyphicon-plus"></i></button>';
$html .= '<ul class="dropdown-menu">';
foreach(Conditions::init()->getConditions() as $id=>$condition)
$html .= '<li><a href="#" data-id="'.$id.'">'.$condition->getName().'</a></li>';
$html .= '</ul>';
$html .= '</div>';
return $html;
}
}
\ No newline at end of file
<?php
namespace common\modules\triggers\components\conditions\conditions;
use common\modules\triggers\components\conditions\vendor\ConditionBase;
use common\modules\triggers\components\conditions\vendor\ConditionInterface;
class CheckClickingOnTheLink extends ConditionBase implements ConditionInterface {
const CONDITION_ID = 2;
public $name = 'Был произведен переход по ссылке';
/**
* @param null|string $conditionName
* @return $this mixed
*/
public static function init($conditionName=__CLASS__){
return parent::init($conditionName);
}
}
\ No newline at end of file
<?php
return [
'check-email-to-opening' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToOpening'
'class' => 'common\modules\triggers\components\conditions\conditions\CheckEmailToOpening',
],
'check-clicking-on-the-link' => [
'class' => 'common\modules\triggers\components\conditions\conditions\CheckClickingOnTheLink',
]
];
\ No newline at end of file
<?php
use \common\modules\triggers\components\conditions\Conditions;
// Формируем html будущей таблицы, открыли тег
$table = '<table class="table table-bordered">';
// Формируем тело будущей таблицы
$table .= '<tbody>';
$table .= '<tr>';
$table .= '<td>'.Conditions::init()->getControlArea().'</td>';
$table .= '<tr>';
$table .= '</tbody>';
// Формируем футер
$table .= '<tfoot>';
$table .= '<td><button type="button" class="btn btn-primary">Добавить условие "И"</button></td>';
$table .= '</tfoot>';
// Закрываем таблицу
$table .= '</table>';
return [
'activeForm' => [
'id' => 'trigger-form'
],
'elements' => [
'table' => $table,
'active' => [
'type' => 'checkbox'
],
......@@ -13,7 +32,7 @@ return [
],
'name' => [
'type' => 'text',
'class' => 'form-control'
'class' => 'form-control',
],
'description' => [
'type' => 'textarea',
......
......@@ -23,6 +23,8 @@ use common\modules\users\models\User;
*/
class TriggerTrigger extends \yii\db\ActiveRecord
{
public $conditions;
/**
* @inheritdoc
*/
......@@ -60,6 +62,7 @@ class TriggerTrigger extends \yii\db\ActiveRecord
'date_create' => 'Дата создания',
'timeout' => 'Задержка перед выполнением (секунд)',
'message_template_id' => 'Шаблон письма',
'conditions' => 'Шаблон письма',
];
}
......
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