Example #1
0
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\cms\models\ArticleSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Статьи');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="article-index">


    <pre>Ссылка на модуль: <?php 
echo htmlspecialchars('<?=\\yii\\helpers\\Url::to(["/cms/article/list","type"=>"(news|article|stock)"])?>');
?>
</pre>


    <p>
        <?php 
echo Html::a(Yii::t('app', 'Добавить статью'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'id', ['header' => '', 'value' => function ($model) {
    return Html::img($model->image->resize('100x100'));
}, 'format' => 'html'], 'title', ['attribute' => 'type', 'filter' => \app\modules\cms\models\Article::typeList(), 'value' => 'typeView'], 'alias', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>

</div>
Example #2
0
<div class="article-form">

    <?php 
$form = ActiveForm::begin();
?>


    <div class="row">
        <div class="col-md-1">
            <?php 
echo $form->field($model, 'visible')->checkbox(['label' => 'Активен']);
?>
        </div>
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'type')->dropDownList(\app\modules\cms\models\Article::typeList(), ['prompt' => 'Выбор']);
?>
        </div>
        <div class="col-md-5">
            <?php 
echo $form->field($model, 'dateCreate')->widget(\yii\jui\DatePicker::className(), ['dateFormat' => 'yyyy-MM-dd', 'options' => ['class' => 'form-control']]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 128]);
?>
        </div>