/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Relevador::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, 'confirmed_at' => $this->confirmed_at, 'blocked_at' => $this->blocked_at, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'flags' => $this->flags, 'user_lat' => $this->user_lat, 'user_lng' => $this->user_lng, 'user_radius' => $this->user_radius]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'password_hash', $this->password_hash])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'unconfirmed_email', $this->unconfirmed_email])->andFilterWhere(['like', 'registration_ip', $this->registration_ip]); return $dataProvider; }
<?php use yii\helpers\Html; use backend\models\Client; use backend\models\Relevador; /* @var $this yii\web\View */ /* @var $model backend\models\ClientSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('app', 'Map'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="client-map"> <?php $clients = \backend\models\Client::find()->asArray()->all(); $relevators = \backend\models\Relevador::find()->asArray()->all(); ?> <div id="map" style="height:800px; width:100%;"></div> </div> <script> // In the following example, markers appear when the user clicks on the map. // The markers are stored in an array. // The user can then click an option to hide, show or delete the markers. var map; var markers = [];
public function getRelevador() { return $this->hasOne(Relevador::className(), ['idRelevador' => 'idRelevador']); }
/** * Finds the Relevador model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Relevador the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Relevador::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }