KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/logicswapweb/fnc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/logicswapweb/fnc/catalogo.php
<?php
class Catalogo extends Componente{
//variables
var $ruta="./aplicaciones/admon/catalogo/archivos/";
var $cantidad=0;
var $filas=0;

//objetos
var $parametros;
var $db1;
var $db2;
var $db3;
var $utileria;

function Catalogo() {
    $this->DBManager('MySQL');
	$this->connect();
	$this->utileria=new Utileria();
	$this->parametros=new Parametros();
	$this->db1=new Componente();
	$this->db2=new Componente();
	$this->db3=new Componente();
}

/*
	function matrix()
	retorna una matrix con todas las categorias disponibles, incluyendo las subcategorias
*/
function matrix(){
	$filas=0;
	$matrix["0"]["0"]="*";
	$matrix["0"]["1"]="*";
	$matrix["0"]["2"]="*";
	$matrix["0"]["3"]="*";
	$matrix["0"]["4"]="*";
	$matrix["0"]["5"]="*";
	//nivel 1	
	$sql1="SELECT id,nombre FROM catalogo_categoria WHERE tipo='categoria' ORDER BY nombre";
	if($this->db1->execute($sql1)){
		while(list($id,$name)=$this->db1->fetchRow()){
			$matrix[$filas]["0"]=$id;
			$matrix[$filas]["1"]=$name;
			$matrix[$filas]["2"]="-";
			$matrix[$filas]["3"]="-";
			$matrix[$filas]["4"]="-";
			$matrix[$filas]["5"]="-";
	//nivel 2
			$sql2="SELECT id,nombre FROM catalogo_categoria WHERE tipo='subcategoria' AND parent='$id ORDER BY nombre'";
			if($this->db2->execute($sql2)){
				while(list($ids,$names)=$this->db2->fetchRow()){			
					$filas++;
					$matrix[$filas]["0"]="*";
					$matrix[$filas]["1"]="*";
					$matrix[$filas]["2"]=$ids;
					$matrix[$filas]["3"]=$names;
					$matrix[$filas]["4"]="-";
					$matrix[$filas]["5"]="-";				
	//nivel 3					
					$sql3="SELECT id,nombre FROM catalogo_categoria WHERE tipo='subcategoria' AND parent='$ids' ORDER BY nombre";
					if($this->db3->execute($sql3)){
						while(list($idss,$namess)=$this->db3->fetchRow()){
							$filas++;
							$matrix[$filas]["0"]="*";
							$matrix[$filas]["1"]="*";
							$matrix[$filas]["2"]="*";
							$matrix[$filas]["3"]="*";						
							$matrix[$filas]["4"]=$idss;
							$matrix[$filas]["5"]=$namess;						
						}
					}else{
						echo "�imposible consultar la base de datos!";
					}
				}
	//cierre nivel 3	
			}else{
				echo "�imposible consultar la base de datos!";
			}
			$filas++;
		}
	// cierra nivel 2	
	}else{
		echo "�imposible consultar la base de datos!";
	}
	//cierra nivel 1
	$matrix[$filas]["0"]="-";
	$matrix[$filas]["1"]="-";
	$matrix[$filas]["2"]="-";
	$matrix[$filas]["3"]="-";					
	$matrix[$filas]["4"]="-";
	$matrix[$filas]["5"]="-";									

	$this->filas = $filas;
	return $matrix;
}

function catalogos($id_car,$ini){
	$sql = "SELECT nombre FROM catalogo_categoria WHERE id='$id_car'";
    $this->execute($sql);
    list($nombre_carpeta) = $this->fetchRow();
	echo '<div align="center" class="menu1">Carpeta: '.$nombre_carpeta.'</div><br>';
	//$parametros=new Parametros();
	$id_tmp=NULL;
	$id_tmp1=NULL;
	$tabla=0;
	$control=0;
	$sql = "SELECT id,categoria,referencia,nombre,descripcion,valor,estado,estado_oferta,fecha_fin,valor_oferta,permiso FROM catalogo_producto WHERE categoria='$id_car' order by nombre";
    $this->execute($sql);
	if($this->numRows()){	
		$i = 1; $j=0; $limite =10; $write=0;
        while((list($id_pro, $categoria,$referencia,$nombre,$descripcion,$valor,$estado,$estado_oferta,$fecha_fin,$valor_oferta,$permiso) = $this->fetchRow())){
			$sql2="SELECT id,producto,tipo,fichero,ancho,alto FROM catalogo_imagen WHERE producto='$id_pro' order by id";
			$this->db2->execute($sql2);	
			if($estado=="disponible"){
				$estado="Producto disponible";
			}elseif($estado=="no disponible"){
				$estado="Producto no disponible";			
			}elseif($estado=="nuevo"){
				$estado="Producto nuevo";			
			}elseif($estado=="promocion"){
				$mes_fin=substr(substr($fecha_fin,5),0,2);
				$dia_fin=substr(substr($fecha_fin,8),0,2);
				$anio_fin=substr($fecha_fin,0,4);
				
				$fecha_act = date('Y-m-d');
				$mes_act=substr(substr($fecha_act,5),0,2);
				$dia_act=substr(substr($fecha_act,8),0,2);
				$anio_act=substr($fecha_act,0,4);
			
				if($anio_fin>$anio_act){
					$estado="Producto en oferta";
				}elseif($anio_fin<$anio_act){
					$estado="Oferta finalizada";
				}elseif($anio_fin=$anio_act){
					if($mes_fin>$mes_act){
						$estado="Producto en oferta";
					}elseif($mes_fin<$mes_act){
						$estado="Oferta finalizada";
					}elseif($mes_fin=$mes_act){
						if($dia_fin>$dia_act){
							$estado="Producto en oferta";
						}elseif($dia_fin<=$dia_act){
							$estado="Oferta finalizada";
						}
					}
				}
			}	 
    		while((list($id_img,$producto,$tipo,$fichero,$ancho,$alto) = $this->db2->fetchRow()) && ($j<$limite)){	
			if($id_img!=$id_tmp && $id_pro!=$id_tmp1 && $tipo!="principal"){
			$id_tmp=$id_img;
			$id_tmp1=$id_pro;
			$this->cantidad++;
			if($write>=$ini){
				if($i==1){ 
					$i++;
								
				$tabla++;
				if($control==0){
					echo '<tr>';
				}
				//$proporcion=$parametros->getAncho()/$parametros->getAlto();
				$proporcion=$this->parametros->getAncho()/$this->parametros->getAlto();
				$anchoSec=160;
				$altoSec=$anchoSec/$proporcion;
				echo '<td width="50%">';
				echo '<table width="100%" border="0" >';
				echo '<tr><td onMouseover="this.bgColor=\'#e0e0e0\'" onMouseout="this.bgColor=\'#ffffff\'" valign="middle" align="center"><a onClick="return fncVisualizarProd('.$id_pro.')" title="Ver mas" style="cursor:hand"><img src="'.$this->ruta.$fichero.'" width="'.$anchoSec.'" height="'.$altoSec.'"></a></td></tr>';				
				echo '</table><table width="100%" border="0">';
				echo '<tr><td valign="top" width="40%" align="right"><strong>Referencia: </strong></td><td width="50%" align="left">'.$referencia.'</td></tr>';	
				echo '<tr><td valign="top" width="40%" align="right"><strong>Status: </strong></td><td width="50%"  align="left">'.$estado.'</td></tr>';	
				echo '<tr><td valign="top" width="40%" align="right"></td><td width="50%" align="right"><a onClick="return fncVisualizarProd('.$id_pro.')" title="Ver mas" style="cursor:hand; text-decoration:none; font-size:10px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000000" onMouseover="this.style.color=\'0000FF\'" onMouseOut="this.style.color=\'000000\';"><strong>Ver mas</strong></a></td></tr>';	
				echo '</table></td>';
				
				if($control==1){
					echo '</tr>';
					$control++;
				}
				
				if($control==2){
					$control=0;
				}else{
					$control++;	
				}	
				
			}else{
			
				$tabla++;
				if($control==0){
					echo '<tr>';
				}
				
				$proporcion=$this->parametros->getAncho()/$this->parametros->getAlto();
				$anchoSec=160;
				$altoSec=$anchoSec/$proporcion;
				echo '<td width="50%">';
				echo '<table width="100%" border="0">';
				echo '<tr><td onMouseover="this.bgColor=\'#e0e0e0\'" onMouseout="this.bgColor=\'#ffffff\'" valign="middle" align="center"><a onClick="return fncVisualizarProd('.$id_pro.')" style="cursor:hand" title="Ver mas"><img src="'.$this->ruta.$fichero.'" width="'.$anchoSec.'" height="'.$altoSec.'"></a></td></tr>';				
				echo '</table><table width="100%" border="0">';
				echo '<tr><td valign="top" width="40%" align="right"><strong>Referencia: </strong></td><td width="50%"  align="left">'.$referencia.'</td></tr>';	
				echo '<tr><td valign="top" width="40%" align="right"><strong>Status: </strong></td><td width="50%"  align="left">'.$estado.'</td></tr>';	
				echo '<tr><td valign="top" width="40%" align="right"></td><td width="50%" align="right"><a onClick="return fncVisualizarProd('.$id_pro.')" title="Ver mas" style="cursor:hand; text-decoration:none; font-size:10px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#000000" onMouseover="this.style.color=\'0000FF\'" onMouseOut="this.style.color=\'000000\';"><strong>Ver mas</strong></a></td></tr>';
				echo '</table></td>';
				
				if($control==1){
					echo '</tr>';
					$control++;
				}
				
				if($control==2){
					$control=0;
				}else{
					$control++;	
				}				
			
			}
			$j++;
			}
			$write++;
			}
			}
			
		}
    } else {
        echo '<tr><td width="100%" ><div align="center">No hay documentos registradas</div></td></tr>';       
    }
	
	if($tabla%2!=0){
		echo '<td></td></tr>';
	}
}



function img_producto_panel_aplicaciones($id_pro){
	$proporcion=$this->parametros->getAncho()/$this->parametros->getAlto();
	$anchoSec=265;
	$altoSec=$anchoSec/$proporcion;

	$index=0;
	$sql = "SELECT fichero FROM catalogo_imagen WHERE producto='$id_pro' AND tipo='principal'";
	if($this->execute($sql)){	
		while(list($fichero)=$this->fetchRow()){
			$imagenes[$index]=$this->ruta.$fichero;
			$index++;
		}
	}else{
		echo "<scrip>alert('�imposible consultar la base de datos!');</script>";
	}
		
	echo '<TABLE border="0" cellspacing="0" cellpadding="0"><TR><TD><form name="Oneslideform">';
	echo '<DIV align="center"><TABLE width="'.$anchoSec.'" border="1" cellspacing="0" cellpadding="4" bordercolor="#999999">';
	echo '<TR><TD bgcolor="#330099"></TD></TR><TR><TD bgcolor="#FFFFFF">';
	echo '<DIV align="center"><A href="javascript:Onetransport()"><IMG src="'.$imagenes[0].'" width="'.$anchoSec.'" height="'.$altoSec.'" name="Oneshow" border="0"></A></DIV>';
	echo '</TD></TR><TR><TD bgcolor="#e0e0e0"><DIV align="center"><SELECT class="listado" name="Oneslide" onChange="Onechange();">';
    for($i=0;$i<$index;$i++){
		if($i==0)
			echo '<OPTION value="'.$imagenes[$i].'"  selected>Imagen '.($i+1).'</OPTION>';
		else	
			echo '<OPTION value="'.$imagenes[$i].'">Imagen '.($i+1).'</OPTION>';
	}		
    echo '</SELECT></TD></TR><TR><TD bgcolor="#e0e0e0"><DIV align="center">';
	echo '<img src="aplicaciones/admon/catalogo/img/atras1.gif" title="Atras" onClick="Oneprevious();">&nbsp;&nbsp;&nbsp;&nbsp;';
	echo '<INPUT name="Oneslidebutton" type=button class="botones" title="AutoPlay" onClick="Oneap(this.value);" value="Play" style="vertical-align:top ">&nbsp;&nbsp;&nbsp;&nbsp;';
	echo '<img src="aplicaciones/admon/catalogo/img/adelante1.gif" title="Adelante" onClick="Onenext();">';
	echo '</DIV></TD></TR></TABLE></DIV></form></TD></TR></TABLE>';
}

function camp_producto($id_pro){
	$sql = "SELECT titulo,contenido FROM catalogo_ campo WHERE producto='$id_pro'";
	
	if($this->execute($sql)){
		echo '<TABLE width="215" border="0" cellpadding="0" cellspacing="0" class="fecha">';
		while(list($titulo,$contenido)=$this->fetchRow()){
			echo '<tr><td class="menu1">'.$titulo.'</td></tr>';
			echo '<tr><td><div  align="justify" style=" width:215; height:60; overflow:auto">'.$contenido.'</div></td></tr>';		
			echo '<tr><td>&nbsp;</td></tr>';		
		}
		echo '</table>';
	}else{
		echo "�imposible consultar la base de datos!";
	}
}

function validar_fecha($fecha_fin){
	$mes_fin=substr(substr($fecha_fin,5),0,2);
	$dia_fin=substr(substr($fecha_fin,8),0,2);
	$anio_fin=substr($fecha_fin,0,4);
				
	$fecha_act = date('Y-m-d');
	$mes_act=substr(substr($fecha_act,5),0,2);
	$dia_act=substr(substr($fecha_act,8),0,2);
	$anio_act=substr($fecha_act,0,4);
			
	if($anio_fin>$anio_act){
		return true;
	}elseif($anio_fin<$anio_act){
		return false;
	}elseif($anio_fin=$anio_act){
		if($mes_fin>$mes_act){
			return true;
		}elseif($mes_fin<$mes_act){
			return false;
		}elseif($mes_fin=$mes_act){
			if($dia_fin>$dia_act){
				return true;
			}elseif($dia_fin<=$dia_act){
				return false;
			}
		}
	}
}

function fecha($fecha_ing){
	if(substr(substr($fecha_ing,5),0,2)=="01"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Enero ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="02"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Febrero ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="03"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Marzo ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="04"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Abril ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="05"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Mayo ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="06"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Junio ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="07"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Julio ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="08"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Agosto ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="09"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Septiembre ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="10"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Octubre ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="11"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Noviembre ".$dia." del ".$ano;
	}
	if(substr(substr($fecha_ing,5),0,2)=="12"){
		$dia=substr(substr($fecha_ing,8),0,2);
		$ano=substr($fecha_ing,0,4);
		$fechaing="Diciembre ".$dia." del ".$ano;
	}
	return $fechaing;
}
}
?>

Anon7 - 2021