diff --git a/backend/modules/card/models/UserCard.php b/backend/modules/card/models/UserCard.php index 302e32b..9365b92 100755 --- a/backend/modules/card/models/UserCard.php +++ b/backend/modules/card/models/UserCard.php @@ -71,6 +71,8 @@ class UserCard extends \common\models\UserCard if ($post['fields']) { FieldsValueNew::deleteAll(['item_id' => $this->id, 'item_type' => FieldsValueNew::TYPE_PROFILE]); foreach ($post['fields'] as $item) { + $item['value'] = urldecode($item['value']); + $fieldsValue = new FieldsValueNew(); $fieldsValue->field_id = $item['field_id']; $fieldsValue->value = $item['value']; diff --git a/backend/modules/notes/models/Note.php b/backend/modules/notes/models/Note.php index e1d320c..4dc2258 100755 --- a/backend/modules/notes/models/Note.php +++ b/backend/modules/notes/models/Note.php @@ -51,6 +51,8 @@ class Note extends \common\models\Note FieldsValueNew::deleteAll(['item_id' => $this->id, 'item_type' => FieldsValueNew::TYPE_NOTE]); foreach ( $post['fields'] as $item) { + $item['value'] = urldecode($item['value']); + $fieldsValue = new FieldsValueNew(); $fieldsValue->field_id = $item['field_id']; $fieldsValue->item_id = $this->id; diff --git a/common/models/FieldsValueNew.php b/common/models/FieldsValueNew.php index ffaf54a..ca60f82 100644 --- a/common/models/FieldsValueNew.php +++ b/common/models/FieldsValueNew.php @@ -70,8 +70,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord { return $this->hasOne(AdditionalFields::class, ['id' => 'field_id']); } - - + /** * get value for view * @return string @@ -94,7 +93,9 @@ class FieldsValueNew extends \yii\db\ActiveRecord $downloadLinkHTML = ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')'; $result = $imageHTML . $downloadLinkHTML; } else { - $result = $filename . ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')'; + $imageHTML = Html::img('/media/file.png', ['width' => '100px', 'alt' => $filename]); + $downloadLinkHTML = ' (' . Html::a('Скачать', $this->value, ['target' => '_blank', 'download' => $filename]) . ')';; + $result = $imageHTML . $filename . $downloadLinkHTML; } return $result; } @@ -137,7 +138,7 @@ class FieldsValueNew extends \yii\db\ActiveRecord } $extension = explode('/', $mime)['0']; - if (($extension === 'image') || $extension === 'application') { + if ($extension === 'image') { return true; } else { return false; diff --git a/frontend/web/media/file.png b/frontend/web/media/file.png new file mode 100644 index 0000000..b14b639 Binary files /dev/null and b/frontend/web/media/file.png differ