public static function defaultColumns() { return ['mail' => ['class' => MainColumn::class, 'filterAttribute' => 'mail_like'], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:hosting', 'format' => 'raw', 'value' => function ($model) { return State::widget(compact('model')); }, 'gtype' => 'state,mail'], 'server' => ['class' => ServerColumn::class], 'domain' => ['attribute' => 'hdomain_id', 'format' => 'raw', 'value' => function ($model) { return Html::a($model->domain, ['@hdomain/view', 'id' => $model->hdomain_id]); }], 'type' => ['format' => 'raw', 'filter' => function ($column, $model, $attribute) { return Html::activeDropDownList($model, $attribute, ['' => '----------'] + Mail::getTypes(), ['class' => 'form-control']); }, 'value' => function ($model) { return Type::widget(compact('model')); }], 'forwards' => ['format' => 'raw', 'value' => function ($model) { return ArraySpoiler::widget(['delimiter' => '<br>', 'visibleCount' => 2, 'data' => $model->forwards, 'button' => ['label' => '+{count}', 'popoverOptions' => ['html' => true]]]); }], 'spam_action' => ['format' => 'raw', 'value' => function ($model) { /** @var $model Mail */ if ($model->spam_action === $model::SPAM_ACTION_DELETE) { return Label::widget(['color' => 'danger', 'label' => Yii::t('hipanel', 'Delete')]); } elseif ($model->spam_action === '') { return Label::widget(['color' => 'info', 'label' => Yii::t('hipanel:hosting', 'Do nothing')]); } else { return Label::widget(['color' => 'primary', 'label' => Yii::t('hipanel:hosting', 'Forward to')]) . ' ' . ArraySpoiler::widget(['data' => $model->spam_action, 'visibleCount' => 2]); } }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {delete}']]; }
public function getTypeData() { return Mail::getTypes(); }