|
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/aplicaciones/admon/catalogo/fnc/ |
Upload File : |
<?php
class Parametros extends Componente{
/*constructor*/
function Parametros(){
$this->DBManager('MySQL');
$this->connect();
}
function getCategoria(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_categoria'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getSubcategoria(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_subcategoria'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getProducto(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_producto'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getImagen(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_imagen'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getCampo(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_campo'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getAncho(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_ancho'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getAlto(){
$sql = "SELECT valor FROM parametro WHERE nombre='num_alto'";
if($this->execute($sql)){
list($id)=$this->fetchRow();
return $id;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getCategoriaAct(){
$sql = "SELECT count(id) as cantidad FROM `catalogo_categoria` WHERE tipo='categoria' GROUP BY parent";
$mayor=0;
if($this->execute($sql)){
while(list($cantidad)=$this->fetchRow()){
if($cantidad>$mayor){
$mayor=$cantidad;
}
}
return $mayor;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getSubcategoriaAct(){
$sql = "SELECT count(id) as cantidad FROM `catalogo_categoria` WHERE tipo='subcategoria' GROUP BY parent";
$mayor=0;
if($this->execute($sql)){
while(list($cantidad)=$this->fetchRow()){
if($cantidad>$mayor){
$mayor=$cantidad;
}
}
return $mayor;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getProductoAct(){
$sql = "SELECT count(id) as cantidad FROM `catalogo_producto` where tipo='p' GROUP BY categoria";
$mayor=0;
if($this->execute($sql)){
while(list($cantidad)=$this->fetchRow()){
if($cantidad>$mayor){
$mayor=$cantidad;
}
}
return $mayor;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getCampoAct(){
$sql = "SELECT count(id) as cantidad FROM `catalogo_campo` GROUP BY producto";
$mayor=0;
if($this->execute($sql)){
while(list($cantidad)=$this->fetchRow()){
if($cantidad>$mayor){
$mayor=$cantidad;
}
}
return $mayor;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getImagenAct(){
$sql = "SELECT count(id) as cantidad FROM `catalogo_imagen` WHERE tipo!='principal' GROUP BY producto";
$mayor=0;
if($this->execute($sql)){
while(list($cantidad)=$this->fetchRow()){
if($cantidad>$mayor){
$mayor=$cantidad;
}
}
return $mayor;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getAnchoAct(){
$sql = "SELECT min(ancho) as anchomin FROM `catalogo_imagen` WHERE tipo='principal'";
if($this->execute($sql)){
list($ancho)=$this->fetchRow();
return $ancho;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
function getAltoAct(){
$sql = "SELECT min(alto) as altomin FROM `catalogo_imagen` WHERE tipo='principal'";
if($this->execute($sql)){
list($alto)=$this->fetchRow();
return $alto;
}elseif ($this->isDebuggerEnabled()) {
$msg = "Error ".$this->getException();
return $msg;
}
}
}
?>