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.15.3.17


Current Path : /proc/thread-self/root/var/www/oasis/Report_details/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/Report_details/subwiseGrafAnalysis1.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->degree=trim($this->aobj_context->mobj_data["degree"]);
            $this->degexam=trim($this->aobj_context->mobj_data["degexam"]);
            $this->yearmode=trim($this->aobj_context->mobj_data["yearmode"]);
            $this->section=trim($this->aobj_context->mobj_data["section"]);

            $this->collcode=$_SESSION['collcode'];
            $this->funivcode=$_SESSION['FUNIVCODE'];
            $this->ip=$_SERVER["REMOTE_ADDR"];
            
            $yearmode = explode("*",$this->yearmode);
		    $this->year = $yearmode[0];
		    $this->examtye = $yearmode[1];
       
                
            $get_date= "select NOW()  as now_date,
            CONCAT('[',fcollcode,'] ', fcollname,', ',FTOWN) as college_name,
            dg.fexamdate as fresexamdate, d.fdescpn, d.fexamname from college c, degree d, degexam dg 
            where fcollcode = '{$this->collcode}' and d.fdegree = '{$this->degree}'
            and d.fdegree = dg.fdegree and d.fexamno = dg.fexamno 
            and d.fexamno = '{$this->degexam}'
            and dg.fyear = '{$this->year}'
            and dg.fexamtype = '{$this->examtye}'";
           
        
            $obj=$aobj_context->mobj_db->GetRow($get_date);
           
            $this->current_date = $obj['now_date'];
            $this->college_name = $obj['college_name'];
            $this->fresexamdate = $obj['fresexamdate'];
            $this->fdescpn      = $obj['fdescpn'];
            $this->fexamname    = $obj['fexamname'];
            $this->first    = true;
           
            $this->headeractive = true;
            $this->startPageGroup();
	    }
 
        function Header(){
            $deg = "select distinct fdescpn from degree where fdegree='{$this->degree}'";
            $resDeg =  $this->aobj_context->mobj_db->GetRow($deg);

            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,10,10,35);
                    
                }
		        $this->SetY(8);

                $this->pdf->SetFont('Times','B',8);
                $this->Cell(0, 6,'Page ' .$this->PageNo().'', 0, 1, 'R');
		        $this->SetY(0);

                $this->pdf->SetFont('Times','B',15);
                $this->pdf->ln(5);
                if($this->funivcode=="052"){
                    $this->pdf->SetFont('Times','B',8);
                    $this->pdf->cell(0,7,""."JSS MAHAVIDYAPEETHA","0",1,"C");
                }
                $this->pdf->SetFont('Times','B',10);
                $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->cell(0,7,"SUBJECTWISE RESULT ANALYSIS(GRADEWISE) - ".$this->fresexamdate." EXAMINATION", "0",1,"C");
            $this->pdf->SetFont('Times','B',10);
            $this->pdf->cell(0,7,$this->fexamname." - ". ($resDeg['fdescpn']),"0",1,"C");
            $this->pdf->SetFont('Times','B',12);
            $this->pdf->Cell(0,5,$this->date.$this->classid,"0",0,"L");       
        }	
	
        function Footer(){
            $sign = $this->aobj_context->main_src.$this->aobj_context->mobj_data["db"]."/img/controler_sign.jpg";
            $this->SetY(-30);
            $y = 5;
            $x = 200;
            $size = 40;
            $img_x=($this->pdf->getX()+$x);;
            $img_y=$this->pdf->getY()+$y;
            $this->pdf->SetFont('Times','B',10);
            if($this->funivcode=="052"){
                if(file_exists($sign)) 
                $this->pdf->Image($sign,$img_x,$img_y,$size);
            }
            $this->pdf->Cell(0,40,"Controller of Examinations","",0,"R");
            $this->SetY(-14);
            $this->pdf->SetFont('Times','B',8);
            $this->Cell(140,6,'Printed   : IP Address : '.$this->ip." Date ".$this->current_date,'0',0,'L');
        }
	
        function formcolldata(){
            $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->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->funivcode=$lobj_get_coll_name['FUNIVCODE'];
            $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); 
            
            $this->college_details = $obj_student['FCOLLNAME'];
            $this->degree_details  = " College : {$this->FCOLLNAME}";

            		
        }
	 
        function writepdf($data){
            $split = explode("*", $this->yearmode);
            $year = $split[0];
            $examtype = $split[1];
            if($this->section === "All"){
                $secCond = "";
            }else{
                 $secCond = "and ifnull(fsection, '') = '{$this->section}'";
            }

            $qrySection = "select distinct fsection from student where ifnull(fsection, '') <> '' {$secCond} order by fsection";
		    $resSection =  $this->aobj_context->mobj_db->GetAll($qrySection);
         
            $deg = "select distinct fdescpn from degree where fdegree='{$this->degree}'";
            $resDeg =  $this->aobj_context->mobj_db->GetRow($deg);
         
            foreach($resSection as $value){

                $query = "select count(*)as count, r.fdegree,
                        (select distinct fsubshort from subject where fsubcode = r.fsubcode 
                        and fdegree='{$this->degree}' and fexamno='{$this->degexam}')as fsubcode,
                        sum(case when ifnull(fgrade, '') = 'NE' then 1 else 0 end)as fne,
                        sum(case when ifnull(fgrade, '') = 'F' then 1 else 0 end)as ff,
                        sum(case when ifnull(fgrade, '') = 'AB' then 1 else 0 end)as fab,
                        sum(case when ifnull(fgrade, '') = 'MP' or 
                        ifnull(fgrade, '') = 'I' or  
                        ifnull(fgrade, '') = 'TL' or 
                        ifnull(fgrade, '') = 'DR' or 
                        ifnull(fgrade, '') = 'W'
                        then 1 else 0 end)as fmp,
                        sum(case when ifnull(fgrade, '') = 'S' then 1 else 0 end)as fs,
                        sum(case when ifnull(fgrade, '') = 'A' then 1 else 0 end)as fa,
                        sum(case when ifnull(fgrade, '') = 'B' then 1 else 0 end)as fb,
                        sum(case when ifnull(fgrade, '') = 'C' then 1 else 0 end)as fc,
                        sum(case when ifnull(fgrade, '') = 'D' then 1 else 0 end)as fd,
                        sum(case when ifnull(fgrade, '') = 'E' then 1 else 0 end)as fe,
                        sum(case when ifnull(fgrade, '') = 'pass' then 1 else 0 end)as fpass,
                        sum(case when ifnull(fgrade, '') = 'fail' then 1 else 0 end)as ffail
                        from resmarks r inner join student s on s.fdegree = r.fdegree and 
                        s.fregno = r.fregno 
                        where r.fdegree='{$this->degree}' and s.fsection='{$value['fsection']}' 
                        and r.fexamno='{$this->degexam}'
                        and r.fsubcode = 'A021'
                        and r.fyear='{$year}' and r.fexamtype='{$examtype}' 
                        group by r.fsubcode, r.fdegree order by fsubcode";
                        $res =  $this->aobj_context->mobj_db->GetAll($query);
                    
                    $s = 0;
                    $a = 0;
                    $b = 0;
                    $c = 0;
                    $d = 0;
                    $e = 0;
                    $ne = 0;
                    $f = 0;
                    $ab = 0;
                    $pp = 0;
                    $np = 0;
                    $ot = 0;
                    
                        
            if(count($res) > 0)
            {
                $pdf=$this->pdf;
                //write labels
                $pdf->SetTextColor(255,255,255);
                $pdf->Text(105, 65, 'BLUE');
                $pdf->Text(60, 95, 'GREEN');
                $pdf->Text(120, 115, 'RED');

                    foreach($res as $val){
                        $pdf=$this->pdf;

                        $pdf->SetMargins(25,40,30,15);
                        $pdf->startPageGroup();
                        $pdf->SetFont('Times','B',10);
                        
                        $pdf->AddPage("L");

                        $html = '<!DOCTYPE html>
                        <html>
                        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
                        <body>
                        
                        <canvas id="myChart" style="width:100%;max-width:600px"></canvas>
                        
                        <script>
                        const xValues = ["Italy", "France", "Spain", "USA", "Argentina"];
                        const yValues = [55, 49, 44, 24, 15];
                        const barColors = [
                          "#b91d47",
                          "#00aba9",
                          "#2b5797",
                          "#e8c3b9",
                          "#1e7145"
                        ];
                        
                        new Chart("myChart", {
                          type: "pie",
                          data: {
                            labels: xValues,
                            datasets: [{
                              backgroundColor: barColors,
                              data: yValues
                            }]
                          },
                          options: {
                            title: {
                              display: true,
                              text: "World Wide Wine Production 2018"
                            }
                          }
                        });
                        </script>
                        
                        </body>
                        </html>
                        ';

$this->pdf->writeHTML($html, true, false, true, false, '');



                        $this->SetY(40);
                        $c = 1;
                        $xc = 140;
                        $yc = 100;
                        $r = 50;

                        $s = (round($val['fs'] / $val['count'] * 360,2));
                        $a = (round($val['fa'] / $val['count'] * 360,2));
                        $b = (round($val['fb'] / $val['count'] * 360,2));
                        $c = (round($val['fc'] / $val['count'] * 360,2));
                        $d = (round($val['fd'] / $val['count'] * 360,2));
                        $e = (round($val['fe'] / $val['count'] * 360,2));
                        $ne = (round($val['fne'] / $val['count'] * 360,2));
                        $f = (round($val['ff'] / $val['count'] * 360,2));
                        $ab = (round($val['fab'] / $val['count'] * 360,2));
                        $pp = (round($val['fpass'] / $val['count'] * 360,2));
                        $np = (round($val['ffail'] / $val['count'] * 360,2));
                        $ot = (round($val['fmp'] / $val['count'] * 360,2));
                        $x = $this->pdf->getX();
                        $y = $this->pdf->getY();
                        $this->pdf->SetFillColor(147, 177, 189);
                        $this->pdf->PieSector($xc, $yc, $r, 0, $s);
                    
                        $this->pdf->SetFillColor(101, 178, 137);
                        $this->pdf->PieSector($xc, $yc, $r, $s, $s+$a);

                       

                        $this->pdf->SetFillColor(255, 97, 71);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a, $s+$a+$b );

                        $this->pdf->SetFillColor(128, 219, 254);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b, $s+$a+$b+$c);

                        $this->pdf->SetFillColor(255, 191, 0);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c, $s+$a+$b+$c+$d);

                        $this->pdf->SetFillColor(255, 112, 180);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d, $s+$a+$b+$c+$d+$e);
                        
                        $this->pdf->SetFillColor(255, 81, 10);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d+$e, $s+$a+$b+$c+$d+$e+$ne);

                        $this->pdf->SetFillColor(148, 216, 56);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d+$e+$ne, $s+$a+$b+$c+$d+$e+$ne+$f);

                        $this->pdf->SetFillColor(253, 126, 6);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d+$e+$ne+$f, $s+$a+$b+$c+$d+$e+$ne+$f+$ab);

                        $this->pdf->SetFillColor(198, 2, 0);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d+$e+$ne+$f+$ab, $s+$a+$b+$c+$d+$e+$ne+$f+$ab+$pp);

                        $this->pdf->SetFillColor(131, 123, 254);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d+$e+$ne+$f+$ab+$pp, $s+$a+$b+$c+$d+$e+$ne+$f+$ab+$pp+$np);

                        $this->pdf->SetFillColor(173, 129, 112);
                        $this->pdf->PieSector($xc, $yc, $r, $s+$a+$b+$c+$d+$e+$ne+$f+$ab+$pp+$np, $s+$a+$b+$c+$d+$e+$ne+$f+$ab+$pp+$np+$ot);

                        $this->pdf->SetTextColor(0,0,0);
                        $this->pdf->cell(0,115, "Section: ".$value['fsection'],"",1,"L");
                    

                        $this->pdf->SetTextColor(0,0,0);
                        $this->pdf->Text($xc, $s, 'S');
                        $this->pdf->setX($xc);
                        $this->pdf->Text($xc, $a, 'A');
                        $this->pdf->setX($xc);
                        $this->pdf->Text($xc, $b, 'B');

                        $this->pdf->cell(0,1, "","",1,"C");

                        $pdf->SetFont('Times','B',10);
 
                        $this->pdf->cell(25,6, "Subject","LRT",0,"C");
                        $this->pdf->cell(26,6, "No. of Students","LRT",0,"C");
                        $this->pdf->cell(105,6, "No. of Students with","LRTB",0,"C");
                        $this->pdf->cell(90,6, "No. of Students Awarded (Counts/Percentage)","LRTB",1,"C");

                        $this->pdf->cell(25,6, "Codes","LR",0,"C");
                        $this->pdf->cell(26,6, "Registered","LR",0,"C");
                        $this->pdf->SetTextColor(255, 81, 10);
                        $this->pdf->cell(15,6, "NE","LR",0,"C");
                        $this->pdf->SetTextColor(148, 216, 56);
                        $this->pdf->cell(15,6, "F","LR",0,"C");
                        $this->pdf->SetTextColor(253, 126, 6);
                        $this->pdf->cell(15,6, "AB","LR",0,"C");
                        $this->pdf->SetTextColor(131, 123, 254);
                        $this->pdf->cell(15,6, "PP","LR",0,"C");
                        $this->pdf->SetTextColor(198, 2, 0);
                        $this->pdf->cell(15,6, "NP","LR",0,"C");
                        $pdf->SetFont('Times','B',9);
                        $this->pdf->SetTextColor(117, 104, 8);
                        $this->pdf->cell(30,6, "OTHERS","LR",0,"C");
                        $pdf->SetFont('Times','B',10);

                        $this->pdf->SetTextColor(147, 177, 189);
                        $this->pdf->cell(15,6, "S","LR",0,"C");
                        $this->pdf->SetTextColor(101, 178, 137);
                        $this->pdf->cell(15,6, "A","LR",0,"C");
                        $this->pdf->SetTextColor(255, 97, 71);
                        $this->pdf->cell(15,6, "B","LR",0,"C");
                        $this->pdf->SetTextColor(128, 219, 254);
                        $this->pdf->cell(15,6, "C","LR",0,"C");
                        $this->pdf->SetTextColor(255, 191, 0);
                        $this->pdf->cell(15,6, "D","LR",0,"C");
                        $this->pdf->SetTextColor(255, 112, 180);
                        $this->pdf->cell(15,6, "E","LR",1,"C");

                        $this->pdf->cell(25,3, "","LRB",0,"C");
                        $this->pdf->cell(26,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $pdf->SetFont('Times','B',9);
                        $this->pdf->SetTextColor(173, 129, 112);
                        $this->pdf->cell(30,3, "(MP, I, TL, DR, W)","LRB",0,"C");
                        $pdf->SetFont('Times','B',10);

                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",0,"C");
                        $this->pdf->cell(15,3, "","LRB",1,"C");
                        $pdf->SetFont('Times','B',10);
                    
                        $this->pdf->SetTextColor(0, 0, 0);
                        $this->pdf->cell(25,5, $val['fsubcode'],"LR",0,"C");						
                        $this->pdf->cell(26,5, $val['count'],"LR",0,"C");
                        $this->pdf->SetTextColor(255, 81, 10);
                        $this->pdf->cell(15,5, $val['fne'],"LR",0,"C");
                        $this->pdf->SetTextColor(148, 216, 56);
                        $this->pdf->cell(15,5, $val['ff'],"LR",0,"C");
                        $this->pdf->SetTextColor(253, 126, 6);
                        $this->pdf->cell(15,5, $val['fab'],"LR",0,"C");
                        $this->pdf->SetTextColor(131, 123, 254);
                        $this->pdf->cell(15,5, $val['fpass'],"LR",0,"C");
                        $this->pdf->SetTextColor(198, 2, 0);
                        $this->pdf->cell(15,5, $val['ffail'],"LR",0,"C");
                        $this->pdf->SetTextColor(173, 129, 112);
                        $this->pdf->cell(30,5, $val['fmp'],"LR",0,"C");

                        $this->pdf->SetTextColor(147, 177, 189);
                        $this->pdf->cell(15,5, $val['fs'],"LR",0,"C");
                        $this->pdf->SetTextColor(101, 178, 137);
                        $this->pdf->cell(15,5, $val['fa'],"LR",0,"C");
                        $this->pdf->SetTextColor(255, 97, 71);
                        $this->pdf->cell(15,5, $val['fb'],"LR",0,"C");
                        $this->pdf->SetTextColor(128, 219, 254);
                        $this->pdf->cell(15,5, $val['fc'],"LR",0,"C");
                        $this->pdf->SetTextColor(255, 191, 0);
                        $this->pdf->cell(15,5, $val['fd'],"LR",0,"C");
                        $this->pdf->SetTextColor(255, 112, 180);
                        $this->pdf->cell(15,5, $val['fe'],"LR",1,"C");

                        $this->pdf->cell(25,5,"","LRB",0,"C");						
                        $this->pdf->cell(26,5,"" ,"LRB",0,"C");
                        $this->pdf->cell(15,5, "","LRB",0,"C");
                        $this->pdf->cell(15,5, "","LRB",0,"C");
                        $this->pdf->cell(15,5, "","LRB",0,"C");
                        $this->pdf->cell(15,5, "","LRB",0,"C");
                        $this->pdf->cell(15,5, "","LRB",0,"C");

                        $this->pdf->cell(30,5, "","LRB",0,"C");
                        $this->pdf->SetTextColor(147, 177, 189);
                        $this->pdf->cell(15,5, round($val['fs'] / $val['count'] * 100,2),"LRB",0,"C");
                        $this->pdf->SetTextColor(101, 178, 137);
                        $this->pdf->cell(15,5, round($val['fa'] / $val['count'] * 100,2),"LRB",0,"C");
                        $this->pdf->SetTextColor(255, 97, 71);
                        $this->pdf->cell(15,5, round($val['fb'] / $val['count'] * 100,2),"LRB",0,"C");
                        $this->pdf->SetTextColor(128, 219, 254);
                        $this->pdf->cell(15,5, round($val['fc'] / $val['count'] * 100,2),"LRB",0,"C");
                        $this->pdf->SetTextColor(255, 191, 0);
                        $this->pdf->cell(15,5, round($val['fd'] / $val['count'] * 100,2),"LRB",0,"C");
                        $this->pdf->SetTextColor(255, 112, 180);
                        $this->pdf->cell(15,5, round($val['fe'] / $val['count'] * 100,2),"LRB",1,"C");
                        
                    }
                }
            }
        }
        
        function SendOutput()
        {
            $this->pdf->Output("subwiseGrafAnalysis.pdf","I");
        }
    }

    function subwiseGrafAnalysis1($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $class_obj=new ra_invigilators_dairy();
        $class_obj->DefaultConstructor($aobj_context);
        $class_obj->formcolldata();
        $class_obj->writepdf();
        $class_obj->SendOutput();
    }
?>