/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = RecommendList::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'fontnum' => $this->fontnum, 'width' => $this->width, 'height' => $this->height]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'filedir', $this->filedir]);
     return $dataProvider;
 }
 /**
  * Finds the RecommendList model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return RecommendList the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = RecommendList::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #3
0
echo $form->field($model, 'subject')->textInput(['maxlength' => true]);
?>
    <div class="form-group">
        <label>标题颜色:</label>
        <div class="input-group my-colorpicker2 colorpicker-element">
        <input type="text" class="form-control" name="RecommendData[color]" value="<?php 
echo $model->color;
?>
">
        <div class="input-group-addon">
        <i style="background-color: rgb(0, 0, 0);"></i>
        </div>
        </div><!-- /.input group -->
    </div>
    <?php 
echo $form->field($model, 'lid')->dropDownList(ArrayHelper::map(RecommendList::get(RecommendList::find()->asArray()->all()), 'id', 'label'), ['style' => 'width:auto;']);
?>

    <?php 
echo $form->field($model, 'summary')->widget('kucha\\ueditor\\UEditor', ['clientOptions' => ['initialFrameHeight' => '200', 'toolbars' => [['fullscreen', 'source', 'undo', 'redo', '|', 'fontsize', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', '|', 'forecolor', 'backcolor', '|']]]]);
?>
    <?php 
echo $form->field($model, 'img')->fileInput();
?>
    <?php 
if ($model->img) {
    echo '<img id="preview" src="' . Yii::$app->params['siteurl']['frontend'] . $model->img . '">';
}
?>
    <?php 
echo $form->field($model, 'url')->textInput(['maxlength' => true]);
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getList()
 {
     return $this->hasOne(RecommendList::className(), ['id' => 'lid']);
 }