if (isset($_REQUEST["opcion"])) { $this->cadena_sql = $this->sql->cadena_sql($configuracion, "totalConductores"); $this->registro = $this->funcion->ejecutarSQL($configuracion, $this->cadena_sql, "busqueda", $configuracion["db_principal"]); if ($this->funcion->totalRegistros($configuracion, $configuracion["db_principal"]) > 0) { $atributosNavegacion["totalRegistros"] = $this->registro[0][0]; if ($atributosNavegacion["totalRegistros"] != 0) { unset($this->registro); if (!isset($_REQUEST["hoja"])) { $atributosNavegacion["hojaActual"] = 1; } else { $atributosNavegacion["hojaActual"] = $_REQUEST["hoja"]; } $this->cadena_sql = $this->sql->cadena_sql($configuracion, "rescatarConductores", $atributosNavegacion); //echo $this->cadena_sql; $this->registro = $this->funcion->ejecutarSQL($configuracion, $this->cadena_sql, "busqueda", $configuracion["db_principal"]); $navegador = new navegacion(); if ($this->funcion->totalRegistros($configuracion, $configuracion["db_principal"]) > 0) { $atributos["titulo"][1] = $this->lenguaje['nombre']; $atributos["titulo"][2] = $this->lenguaje['apellido']; $atributos["titulo"][3] = $this->lenguaje['identificacion']; $atributos["titulo"][4] = $this->lenguaje['telefono']; $atributos["titulo"]["borrar"] = $this->lenguaje['borrar']; $atributos["titulo"]["ver"] = $this->lenguaje['ver']; $variable = "pagina=conductorAdministrador"; $variable .= "&opcion=mostrar"; $atributos["opcion"]["informacion"] = $variable; $atributos["opcion"]["borrar"] = "conductor"; $atributos["opcion"]["totalColumnas"] = count($this->registro[0]) / 2; $atributosNavegacion["enlace"] = "pagina=" . $_REQUEST["pagina"]; $atributosNavegacion["enlace"] .= "&opcion=" . $_REQUEST["opcion"]; $navegador->menu_navegacion($configuracion, $atributosNavegacion);
function armarListado($configuracion, $conexion) { ob_start(); /*la funcion menu navegacion requiere: configuracion,el numero de la hoja actual,el numero total de hojas,y una variable */ setlocale(LC_MONETARY, 'en_US'); include_once $configuracion["raiz_documento"] . $configuracion["clases"] . "/encriptar.class.php"; include_once $configuracion["raiz_documento"] . $configuracion["clases"] . "/navegacion.class.php"; $menu = new navegacion(); $cripto = new encriptar(); $indice = $configuracion["host"] . $configuracion["site"] . "/index.php?"; $this->armarRegistro($conexion); $this->totalPaginas = ceil($this->total / $this->getNumRegistros()); if (isset($_REQUEST['pagina'])) { $pagina = 'pagina'; } elseif (isset($_REQUEST['no_pagina'])) { $pagina = 'no_pagina'; } if (isset($_REQUEST['opcion'])) { $variableNavegacion["opcion"] = $_REQUEST['opcion']; } $this->setPagina($_REQUEST[$pagina]); $variableNavegacion[$pagina] = $_REQUEST[$pagina]; $variableNavegacion["orden"] = $this->getOrden(); if (isset($_REQUEST['generaxls'])) { $nom_archivo = time(); $archivo = $configuracion["raiz_documento"] . "/documento/listados/" . $nom_archivo . ".txt"; // el nombre de tu archivo $crea = fopen($archivo, "w"); // abrimos el archivo como escritura $i = 0; for ($i; $i < count($this->etiquetas); $i++) { fwrite($crea, $this->etiquetas[$i] . ","); } fwrite($crea, chr(10)); $contador = 0; for ($contador; $contador < $this->totalParcial; $contador++) { $j = 1; for ($j; $j <= count($this->columnas); $j++) { fwrite($crea, $this->registro[$contador][$j] . ","); // guardamos el valor } fwrite($crea, chr(10)); } fclose($crea); echo "<script>window.open('" . $configuracion["host"] . $configuracion["site"] . "/documento/lista.php?archivo=" . $nom_archivo . "')</script>"; } else { echo "<a href='" . $indice . $cripto->codificar_url($pagina . "=" . $this->getPagina() . "&orden=" . $this->getOrden() . "&opcion=" . $_REQUEST['opcion'] . "&generaxls=generaxls", $configuracion) . "'>Generar XLS</a>"; if ($this->totalPaginas > 1) { $menu->menu_navegacion($configuracion, $this->getHojaActual(), $this->totalPaginas, $variableNavegacion); } $html .= "<table width='100%' style='border-collapse:collapse; border-spacing:0;'>"; $html .= "<tr class='cuadro_color'>"; $check = $this->getCheck(); $html .= "<td class='cuadro_plano'>#</td>"; if (isset($check)) { $html .= "<td class='cuadro_plano'> </td>"; } $i = 0; for ($i; $i < count($this->etiquetas); $i++) { $html .= "<td style='border:1px solid #AAAAAA; background-color: #CCCCCC; font-family:Arial,Verdana,Trebuchet MS,Helvetica,sans-serif; font-size:12px;'><a href=" . $indice . $cripto->codificar_url($pagina . "=" . $this->getPagina() . "&opcion=" . $_REQUEST['opcion'] . "&orden=" . ($i + 1), $configuracion) . "'>" . $this->etiquetas[$i] . "</a></td>"; } $html .= "</tr>"; $contador = 0; $numColumnas = count($this->columnas); for ($contador; $contador < $this->totalParcial; $contador++) { $html .= "<tr>"; $html .= "<td style='border:1px solid #AAAAAA; font-family:Arial,Verdana,Trebuchet MS,Helvetica,sans-serif; font-size:11px;'>" . $this->registro[$contador][0] . "</td>"; if (isset($check)) { $html .= "<td style='border:1px solid #AAAAAA; font-family:Arial,Verdana,Trebuchet MS,Helvetica,sans-serif; font-size:11px;'><input type='checkbox' name='" . $check[0] . $this->registro[$contador][0] . "' value='" . $this->registro[$contador][$check[1] + 1] . "'></td>"; } $j = 1; for ($j; $j <= $numColumnas; $j++) { $html .= "<td style='border:1px solid #AAAAAA; font-family:Arial,Verdana,Trebuchet MS,Helvetica,sans-serif; font-size:11px;'>" . $this->registro[$contador][$j] . "</td>"; } $html .= "</tr>"; } $html .= "</table>"; } ob_end_flush(); return $html; }