public function selectOptions() { $query = Provider::find(); $arr = $query->select(['id', 'name'])->asArray()->all(); $options = ['' => 'Обрати']; foreach ($arr as $op) { $options[$op['id']] = $op['name']; } return $options; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Provider::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, 'user_id' => $this->user_id, 'industry_id' => $this->industry_id, 'registration_time' => $this->registration_time, 'is_active' => $this->is_active, 'del_upd_time' => $this->del_upd_time, 'service_upd_time' => $this->service_upd_time, 'score' => $this->score, 'rate' => $this->rate, 'rating' => $this->rating, 'hit_counter' => $this->hit_counter]); $query->andFilterWhere(['like', 'legal_form', $this->legal_form])->andFilterWhere(['like', 'VAT_ID', $this->VAT_ID])->andFilterWhere(['like', 'company_no', $this->company_no])->andFilterWhere(['like', 'status', $this->status]); return $dataProvider; }
} // foreach ($sektor as $key=>$sek) ?> </div> <div class="show_more"><?php echo Html::a('POKAŽI JOŠ', Url::to('/providers'), array('class' => 'btn btn-default')); ?> </div> <div class="featured"> <h2 style="text-align:center; margin:30px 0 10px 0;">Pružaoci usluga koje ste preporučili</h2> <hr> <p class="paragraph" style="text-align:center; margin:0 0 10px 0; color:#aaa; font-size:11px;"><?php echo Yii::t('app', 'Choose category by clicking on the colored boxes and then select one of the service industry from the list below.'); ?> </p> <?php foreach (Provider::find()->where('id>0')->limit(5)->all() as $key => $provider) { echo ProviderBox::widget(['boxData' => []]); } // foreach ($sektor as $key=>$sek) ?> </div> <div class="show_more"><?php echo Html::a('POKAŽI JOŠ', Url::to('/providers'), array('class' => 'btn btn-default')); ?> </div>