82); $_result['visibility'] = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } require('../main/base.events.php'); // isbasewindow: // On Open while( ($__action == "" or $__action == "executedonopen") and (empty($_x) or in('onopen', $_x)) ) { $__action = "executedonopen"; $__tempresult = sqlexec($Link, "select datos, archivo from planos where id = '" . mysql_escape($id) . "'"); while( $__temprow = mysql_fetch_array($__tempresult)) { $datos = $__temprow[0]; $archivo = $__temprow[1]; } $archivos = stringToGallery($archivo); debug("Arranca edita plano externo: ", $datos); // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } break; } // On Refresh do { if( in('datos', $_x) ) { debug("ACTUALIZANDO DATOS DE PLANO $id"); debug($datos); sqlexec($Link, "update planos set datos = '" . mysql_escape($datos) . "' where id = " . mysql_escape($id) . ""); $obj = json_decode($datos, true); sqlexec($Link, "delete from pol where plano = " . mysql_escape($id) . ""); $errors = ""; foreach($obj['spots'] as $spot) { //debug("Spot"); //debug(print_r($spot, true)); if( array_key_exists("actions", $spot) ) continue; $title = str_replace(' ', '', $spot['title']); if( $title == '' ) continue; $unidad = "" ; $__tempresult = sqlexec($Link, "select id from Unidades where emprendimientoid = '" . mysql_escape($proyecto) . "' and replace(denominacion, ' ', '') = '" . mysql_escape($title) . "'"); while( $__temprow = mysql_fetch_array($__tempresult)) { $unidad = $__temprow[0]; } if( $unidad != "" ) { debug("Unidad"); debug($unidad); if( $spot['type'] == 'poly' ) { $points = json_encode($spot['points']); } else { $tpoints = array(); $tpoints[] = array("x" => $spot['x'], "y" => $spot['y']); $tpoints[] = array("x" => $spot['x'] + $spot['width'], "y" => $spot['y']); $tpoints[] = array("x" => $spot['x'] + $spot['width'], "y" => $spot['y'] + $spot['height']); $tpoints[] = array("x" => $spot['x'], "y" => $spot['y'] + $spot['height']); $points = json_encode($tpoints); } sqlexec($Link, "insert into pol(plano, unidad, coordenadas) values(" . mysql_escape($id) . ", '" . mysql_escape($unidad) . "', '" . mysql_escape($points) . "')"); } else { $errors .= "No encontrada unidad $title. "; } } print($errors); disconnectDb($Link); exit(0); } // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } } while(false); // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $__row0['__botoneditar__1'] = $proyecto ; $__row0['__botoneditar__2'] = $id ; $__row0['__botonfinalizar__1'] = $_SERVER['QUERY_STRING'] ; $__row0['__botonfinalizar__2'] = $proyecto ; $__row0['__botonfinalizar__3'] = $id ; $_result['morevars'] = $__row0; break; } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { require_once('../include/fpdfreport.php'); $_pdf = new PDF((isset($_orientation) ? $_orientation : 'P'),'pt', (isset($_size) ? $_size : 'A4' )); $_pdf->initialPage = ($_page != '' ? $_page : 1); //$_pdf->SetAutoPageBreak(true); $_pdf->title = ""; $_pdf->SetTopMargin(50); $_pdf->AliasNbPages(); $_pdf->AddPage(); } if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->Output(); } ?> '); //echo(''); echo(''); ?> class="popup" >