当前位置: 首页>>代码示例>>PHP>>正文


PHP Post::getAvailableStatus方法代码示例

本文整理汇总了PHP中app\models\Post::getAvailableStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::getAvailableStatus方法的具体用法?PHP Post::getAvailableStatus怎么用?PHP Post::getAvailableStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Post的用法示例。


在下文中一共展示了Post::getAvailableStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: function

<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\models\Category;
use app\models\Post;
/* @var $this yii\web\View */
/* @var $searchModel app\models\PostSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '文章管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="box post-index">
    <div class="box-header with-border">
        <?php 
echo Html::a('发表新文章', ['create'], ['class' => 'btn btn-success']);
?>
    </div>
    <div class="box-body">
        <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'tableOptions' => ['class' => 'table table-bordered table-hover'], 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'title', ['attribute' => 'cid', 'value' => 'postCategory', 'filter' => Html::activeDropDownList($searchModel, 'cid', ['' => '全部'] + Category::getAllCategories(), ['class' => 'form-control'])], ['attribute' => 'author_id', 'value' => function ($model, $key, $index, $column) {
    return $model->author ? $model->author->nickname : null;
}], ['attribute' => 'is_top', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    return $model->is_top ? '<span class="label label-success">置顶</span>' : '';
}, 'filter' => Html::activeDropDownList($searchModel, 'is_top', ['' => '全部', '0' => '否', '1' => '是'], ['class' => 'form-control'])], ['attribute' => 'status', 'value' => 'postStatus', 'filter' => Html::activeDropDownList($searchModel, 'status', ['' => '全部'] + Post::getAvailableStatus(), ['class' => 'form-control'])], ['attribute' => 'comment_count', 'filter' => false], ['attribute' => 'view_count', 'filter' => false], ['attribute' => 'post_time', 'format' => ['date', 'php:Y-m-d H:i:s'], 'filter' => false], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}&nbsp;&nbsp;{update}']]]);
?>
    </div>
</div>
开发者ID:heartshare,项目名称:yii2-crazydb-blog,代码行数:28,代码来源:index.php

示例2:

echo $form->field($model, 'author_name')->textInput(['maxlength' => true]);
?>
        </div>
    </div>
    <?php 
echo $form->field($model, 'cover', ['template' => '{label}<div class="input-group"><span class="input-group-btn"><button id="cover-upload" type="button" class="btn btn-success">上传图片</button></span>{input}</div>'])->textInput(['maxlength' => true]);
?>
    <div class="row">
        <div class="col-md-12 col-lg-3">
            <?php 
echo $form->field($model, 'cid')->dropDownList(Category::getAllCategories());
?>
        </div>
        <div class="col-md-12 col-lg-3">
            <?php 
echo $form->field($model, 'status')->dropDownList(Post::getAvailableStatus());
?>
        </div>
        <div class="col-md-12 col-lg-3">
            <?php 
echo $form->field($model, 'type')->dropDownList(Post::getAvailableType());
?>
        </div>
        <div class="col-md-12 col-lg-3">
            <?php 
echo $form->field($model, 'is_top')->dropDownList(['0' => '普通', '1' => '置顶']);
?>
        </div>
    </div>
    <?php 
echo $form->field($model, 'content')->textarea(['rows' => 6])->widget(UEditor::className(), ['config' => ['serverUrl' => ['editor/index'], 'iframeCssUrl' => Yii::getAlias('@web') . '/static/css/ueditor.css']]);
开发者ID:heartshare,项目名称:yii2-crazydb-blog,代码行数:31,代码来源:_form.php


注:本文中的app\models\Post::getAvailableStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。