<?php

require_once 'bs_con2.php';
require_once '../../../../app/model/bs_info_col.php';
require_once('../../../../app/model/FPDF/fpdf.php');

class GenerarPdf extends FPDF
{
    function Header()
    {
        $obj=new InfoCol();
        $arr=$obj->proceso();
        
        $this->Ln(9);
//        $this->Image("../../../../fotografias/".$arr[1],12,12,20);
        $this->SetFont("Times","B",16);
        $this->Cell(25);
        $this->SetTextColor(0,0,0);
        $this->SetFillColor(248,248,255);
//        $this->Cell(155,9,$arr[0],1,0,'C',false);
                
                
        $this->Ln(13);
        //$this->Image("",10,10,30);
        $this->SetFont("Times","B",12);
        $this->Cell(70);
        $this->SetTextColor(0,0,0);
        $this->SetFillColor(240,230,140);
        $this->Cell(50,6,"Labor Academica",1,0,'C',true);
        $this->Ln(12);
        
    }
 
    



    function datos_Tbla($cabeceraT){
        
        $obj=new Con2();
        $arr=$obj->proceso($_REQUEST['pro']);
        $obj->disconnect();

        
        if($arr=='no')
         {
            //$this->SetFont("Helvetica","B",9);
            $this->Cell(65);
            $this->SetFillColor(248,248,255);
            $this->Cell(60,9,"No hay Horario Registrado",1,0,'C',true);
         }else{
       
        
            $this->Ln(5);
            $this->Cell(30);
            $this->SetFont("Times","B",12);
            $this->SetTextColor(0,0,0);
            $this->SetFillColor(248,248,255);
            $this->Cell(110,6," Profesor: ".$arr[0][6]."  ".($arr[0][7]),1,0,'C',true);
            $this->Ln(10);
            $this->SetFont("Helvetica","B",7);
            
   
            $this->Cell(30);
            $this->SetFillColor(248,248,255);

            for($i=0;$i<count($cabeceraT);$i++)
             {
                  if($i==0)
                   {
                        $this->Cell(10,5,($cabeceraT[$i]),1,0,'C',true);

                   }else if($i==1)
                   {
                        $this->Cell(30,5,($cabeceraT[$i]),1,0,'C',true);

                   }else if($i==2)
                   {
                        $this->Cell(15,5,($cabeceraT[$i]),1,0,'C',true);

                   }else  if($i==3)
                   {
                        $this->Cell(50,5,($cabeceraT[$i]),1,0,'C',true);
                   }else if($i==4)
                   {
                        $this->Cell(7,5,($cabeceraT[$i]),1,0,'C',true);

                   }else if($i==5)
                   {
                        $this->Cell(20,5,($cabeceraT[$i]),1,0,'C',true);

                   }

              }
             $this->ln(5);


             for($c=0;$c<count($arr)-1;$c++)
              {
                    $this->Cell(30);
                    $this->SetFont("Helvetica","I",7);

                    for($i=0;$i<10;$i++)
                       {

                            if($i==0)
                               {
                                    $this->Cell(10,5,$arr[$c][$i],1,0,'C');

                               }else if($i==1)
                               {
                                    $this->Cell(30,5,$arr[$c][$i]."   ".$arr[$c][$i+1],1,0,'C');
                                    $i++;
                               }else if($i==3)
                               {
                                    $this->Cell(15,5,$arr[$c][$i],1,0,'C');

                               }else if($i==4)
                               {
                                    $this->Cell(50,5,$arr[$c][$i]."   ".$arr[$c][$i+1],1,0,'');
                                    $i++;
                               }else if($i==8)
                               {
                                    $this->Cell(7,5,$arr[$c][$i],1,0,'C');
                                    
                               }else if($i==9)
                               {
                                    $this->Cell(20,5,$arr[$c][$i],1,0,'C');

                               }

                       }

                       $this->ln(5);

              }
                $this->ln(9);
                $this->Cell(15);
                $this->Cell(150,0,'','T');
                $this->ln(1);
                $this->Cell(130);
                $this->Cell(20,5,'Total Horas : '.$arr[count($arr)-1][0],1,0,'C');
               
         }
        
       
        
    }





function Footer()
    {
        $this->SetY(-20);
        $this->Cell(20);
        $this->Cell(120,10,"Pagina No.".$this->PageNo()."",1,0);
        $this->Cell(200);
    }
}

$cabeceraT=array("Grado","Curso","Jornada","Asignaturas","I_H","Dia y Hora");


$pdf=new GenerarPdf();
$pdf->AddPage();

$pdf->datos_Tbla($cabeceraT);
$pdf->Output();

?>
