Beispiel #1
0
use yii\helpers\Html;
use yii\grid\GridView;
use app\modules\article\models\CategoryRecord;
/* @var $this yii\web\View */
/* @var $searchModel app\modules\article\models\EventsRecordSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('app', 'Новости');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="events-record-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <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', ['class' => \app\modules\core\components\ImageColumn::className()], ['attribute' => 'categoryId', 'value' => 'category.title', 'filter' => CategoryRecord::dropdown()], 'title', 'alias', 'dateUpdate:date', ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]);
?>

</div>
Beispiel #2
0
<?php

use app\modules\article\models\CategoryRecord;
/* @var $this yii\web\View */
/* @var $model app\modules\article\models\EventsRecord */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="events-record-form">
    <div class="well">
        <div class="row">
            <div class="col-md-6">
                <?php 
echo $form->field($model, '[' . $k . ']categoryId')->dropDownList(CategoryRecord::dropdown(), ['prompt' => 'Выбор']);
?>
                <?php 
echo $form->field($model, '[' . $k . ']title')->textInput(['maxlength' => true]);
?>
                <?php 
echo $form->field($model, '[' . $k . ']descriptionShort')->textarea(['rows' => 6]);
?>

                <?php 
echo $form->field($model, '[' . $k . ']metaKeywords')->textInput(['maxlength' => true]);
?>

                <?php 
echo $form->field($model, '[' . $k . ']metaDescription')->textarea(['maxlength' => true]);
?>
            </div>
            <div class="col-md-6">