<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Dictamen_a extends Admin_Controller {

	public function __construct()
	{
		parent::__construct();

		$this->load->model('expedientes/dictamen_model');
		//$this->lang->load('expedientes/dictamen_lang');

		/* Titulo de la pagina :: Common */
		$this->page_title->push(lang('menu_dictamen_a'));
		$this->data['pagetitle'] = $this->page_title->show();

		//verificación de módulo para el reset de las variables de sessión utilizadas en la misma
		if ($_SESSION['id_modulo'] != 'DICTAMEN_A') {

			//$_SESSION['arraywhere_expedientes'] 		 = NULL;
			//$_SESSION['arraywhere_expedientes_busqueda'] = NULL;
			//$_SESSION['id_modulo'] = 'EXPEDIENTES';
		}
		
		/* Breadcrumbs :: Common */
		$this->breadcrumbs->unshift(2, lang('menu_expedientes'), 'expedientes/expedientes');
	}

	
	public function index($expe_id)
	{
		if ( ! $this->ion_auth->logged_in() OR ! $this->ion_auth->is_admin())
		{
			redirect('auth/login', 'refresh');
		}
		else
		{	
			$this->data['expe_info'] = $this->dictamen_model->dropdown_data('exp', array('expe_id' => $expe_id))->row();

			$exist_exp 	= $this->dictamen_model->dropdown_data('dic1_datos', array('dic1_expe_id' => $expe_id))->result_array();

			$this->data['expe_id'] = $exist_exp[0]['dic1_expe_id'];
			
			foreach ($exist_exp as $value) {

				$dict_datos[$value['concepto']] = $value['valor'];
			}

			$dict_datos = (object)$dict_datos;
			$this->data['dict_datos'] = $dict_datos;

			if ($_POST) { 

				if($_POST['dic1_mapa_localizacion']){
					$arraycampos[] = array('mapa_localizacion','SI');
				}else{
					$arraycampos[] = array('mapa_localizacion','NO');
				}

				if($_POST['dic1_leyenda_tematica']){
					$arraycampos[] = array('leyenda_tematica','SI');
				}else{
					$arraycampos[] = array('leyenda_tematica','NO');
				}

				if($_POST['dic1_leyenda_signos_conv']){
					$arraycampos[] = array('leyenda_signos_conv','SI');
				}else{
					$arraycampos[] = array('leyenda_signos_conv','NO');
				}

				if($_POST['dic1_fuente_tematica']){
					$arraycampos[] = array('fuente_tematica','SI');
				}else{
					$arraycampos[] = array('fuente_tematica','NO');
				}

				if($_POST['dic1_fuente_cartografica']){
					$arraycampos[] = array('fuente_cartografica','SI');
				}else{
					$arraycampos[] = array('fuente_cartografica','NO');
				}

				if($_POST['dic1_norte']){
					$arraycampos[] = array('norte','SI');
				}else{
					$arraycampos[] = array('norte','NO');
				}

				if($_POST['dic1_escala_grafica']){
					$arraycampos[] = array('escala_grafica','SI');
				}else{
					$arraycampos[] = array('escala_grafica','NO');
				}

				if($_POST['dic1_escala_numerica']){
					$arraycampos[] = array('escala_numerica','SI');
				}else{
					$arraycampos[] = array('escala_numerica','NO');
				}

				if($_POST['dic1_cuadro_superficies_porc']){
					$arraycampos[] = array('cuadro_superficies_porc','SI');
				}else{
					$arraycampos[] = array('cuadro_superficies_porc','NO');
				}

				if($_POST['dic1_proyeccion_carto_utm']){
					$arraycampos[] = array('proyeccion_carto_utm','SI');
				}else{
					$arraycampos[] = array('proyeccion_carto_utm','NO');
				}

				if($_POST['dic1_elipsoide_wgs84']){
					$arraycampos[] = array('elipsoide_wgs84','SI');
				}else{
					$arraycampos[] = array('elipsoide_wgs84','NO');
				}

				if($_POST['dic1_red_vial']){
					$arraycampos[] = array('red_vial','SI');
				}else{
					$arraycampos[] = array('red_vial','NO');
				}

				if($_POST['dic1_red_hidrografica']){
					$arraycampos[] = array('red_hidrografica','SI');
				}else{
					$arraycampos[] = array('red_hidrografica','NO');
				}

				if($_POST['dic1_equipamiento']){
					$arraycampos[] = array('equipamiento','SI');
				}else{
					$arraycampos[] = array('equipamiento','NO');
				}

				if($_POST['dic1_linderamiento']){
					$arraycampos[] = array('linderamiento','SI');
				}else{
					$arraycampos[] = array('linderamiento','NO');
				}

				if($_POST['dic1_distancias']){
					$arraycampos[] = array('distancias','SI');
				}else{
					$arraycampos[] = array('distancias','NO');
				}

				if($_POST['dic1_rumbos']){
					$arraycampos[] = array('rumbos','SI');
				}else{
					$arraycampos[] = array('rumbos','NO');
				}

				if($_POST['dic1_colindantes']){
					$arraycampos[] = array('colindantes','SI');
				}else{
					$arraycampos[] = array('colindantes','NO');
				}

				if($_POST['dic1_cuadricula_utm']){
					$arraycampos[] = array('cuadricula_utm','SI');
				}else{
					$arraycampos[] = array('cuadricula_utm','NO');
				}

				if($_POST['dic1_coordenadas_esquinero']){
					$arraycampos[] = array('coordenadas_esquinero','SI');
				}else{
					$arraycampos[] = array('coordenadas_esquinero','NO');
				}

				if($_POST['dic1_titulo_mapa']){
					$arraycampos[] = array('titulo_mapa','SI');
				}else{
					$arraycampos[] = array('titulo_mapa','NO');
				}

				if($_POST['dic1_propietario']){
					$arraycampos[] = array('propietario','SI');
				}else{
					$arraycampos[] = array('propietario','NO');
				}

				if($_POST['dic1_lugar']){
					$arraycampos[] = array('lugar','SI');
				}else{
					$arraycampos[] = array('lugar','NO');
				}

				if($_POST['dic1_distrito']){
					$arraycampos[] = array('distrito','SI');
				}else{
					$arraycampos[] = array('distrito','NO');
				}

				if($_POST['dic1_departamento']){
					$arraycampos[] = array('departamento','SI');
				}else{
					$arraycampos[] = array('departamento','NO');
				}

				if($_POST['dic1_finca']){
					$arraycampos[] = array('finca','SI');
				}else{
					$arraycampos[] = array('finca','NO');
				}

				if($_POST['dic1_padron']){
					$arraycampos[] = array('padron','SI');
				}else{
					$arraycampos[] = array('padron','NO');
				}

				if($_POST['dic1_responsable_cartografia']){
					$arraycampos[] = array('responsable_cartografia','SI');
				}else{
					$arraycampos[] = array('responsable_cartografia','NO');
				}

				if($_POST['dic1_fecha_impresion']){
					$arraycampos[] = array('fecha_impresion','SI');
				}else{
					$arraycampos[] = array('fecha_impresion','NO');
				}

				if($_POST['dic1_responsable_cartografia']){
					$arraycampos[] = array('responsable_cartografia','SI');
				}else{
					$arraycampos[] = array('responsable_cartografia','NO');
				}

				if($_POST['dic1_aclaracion']){
					$arraycampos[] = array('aclaracion',$_POST['dic1_aclaracion']);
				}else{
					$arraycampos[] = array('aclaracion','');
				}

				if($_POST['dic1_responsable_cartografia']){
					$arraycampos[] = array('responsable_cartografia','SI');
				}else{
					$arraycampos[] = array('responsable_cartografia','NO');
				}

				if($_POST['dic1_responsable_cartografia']){
					$arraycampos[] = array('responsable_cartografia','SI');
				}else{
					$arraycampos[] = array('responsable_cartografia','NO');
				}

				if($_POST['dic1_observaciones']){
					$arraycampos[] = array('observaciones',$_POST['dic1_observaciones']);
				}else{
					$arraycampos[] = array('observaciones','');
				}

				$error = FALSE;
				foreach ($arraycampos as $value) {

					$actualizado = $this->dictamen_model->actualizar_dic1($this->data['expe_id'], $value[0], $value[1]);
					if (!$actualizado) {
						$error = TRUE;
					}
				}

				if (!$error) {
					$this->session->set_flashdata('message', '¡Datos grabados exitósamente!');

					redirect('expedientes/dictamen_a/index/'.$expe_id);
				}else{
					$this->session->set_flashdata('message', '<b>ATENCIÓN:</b> Algunos datos no se pudieron grabar');					
					redirect('expedientes/dictamen_a/index/'.$expe_id);
				}

			}else{
				/****************** Area Informativa o Marginal ******************/
				$this->data['dic1_aprobado'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_aprobado',
					'id'       => 'dic1_aprobado',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->aprobado=='SI'){
					$this->data['dic1_aprobado']['checked_s'] = TRUE;
					$this->data['dic1_aprobado']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_aprobado']['checked_s'] = FALSE;
					$this->data['dic1_aprobado']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_colindantes'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_colindantes',
					'id'       => 'dic1_colindantes',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->colindantes=='SI'){
					$this->data['dic1_colindantes']['checked_s'] = TRUE;
					$this->data['dic1_colindantes']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_colindantes']['checked_s'] = FALSE;
					$this->data['dic1_colindantes']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_coordenadas_esquinero'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_coordenadas_esquinero',
					'id'       => 'dic1_coordenadas_esquinero',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->coordenadas_esquinero=='SI'){
					$this->data['dic1_coordenadas_esquinero']['checked_s'] = TRUE;
					$this->data['dic1_coordenadas_esquinero']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_coordenadas_esquinero']['checked_s'] = FALSE;
					$this->data['dic1_coordenadas_esquinero']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_cuadricula_utm'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_cuadricula_utm',
					'id'       => 'dic1_cuadricula_utm',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->cuadricula_utm=='SI'){
					$this->data['dic1_cuadricula_utm']['checked_s'] = TRUE;
					$this->data['dic1_cuadricula_utm']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_cuadricula_utm']['checked_s'] = FALSE;
					$this->data['dic1_cuadricula_utm']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_cuadro_superficies_porc'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_cuadro_superficies_porc',
					'id'       => 'dic1_cuadro_superficies_porc',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->cuadro_superficies_porc=='SI'){
					$this->data['dic1_cuadro_superficies_porc']['checked_s'] = TRUE;
					$this->data['dic1_cuadro_superficies_porc']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_cuadro_superficies_porc']['checked_s'] = FALSE;
					$this->data['dic1_cuadro_superficies_porc']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_curvas_nivel'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_curvas_nivel',
					'id'       => 'dic1_curvas_nivel',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->curvas_nivel=='SI'){
					$this->data['dic1_curvas_nivel']['checked_s'] = TRUE;
					$this->data['dic1_curvas_nivel']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_curvas_nivel']['checked_s'] = FALSE;
					$this->data['dic1_curvas_nivel']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_datum'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_datum',
					'id'       => 'dic1_datum',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->datum=='SI'){
					$this->data['dic1_datum']['checked_s'] = TRUE;
					$this->data['dic1_datum']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_datum']['checked_s'] = FALSE;
					$this->data['dic1_datum']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_departamento'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_departamento',
					'id'       => 'dic1_departamento',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->departamento=='SI'){
					$this->data['dic1_departamento']['checked_s'] = TRUE;
					$this->data['dic1_departamento']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_departamento']['checked_s'] = FALSE;
					$this->data['dic1_departamento']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_distancias'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_distancias',
					'id'       => 'dic1_distancias',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->distancias=='SI'){
					$this->data['dic1_distancias']['checked_s'] = TRUE;
					$this->data['dic1_distancias']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_distancias']['checked_s'] = FALSE;
					$this->data['dic1_distancias']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_distrito'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_distrito',
					'id'       => 'dic1_distrito',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->distrito=='SI'){
					$this->data['dic1_distrito']['checked_s'] = TRUE;
					$this->data['dic1_distrito']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_distrito']['checked_s'] = FALSE;
					$this->data['dic1_distrito']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_elipsoide_wgs84'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_elipsoide_wgs84',
					'id'       => 'dic1_elipsoide_wgs84',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->elipsoide_wgs84=='SI'){
					$this->data['dic1_elipsoide_wgs84']['checked_s'] = TRUE;
					$this->data['dic1_elipsoide_wgs84']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_elipsoide_wgs84']['checked_s'] = FALSE;
					$this->data['dic1_elipsoide_wgs84']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_equidistancia_curvas'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_equidistancia_curvas',
					'id'       => 'dic1_equidistancia_curvas',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->equidistancia_curvas=='SI'){
					$this->data['dic1_equidistancia_curvas']['checked_s'] = TRUE;
					$this->data['dic1_equidistancia_curvas']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_equidistancia_curvas']['checked_s'] = FALSE;
					$this->data['dic1_equidistancia_curvas']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_equipamiento'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_equipamiento',
					'id'       => 'dic1_equipamiento',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->equipamiento=='SI'){
					$this->data['dic1_equipamiento']['checked_s'] = TRUE;
					$this->data['dic1_equipamiento']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_equipamiento']['checked_s'] = FALSE;
					$this->data['dic1_equipamiento']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_escala_grafica'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_escala_grafica',
					'id'       => 'dic1_escala_grafica',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->escala_grafica=='SI'){
					$this->data['dic1_escala_grafica']['checked_s'] = TRUE;
					$this->data['dic1_escala_grafica']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_escala_grafica']['checked_s'] = FALSE;
					$this->data['dic1_escala_grafica']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_escala_numerica'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_escala_numerica',
					'id'       => 'dic1_escala_numerica',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->escala_numerica=='SI'){
					$this->data['dic1_escala_numerica']['checked_s'] = TRUE;
					$this->data['dic1_escala_numerica']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_escala_numerica']['checked_s'] = FALSE;
					$this->data['dic1_escala_numerica']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_fecha_impresion'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_fecha_impresion',
					'id'       => 'dic1_fecha_impresion',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->fecha_impresion=='SI'){
					$this->data['dic1_fecha_impresion']['checked_s'] = TRUE;
					$this->data['dic1_fecha_impresion']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_fecha_impresion']['checked_s'] = FALSE;
					$this->data['dic1_fecha_impresion']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_finca'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_finca',
					'id'       => 'dic1_finca',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->finca=='SI'){
					$this->data['dic1_finca']['checked_s'] = TRUE;
					$this->data['dic1_finca']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_finca']['checked_s'] = FALSE;
					$this->data['dic1_finca']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_firmante'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_firmante',
					'id'       => 'dic1_firmante',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->firmante=='SI'){
					$this->data['dic1_firmante']['checked_s'] = TRUE;
					$this->data['dic1_firmante']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_firmante']['checked_s'] = FALSE;
					$this->data['dic1_firmante']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_fuente_cartografica'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_fuente_cartografica',
					'id'       => 'dic1_fuente_cartografica',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->fuente_cartografica=='SI'){
					$this->data['dic1_fuente_cartografica']['checked_s'] = TRUE;
					$this->data['dic1_fuente_cartografica']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_fuente_cartografica']['checked_s'] = FALSE;
					$this->data['dic1_fuente_cartografica']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_fuente_tematica'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_fuente_tematica',
					'id'       => 'dic1_fuente_tematica',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->fuente_tematica=='SI'){
					$this->data['dic1_fuente_tematica']['checked_s'] = TRUE;
					$this->data['dic1_fuente_tematica']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_fuente_tematica']['checked_s'] = FALSE;
					$this->data['dic1_fuente_tematica']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_leyenda_signos_conv'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_leyenda_signos_conv',
					'id'       => 'dic1_leyenda_signos_conv',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->leyenda_signos_conv=='SI'){
					$this->data['dic1_leyenda_signos_conv']['checked_s'] = TRUE;
					$this->data['dic1_leyenda_signos_conv']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_leyenda_signos_conv']['checked_s'] = FALSE;
					$this->data['dic1_leyenda_signos_conv']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_leyenda_tematica'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_leyenda_tematica',
					'id'       => 'dic1_leyenda_tematica',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->leyenda_tematica=='SI'){
					$this->data['dic1_leyenda_tematica']['checked_s'] = TRUE;
					$this->data['dic1_leyenda_tematica']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_leyenda_tematica']['checked_s'] = FALSE;
					$this->data['dic1_leyenda_tematica']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_linderamiento'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_linderamiento',
					'id'       => 'dic1_linderamiento',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->linderamiento=='SI'){
					$this->data['dic1_linderamiento']['checked_s'] = TRUE;
					$this->data['dic1_linderamiento']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_linderamiento']['checked_s'] = FALSE;
					$this->data['dic1_linderamiento']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_lugar'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_lugar',
					'id'       => 'dic1_lugar',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->lugar=='SI'){
					$this->data['dic1_lugar']['checked_s'] = TRUE;
					$this->data['dic1_lugar']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_lugar']['checked_s'] = FALSE;
					$this->data['dic1_lugar']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_mapa_localizacion'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_mapa_localizacion',
					'id'       => 'dic1_mapa_localizacion',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->mapa_localizacion=='SI'){
					$this->data['dic1_mapa_localizacion']['checked_s'] = TRUE;
					$this->data['dic1_mapa_localizacion']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_mapa_localizacion']['checked_s'] = FALSE;
					$this->data['dic1_mapa_localizacion']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_norte'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_norte',
					'id'       => 'dic1_norte',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->norte=='SI'){
					$this->data['dic1_norte']['checked_s'] = TRUE;
					$this->data['dic1_norte']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_norte']['checked_s'] = FALSE;
					$this->data['dic1_norte']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_padron'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_padron',
					'id'       => 'dic1_padron',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->padron=='SI'){
					$this->data['dic1_padron']['checked_s'] = TRUE;
					$this->data['dic1_padron']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_padron']['checked_s'] = FALSE;
					$this->data['dic1_padron']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_propietario'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_propietario',
					'id'       => 'dic1_propietario',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->propietario=='SI'){
					$this->data['dic1_propietario']['checked_s'] = TRUE;
					$this->data['dic1_propietario']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_propietario']['checked_s'] = FALSE;
					$this->data['dic1_propietario']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_proyeccion_carto_utm'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_proyeccion_carto_utm',
					'id'       => 'dic1_proyeccion_carto_utm',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->proyeccion_carto_utm=='SI'){
					$this->data['dic1_proyeccion_carto_utm']['checked_s'] = TRUE;
					$this->data['dic1_proyeccion_carto_utm']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_proyeccion_carto_utm']['checked_s'] = FALSE;
					$this->data['dic1_proyeccion_carto_utm']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_red_hidrografica'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_red_hidrografica',
					'id'       => 'dic1_red_hidrografica',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->red_hidrografica=='SI'){
					$this->data['dic1_red_hidrografica']['checked_s'] = TRUE;
					$this->data['dic1_red_hidrografica']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_red_hidrografica']['checked_s'] = FALSE;
					$this->data['dic1_red_hidrografica']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_red_vial'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_red_vial',
					'id'       => 'dic1_red_vial',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->red_vial=='SI'){
					$this->data['dic1_red_vial']['checked_s'] = TRUE;
					$this->data['dic1_red_vial']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_red_vial']['checked_s'] = FALSE;
					$this->data['dic1_red_vial']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_responsable_cartografia'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_responsable_cartografia',
					'id'       => 'dic1_responsable_cartografia',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->responsable_cartografia=='SI'){
					$this->data['dic1_responsable_cartografia']['checked_s'] = TRUE;
					$this->data['dic1_responsable_cartografia']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_responsable_cartografia']['checked_s'] = FALSE;
					$this->data['dic1_responsable_cartografia']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_rumbos'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_rumbos',
					'id'       => 'dic1_rumbos',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->rumbos=='SI'){
					$this->data['dic1_rumbos']['checked_s'] = TRUE;
					$this->data['dic1_rumbos']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_rumbos']['checked_s'] = FALSE;
					$this->data['dic1_rumbos']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				/**************** FIN Area Informativa o Marginal ****************/
				
				/********************** Area Util Efectiva ***********************/
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_titulo_mapa'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_titulo_mapa',
					'id'       => 'dic1_titulo_mapa',
					'value_s'  => '1',
					'value_n'  => '0',
					'class'    => 'form-control',
				);
				if($dict_datos->titulo_mapa=='SI'){
					$this->data['dic1_titulo_mapa']['checked_s'] = TRUE;
					$this->data['dic1_titulo_mapa']['checked_n'] = FALSE;
				}else{
					$this->data['dic1_titulo_mapa']['checked_s'] = FALSE;
					$this->data['dic1_titulo_mapa']['checked_n'] = TRUE;
				}
				//*******************************************************
				$this->data['dic1_aclaracion'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_aclaracion',
					'id'       => 'dic1_aclaracion',
					'class'    => 'form-control',
				);
				if($dict_datos->aclaracion==''){
					$this->data['dic1_aclaracion']['value'] = NULL;
				}else{
					$this->data['dic1_aclaracion']['value'] = $dict_datos->aclaracion;					
				}
				//*******************************************************
				$this->data['dic1_observaciones'] = array(
					'type'     => 'radio',
					'name'	   => 'dic1_observaciones',
					'id'       => 'dic1_observaciones',
					'class'    => 'form-control',
					'rows'     => '3',
				);
				if($dict_datos->observaciones==''){
					$this->data['dic1_observaciones']['value'] = NULL;
				}else{
					$this->data['dic1_observaciones']['value'] = $dict_datos->observaciones;					
				}
				/******************** FIN Area Util Efectiva *********************/
			}

			//$this->data['expe_info'][0] = array('expe_id_expediente' => $exp, 'expe_gestion' => $gest);

			$this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));

			// Breadcrumbs 
			$this->breadcrumbs->unshift(2, 'Dictamen A', 'expedientes/expedientes');
	        $this->data['breadcrumb'] = $this->breadcrumbs->show();

			// Load Template 
            $this->template->admin_render('expedientes/dictamen_a', $this->data);
		}
	}
}