require_once('../include/orm.php');
require_once('../include/globals.php');
require_once('../include/util.php');
$_contenidos_enform_db_connected = $Link == '';
if($_contenidos_enform_db_connected) $Link = connectDb();
define('DBCONNECTED', 1);
// On Div Load
while( $_x == '' ) {
$__tempresult = sqlexec($Link, "select config2 from features where component = '$_form' and feature = 'documentos'");
while( $__temprow = mysql_fetch_array($__tempresult)) {
$_condicion = $__temprow[0];
}
if( $_condicion != '' ) $_condicion = ' and ' . $_condicion;
debug("DOCUMENTOS/ENFORM:");
debug("Condicion: $_condicion");
$_condicion = dophptemplate($_condicion, removearrays(arrayExclude(get_defined_vars(), array("_*", "s_*", "GLOBALS", "Link", "thisname"))));
debug("Condicion: $_condicion");
// Si puso header location para ir a otra pagina cierra el script
if( !isset($_x) and $__exiting ) {
disconnectDb($Link); exit(0);
}
break;
}
if( !isset($_x) ) {
?>
$_botones = sqltoarray($Link, "select id, ubicacion, titulo, icono, url from contenidos where form = '$_form' and tipo = 'boton'");
$_codigo = sqltoarray($Link, "select id, ubicacion, titulo, icono, url, contenido from contenidos where form = '$_form' and tipo = 'codigo'");
if( sizeof($_botones) > 0 ) {
//require_once("../include/easyflexa.php");
//print("
GLOBALS
");
//print("
");
//print_r($GLOBALS);
//print("
");
//foreach($GLOBALS as $_n => $_v) {
// print("
$_n = $_v
");
//}
}
//print("BOTONES: $_form ");
//print_r($_botones);
foreach($_botones as $_boton) {
$_url = doarraytemplate($_boton['url'], $GLOBALS, '{', '}', '', false);
?>
if( $_boton['icono'] != "" ) { ?> } ?>
} ?>
foreach($_codigo as $_codigo) { ?>
} ?>
?>
}
if( isset($_x) and !(has($_x, 'pdf') or has($_x, 'pdfprint') or has($_x, 'pdfprint2')) ) {
if( $errors != "" ) $_result['errors'] = $errors;
if( $messages != "" ) $_result['messages'] = $messages;
if( $alerts != "" ) $_result['alerts'] = $alerts;
if( empty($_x) )
$_snapshot = arrayExclude(get_defined_vars(), array("_*", "s_*", "GLOBALS", "Link", "thisname"));
else
$_snapshot = objectToStructure(getSomeElements(get_defined_vars(), array("unnamed3") ));
//debug('initialvars:');
//debug($_initialvars);
//debug('snapshot:');
//debug($_snapshot);
unset($_snapshot['GLOBALS']);
$_changes = arrayChanges($_snapshot, $_initialvars);
if( !empty($_changes) ) $_result['changes'] = $_changes;
//logToFile("Variables changed: " . print_r($_changes) );
//logToFile("RESULT TO BROWSER: " . print_r($_result, true));
header('Content-Type: application/json');
print(json_encode($_result));
}
if($_contenidos_enform_db_connected)
disconnectDb($Link);
?>