0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.139.93.242


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/Reports/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/Reports/pget_invigilator_dairy.php

<?php
$main_src = substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - 7);
$pdf_writer_class = $main_src . "/tcpdf/tcpdf.php";
require_once $pdf_writer_class;
ini_set('memory_limit','900M');
ini_set('max_execution_time',600);

class MYPDF extends TCPDF
{
    public $aobj_context;

    public function setData($aobj_context)
    {
        $this->aobj_context = $aobj_context;
    }
    public function Header()
    {
        // get the current page break margin
        $bMargin = $this->getBreakMargin();
        // get current auto-page-break mode
        $auto_page_break = $this->AutoPageBreak;
        // disable auto-page-break
        $this->SetAutoPageBreak(false, 0);
        // set bacground image
        $this->SetFillColor(248, 248, 255);
        $img_path = $this->aobj_context->main_src . "/img/{$this->aobj_context->FUNIVCODE}_logo.jpg";

        if (file_exists($img_path)) {
            $this->Image($img_path, 6, 6, 20, 20);
        }

        $this->SetFont('Times', 'B', 14);
        $this->SetY(5);
        $this->Cell(0, 4, $this->aobj_context->FUNIVNAME, 0, 1, 'C');
        //state
        $this->SetFont('Times', '', 11);
        $this->Cell(0, 4, $this->aobj_context->s_state, 0, 1, 'C');
        $this->SetFont('Times', 'B', 12);
        $this->MultiCell(0,6, "Centre : {$this->aobj_context->college_details} ","0","C");

        $this->SetFont('Times', 'BU', 12);
        $this->Ln(1);
        $this->Cell(180,6,"Invigilator's Diary PG Entrance Test - 2019","0",1,"C");
        $this->SetAutoPageBreak($auto_page_break, $bMargin);
        // set the starting point for the page content
    }

    public function Footer()
    {
        $this->SetFont('Times', 'B', 10);
        $this->SetY(-20);
        $this->Cell(0,7,"Name Signature of the Invigilator ","0",1,"R");
        $this->SetY(-15);
        $this->SetFont('helvetica', 'I', 8);
        if($this->CurOrientation == 'P')
        {
            $this->Cell(60, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
            $this->Cell(60, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
            $this->Cell(60, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
        }
        else {
            $this->Cell(90, 10, 'IP : ' . $_SERVER["REMOTE_ADDR"], 0, 0, 'L');
            $this->Cell(90, 10, 'Date : ' . date("d-m-Y h:i:s A"), 0, 0, 'C');
            $this->Cell(90, 10, 'Page ' . $this->getPageNumGroupAlias() . '/' . $this->getPageGroupAlias(), 0, 1, 'R');
        }
    }
}

class ReprtObject
{

    public function DefaultConstructor($aobj_context)
    {
        $this->aobj_context = $aobj_context;
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

        $this->ip = $_SERVER["REMOTE_ADDR"];
        $get_date = "select DATE_FORMAT(now(), '%d/%m/%Y') as now_date";
        $obj = $this->aobj_context->mobj_db->GetRow($get_date);
        $this->reportType = $aobj_context->mobj_data["rtype"];

        $this->date = $aobj_context->mobj_data["date"];
        $this->cntr = $aobj_context->mobj_data["cntr"];  

        $get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE,
		FUNIVADD1 as 'state', pdf_logo_path,
		ifnull(FEXAMAPPREQ,'F') as FEXAMAPPREQ From control";
        $lobj_get_coll_name = $this->aobj_context->pobj_db->GetRow($get_coll_name);
// var_dump($get_coll_name);
        $aobj_context->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
        $aobj_context->s_state = $lobj_get_coll_name['state'];
        $aobj_context->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
        $aobj_context->FUNIVCODE = $lobj_get_coll_name['FUNIVCODE'];

        $this->current_date = $obj['now_date'];

        $get_data="SELECT c.FCOLLCODE,
        CONCAT(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME FROM college c
        where c.FCOLLCODE='{$this->cntr}'";					
        $obj_student=$this->aobj_context->pobj_db->GetRow($get_data); 
        $aobj_context->college_details = $obj_student['FCOLLNAME'];
        // $this->pdf = new MYPDF('P',PDF_UNIT, PDF_PAGE_FORMAT, true, 'ISO-8859-1', false);
        $this->pdf = new MYPDF('P');
        $this->pdf->setData($aobj_context);
    }

    public function Header($pdf)
    {
        $pdf->SetFont('Times', 'B', 10);
        $this->pdf->cell(13,7, "Sl. No.","1",0,"C");
        $this->pdf->cell(23,7, "App. No.","1",0,"C");						
        $this->pdf->cell(70,7, "Name","1",0,"C");
        $this->pdf->cell(13,7, "Photo","1",0,"C");
        $this->pdf->cell(27,7, "Ans. Book No.","1",0,"C");
        $this->pdf->cell(25,7, "Signature","1",1,"C");
        $pdf->SetFont('Times', '', 10);
    }

    public function Report($data)
    {
        $pdf = $this->pdf;

        $pdf->SetMargins(15, 32 );
        $pdf->startPageGroup();
        $pdf->AddPage("P");

        $pdf->SetFont('Times', '', 10);

        $oldCode = "";
        $newCode = "";
        $sl_no = 1;
        $block = 0;
        $first = true;
        foreach ($data as $key => $value) {

            // $sl_no++

            if($sl_no >= 16) {
                $pdf->AddPage("P");
                $block++;
                $sl_no = 1;
                $pdf->SetFont('Times', 'B', 12);
                $pdf->cell(0, 6, $value['fpgqpcode'] . ' - ' . $value['fdescpn'], 0, 1, "C");
                $pdf->cell(0, 6, $value['fdoe'] . ' - ' . $value['fpgsession'], 0, 1, "C");
                $pdf->Ln(2);
                $pdf->cell(0, 6,'BLOCK : '.  substr(str_pad($block,5,'0000', STR_PAD_LEFT),-4), 0, 1, "L");
                $this->Header($pdf);
                $pdf->SetFont('Times', '', 10);
                
            }

            $newCode = $value['fpgqpcode'];
            if ($newCode != $oldCode) {
                if(!$first)
                {
                    $pdf->AddPage("P");
                    
                }
                $first = false;
                $sl_no = 1;
                $block = 1;
                $pdf->SetFont('Times', 'B', 12);
                $pdf->cell(0, 6, $value['fpgqpcode'] . ' - ' . $value['fdescpn'], 0, 1, "C");
                $pdf->cell(0, 6, $value['fdoe'] . ' - ' . $value['fpgsession'], 0, 1, "C");
                $pdf->Ln(1);
                $pdf->cell(0, 6,'BLOCK : '.  substr(str_pad($block,5,'0000', STR_PAD_LEFT),-4), 0, 1, "L");
                $this->Header($pdf);
                $pdf->SetFont('Times', '', 10);
            }
            
            $x = $this->pdf->GetX();
            $y = $this->pdf->GetY();
            // $dir = dirname( $this->aobj_context->main_src );
            $dir = realpath(__DIR__ . '/../..');
            // var_dump($dir);
            $full_photo_path=trim($dir."/bcu/adm".'/'.$value['fphotopath']);
            // var_dump($full_photo_path);
            if(file_exists($full_photo_path) && !empty($value['fphotopath']))
            {

                // $image_format = strtolower(pathinfo($full_photo_path, PATHINFO_EXTENSION));
                $this->pdf->Image($full_photo_path,122,$y+1,12,12);
            }
            else
            {
                $this->pdf->Image($this->aobj_context->main_src."/img/nophotoborder.jpg",107,$y+1,12,12);				
            }
            
            $this->pdf->cell(13,13, $sl_no,"1",0,"C");
            $this->pdf->cell(23,13, $value['fappno'],"1",0,"C");						
            $this->pdf->cell(70,13, $value['fname'],"1",0,"L");
            $this->pdf->cell(13,13,'',"1",0,"L");
            $this->pdf->cell(27,13, "","1",0,"C");
            $this->pdf->cell(25,13, "","1",1,"C");


            $oldCode = $newCode;
            $sl_no++;
        }
    }

    public function SendOutput()
    {
        // ob_end_clean();
        $this->pdf->Output("Pget_Invigilators_dairy_{$this->cntr}_" . $this->date . ".pdf", "D");
    }
}

function pgetInvigilatorDairy($aobj_context)
{
    $univcode = $aobj_context->mobj_data["univcode"];  
    $date = $aobj_context->mobj_data["date"];
    $cntr = $aobj_context->mobj_data["cntr"];  

    $query = "select d.fpgqpcode, d.fdegree, d.fdescpn, 
    concat(date_format(d.fpgdate,'%d/%m/%Y'),' [',dayname(d.fpgdate),']') as fdoe, 
    fpgsession, dt.fcntr, 
    concat(cl.fcollcode, ' ', cl.fcollname, ', ', cl.ftown, ', ', cl.fcolladd1) as fcollege, 
    sa.fappno, 
    ucase(sa.fname) as fname, sa.fphotopath from pgstudadm sa 
    inner join pgstuddeg dt on sa.fappno = dt.fappno 
    inner join degree d on dt.fdegree = d.fdegree and d.fexamno = 'A' 
    inner join college cl on dt.fcntr = cl.fcollcode 
    where ifnull(d.fpgqpcode,'') <> ''  and ifnull(fpaystatus,'') = 'success' 
    and d.fpgdate = '{$date}' and dt.fcntr = '{$cntr}'
    group by d.fpgqpcode, sa.fappno
    order by d.fpgqpcode, sa.fappno";
    $result = $aobj_context->pobj_db->GetAll($query);

    $class_obj = new ReprtObject();
    $class_obj->univcode = $univcode;
    $class_obj->DefaultConstructor($aobj_context);

    // If No data found Generate Blank Report
    if (count($result) > 0) {
        $class_obj->Report($result);
    }

    $class_obj->SendOutput();

}