function arrayToJsArray($array, $name, $nl = "\n", $encoding = false)
{
    if (is_array($array)) {
        $jsArray = $name . ' = new Array();' . $nl;
        foreach ($array as $key => $value) {
            switch (gettype($value)) {
                case 'unknown type':
                case 'resource':
                case 'object':
                    break;
                case 'array':
                    $jsArray .= arrayToJsArray($value, $name . '[' . valueToJsValue($key, $encoding) . ']', $nl);
                    break;
                case 'NULL':
                    $jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = null;' . $nl;
                    break;
                case 'boolean':
                    $jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = ' . ($value ? 'true' : 'false') . ';' . $nl;
                    break;
                case 'string':
                    $jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = ' . valueToJsValue($value, $encoding) . ';' . $nl;
                    break;
                case 'double':
                case 'integer':
                    $jsArray .= $name . '[' . valueToJsValue($key, $encoding) . '] = ' . $value . ';' . $nl;
                    break;
                default:
                    trigger_error('Hoppa, egy j t�us a PHP-ben?' . __CLASS__ . '::' . __FUNCTION__ . '()!', E_USER_WARNING);
            }
        }
        return $jsArray;
    } else {
        return false;
    }
}
Example #2
0
		document.getElementById('Slc_act').value = '0';
		document.getElementById('txt_dir').value = '';
		document.getElementById('txt_namer').value = '';
		crea_var_idlugar_defa(<?php 
echo "'" . $_SESSION['cod_local'] . "'";
?>
);
	}
}

<?php 
// Convertimos los vectores de los paises, dptos y municipios creados en crea_combos_universales.php a vectores en JavaScript.
echo arrayToJsArray($vpaisesv, 'vp');
echo arrayToJsArray($vdptosv, 'vd');
echo arrayToJsArray($vmcposv, 'vm');
echo arrayToJsArray($v_esp, 've');
?>
</script>
<script language="JavaScript" src="<?php 
echo $ruta_raiz;
?>
/js/crea_combos_2.js"></script>
<link rel="stylesheet" href="<?php 
echo $ruta_raiz . "/estilos/" . $_SESSION["ESTILOS_PATH"];
?>
/orfeo.css">
<title>.: ORFEO :. Administraci&oacute;n de Remitentes / Terceros</title>
</head>
<body onLoad="crea_var_idlugar_defa(<?php 
echo "'" . $_SESSION['cod_local'] . "'";
?>
Example #3
0
    if ($_POST['New']) {
        $UsrAux->ImpUsrFill($_POST['UsuaDoc'], true);
    } else {
        $UsrAux->ImpUsrFill($_POST['UsuaDoc'], false, true);
    }
    //$ArrayUpdate = "<script type=\"text/javascript\"> ImpDeps=[]; ";
    //    $UsrAux = new ImpUsrClass($db);
    //    $UsrAux->ImpUsrFill($_POST['UsuaDoc']);
    /* foreach ($ImpAux->Dep as $key => $value) {
       $ArrayUpdate.=" ImpDeps.push(\"" . $value[0] . "\"); ";
       } */
    foreach ($UsrAux->Dep as $value) {
        $depArray[] = $value[0];
    }
    include "{$ruta_raiz}/radicacion/crea_combos_universales.php";
    $ArrayUpdate = arrayToJsArray($depArray, "ImpDeps");
    //$ArrayUpdate.= "</script>";
    $script = "<script type='text/javascript'>\n                \$('select[name=\"ImpUsrAsDep\"]').change(function(){\n                PostImpDep(\"Del\",\$('select[name=\"ImpUsrAsDep\"]').val());\n                });\n                \$('select[name=\"ImpDepHab\"]').change(function(){\n                PostImpDep(\"Add\",\$('select[name=\"ImpDepHab\"]').val());\n                });\n                {$ArrayUpdate}\n                </script>";
    echo $UsrAux->select . $script;
    $FunctReload = "<script type=\"text/javascript\" src=\"FunctionsValidar.js\"></script>";
    //echo $FunctReload;
}
if ($_POST['Act'] == 'Add') {
    echo CreateSelect($_POST['ImpDeps'], $db);
    //$UsrAux = new ImpUsrClass($db);
    //$UsrAux->ImpUsrAdd($_POST['UsuaDoc'], $_POST['Dep']);
    //echo (" Hola ");
}
if ($_POST['Act'] == 'Del') {
    echo CreateSelect($_POST['ImpDeps'], $db);
    //$UsrAux = new ImpUsrClass($db);
Example #4
0
error_reporting(7);
$db->conn->SetFetchMode(ADODB_FETCH_NUM);
//$db->conn->debug=true;
?>
<html>
<head>
<title>Busqueda Remitente / Destino</title>
<link rel="stylesheet" href="../estilos/orfeo.css" type="text/css">
<SCRIPT Language="JavaScript" SRC="../js/crea_combos_2.js"></SCRIPT>
<script LANGUAGE="JavaScript">
 
<?php 
// Convertimos los vectores de los paises, dptos y municipios creados en crea_combos_universales.php a vectores en JavaScript.
echo arrayToJsArray($vpaisesv, 'vp');
echo arrayToJsArray($vdptosv, 'vd');
echo arrayToJsArray($vmcposv, 'vm');
?>

function verif_data()
{	if (document.formu1.idcont4.value && document.formu1.idpais4.value && document.formu1.codep_us4.value && document.formu1.muni_us4.value == 0)
	{	alert("Seleccione la geograf&iacute;a completa del destinatario");
		return false;
	}
	if (document.formu1.direccion_nus1.value=='')
	{	alert("Debe colocar una Direcci&oacute;n.");
		return false;
	}
	if (document.formu1.nombre_nus1.value=='')
	{	alert("Debe colocar un nombre.");
		return false;
	}
Example #5
0
       $FunctReload = "<script type=\"text/javascript\" src=\"FunctionsValidar.js\"></script>";
       echo $FunctReload;
       } */
}
if ($_POST['SuperDep']) {
    $UsrAux = new SecSuperClass($db);
    if ($_POST['New']) {
        $UsrAux->SecSuperFill($_POST['UsuaDoc'], true);
    } else {
        $UsrAux->SecSuperFill($_POST['UsuaDoc'], false, TRUE);
    }
    foreach ($UsrAux->Dep as $value) {
        $depArray[] = $value[0];
    }
    include "{$ruta_raiz}/radicacion/crea_combos_universales.php";
    $ArrayUpdate = arrayToJsArray($depArray, "SuperDeps");
    $script = "<script type='text/javascript'>\n                \$('select[name=\"UsrAsDep\"]').change(function(){\n                PostSecDep(\"Del\",\$('select[name=\"UsrAsDep\"]').val());\n                });\n                \$('select[name=\"DepHab\"]').change(function(){\n                PostSecDep(\"Add\",\$('select[name=\"DepHab\"]').val());\n                });\n                {$ArrayUpdate}\n                </script>";
    echo $UsrAux->select . $script;
    $FunctReload = "<script type=\"text/javascript\" src=\"FunctionsValidar.js\"></script>";
    //echo $FunctReload;
}
if ($_POST['Act'] == 'Add') {
    echo CreateSelect($_POST['SuperDeps'], $db);
    //$UsrAux = new SecSuperClass($db);
    //$UsrAux->SecSuperAdd($_POST['UsuaDoc'], $_POST['Dep']);
    //echo (" Hola ");
}
if ($_POST['Act'] == 'Del') {
    echo CreateSelect($_POST['SuperDeps'], $db);
    //$UsrAux = new SecSuperClass($db);
    //$UsrAux->SecSuperDel($_POST['UsuaDoc'], $_POST['Dep'][0]);