"Mon", "Mar" => "Tue", "Mie" => "Wed", "Jue" => "Thu", "Vie" => "Fri", "Sab" => "Sat", "Dom" => "Sun", "Enero" => "January", "Febrero" => "February", "Marzo" => "March", "Abril" => "April", "Mayo" => "May", "Junio" => "June", "Julio" => "July", "Agosto" => "August", "Septiembre" => "September", "Octubre" => "October", "Noviembre" => "November", "Diciembre" => "December", "Indistinto" => "Any", "hasta" => "until", "entre" => "between", "más de" => "more than" ); if ($IDIOMA=="E") { return $palabras[$Texto]; } else { return $Texto; } } function TextoEstatico($espaniol, $ingles) { global $session_idioma; if ($session_idioma=="E") return $espaniol; else return $ingles; } function substrHTML($sTexto, $size=60) { $resultado=""; $i=0; $real=0; $inTag=false; while ($i"; $inTag=true; } if ($inTag and substr($sTexto,$i,1)==">") { //echo "encontro un cierra html
"; $inTag=false; } else { if ($inTag==false) { //echo "esta agergando letra: ".substr($sTexto,$i,1)."
"; $resultado=$resultado.substr($sTexto,$i,1); //echo "Res:$resultado
"; $real++; } } $i++; } if ($i".$opcionAdicional."\n"; $res=mysql_query("SELECT * FROM $tabla") or die ("Fallo en Combos->guardar(): " . mysql_error()); while ($Result = mysql_fetch_assoc($res)) { if ($Result[$campoId]==$defaultvalue) $respuesta=$respuesta."\n"; else $respuesta=$respuesta."\n"; } $respuesta=$respuesta."\n"; return $respuesta; } function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // Quote if not integer if (!is_numeric($value)) { $value = mysql_real_escape_string($value); //reemplazamos entonces a mano /*$trans = array( "\x00" => "\\x00", "\n" => "\\n", "\r" => "\\r", "\\" => "\\\\", "'" => "\\'", "\"" => "\\\"", "\x1a" => "\x1a"); $value = strtr($value, $trans);*/ } return $value; }; /******************************************************/ /* Funcion paginar * actual: Pagina actual * total: Total de registros * por_pagina: Registros por pagina * enlace: Texto del enlace * Devuelve un texto que representa la paginacion */ function paginar($actual, $total, $por_pagina, $enlace) { $total_paginas = ceil($total/$por_pagina); $anterior = $actual - 1; $posterior = $actual + 1; //$texto = "
"; $texto = ""; //maximo de cada lado de la actual. $maxPaginas = 7; $inicio = 1; if($total_paginas>($maxPaginas*2)){ //tenemos que recortar, primero busco la diferencia a cada lado de la actual $strInicio = "<-... "; $strFinal = " ...->"; if($actual > $maxPaginas && $actual < $total_paginas-$maxPaginas){ $iPagI = $maxPaginas; $iPagD = $maxPaginas; if($actual-$iPagI == 1) $strInicio = ""; if($actual+$iPagD == $total_paginas) $strFinal = ""; } if($actual <= $maxPaginas){ //Si estamos más cerca del inicio $iPagI = $actual-1; $iPagD = $maxPaginas+($maxPaginas-$iPagI); $strInicio = ""; if($actual+$iPagD == $total_paginas) $strFinal = ""; } if($actual >= $total_paginas-$maxPaginas){ //Si estamos más cerca del final $iPagD = $total_paginas-$actual; $iPagI = $maxPaginas+($maxPaginas-$iPagD); if($actual-$iPagI == 1) $strInicio = ""; $strFinal = ""; } /* if($actual == $maxPaginas){ //Si estamos en el medio $iPagI = $maxPaginas-1; $iPagD = $maxPaginas-1; }*/ $texto .= $strInicio; //anteriores a la actual for ($i=$actual-$iPagI; $i<$actual; $i++) $texto .= "$i  -  "; //actual $texto .= "$actual  -  "; //posteriores a la actual for ($i=$actual+1; $i<=$iPagD+$actual; $i++){ if($i==$iPagD+$actual) $texto .= "$i"; else $texto .= "$i  -  "; } $texto .= $strFinal; }else{ //anteriores a la actual for ($i=1; $i<$actual; $i++) $texto .= "$i  -  "; //actual $texto .= "$actual  -  "; //posteriores a la actual for ($i=$actual+1; $i<=$total_paginas; $i++){ if($i==$total_paginas) $texto .= "$i"; else $texto .= "$i  -  "; } } if ($actual>1) // $texto .= "  [<]"; $texto="
  [<]  ".$texto; else // $texto .= "[<]"; $texto="
  [<]  ".$texto; if ($actual<$total_paginas) $texto .= "   [>]"; else $texto .= "   [>]"; $texto .= "
"; return $texto; } ?>host = $DBHost; $this->db = $DBMain; $this->user = $DBUser; $this->pass = $DBPass; $this->link = mysql_connect($this->host, $this->user, $this->pass); mysql_select_db($this->db); register_shutdown_function(array(&$this,'close')); } function close() { mysql_close($this->link); } } ?>