Commit 2231c98f authored by Shakarim Sapa's avatar Shakarim Sapa

- Метод формирующий кнопки для управления триггером вынесен в модель;

parent d0dfa625
...@@ -103,6 +103,16 @@ class Conditions { ...@@ -103,6 +103,16 @@ class Conditions {
return $result; return $result;
} }
/**
* @param array $condition_array
* @param null $key
* @return string
*/
public static function getControlButtons($condition_array=array(), $key=null){
$key = ($key!==null) ? $key : rand(100000,999999);
return '<tr data-key='.$key.'><td>'.Conditions::init()->getControlArea($condition_array, $key).'</td></tr>';
}
/** /**
* @param array $condition_array * @param array $condition_array
* @param $key * @param $key
......
...@@ -35,7 +35,7 @@ class TriggerAdminController extends AdminController { ...@@ -35,7 +35,7 @@ class TriggerAdminController extends AdminController {
} }
public function actionGetandconditionhtml(){ public function actionGetandconditionhtml(){
$result = TriggerTrigger::getControlButtons(); $result = Conditions::getControlButtons();
return (Yii::$app->request->isAjax) ? Json::encode($result) : $result; return (Yii::$app->request->isAjax) ? Json::encode($result) : $result;
} }
......
...@@ -107,11 +107,6 @@ class TriggerTrigger extends \common\components\ActiveRecordModel ...@@ -107,11 +107,6 @@ class TriggerTrigger extends \common\components\ActiveRecordModel
return $table; return $table;
} }
public static function getControlButtons($condition_array=array(), $key=null){
$key = ($key!==null) ? $key : rand(100000,999999);
return '<tr data-key='.$key.'><td>'.Conditions::init()->getControlArea($condition_array, $key).'</td></tr>';
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
......
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