public function searchPersonalia($params) { // $EMP_ID=Yii::$app->user->identity->EMP_ID; $profile = Yii::$app->getUserOpt->Profile_user(); $query = ModulEvent::find()->joinWith('modulPesonalia', false)->where(['p0001.USER_ID' => $profile->emp->EMP_ID]); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['MODUL_ID' => $this->MODUL_ID]); // $query->andFilterWhere(['like', 'title', $this->title]) // ->andFilterWhere(['like', 'USER_ID', $this->USER_ID]) // ->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY]) // ->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]); return $dataProvider; }
/** * Finds the ModulEvent model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return ModulEvent the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ModulEvent::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function actionSaveEvent() { if (Yii::$app->request->isAjax) { $request = Yii::$app->request; $profile = Yii::$app->getUserOpt->Profile_user(); $tgl2 = $request->post('title'); $modulid = $request->post('modulid'); $tgl1 = $request->post('tgl1'); $mdl_parent = $request->post('parent'); // echo $title; $model = new ModulEvent(); $model->MODUL_ID = $modulid; $model->MODUL_PRN = $mdl_parent; $model->start = $tgl1; $model->end = $tgl2; $model->CREATE_BY = $profile->emp->EMP_ID; $model->CREATE_AT = date('Y-m-d H:i:s'); $model->USER_ID = $profile->emp->EMP_ID; // $model-> $model->save(); return true; } }