Viewing file: class_filtrar_select_edicion.php (3.49 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class filtrar_select_edicion {
function filtrar_select_edicion($seleccion, $desde, $cuando, $arreglo_nombres, $arreglo_valores, $campo_id, $campo_id_comparacion, $id_buscar, $tabla, $nombre_select)
{
$this->SELECCION = $seleccion;
$this->DESDE = $desde;
$this->CUANDO = $cuando;
$this->TABLA = $tabla;
$this->ARREGLO_NOMBRES = $arreglo_nombres;
$this->ARREGLO_VALORES = $arreglo_valores;
$this->NOMBRE_SELECT = $nombre_select;
// 1. Determinar si usa arreglo de variables predefinidas o si hace un select
if ($this->ARREGLO_NOMBRES == "") {
$arreglo_1 = new select_v1(0, $this->SELECCION, $this->DESDE, $this->CUANDO, 2, 0, "", "", "");
for ($i = 0; $i < $arreglo_1->NUMERO_REGISTROS; $i++) {
$this->ARREGLO_VALORES = $this->ARREGLO_VALORES . "-" . $arreglo_1->RESULTADOS[$i][0];
}
for ($i = 0; $i < $arreglo_1->NUMERO_REGISTROS; $i++) {
$this->ARREGLO_NOMBRES = $this->ARREGLO_NOMBRES . "-" . $arreglo_1->RESULTADOS[$i][1];
}
}
// 2. Extraccion del Dato a Comparar
// Campo sobre el cual que se confronta el ID
$this->CAMPO_ID = $campo_id;
// Campo sobre el que se extrae el dato para comparar
$this->CAMPO_ID_COMPARACION = $campo_id_comparacion;
// Id a buscar en campo_id de la tabla
$this->ID_BUSCAR = $id_buscar;
$cuando_2 = $this->CAMPO_ID . " = '" . $this->ID_BUSCAR . "'";
$arreglo_2 = new select_v1(0, $this->CAMPO_ID_COMPARACION, $this->TABLA, $cuando_2, 1, 0, "", "", "");
$dato_comparacion = $arreglo_2->RESULTADOS[0][0];
// 2.1 Si no tiene datos validos que asigna #
if ($dato_comparacion == "") {
$dato_comparacion = "#";
}
// 2.2 Si es una fecha que en vez de un dato plano cree un arreglo
$aplica = substr_count($dato_comparacion, "-");
if ($aplica != 0) {
$dato_comparacion_1 = explode(" ", $dato_comparacion);
$dato_comparacion = explode("-", $dato_comparacion_1[0]);
}
// 3. Imprimir el seleccionable filtrado
$arreglo = is_array($dato_comparacion);
if ($arreglo == true)
{
$c = 0;
$nombre_select_original = $nombre_select;
foreach ($dato_comparacion as $valor)
{
$dato_comparacion_1 = $valor;
if ($c == 2) {
$nombre_select = "dia" . $nombre_select_original;
$this->ARREGLO_NOMBRES = "01-02-03-04-05-06-07-08-09-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31";
$this->ARREGLO_VALORES = "01-02-03-04-05-06-07-08-09-10-11-12-13-14-15-16-17-18-19-20-21-22-23-24-25-26-27-28-29-30-31";
}
if ($c == 1) {
$nombre_select = "mes" . $nombre_select_original;
$this->ARREGLO_NOMBRES = "Enero-Febrero-Marzo-Abril-Mayo-Junio-Julio-Agosto-Septiembre-Octubre-Noviembre-Diciembre";
$this->ARREGLO_VALORES = "01-02-03-04-05-06-07-08-09-10-11-12";
}
if ($c == 0) {
$nombre_select = "ano" . $nombre_select_original;
$this->ARREGLO_NOMBRES = "2003-2004-2005-2006-2007-2008-2009-2010-2011-2012-2013-2014-2015";
$this->ARREGLO_VALORES = "2003-2004-2005-2006-2007-2008-2009-2010-2011-2012-2013-2014-2015";
}
imprimir1($nombre_select, $dato_comparacion_1, $this->ARREGLO_NOMBRES, $this->ARREGLO_VALORES);
$c++;
}
}else{
imprimir($nombre_select, $dato_comparacion, $this->ARREGLO_NOMBRES, $this->ARREGLO_VALORES);
}
}
}
?>
|