Esempio n. 1
0
 public function actionIndex()
 {
     $Model = new Masuser();
     $Log = new LogOpen();
     $userId = Yii::$app->session['userId'];
     $data['log'] = $Log->Getlog($userId);
     $data['user'] = $Model->Getuser($userId);
     return $this->render('index', $data);
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Masuser::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, 'flag' => $this->flag, 'create_date' => $this->create_date]);
     $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'lname', $this->lname])->andFilterWhere(['like', 'card', $this->card])->andFilterWhere(['like', 'hospcode', $this->hospcode]);
     return $dataProvider;
 }
Esempio n. 3
0
 public function actionLogin()
 {
     $Model = new Masuser();
     $request = \Yii::$app->request;
     $username = $request->post('username');
     $passwordInput = $request->post('password');
     $Auth = $Model->Auth($username);
     if (!empty($Auth)) {
         if ($Auth['password'] == $passwordInput) {
             \Yii::$app->session['username'] = $username;
             \Yii::$app->session['userId'] = $Auth['id'];
             \Yii::$app->session['user'] = true;
             //Set Privilege In Session
             $Privilege = new Privilege();
             $Privilege->getPrivilege($Auth['id']);
             $flag = "1";
         } else {
             $flag = "0";
         }
     } else {
         $flag = "0";
     }
 }
Esempio n. 4
0
 /**
  * Finds the Masuser model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Masuser the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Masuser::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(Masuser::className(), ['id' => 'user_id']);
 }