From efeb333f79db69d30ca58ba31ea461a66a90555f Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Thu, 5 Jan 2017 18:51:01 +0200 Subject: [PATCH] Added include_subclients fielter --- src/controllers/PrepareController.php | 12 ++++++++++++ src/forms/FiltersForm.php | 5 ++++- src/messages/ru/hipanel:mailing.php | 1 + src/views/prepare/_search.php | 12 ++++-------- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/controllers/PrepareController.php b/src/controllers/PrepareController.php index 4fb736d..fa4ef6e 100644 --- a/src/controllers/PrepareController.php +++ b/src/controllers/PrepareController.php @@ -96,16 +96,28 @@ private function getClientTypes() private function getServerTypes() { + if (!Yii::getAlias('@server', false)) { + return []; + } + return $this->getRefs('type,device', 'hipanel:server'); } private function getServerStates() { + if (!Yii::getAlias('@server', false)) { + return []; + } + return $this->getRefs('state,device', 'hipanel:server'); } private function getDomainStates() { + if (!Yii::getAlias('@domain', false)) { + return []; + } + return $this->getRefs('state,domain', 'hipanel:domain'); } diff --git a/src/forms/FiltersForm.php b/src/forms/FiltersForm.php index 12886d9..50cb47c 100644 --- a/src/forms/FiltersForm.php +++ b/src/forms/FiltersForm.php @@ -45,10 +45,12 @@ class FiltersForm extends Model public $language_in; + public $include_subclients; + public function attributes() { return [ - 'client_in', 'client_state_in', + 'client_in', 'client_state_in', 'include_subclients', 'seller_in', 'server_in', 'has_server', 'server_state_in', 'server_type_in', 'server_switch_like', 'server_rack_like', 'server_pdu_like', @@ -84,6 +86,7 @@ public function attributeLabels() 'exclude_unsubscribed' => Yii::t('hipanel:mailing', 'Exclude unsubscribed'), 'language_in' => Yii::t('hipanel:mailing', 'Languages'), 'language_unknown' => Yii::t('hipanel:mailing', 'Language is unknown'), + 'include_subclients' => Yii::t('hipanel:mailing', 'Include subclients') ]; } } diff --git a/src/messages/ru/hipanel:mailing.php b/src/messages/ru/hipanel:mailing.php index 0b63adb..c18a274 100644 --- a/src/messages/ru/hipanel:mailing.php +++ b/src/messages/ru/hipanel:mailing.php @@ -33,4 +33,5 @@ 'Set filters to start the mailing preparation' => 'Установить фильтры для начала подготовки рассылки', 'Not set' => 'Не выбран', 'Languages' => 'Языки', + 'Include subclients' => 'Включить субклиентов' ]; diff --git a/src/views/prepare/_search.php b/src/views/prepare/_search.php index ba1ab91..173666f 100644 --- a/src/views/prepare/_search.php +++ b/src/views/prepare/_search.php @@ -21,6 +21,10 @@ ]) ?> +
+ field('include_subclients')->checkbox() ?> +
+
field('client_in')->widget(ClientCombo::class, [ 'multiple' => true, @@ -65,14 +69,6 @@ ]) ?>
-
- field('server_state_in')->widget(StaticCombo::class, [ - 'multiple' => true, - 'hasId' => true, - 'data' => $serverStates, - ]) ?> -
-
field('server_type_in')->widget(StaticCombo::class, [ 'multiple' => true,