[#] hm X_Shell Backd00r [#]

Current Path : /var/www/clients/client35/web46/web/admin/models/
Upload File :
Current File : /var/www/clients/client35/web46/web/admin/models/Fondos.php

<?php

require_once 'Conexion.php';

class Fondos {

    private $id_fondo;
    private $nombre_img;
    private $fnd_activo;

    const TABLA = 'fondo';
    
    public function __construct($id_fondo=null, $nombre_img=null, $fnd_activo=null) {
        $this->id_fondo = $id_fondo;
        $this->nombre_img = $nombre_img; 
        $this->fnd_activo = $fnd_activo;
       
    }

    public function getid_fondo() {
        return $this->id_fondo;
    }

    public function getnombre_img() {
        return $this->nombre_img;
    }

    public function getfnd_activo() {
        return $this->fnd_activo;
    }
   
    
    public function setId_fondo($id_fondo) {
        $this->id_fondo = $id_fondo;
    }
    public function setNombre_img($nombre_img) {
        $this->nombre_img = $nombre_img;
    }

    public function setFnd_activo($fnd_activo) {
        $this->fnd_activo = $fnd_activo;
    }
     

      public function guardar() {
        $conexion = new Conexion();
        $consulta = $conexion->prepare('INSERT INTO ' . self::TABLA . ' ( nombre_img, fnd_activo) VALUES(:nombre_img, :fnd_activo)');
        
        $consulta->bindParam(':nombre_img', $this->nombre_img);
        $consulta->bindParam(':fnd_activo', $this->fnd_activo);
        $consulta->execute();
        $conexion = null; 
                              }

    
    public function eliminar($id_fondo){
        $conexion = new Conexion();
        $consulta = $conexion->prepare('DELETE FROM ' . self::TABLA . ' WHERE id_fondo = :id_fondo');
        $consulta->bindParam(':id_fondo', $id_fondo);
        $consulta->execute();
        $conexion = null;
    }

   

    public static function RecuperarImagenes() {
        $conexion = new Conexion();
        $consulta = $conexion->prepare('SELECT id_fondo, nombre_img, fnd_activo FROM fondo ORDER BY id_fondo');
        $consulta->execute();
        $registros = $consulta->fetchAll();
        $conexion = null;
        return $registros;
    }

     public static function definir_fondo() {
        $conexion = new Conexion();
        $consulta = $conexion->prepare('SELECT nombre_img FROM fondo WHERE fnd_activo = "Activo" ');
        $consulta->execute();
        $registros = $consulta->fetchAll();
        $conexion = null;
        return $registros;


    }

    public function establecerOrden($id_fondo) {
            $conexion = new Conexion();
            $consulta = $conexion->prepare('UPDATE ' . self::TABLA . ' SET  fnd_activo = "inactivo" WHERE id_fondo != :id_fondo' );
            $consulta->bindParam(':id_fondo', $id_fondo);      
            $consulta->execute();
            $conexion = null;

        
        }

     public function establecerFondo($id_fondo) {
            $conexion = new Conexion();
            $consulta = $conexion->prepare('UPDATE ' . self::TABLA . ' SET  fnd_activo = "Activo" WHERE id_fondo    = :id_fondo' );
            $consulta->bindParam(':id_fondo', $id_fondo);      
            $consulta->execute();
            $conexion = null;

          
        }


}

Mr.hm X_Shell Backd00r 1.0, Coded By Mr.hm X_Shell Backd00r