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 : 13.59.250.115


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/subjectDetailsReport.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);
include_once("stringspliter.php");
require_once("/var/www/html/aws/aws-autoloader.php");
use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;

ini_set('max_execution_time', 300);
ini_set("memory_limit", "500M");

class ra_invigilators_dairy extends TCPDF
{
    function DefaultConstructor($aobj_context)
    {
        session_start();
        $this->aobj_context = $aobj_context;
        $this->pdf = new TCPDF();
        $this->pdf = $this;

        $this->ip = $_SERVER["REMOTE_ADDR"];
        $get_coll_name = "select FUNIVNAME as 'FUNIVNAME', funivcode, FUNIVADD1 as 'state', pdf_logo_path From control";
        $lobj_get_coll_name = $this->aobj_context->mobj_db->GetRow($get_coll_name);

        $this->FUNIVNAME = $lobj_get_coll_name['FUNIVNAME'];
        $this->funivcode = $lobj_get_coll_name['funivcode'];
        $this->s_state = $lobj_get_coll_name['state'];
        $this->f_year = $lobj_get_coll_name['f_year'];
        $this->pdf_logo_path = $lobj_get_coll_name['pdf_logo_path'];
		$this->degree = $aobj_context->mobj_data['degreeid'];
        $this->examno = $aobj_context->mobj_data['examno'];

        $this->collcode = $_SESSION['collcode'];
        $this->funivcode = $_SESSION['FUNIVCODE'];

        $get_coll_name = "select FUNIVNAME as 'FUNIVNAME',FUNIVCODE, FUNIVADD1 as 'state', pdf_logo_path From control";
        $lobj_get_coll_name = $this->aobj_context->mobj_db->GetRow($get_coll_name);

        $get_data = "SELECT c.FCOLLCODE, CONCAT(c.FCOLLCODE, ' - ', c.FCOLLNAME,', ',c.FTOWN) AS FCOLLNAME FROM college c where c.FCOLLCODE='{$this->collcode}'";
        $obj_student = $this->aobj_context->mobj_db->GetRow($get_data);

        $query1="SELECT fdegree,fdescpn ,CONCAT(fexamno,' - ',fexamname) AS examno FROM degree where fdegree='{$this->degree}' and fexamno='{$this->examno}'";
		$res= $this->aobj_context->mobj_db->GetRow($query1);
	    $this->descpn=$res['fdescpn'];
        $this->exam=$res['examno'];
     
        $this->college_details = $obj_student['FCOLLNAME'];
        $this->degree_details  = " College : {$this->FCOLLNAME}";

    }

    function Header()
    {
    //     if ($FUNIVCODE == '031') {
    //         if (!empty($this->pdf_logo_path)) {
    //             $img_logo_path = $this->aobj_context->main_src . '/' . $this->aobj_context->mobj_data["db"] . "/img/report_uni_logo.jpg";
    //             $this->pdf->Image($img_logo_path, 60, 4, 80);
    //             $this->pdf->Ln(10);
    //         }
    //     } else {
    //         if (!empty($this->pdf_logo_path)) {
    //             $img_logo_path = $this->aobj_context->main_src . '/' . $this->aobj_context->mobj_data["db"] . '/' . $this->pdf_logo_path;
    //             $this->pdf->Image($img_logo_path, 5, 2, 20);
    //         }
    //         $this->pdf->SetFont('Times', 'B', 15);
    //         $this->pdf->ln(5);
    //         $this->pdf->cell(0, 3, $this->FUNIVNAME . "", "0", 1, "C");
    //         $this->pdf->SetFont('Times', 'B', 8);
    //         $this->pdf->cell(0, 6, $this->s_state, "0", 1, "C");
    //     }
    //     $this->pdf->SetFont('Times', 'B', 12);
    //     $this->pdf->cell(0, 6, "College : $this->college_details ", "0", 1, "C");
    //     $this->pdf->SetFont('Times', 'B', 12);

    //     $this->pdf->Cell(0, 7, "Subject Details", "0", 1, "C");
    //     $this->pdf->Cell(0, 5, "Degree  : " .$this->degree. " - " .$this->descpn."   Semester :". $this->exam, "0", 0, "C");
       
    }

    function Footer()
    {
        $this->SetY(-15);
        $this->pdf->SetFont('Times', 'B', 8);
        $this->Cell(140, 6, 'Printed   : IP Address : ' . $this->ip . " Date " . $this->current_date, '0', 0, 'L');
        $this->Cell(40, 6, 'Page ' . $this->PageNo() . '', 0, 1, 'R');
    }
 
    function writepdf($data)
{
    $pdf = $this->pdf;
    $pdf->SetMargins(1, 1, 10, 10);
    $pdf->AddPage('L');

     if ($FUNIVCODE == '031') {
            if (!empty($this->pdf_logo_path)) {
                $img_logo_path = $this->aobj_context->main_src . '/' . $this->aobj_context->mobj_data["db"] . "/img/report_uni_logo.jpg";
                $this->pdf->Image($img_logo_path, 60, 4, 80);
                $this->pdf->Ln(10);
            }
        } else {
            if (!empty($this->pdf_logo_path)) {
                $img_logo_path = $this->aobj_context->main_src . '/' . $this->aobj_context->mobj_data["db"] . '/' . $this->pdf_logo_path;
                $this->pdf->Image($img_logo_path, 5, 2, 20);
            }
            $this->pdf->SetFont('Times', 'B', 15);
            $this->pdf->ln(5);
            $this->pdf->cell(0, 3, $this->FUNIVNAME . "", "0", 1, "C");
            $this->pdf->SetFont('Times', 'B', 8);
            $this->pdf->cell(0, 6, $this->s_state, "0", 1, "C");
        }
        $this->pdf->SetFont('Times', 'B', 12);
        $this->pdf->cell(0, 6, "College : $this->college_details ", "0", 1, "C");
        $this->pdf->SetFont('Times', 'B', 12);

        $this->pdf->Cell(0, 7, "Subject Details", "0", 1, "C");
        $this->pdf->Cell(0, 5, "Degree  : " .$this->degree. " - " .$this->descpn."   Semester :". $this->exam, "0", 0, "C");

    $pdf->ln(10);
    $table3 = '<style>
            td {
                border: 0.5px solid black;
            }
            .lable {
                font-size:9px;
            }
            .lablewithoblod {
                font-size:8px;
                font-weight:normal;
            }
        </style>
        <table cellpadding="3" cellspacing="0">
        <tr nobr="true">
                <td width="30" align="center" class="lable">Subcode</td>
                <td width="60" align="center" class="lable">Subname</td>
                <td width="30" align="center" class="lable">SubShort</td>
                <td width="40" align="center" class="lable">Subject Subname</td>
                <td width="30" align="center" class="lable">QP Code</td>
                <td width="40" align="center" class="lable">TH/PR</td>
                <td width="40" align="center" class="lable">LTP</td>
                <td width="40" align="center" class="lable">Credits</td>
                <td width="40" align="center" class="lable">Subsidary</td>
                <td width="40" align="center" class="lable">Sub. max Marks</td>  
                <td width="40" align="center" class="lable">Val. Marks</td>
                <td width="40" align="center" class="lable">Max. Marks</td>
                <td width="40" align="center" class="lable">Sub. min Marks</td>    
                <td width="40" align="center" class="lable">Min Marks</td>
                <td width="40" align="center" class="lable">Th Min Marks</td>                     
                <td width="40" align="center" class="lable">Pr Min Marks</td>
                <td width="40" align="center" class="lable">Grace</td>  
                <td width="40" align="center" class="lable">Carry Upto</td>    
                <td width="90" align="center" class="lable">Group</td>
                <td width="30" align="center" class="lable">Block No</td>
            </tr>';

    $previousValue = null;
    $rowspans = [];
    $rowCount = 0;

    foreach ($data as $key => $value) {
        if ($value['FTHEORY'] == "T") {
            $thpr = "Theory";
        } else if ($value['FTHEORY'] == "F") {
            $thpr = "Practical";
        }
        // var_dump($previousValue);die();
        
        if ($previousValue == $value["FSUBCODE"] ) {
            $rowspans[$value["FSUBCODE"]]++;
        } else if($previousValue !== $value["FSUBCODE"]) {
            $rowspans[$value["FSUBCODE"]] = 1;
        }
        $previousValue = $value["FSUBCODE"];

    }
//  var_dump($rowspans);die();

    $sameData=$data[0]['FSUBCODE'];
    $previousValue = null;
    foreach ($data as $key => $value) {
        if ($value['FTHEORY'] == "T") {
            $thpr = "Theory";
        } else if ($value['FTHEORY'] == "F") {
            $thpr = "Practical";
        }
        //  if ($rowCount == 15) {
        //     $table3 .= '</table>';
        //     $pdf->writeHTMLCell(188, 0, '', '', $table3, false, 1, false, true, '', false);
        //     $pdf->AddPage('L');
        //     // $pdf->ln(40);
        //     $table3 = '<style>
        //         td {
        //             border: 0.5px solid black;
        //         }
        //         .lable {
        //             font-weight: bold;
        //             font-size:8px;
        //         }
        //         .lablewithoblod {
        //             font-size:7px;
        //         }
        //     </style>
        //     <table cellpadding="3" cellspacing="0">
        //     <tr nobr="true">
        //             <td width="30" align="center" class="lable">Subcode</td>
        //             <td width="60" align="center" class="lable">Subname</td>
        //             <td width="30" align="center" class="lable">SubShort</td>
        //             <td width="40" align="center" class="lable">Subject Subname</td>
        //             <td width="30" align="center" class="lable">QP Code</td>
        //             <td width="40" align="center" class="lable">TH/PR</td>
        //             <td width="40" align="center" class="lable">LTP</td>
        //             <td width="40" align="center" class="lable">Credits</td>
        //             <td width="40" align="center" class="lable">Subsidary</td>
        //             <td width="40" align="center" class="lable">Sub. max Marks</td>  
        //             <td width="40" align="center" class="lable">Val. Marks</td>
        //             <td width="40" align="center" class="lable">Max. Marks</td>
        //             <td width="40" align="center" class="lable">Sub. min Marks</td>    
        //             <td width="40" align="center" class="lable">Min Marks</td>
        //             <td width="40" align="center" class="lable">Th Min Marks</td>                     
        //             <td width="40" align="center" class="lable">Pr Min Marks</td>
        //             <td width="40" align="center" class="lable">Grace</td>  
        //             <td width="40" align="center" class="lable">Carry Upto</td>    
        //             <td width="90" align="center" class="lable">Group</td>
        //             <td width="30" align="center" class="lable">Block No</td>
        //         </tr>';
            // $sameData = $value["FSUBCODE"];
        //     $rowCount = 0;
        // }
      

        $table3 .= '<tr>';
        
        if ($previousValue != $value["FSUBCODE"]) {

      
            $table3 .= '<td rowspan="' . $rowspans[$value["FSUBCODE"]] . '" class="lablewithoblod">' . $value["FSUBCODE"] . '</td>';
            $table3 .= '<td rowspan="' . $rowspans[$value["FSUBCODE"]] . '" class="lablewithoblod">' . $value["FSUBNAME"] . '</td>';
            $table3 .= '<td rowspan="' . $rowspans[$value["FSUBCODE"]] . '" class="lablewithoblod">' . $value["FSUBSHORT"] . '</td>';
           
        }
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FSSUBNAME"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FQPCODE"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $thpr  . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FLTP"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FCREDITS"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FSUBSIDARY"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FSMAXMARKS"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FVALMAX"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FMAXMARKS"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FMINMARKS"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FSMINMARKS"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FTHEORYMIN"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FPRACTMIN"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FGRACE"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["fcarryupto"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FGROUP"] . '</td>';
        $table3 .= '<td align="center" class="lablewithoblod">' . $value["FBLOCKNO"] . '</td>';
        $table3 .= '</tr>';
        $sameData = $value["FSUBCODE"];
        $previousValue = $value["FSUBCODE"];
        $rowCount++;

    }

    // if ($rowCount < 16) {
        $table3 .= '</table>';
        $pdf->writeHTMLCell(188, 0, '', '', $table3, false, 1, false, true, '', false);
    
    // }
}

    function SendOutput()
    {
        $this->pdf->Output("detail_Degree_Report.pdf", "I");
    }
}

function sujectDetailsReport($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

    $class_obj = new ra_invigilators_dairy();
    $class_obj->DefaultConstructor($aobj_context);
	$degree = $aobj_context->mobj_data['degreeid'];
    $examno = $aobj_context->mobj_data['examno'];
    $collcode = $_SESSION['collcode'];
                $query=" SELECT FSUBCODE, FSUBNAME, FSUBSHORT, FSSUBNAME, FQPCODE, FTHEORY, FLTP,FCREDITS,
                FSUBSIDARY,FSMAXMARKS,FVALMAX,FMAXMARKS,FMINMARKS,FSMINMARKS,FTHEORYMIN,FPRACTMIN,
                FGRACE,fcarryupto,FGROUP,FBLOCKNO FROM subject s                
 WHERE s.fdegree='{$degree}' AND s.fexamno='{$examno}'";

    $res1 = $aobj_context->mobj_db->GetAll($query);
	$class_obj->writepdf($res1);
  
   
    $class_obj->SendOutput();
}
?>