コード例 #1
0
ファイル: _form.php プロジェクト: funson86/yii2-blog
?>

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

    <?php 
echo $form->field($model, 'banner')->fileInput();
?>

    <?php 
echo $form->field($model, 'click')->textInput();
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(\funson86\blog\models\Status::labels());
?>

    <div class="form-group">
        <label class="col-lg-2 control-label" for="">&nbsp;</label>
        <?php 
echo Html::submitButton($model->isNewRecord ? Module::t('blog', 'Create') : Module::t('blog', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

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

</div>
コード例 #2
0
ファイル: index.php プロジェクト: funson86/yii2-blog
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="blog-post-index">

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

    <p>
        <?php 
echo Html::a(Module::t('blog', 'Create ') . Module::t('blog', 'Blog Post'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\CheckboxColumn'], ['attribute' => 'catalog_id', 'value' => function ($model) {
    return $model->catalog->title;
}, 'filter' => Html::activeDropDownList($searchModel, 'catalog_id', \funson86\blog\models\BlogPost::getArrayCatalog(), ['class' => 'form-control', 'prompt' => Module::t('blog', 'Please Filter')])], 'title', 'commentsCount', ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    if ($model->status === Status::STATUS_ACTIVE) {
        $class = 'label-success';
    } elseif ($model->status === Status::STATUS_INACTIVE) {
        $class = 'label-warning';
    } else {
        $class = 'label-danger';
    }
    return '<span class="label ' . $class . '">' . $model->getStatus()->label . '</span>';
}, 'filter' => Html::activeDropDownList($searchModel, 'status', Status::labels(), ['class' => 'form-control', 'prompt' => Module::t('blog', 'PROMPT_STATUS')])], 'created_at:date', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
コード例 #3
0
ファイル: index.php プロジェクト: funson86/yii2-blog
    ?>
</td>
            <td><?php 
    echo $item['sort_order'];
    ?>
</td>
            <td><?php 
    echo $item['template'];
    ?>
</td>
            <td><?php 
    echo BlogCatalog::getOneIsNavLabel($item['is_nav']);
    ?>
</td>
            <td><?php 
    echo \funson86\blog\models\Status::labels()[$item['status']];
    ?>
</td>
            <td>
                <a href="<?php 
    echo \Yii::$app->getUrlManager()->createUrl(['blog/blog-catalog/create', 'parent_id' => $item['id']]);
    ?>
" title="<?php 
    echo Module::t('blog', 'Add Sub Catelog');
    ?>
" data-pjax="0"><span class="glyphicon glyphicon-plus-sign"></span></a>
                <a href="<?php 
    echo \Yii::$app->getUrlManager()->createUrl(['blog/blog-catalog/view', 'id' => $item['id']]);
    ?>
"" title="<?php 
    echo Module::t('blog', 'View');