Ejemplo n.º 1
0
<div class="news-form">

    <?php 
$form = ActiveForm::begin();
?>

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

    <!--
    <//?= $form->field($model, 'cat')->textInput() ?>
    -->

    <?php 
echo $form->field($model, 'cat')->dropDownList(News::getCatOption());
?>

    <!--
    <//?= $form->field($model, 'content')->textarea(['rows' => 6]) ?>
    -->


    <?php 
echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => ['lang' => 'zh_cn', 'minHeight' => 200, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'plugins' => ['clips', 'fullscreen', 'fontcolor', 'fontfamily', 'fontsize', 'limiter', 'table', 'textexpander', 'textdirection', 'video', 'definedlinks', 'filemanager', 'imagemanager'], 'imageManagerJson' => Url::to(['/news/imagesget']), 'imageUpload' => Url::to(['/news/imageupload'])]]);
?>


    <!--
    <//?= $form->field($model, 'create_time')->textInput() ?>
Ejemplo n.º 2
0
use app\models\News;
/* @var $this yii\web\View */
/* @var $searchModel app\models\NewsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '新闻管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-index">

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

    <p>
        <?php 
echo Html::a('创建新闻', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'showOnEmpty' => false, 'tableOptions' => ['class' => 'table table-striped'], 'columns' => ['news_id', 'title', 'create_time', ['attribute' => 'cat', 'label' => '分类', 'value' => function ($model, $key, $index, $column) {
    return News::getCatOption($model->cat);
}, 'filter' => News::getCatOption(), 'headerOptions' => array('style' => 'width:90px;')], 'clickcnt', ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>