public function actionLogin() { $model = new LoginForm(); if (!Yii::$app->user->isGuest or $model->load(Yii::$app->request->post()) && $model->login()) { $usuarioActual = UsuariosRoles::find()->where('usuarioId = :id', ['id' => Yii::$app->user->id])->all(); foreach ($usuarioActual as $ua) { if ($ua->roles->nombre == "educacion") { return $this->redirect(["site/escuelas"]); } else { if ($ua->roles->nombre == "Proyectos") { return $this->redirect(['proyectos/index']); } else { if ($ua->roles->nombre == "eduardo") { return $this->redirect(['dictamenes/index']); } else { if ($ua->roles->nombre == "Zonificacion") { return $this->redirect(['tramite-zonificacion/index']); } else { if ($ua->roles->nombre == "Uso de Suelo") { return $this->redirect(['tramite-zonificacion/index']); //$rol = UsuariosRoles::find()->where('usuarioId = '. Yii::$app->user->id)->one(); //$tramites = TipoTramitesRoles::find()->where('roleId = '. $rol->roleId . ' and leer = 1' )->all(); //return $this->redirect(['tipos-tramite/index']); //'index',['tipos-tramites'=>$tramites]); } else { if ($ua->roles->nombre == 'Dev') { return $this->redirect(['tramite-zonificacion/index']); } else { if ($ua->roles->nombre == 'pedro') { return $this->redirect(['tramites-espectaculares/index']); } else { if ($ua->roles->nombre == 'Fraccionamiento') { return $this->redirect(['tramites-autorizacion/index']); } else { if ($ua->roles->nombre == 'Construccion') { return $this->redirect(['tramites-alineamiento/index']); } else { if ($ua->roles->nombre == 'Sistemas') { return $this->redirect(['tipos-tramite/index']); } else { if ($ua->roles->nombre == "Direccion") { return $this->redirect(['tramite-zonificacion/index']); } } } } } } } } } } } } } else { $requisitos = Requisitos::find()->all(); return $this->render('login', ['model' => $model, 'requisitos' => $requisitos]); } }
/** * Finds the Empleado model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Empleado the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Requisitos::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }