public function init()
 {
     $this->name = \Yii::t('skeeks/form2/app', 'Messages');
     $this->modelShowAttribute = "id";
     $this->modelClassName = Form2FormSend::className();
     parent::init();
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getForm2FormSends()
 {
     return $this->hasMany(Form2FormSend::className(), ['form_id' => 'id']);
 }
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<? $pjax = \skeeks\cms\modules\admin\widgets\Pjax::begin(); ?>

    <?php 
echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
?>

<?php 
echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'adminController' => $controller, 'pjax' => $pjax, 'columns' => [['attribute' => 'status', 'class' => \yii\grid\DataColumn::className(), 'filter' => \skeeks\modules\cms\form2\models\Form2FormSend::getStatuses(), 'format' => 'raw', 'value' => function (\skeeks\modules\cms\form2\models\Form2FormSend $model) {
    if ($model->status == \skeeks\modules\cms\form2\models\Form2FormSend::STATUS_NEW) {
        $class = "danger";
    } else {
        if ($model->status == \skeeks\modules\cms\form2\models\Form2FormSend::STATUS_PROCESSED) {
            $class = "warning";
        } else {
            if ($model->status == \skeeks\modules\cms\form2\models\Form2FormSend::STATUS_EXECUTED) {
                $class = "success";
            }
        }
    }
    return '<span class="label label-' . $class . '">' . \yii\helpers\ArrayHelper::getValue(\skeeks\modules\cms\form2\models\Form2FormSend::getStatuses(), $model->status) . '</span>';
}], ['class' => \skeeks\cms\grid\DateTimeColumnData::className(), 'attribute' => 'processed_at'], ['class' => \skeeks\cms\grid\UserColumnData::className(), 'attribute' => 'processed_by'], ['attribute' => 'form_id', 'class' => \yii\grid\DataColumn::className(), 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\modules\cms\form2\models\Form2Form::find()->all(), 'id', 'name'), 'value' => function (\skeeks\modules\cms\form2\models\Form2FormSend $model) {
    return $model->form->name;
}], ['class' => \skeeks\cms\grid\CreatedAtColumn::className(), 'label' => 'Отправлена'], ['attribute' => 'site_code', 'class' => \yii\grid\DataColumn::className(), 'filter' => \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsSite::find()->all(), 'code', 'name'), 'value' => function (\skeeks\modules\cms\form2\models\Form2FormSend $model) {
    return $model->site->name;
}], 'comment']]);
?>

<? $pjax::end(); ?>
echo $form->fieldSetEnd();
echo $form->fieldSet(\Yii::t('skeeks/form2/app', 'Additional Data'));
?>
    <?php 
echo \yii\widgets\DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'id', 'label' => \Yii::t('skeeks/form2/app', 'Post Number')], ['attribute' => 'created_at', 'value' => \Yii::$app->formatter->asDatetime($model->created_at, 'medium') . "(" . \Yii::$app->formatter->asRelativeTime($model->created_at) . ")"], ['format' => 'raw', 'label' => \Yii::t('skeeks/form2/app', 'Post Number'), 'value' => "<a href=\"{$model->site->url}\" target=\"_blank\" data-pjax=\"0\">{$model->site->name}</a>"], ['format' => 'raw', 'label' => \Yii::t('skeeks/form2/app', 'Submitted by'), 'value' => "{$model->createdBy->displayName}"], ['attribute' => 'ip', 'label' => \Yii::t('skeeks/form2/app', 'Ip address of the sender')], ['attribute' => 'page_url', 'format' => 'raw', 'label' => \Yii::t('skeeks/form2/app', 'Ip address of the sender'), 'value' => Html::a($model->page_url, $model->page_url, ['target' => '_blank', 'data-pjax' => 0])]]]);
?>

<?php 
echo $form->fieldSetEnd();
?>

<?php 
echo $form->fieldSet(\Yii::t('skeeks/form2/app', 'Control'));
?>
    <?php 
echo $form->fieldSelect($model, 'status', \skeeks\modules\cms\form2\models\Form2FormSend::getStatuses())->hint(\Yii::t('skeeks/form2/app', 'If you are treated with this message, change the status for convenience'));
?>

    <?php 
echo $form->fieldSelect($model, 'processed_by', \yii\helpers\ArrayHelper::map(\skeeks\cms\models\User::find()->active()->all(), 'id', 'displayName'))->hint(\Yii::t('skeeks/form2/app', 'If you are treated with this message, change the status for convenience'));
?>

    <?php 
echo $form->field($model, 'comment')->textarea(['rows' => 5])->hint(\Yii::t('skeeks/form2/app', 'Short note, personal notes on this ship. Not necessary.'));
?>

<?php 
echo $form->fieldSetEnd();
?>

<?php 
/**
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 21.09.2016
 */
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\Game */
/* @var $dataProvider yii\data\ActiveDataProvider */
$filter = new \yii\base\DynamicModel(['id']);
$filter->addRule('id', 'integer');
$filter->load(\Yii::$app->request->get());
if ($filter->id) {
    $dataProvider->query->andWhere(['id' => $filter->id]);
}
?>
<? $form = \skeeks\cms\modules\admin\widgets\filters\AdminFiltersForm::begin([
        'action' => '/' . \Yii::$app->request->pathInfo,
    ]); ?>


    <?php 
echo $form->field($searchModel, 'form_id')->listBox(\yii\helpers\ArrayHelper::merge(['' => null], \yii\helpers\ArrayHelper::map(\skeeks\modules\cms\form2\models\Form2Form::find()->all(), 'id', 'name')), ['size' => 1])->setVisible();
?>

    <?php 
echo $form->field($searchModel, 'status')->listBox(\yii\helpers\ArrayHelper::merge(['' => null], \skeeks\modules\cms\form2\models\Form2FormSend::getStatuses()), ['size' => 1]);
?>

<? $form::end(); ?>
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getElement()
 {
     return $this->hasOne(Form2FormSend::className(), ['id' => 'element_id']);
 }