本文整理汇总了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} {update}']]]);
?>
</div>
</div>
示例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']]);