<?php
class GBanner{    

    public function lista(){
      return "SELECT id_banner as id, no_titulo as noTitulo, no_descripcion as noDescripcion, no_ruta as noRuta, no_enlace as noEnlace, fe_inicio as feInicio, fe_fin as feFin  FROM tb_banner where status='1'";
    }

    public function listaFront(){
      return "SELECT id_banner as id, no_titulo as noTitulo, no_descripcion as noDescripcion, no_ruta as noRuta, no_enlace as noEnlace, fe_inicio as feInicio, fe_fin as feFin  FROM tb_banner where status='1' and CURDATE() BETWEEN fe_inicio AND fe_fin";
    }

    public function guardar(){
        return "INSERT INTO tb_banner(no_titulo,no_descripcion,no_ruta,no_enlace,fe_inicio,fe_fin,id_banner) VALUES (?,?,?,?,?,?,?)";
    }

    public function modificar(){
      return "UPDATE tb_banner SET no_titulo = ?, no_descripcion = ?, no_ruta = ?, no_enlace = ?, fe_inicio = ?, fe_fin = ? WHERE id_banner = ?";     
    }

    public function existeImagen(){
      return "SELECT COUNT(1) as cant FROM tb_banner WHERE no_ruta = ? and status='1'";
    }

    public function eliminar(){
      return "UPDATE tb_banner SET status = '0' WHERE id_banner = ?";
    }

}
?>