コード例 #1
0
ファイル: _form.php プロジェクト: cnzhangxl/lnsoft
$form = ActiveForm::begin();
?>
    <div class="box-body piece-form">
    <?php 
echo $form->field($model, 'name', ['inputOptions' => ['class' => 'form-control', 'readonly' => $model->isNewRecord ? false : true]])->textInput(['maxlength' => true, 'placeholder' => '输入' . $model->getAttributeLabel('name')]);
?>


    <?php 
if ($model->isNewRecord) {
    ?>
    <?php 
    echo $form->field($model, 'key')->textInput(['maxlength' => true, 'placeholder' => '输入' . $model->getAttributeLabel('key')]);
    ?>
    <?php 
    echo $form->field($model, 'category_id')->textInput()->dropDownList(ArrayHelper::map(PieceCategory::find()->where(['status' => 1])->all(), 'id', 'title'));
    ?>
    <?php 
    echo $form->field($model, 'description')->textarea(['rows' => 3]);
    ?>

    <?php 
    echo $form->field($model, 'pre_url')->textInput(['maxlength' => true, 'placeholder' => '输入' . $model->getAttributeLabel('pre_url')]);
    ?>

    <?php 
    echo $form->field($model, 'status')->textInput()->dropDownList(common\models\Common::getStatus());
    ?>
    <?php 
}
?>
コード例 #2
0
 /**
  * 列表
  * @return  {[type]} [description]
  * @version 1.0      2016-03-09T14:45:28+0800     * @author cnzhangxl@foxmail.com
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => PieceCategory::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }