mainmodel.php 2.6 KB
<?php 

include_once 'models/arcu.php';

class MainModel extends Model{

    public function __construct(){
        parent::__construct();
    }

    public function getCant($tabla){

            $items=[];
        
        try{
        
            $query=$this->db->connect()->query("SELECT numero, documento AS file1, fecha FROM ".$tabla." ORDER BY fecha DESC LIMIT 6");
        
        
            while($row=$query->fetch()){
                $item=new Arcu();
                $item->numero=$row['numero'];
                $item->file1=$row['file1'];
                $item->fecha=$row['fecha'];
                array_push($items,$item);
            }
                return $items;
        
        }catch(PDOException $e){
        
              
            return false;
        
        }
        
        }


    public function getButtonA($tabla){

        $items=[];
    
    try{
    
        $query=$this->db->connect()->query("SELECT numero, documento AS file1, fecha FROM ".$tabla." ORDER BY fecha DESC");
    
    
        while($row=$query->fetch()){
            $item=new Arcu();
            $item->numero=$row['numero'];
            $item->file1=$row['file1'];
            $item->fecha=$row['fecha'];
            array_push($items,$item);
        }
            return $items;
    
    }catch(PDOException $e){
    
          
        return false;
    
    }
    
    }

    public function getButtonR($tabla){

        $items=[];
    
    try{
    
        $query=$this->db->connect()->query("SELECT numero, documento AS file2, fecha FROM ".$tabla." ORDER BY fecha DESC");
    
    
        while($row=$query->fetch()){
            $item=new Arcu();
            $item->numero=$row['numero'];
            $item->file1=$row['file2'];
            $item->fecha=$row['fecha'];
            array_push($items,$item);
        }
            return $items;
    
    }catch(PDOException $e){
    
          
        return false;
    
    }
    
    }

        public function getResolucion($tabla){

            $items=[];
        
        try{
        
            $query=$this->db->connect()->query("SELECT numero, documento AS file2, fecha FROM ".$tabla." ORDER BY fecha DESC LIMIT 6");
        
        
            while($row=$query->fetch()){
                $item=new Arcu();
                $item->numero=$row['numero'];
                $item->file2=$row['file2'];
                $item->fecha=$row['fecha'];
                array_push($items,$item);
            }
                return $items;
        
        }catch(PDOException $e){
        
              
            return false;
        
        }
        
        }

    
    }

?>