public function __construct()
 {
     $this->middleware('auth');
     $this->edo_civil = \App\Models\EdoCivil::all()->lists('descripcion', 'id');
     $this->estados = \App\Models\Estados::all()->lists('nombre', 'id');
     $this->municipios = \App\Models\Municipios::all()->lists('nombre', 'id');
     $this->parroquias = \App\Models\Parroquias::all()->lists('nombre', 'id');
     $this->ocupacion = \App\Models\Ocupacion::all()->lists('nombre', 'id');
     $this->recepcion = \App\Models\Recepcion::all()->lists('nombre', 'id') + ['' => 'SELECCIONE..'];
     $this->discapacidad = \App\Models\discapacidad::all()->lists('nombre', 'id') + ['' => 'SELECCIONE..'];
     $this->gradoDis = \App\Models\GradoDiscapacidad::where('estatus', '=', 1)->lists('nombre', 'id') + ['' => 'SELECCIONE..'];
     $this->modalidad = \App\Models\TipoAtencion::all()->lists('nombre', 'id') + ['' => 'SELECCIONE..'];
     $this->comites = \App\Models\Comites::all()->lists('nombre', 'id');
     $this->misiones = \App\Models\Misiones::all()->lists('nombre', 'id');
     $this->vivienda = \App\Models\tipoVivienda::all()->lists('nombre', 'id');
     $this->pisos = \App\Models\tipoPisos::all()->lists('nombre', 'id');
     $this->paredes = \App\Models\tipoParedes::all()->lists('nombre', 'id');
     $this->techos = \App\Models\tipoTechos::all()->lists('nombre', 'id');
     $this->suministro_agua = \App\Models\Servicios::where('padre', '=', 1)->lists('nombre', 'id');
     $this->gas = \App\Models\Servicios::where('padre', '=', 2)->lists('nombre', 'id');
     $this->desecho = \App\Models\Servicios::where('padre', '=', 3)->lists('nombre', 'id');
     $this->agua_ser = \App\Models\Servicios::where('padre', '=', 8)->lists('nombre', 'id');
     $this->servicios = \App\Models\Servicios::where('padre', '=', null)->lists('nombre', 'id');
     $this->servicios_comunidad = \App\Models\Servicios_comunidad::all()->lists('nombre', 'id');
     $this->realidad = \App\Models\RealidadSocioeconomica::all()->lists('pregunta', 'id');
     $this->casa_comercial = \App\Models\CasaComercial::all()->lists('nombre', 'id');
     $this->sub_secretaria = \App\Models\Sub_secretaria::where('estatus', '=', 1)->lists('descripcion', 'id');
     $this->consulta_ingreso = \App\Models\consulta_ingreso::where('estatus', '=', 1)->lists('nombre', 'id');
     $this->nivel_instruccion = \App\Models\nivel_instruccion::where('estatus', '=', 1)->lists('nombre', 'id');
     $this->parentesco = \App\Models\parentesco::where('estatus', '=', 1)->lists('nombre', 'id');
     $this->anexos = \App\Models\Anexos::where('estatus', '=', 1)->lists('nombre', 'id');
     $this->atencion = \App\Models\TipoAtencion::where('estatus', 1)->lists('nombre', 'id');
 }
Example #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Estados::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]);
     $query->andFilterWhere(['like', 'nombre_estado', $this->nombre_estado])->andFilterWhere(['like', 'contexto', $this->contexto]);
     return $dataProvider;
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdEstado()
 {
     return $this->hasOne(Estados::className(), ['id' => 'id_estado']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdAdmin()
 {
     return $this->hasOne(Estados::className(), ['id' => 'id_admin']);
 }
 /**
  * Updates an existing ProyectoLocalizacion model.
  * For ajax request will return json object
  * and for non-ajax request if update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $request = Yii::$app->request;
     $model = $this->findModel($id);
     //Escenario
     $model->scenario = $this->findAmbito($model->id_proyecto);
     switch ($model->scenario) {
         case 'Nacional':
             $model->id_pais = Pais::findOne(['nombre' => 'Venezuela'])->id;
             break;
         default:
             $model->id_pais = Pais::findOne(['nombre' => 'Venezuela'])->id;
             break;
     }
     //Listas desplegables
     $paises = Pais::find()->all();
     $estados = Estados::find()->all();
     $parroquias = Parroquia::find()->all();
     $municipios = Municipio::find()->all();
     if ($request->isAjax) {
         /*
          *   Process for ajax request
          */
         Yii::$app->response->format = Response::FORMAT_JSON;
         if ($request->isGet) {
             return ['title' => "Update ProyectoLocalizacion #" . $id, 'content' => $this->renderPartial('update', ['model' => $model, 'paises' => $paises, 'estados' => $estados, 'municipios' => $municipios, 'parroquias' => $parroquias]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
         } else {
             if ($model->load($request->post()) && $model->save()) {
                 return ['forceReload' => 'true', 'title' => "ProyectoLocalizacion #" . $id, 'content' => $this->renderPartial('view', ['model' => $model, 'paises' => $paises, 'estados' => $estados, 'municipios' => $municipios, 'parroquias' => $parroquias]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::a('Edit', ['update', 'id' => $id], ['class' => 'btn btn-primary', 'role' => 'modal-remote'])];
             } else {
                 return ['title' => "Update ProyectoLocalizacion #" . $id, 'content' => $this->renderPartial('update', ['model' => $model, 'paises' => $paises, 'estados' => $estados, 'municipios' => $municipios, 'parroquias' => $parroquias]), 'footer' => Html::button('Close', ['class' => 'btn btn-default pull-left', 'data-dismiss' => "modal"]) . Html::button('Save', ['class' => 'btn btn-primary', 'type' => "submit"])];
             }
         }
     } else {
         /*
          *   Process for non-ajax request
          */
         if ($model->load($request->post()) && $model->save()) {
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             return $this->render('update', ['model' => $model, 'paises' => $paises, 'estados' => $estados, 'municipios' => $municipios, 'parroquias' => $parroquias]);
         }
     }
 }
 /**
  * Finds the Estados model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Estados the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Estados::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }