/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Catgry::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, 'added' => $this->added]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'descript', $this->descript]);
     return $dataProvider;
 }
 /**
  * Finds the Catgry model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Catgry the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Catgry::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => true]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <?php 
echo $form->field($model, 'website')->textInput(['type' => 'url', 'maxlength' => true]);
?>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <?php 
$categories = Catgry::find()->asArray()->all();
$dataList = ArrayHelper::map($categories, 'id', 'name');
?>

            <?php 
echo $form->field($model, 'catgry')->dropDownList($dataList, ['empty' => '--- Odaberi---']);
?>
        </div>
        <div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
            <?php 
$dataList = ['0' => 'Besplatno', '1' => 'Prijatelji', '2' => 'Placeno'];
?>

            <?php 
echo $form->field($model, 'priority')->dropDownList($dataList, ['empty' => '--- Odaberi---']);
?>