コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CategoryDifficulty::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]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'text', $this->text]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the CategoryDifficulty model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CategoryDifficulty the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CategoryDifficulty::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
?>

    <?php 
echo $form->field($model, 'url_info')->textInput(['maxlength' => true])->hint('Optional. separate multiple with ;');
?>

    <?php 
echo $form->field($model, 'text')->textarea(['rows' => 10]);
?>

    <?php 
echo $form->field($model, 'id_classification')->checkboxList(ArrayHelper::map(CategoryClassification::find()->all(), 'id', 'name'));
?>

    <?php 
echo $form->field($model, 'id_difficulty')->radioList(ArrayHelper::map(CategoryDifficulty::find()->all(), 'id', 'name'), ['prompt' => 'Select Difficulty...']);
?>

    <div class="col-sm-12" id="tbl_display">
        <table class="table table-bordered table-condensed table-striped">
            <thead>
            <tr>
                <th>Relax</th>
                <th>Fun</th>
                <th>Adventure</th>
                <th>Extreme</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Zoo</td>
コード例 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdDifficulty()
 {
     return $this->hasOne(CategoryDifficulty::className(), ['id' => 'id_difficulty']);
 }