require_once('../include/orm.php'); require_once('../include/globals.php'); require_once('../include/util.php'); $_import_dbimport_db_connected = $Link == ''; if($_import_dbimport_db_connected) $Link = connectDb(); define('DBCONNECTED', 1); debugstartpage(); if( isset($_x) ) { //if( $_x != '' ) { $_x = $_x == '' ? array() : StringTokenize($_x, ","); $_result = array(); $_result['version'] = array('actual' => 22); $_result['visibility'] = array(); $_initialvars = arrayExclude(get_defined_vars(), array("_*", "form_*", "s_*", "GLOBALS", "Link", "thisname")); } require('../include/base.events.php'); // isbasewindow: // PHP Vars while( ($__action == "" or $__action == "executedonopen") and isset($_GET['_x']) and empty($_x) ) { $__row0 = array(); $__row0['__form1__1'] = $_id ; $__row0['__form1__2'] = $id == '0' ? 'Nueva ' : '' ; $__row0['__tabla__1'] = $tabla ; $__row0['__where__1'] = $where ; $_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->title = "Subida de registros a tabla"; //$_pdf->drawText("Subida de registros a tabla",'Arial','',14); } // aca iba session get, uofr y load/saveobject while( has($_x, 'form1_init') ) { $_result['form1'] = $form1->toarray(false); break; } while( has($_x, 'form1') ) { //if( $errors == "" ) // validateform1(); if( $errors == "" ) { if( $errors == "" ) { $query = "select * from $tabla"; if( $where != "" ) $query .= " where " . $where; $query .= " order by id desc limit 1000"; $cols = array(); $array = sqltoarray($Link, $query); foreach($array as $row) { foreach($row as $name => $value) { if( $value != "" and $value != "NULL" and $value != '0000-00-00') { if( searchInArray($name, $cols) == -1 ) $cols[] = $name; } } } $twhere = ($where == '' ? " 1 = 1 " : $where) . " order by id desc limit 30"; //if( $twhere != "" ) $twhere = "(" . $twhere . ") and "; //$twhere .= " order by RAND() LIMIT 100"; //message(arrayToString($cols)); if( $return != '' ) { redirect("$return?t=$tabla&f=" . arrayToString($cols) . "&tit=Subir registros a tabla $tabla&ret=fin.php&mode=insert&where=" . urlencode($twhere)); // w=ancho1,ancho2,...& //sqltotablearray } else { redirect("../import/importer.php?t=$tabla&f=" . arrayToString($cols) . "&tit=Subir registros a tabla $tabla&ret=fin.php&mode=insert&where=" . urlencode($twhere)); // w=ancho1,ancho2,...& //sqltotablearray } // Si puso header location para ir a otra pagina cierra el script if( !isset($_x) and $__exiting ) { disconnectDb($Link); exit(0); } } if( $_redirect != "" ) redirect($_redirect); sessionset('form_dbimport_form1' . $_id, $form1); if( $_result['redirect'] == '' ) redirect("?id=$id"); } break; } while( has($_x, 'form1__delete') ) { //if( $errors == "" ) // validateform1(); if( $errors == "" ) { if( $_redirect != "" ) redirect($_redirect); sessionset('form_dbimport_form1' . $_id, null); if( $_result['redirect'] == '' ) { $_result['redirect'] = "?message=Subida de registros a tabla eliminada"; } } break; } while( has($_x, 'form1_unload') ) { // Not used break; } if( has($_x, 'section1') ) { } //$form1 -> ['changes'] if( isormObject($form1) ) $form1->makeglobals(); if( has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2') ) { $_pdf->Output(); } ?> if( !isset($_x) ) { ?> if( isset($_export) ) { ?> header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=.xls"); //echo(''); //echo(''); echo(''); ?> } else { ?>
require('../include/base.head.php'); ?> class="popup" } ?> > } ?> if( !isset($_export) ) { ?> } ?>