/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = UserProfile::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'lesson_cost' => $this->lesson_cost, 'currency_id' => $this->currency_id, 'created_at' => $this->created_at, 'updated_ad' => $this->updated_ad]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'lastname', $this->lastname]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = UserProfile::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, 'uid' => $this->uid, 'money' => $this->money, 'friend_money' => $this->friend_money, 'sex' => $this->sex, 'birthday' => $this->birthday]); $query->andFilterWhere(['like', 'nickname', $this->nickname])->andFilterWhere(['like', 'head_image', $this->head_image])->andFilterWhere(['like', 'intro', $this->intro])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'qq', $this->qq])->andFilterWhere(['like', 'school', $this->school]); return $dataProvider; }
public function actionInterview() { $userdetails = \Yii::$app->user->identity; $model = InterviewVideo::find()->where(['user_id' => $userdetails->id])->one(); //echo "<pre>";print_r($model->video);die; if (empty($model)) { $model = new InterviewVideo(); } $video = new Video(); $user = Userform::find()->where(['id' => $userdetails->id])->one(); if (empty($user)) { $user = new Userform(); } $userprofile = UserProfile::find()->where(['user_id' => $userdetails->id])->one(); if (empty($userprofile)) { $userprofile = new UserProfile(); } if (isset($_POST['Video'])) { $video->attributes = $_POST['Video']; $video->media_module_id = 5; // id 5 is interview video type in tlb_media_module table $model->user_id = $userdetails->id; if ($video->validate()) { $video->save(); $model->video_id = $video->id; $model->save(); } } return $this->render('interview', ['model' => $model, 'user' => $user, 'video' => $video, 'userprofile' => $userprofile]); }
public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => UserProfile::find(), 'pagination' => ['pageSize' => 20]]); return $this->render('index', array('dataProvider' => $dataProvider)); }
public static function getTableProfile() { $cat = UserProfile::find()->all(); $cat = ArrayHelper::map($cat, 'id', 'name'); return $cat; }