Пример #1
0
if (!$model->isNewRecord) {
    ?>
                    <?php 
    echo Html::img($model->logo, ['title' => $model->name]);
    ?>
                <?php 
}
?>
            </div>
        </div>

        <?php 
echo $form->field($model, 'sort')->textInput()->hint(Yii::t('Goods', 'brand_form_sort_hint'));
?>

        <?php 
echo $form->field($model, 'available')->hint(Yii::t('Goods', 'brand_form_available_hint'))->radioList(\common\models\Available::labels(), ['item' => function ($index, $label, $name, $checked, $value) {
    return Html::radio($name, $checked, ['value' => $value, 'label' => $label, 'labelOptions' => ['class' => 'radio-inline']]);
}]);
?>
    </div>
</div>

<div class="form-group col-sm-12">
    <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('Goods', 'Create') : Yii::t('Goods', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success col-sm-1' : 'btn btn-primary col-sm-1']);
?>
</div>

<?php 
ActiveForm::end();
Пример #2
0
<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\goods\BrandSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('Goods', 'brands');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="brand-index">

    <p>
        <?php 
echo Html::a(Yii::t('Goods', 'create_brand'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-striped table-bordered text-center'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'name', 'headerOptions' => ['class' => 'text-center']], ['attribute' => 'url', 'format' => 'raw', 'value' => function ($data) {
    return Html::a($data->url, $data->url, ['target' => '_blank']);
}, 'headerOptions' => ['class' => 'text-center']], ['attribute' => 'logo', 'format' => 'raw', 'value' => function ($data) {
    return Html::img($data->logo, ['width' => 60, 'height' => 60, 'title' => $data->name]);
}, 'headerOptions' => ['class' => 'text-center']], ['attribute' => 'sort', 'headerOptions' => ['class' => 'text-center', 'width' => '10%']], ['attribute' => 'available', 'format' => 'raw', 'value' => function ($data) {
    return Html::tag('span', \common\models\Available::getLabel($data->available), ['class' => \common\models\Available::getStyle($data->available)]);
}, 'filter' => Html::activeDropDownList($searchModel, 'available', \common\models\Available::labels(), ['class' => 'form-control', 'prompt' => Yii::t('System', 'common_whole')]), 'headerOptions' => ['class' => 'text-center']], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Пример #3
0
?>

        <?php 
echo $form->field($model, 'parent_id')->dropDownList($model->groups());
?>

        <?php 
echo $form->field($model, 'type')->dropDownList($model->formTags());
?>

        <?php 
echo $form->field($model, 'items')->textarea(['rows' => 5, 'maxlength' => true]);
?>

        <?php 
echo $form->field($model, 'available')->radioList(Available::labels(), ['item' => function ($index, $label, $name, $checked, $value) {
    return Html::radio($name, $checked, ['value' => $value, 'label' => $label, 'labelOptions' => ['class' => 'radio-inline']]);
}]);
?>
    </div>
</div>

<div class="form-group col-sm-12">
    <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('Goods', 'create') : Yii::t('Goods', 'update'), ['class' => $model->isNewRecord ? 'btn btn-success col-sm-1' : 'btn btn-primary col-sm-1']);
?>
</div>

<?php 
ActiveForm::end();
?>