Example #1
0
            <div class="col-md-8">
                <?php 
echo $form->field($model, 'product_img')->fileInput();
?>
                <?php 
if (!$model->isNewRecord) {
    ?>
                    <img src="<?php 
    echo Yii::$app->params['domainName'] . '/images/' . $model->product_img;
    ?>
" />
                <?php 
}
?>
                <?php 
echo $form->field($model, 'product_type')->dropDownlist(Product::getTypeArray());
?>
                <?php 
echo $form->field($model, 'product_name')->textInput(['maxlength' => true]);
?>
                <?php 
echo $form->field($model, 'product_summary')->textarea(['rows' => 6]);
?>
                <?php 
echo $form->field($model, 'product_description')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'replaceDivs' => false, 'minHeight' => 400, 'imageUpload' => Url::to(['/product/default/image-upload']), 'fileUpload' => Url::to(['/product/default/file-upload'])]]);
?>
            </div>
            <div class="col-md-4">
                <?php 
echo $form->field($model, 'meta_title')->textInput();
?>
Example #2
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
use backend\modules\product\models\Product;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\product\models\ProductSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Продукция';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box box-primary">
    <div class="box-body">

    <p>
        <?php 
echo Html::a('Добавить продукцию', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'product_img', 'format' => 'raw', 'value' => function ($model, $key, $index, $column) {
    return Html::img(Yii::$app->params['domainName'] . '/images/' . $model->product_img, ['width' => '130px']);
}, 'contentOptions' => ['style' => 'width:130px;']], ['attribute' => 'product_type', 'filter' => Product::getTypeArray(), 'value' => 'ProductTypeName', 'contentOptions' => ['style' => 'width:250px;']], 'product_name', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'contentOptions' => ['class' => 'actionColumn'], 'buttonOptions' => ['class' => 'btn btn-sm btn-default', 'style' => 'padding:1px 10px;']]]]);
?>

    </div>
</div>