function ListR2($titulo, $sql, $conexion, $clase, $ord, $url, $enlaceCod, $panel, $id_tabla, $checks, $paginador) { $totReg = totReg($sql, $conexion); //$paginador = '3,4'; if ($paginador != '') { $sql = pag($sql, $paginador); } $cmp = array(); $consulta = mysql_query($sql, $conexion); $resultado = $consulta or die(mysql_error()); $v = "<div id='" . $clase . "' style='width:100%;'>"; $v .= "<div class='" . $clase . "' style='width:98%;float:left;'>"; if ($titulo != "") { $v = $v . "<div style='width:100%;float:left;'><h1>" . $titulo . "<h1></div>"; } $v = $v . "<div style='float:left;width:100%;'>"; $v = $v . "<form name='" . $id_tabla . "' method='post' id='" . $id_tabla . "'>"; $v = $v . "<table id='" . $id_tabla . "-T' cellspacing='0' cellpadding='0' style='width:100%;'>"; $v = $v . "<tr>"; for ($i = 0; $i < mysql_num_fields($consulta); ++$i) { $campo = mysql_field_name($consulta, $i); if ($campo != "CodigoAjax" && $campo != 'UrlAjax') { if ($checks != 'SinTitulo') { $v = $v . "<th>" . $campo . "</th>"; } } $cmp[$i] = $campo; } if ($checks == 'checks') { $v = $v . "<th> <input type='checkbox' name='checkAllSelected' value='all' onclick=\"checkAll('{$id_tabla}', this);\"></th>"; } if ($checks == 'cerrarPrograma') { $v = $v . "<th>Cerrar</th>"; } if ($checks == 'editar') { $v = $v . "<th>Acción</th>"; } $v = $v . "</tr>"; $cont = 1; while ($reg = mysql_fetch_array($resultado)) { $cont++; for ($i = 0; $i < mysql_num_fields($consulta); ++$i) { $campo = mysql_field_name($consulta, $i); if ($campo == "CodigoAjax") { $codAjax = $reg[$cmp[$i]]; } if ($campo == "UrlAjax") { $UrlAjax = $reg[$cmp[$i]]; } } $codAjaxId = $codAjax; if (!empty($UrlAjax)) { $codAjax = $codAjax . '&' . $UrlAjax; } $url2 = $url . "&" . $enlaceCod . "=" . $codAjaxId; if ($checks == 'Buscar') { $v = $v . "<tr style='cursor:pointer' id='" . $codAjaxId . "' ondblclick=enviaRegBuscar('" . $codAjaxId . "','" . $panel . "'); >"; } else { $v = $v . "<tr style='cursor:pointer' id='" . $codAjaxId . "' ondblclick=enviaReg('" . $codAjaxId . "','" . $url2 . "','" . $panel . "','" . $id_tabla . "'); >"; } for ($j = 0; $j < mysql_num_fields($consulta); ++$j) { $campo = mysql_field_name($consulta, $j); if ($campo != "CodigoAjax" && $campo != 'UrlAjax') { $v = $v . "<td>" . $reg[$cmp[$j]] . "</td>"; } } if ($checks == 'checks') { $v = $v . "<td>"; $v = $v . "<input type='checkbox' name='ky[]' value='" . $codAjax . "'>"; $v = $v . "</td>"; } if ($checks == 'cerrarPrograma') { $ur = './_vistas/pc_analisis.php?'; $url3 = $ur . "cerrarPrograma=si&" . $enlaceCod . "=" . $codAjax; $v = $v . "<td>"; $v = $v . "<span onclick=enviaVista('" . $url3 . "','" . $panel . "','')>cerrar</span>"; $v = $v . "</td>"; } if ($checks == 'editar') { $v = $v . "<td>"; $v = $v . "<span onclick=enviaVista('" . $url2 . "','" . $panel . "','')>editar</span>"; $v = $v . "</td>"; } $v = $v . "</tr>"; } $v = $v . "</table>"; $v = $v . "</form>"; $v = $v . "</div>"; $v = $v . "</div>"; if ($paginador != '') { $v = $v . paginator($sql, $paginador, $totReg); } $v = $v . '</div>'; if (mysql_num_rows($resultado) == 0) { $v = '<div class="MensajeB vacio" style="float:left;width:95%;">(!) No se encontró ningun registro...</div>'; } return $v; }
$pageLinks .= ' <a href="' . $baseLink . $i . '" class="page">' . $i . '</a> '; } } if ($nextPrev) { //Next and previous links $next = $currentPage + 1 > $totalPages ? false : '<a href="' . $baseLink . ($currentPage + 1) . '">' . $lang["Next"] . '</a>'; $prev = $currentPage - 1 <= 0 ? false : '<a href="' . $baseLink . ($currentPage - 1) . '">' . $lang["Prev"] . '</a>'; } $first = $currentPage > 2 ? '<a href="' . $baseLink . '1">' . $lang["First"] . '</a> ' : false; $last = $currentPage < $totalPages - 2 ? " <a href='" . $baseLink . $totalPages . "'>" . $lang["Last"] . "</a> " : false; return $txtPageList . $first . $prev . $pageLinks . $next . $last; } // end pagination // show pages if ($total_pages != 1) { echo pag($nr, $page, "?or={$or}&nm={$nnm}&k={$k}&perp={$perp}&tb={$tb}&cc={$ccod}&vmi=ionutvmi&page=", true, $perp); } else { echo "1 page<br>- - -"; } if ($total_pages > 2) { echo "<form action='?' align='left'><input type='hidden' name='k' value='{$k}'><input type='hidden' name='tb' value='{$tb}'><input type='hidden' name='nm' value='{$nnm}'><input type='hidden' name='perp' value='{$perp}'>\r\n<input type='hidden' name='cc' value='{$ccod}'>\r\n<input type='hidden' name='vmi' value='ionutvmi'>\r\n<input name='page' value='{$page}' size='2'>"; if ($ord == 'desc') { echo "<input type='hidden' name='or' value='{$or}'>"; } echo " <input type='submit' value='" . $lang["Jump"] . "'><br/>- - -</form>"; } echo "<form action='?' align='left'><br/>" . $lang["Show"] . " <input type='hidden' name='k' value='{$k}'><input type='hidden' name='tb' value='{$tb}'>\r\n<input type='hidden' name='or' value='{$or}'>\r\n<input type='hidden' name='cc' value='{$ccod}'>\r\n<input type='hidden' name='vmi' value='ionutvmi'>\r\n<input type='hidden' name='nm' value='{$nnm}'>\r\n<input name='perp' value='{$perp}' size='2'>"; echo " <input type='submit' value='" . $lang["Per_Page"] . "'></form>"; } else { printf($lang["No_results_search"], "?k={$k}&tb={$tb}"); }
$pageLinks .= ' <a href="' . $baseLink . $i . '" class="page">' . $i . '</a> '; } } if ($nextPrev) { //Next and previous links $next = $currentPage + 1 > $totalPages ? false : '<a href="' . $baseLink . ($currentPage + 1) . '">' . $lang["Next"] . '</a>'; $prev = $currentPage - 1 <= 0 ? false : '<a href="' . $baseLink . ($currentPage - 1) . '">' . $lang["Prev"] . '</a>'; } $first = $currentPage > 2 ? '<a href="' . $baseLink . '1">' . $lang["First"] . '</a> ' : false; $last = $currentPage < $totalPages - 2 ? " <a href='" . $baseLink . $totalPages . "'>" . $lang["Last"] . "</a> " : false; return $txtPageList . $first . $prev . $pageLinks . $next . $last; } // end pagination // show pages if ($total_pages != 1) { echo pag($nr, $page, "?or={$or}&nm={$nnm}&k={$k}&perp={$perp}&tb={$tb}&page=", true, $perp); } else { echo "1 page<br>- - -"; } if ($total_pages > 2) { echo "<form action='?' align='left'><input type='hidden' name='k' value='{$k}'><input type='hidden' name='tb' value='{$tb}'><input type='hidden' name='nm' value='{$nnm}'><input type='hidden' name='perp' value='{$perp}'><input name='page' value='{$page}' size='2'>"; if ($ord == 'desc') { echo "<input type='hidden' name='or' value='{$or}'>"; } echo " <input type='submit' value='" . $lang["Jump"] . "'><br/>- - -</form>"; } echo "<form action='?' align='left'><br/>" . $lang["Show"] . " <input type='hidden' name='k' value='{$k}'><input type='hidden' name='tb' value='{$tb}'>\r\n<input type='hidden' name='or' value='{$or}'><input type='hidden' name='nm' value='{$nnm}'>\r\n<input name='perp' value='{$perp}' size='2'>"; echo " <input type='submit' value='" . $lang["Per_Page"] . "'></form>"; } else { echo "<div class='shout'>" . strtoupper($lang["Browse"]) . "<br/>" . $lang["Query"] . ": " . htmlspecialchars($sql) . "<p align='left'><a href='tables.php?k={$k}'>" . $lang["tables"] . "</a>><a href='table.php?k={$k}&tb={$tb}'>{$tb}</a><br/>- - -<br/>" . $lang["Browse"] . "</a> |<a href='table.php?k={$k}&tb={$tb}'>" . $lang["Structure"] . "</a> | <a href='search.php?k={$k}&tb={$tb}'>" . $lang["Search"] . "</a> | <a href='in.php?k={$k}&tb={$tb}'>" . $lang["Insert"] . "</a> | <a href='trun.php?k={$k}&tb={$tb}'>" . $lang["Clear"] . "</a> | <a href='dropt.php?k={$k}&tb={$tb}'>" . $lang["Drop"] . "</a><br/>- - -<br/>\r\n"; echo $lang["No_values_inserted"] . "<br/>";