Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Menu::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'pid' => $this->pid, 'level' => $this->level, 'type' => $this->type, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'merchant_id', $this->merchant_id])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'url', $this->url]);
     return $dataProvider;
 }
Beispiel #2
0
?>

    <?php 
echo $form->field($model, 'w_id')->hiddenInput(['value' => $wechat->id])->label(false);
?>

    <?php 
echo $form->field($model, 'pid')->dropDownList(Menu::menusMap($wechat->id));
?>

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

    <?php 
echo $form->field($model, 'type')->radioList(Menu::typeMap(), ['value' => 1]);
?>

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


	<div class="form-group">
        <div class="col-sm-offset-2 col-sm-3">
            <?php 
echo Html::submitButton('保 存', ['class' => 'btn btn-primary btn-block']);
?>
        </div>
    </div>
    
Beispiel #3
0
 /**
  * Finds the Menu model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Menu the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Menu::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }