本文整理匯總了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();