本文整理汇总了PHP中app\models\News::getStatuses方法的典型用法代码示例。如果您正苦于以下问题:PHP News::getStatuses方法的具体用法?PHP News::getStatuses怎么用?PHP News::getStatuses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\News
的用法示例。
在下文中一共展示了News::getStatuses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$newsSearch = new NewsSearch();
$dataProvider = $newsSearch->search(Yii::$app->request->get());
$statuses = News::getStatuses();
return $this->render('index', ['newsSearch' => $newsSearch, 'dataProvider' => $dataProvider, 'statuses' => $statuses]);
}
示例2: rules
/**
* @inheritdoc
*/
public function rules()
{
return [['title', 'string'], ['date_pub', 'date', 'format' => 'yyyy-mm-dd'], ['status', 'integer'], ['status', 'in', 'range' => array_keys(News::getStatuses())]];
}
示例3: rules
/**
* @inheritdoc
*/
public function rules()
{
return [[['title', 'text', 'date_pub'], 'required'], [['title', 'text', 'date_pub', 'preview', 'gallery', 'galleryTitles', 'status'], 'safe'], ['title', 'string', 'max' => 255], ['text', 'string'], ['date_pub', 'date', 'format' => 'php:Y-m-d H:i:s', 'timestampAttribute' => 'date_pub', 'timestampAttributeFormat' => 'php:Y-m-d H:i:s'], ['status', 'integer'], ['status', 'in', 'range' => array_keys(News::getStatuses())]];
}
示例4:
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use ijackua\lepture\Markdowneditor;
/* @var $this yii\web\View */
/* @var $model app\models\News */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
$form = ActiveForm::begin();
?>
<?php
echo $form->field($model, 'title')->textInput(['maxlength' => 50]);
?>
<?php
echo Markdowneditor::widget(['model' => $model, 'attribute' => 'text']);
?>
<?php
echo $form->field($model, 'link')->textInput(['maxlength' => 255]);
?>
<?php
echo $form->field($model, 'status')->dropDownList(\app\models\News::getStatuses());
?>
<div class="form-group">
<?php
echo Html::submitButton(Yii::t('news', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>
<?php
ActiveForm::end();