From 2b474916fdf510ead3115634ba4be9bdfe611d20 Mon Sep 17 00:00:00 2001 From: SoHardKI Date: Fri, 26 Jul 2019 16:02:35 +0300 Subject: [PATCH] add_download --- backend/modules/card/models/UserCard.php | 2 ++ backend/modules/card/views/user-card/view.php | 14 +++++++++++++- common/models/FieldsValueNew.php | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/backend/modules/card/models/UserCard.php b/backend/modules/card/models/UserCard.php index d23b70e..72f0b29 100755 --- a/backend/modules/card/models/UserCard.php +++ b/backend/modules/card/models/UserCard.php @@ -31,6 +31,7 @@ class UserCard extends \common\models\UserCard ['field_id' => $item->field_id, 'value' => $item->value, 'order' => $item->order, + 'type_file' => $item->type_file, 'field_name' => $item->field->name]); } $this->fields = $array; @@ -42,6 +43,7 @@ class UserCard extends \common\models\UserCard 'value' => null, 'order' => null, 'field_name' => null, + 'type_file' => null, ], ]; } diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index 21944d6..81f87a4 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -73,8 +73,20 @@ $this->params['breadcrumbs'][] = $this->title; 'columns' => [ 'field.name:text:Поле', 'value', + [ + 'label' => 'Download', + 'format' => 'raw', + 'value' => function($model){ + if ($model->type_file == 'file'){ + return Html::a('Скачать', $model->value, ['target' => '_blank']); + } + return null; + } + ], ], ]); ?> - +fields[0]['type_file'] == 'file'): ?> +fields[0]['value'], ['target' => '_blank']); ?> + diff --git a/common/models/FieldsValueNew.php b/common/models/FieldsValueNew.php index 439faf1..d386bde 100644 --- a/common/models/FieldsValueNew.php +++ b/common/models/FieldsValueNew.php @@ -54,7 +54,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord 'item_type' => 'Item Type', 'order' => 'Order', 'value' => 'Value', - 'type_file' => 'Приложение' + 'type_file' => 'Тип файла' ]; }