Skip to content

Commit

Permalink
Added include_subclients fielter
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Jan 5, 2017
1 parent 7d07209 commit efeb333
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
12 changes: 12 additions & 0 deletions src/controllers/PrepareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down
5 changes: 4 additions & 1 deletion src/forms/FiltersForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')
];
}
}
1 change: 1 addition & 0 deletions src/messages/ru/hipanel:mailing.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@
'Set filters to start the mailing preparation' => 'Установить фильтры для начала подготовки рассылки',
'Not set' => 'Не выбран',
'Languages' => 'Языки',
'Include subclients' => 'Включить субклиентов'
];
12 changes: 4 additions & 8 deletions src/views/prepare/_search.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
]) ?>
</div>

<div class="col-md-4 col-sm-6 col-xs-12">
<?= $search->field('include_subclients')->checkbox() ?>
</div>

<div class="col-md-4 col-sm-6 col-xs-12">
<?= $search->field('client_in')->widget(ClientCombo::class, [
'multiple' => true,
Expand Down Expand Up @@ -65,14 +69,6 @@
]) ?>
</div>

<div class="col-md-4 col-sm-6 col-xs-12">
<?= $search->field('server_state_in')->widget(StaticCombo::class, [
'multiple' => true,
'hasId' => true,
'data' => $serverStates,
]) ?>
</div>

<div class="col-md-4 col-sm-6 col-xs-12">
<?= $search->field('server_type_in')->widget(StaticCombo::class, [
'multiple' => true,
Expand Down

0 comments on commit efeb333

Please sign in to comment.