import.php
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
?>
<div class="product-import-form">
    <?php $form = ActiveForm::begin([
        'options' => ['enctype' => 'multipart/form-data']
    ]); ?>
    <?php if($model->errors) :?>
    <div class="error">
        <?= implode("<br>\n", $model->errors);?>
    </div>
    <?php endif?>
    <?php if($model->output) :?>
    <div class="success">
        <?= implode("<br>\n", $model->output);?>
    </div>
    <?php endif?>
    <?= $form->field($model, 'file')->widget(\kartik\file\FileInput::classname(), [
        'language' => 'ru',
        'options' => [
            'multiple' => false,
        ],
        'pluginOptions' => [
            'allowedFileExtensions' => ['csv'],
            'overwriteInitial' => true,
            'showRemove' => false,
            'showUpload' => false,
        ],
    ])?>
    <div class="form-group">
        <?= Html::submitButton(Yii::t('product', 'Import'), ['class' => 'btn btn-primary']) ?>
    </div>
    <?php ActiveForm::end(); ?>
</div>