Esempio n. 1
0
 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]);
     }
 }
Esempio n. 2
0
 public function actionImprimir()
 {
     // get your HTML raw content without any layouts or scrip
     $Requisitos = Requisitos::find()->all();
     $content = $this->renderPartial('_imprimir', ['Requisitos' => $Requisitos]);
     $header = $this->renderPartial('_header', ['Requisitos' => $Requisitos]);
     $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'Krajee Report Title'], 'methods' => ['SetHeader' => $header, 'SetFooter' => ['{PAGENO}']]]);
     // return the pdf output as per the destination setting
     return $pdf->render();
 }