コード例 #1
0
ファイル: view.php プロジェクト: esoftslimited/yii2-blog
use esoftslimited\blog\Module;
use esoftslimited\blog\helpers\Helper;
/* @var $this yii\web\View */
/* @var $model esoftslimited\blog\models\Type */
$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Post types'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="type-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-pencil"></span> ' . Module::t('main', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-trash"></span> ' . Module::t('main', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'title', 'alias', ['attribute' => 'show_category', 'value' => Helper::booleanChoiceArray()[$model->show_category]]]]);
?>

</div>
コード例 #2
0
ファイル: _form.php プロジェクト: esoftslimited/yii2-blog
<div class="type-form">

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

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'alias')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'show_category')->dropDownList(Helper::booleanChoiceArray());
?>

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

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

</div>
コード例 #3
0
ファイル: index.php プロジェクト: esoftslimited/yii2-blog
use yii\grid\GridView;
use esoftslimited\blog\Module;
use esoftslimited\blog\helpers\Helper;
/* @var $this yii\web\View */
/* @var $searchModel esoftslimited\blog\models\TypeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Module::t('main', 'Post types');
$this->params['breadcrumbs'][] = ['label' => Module::t('main', 'Blog'), 'url' => ['default/index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="type-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('<span class="glyphicon glyphicon-plus"></span> ' . Module::t('main', 'New post type'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => ['title', 'alias', ['attribute' => 'show_category', 'format' => 'html', 'value' => function ($model) {
    return Helper::booleanIconChoiceArray()[$model->show_category];
}, 'filter' => Helper::booleanChoiceArray()], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>