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


Current Path : /proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src/qnwiseMarksStats.php

<?php
    function getSubDetSubElements($aobj_context){
        $collcode = $_SESSION['collcode'];
        
        $query = "select distinct ifnull(fsubname, '')as fsubname 
                  from subdet where fcollcode='{$collcode}'";
        $res = $aobj_context->mobj_db->GetAll($query);
        if($res){
            echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
        }else{
            $arr['msg'] = 'No data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            return;
        }

    }

    function getSubDetMaxTest($aobj_context){
        $collcode = $_SESSION['collcode'];
        $subelement = $aobj_context->mobj_data['subElement'];
        
        $query = "select max(ifnull(fnotest, ''))as fnotest 
                  from subdet where fcollcode='{$collcode}'
                  and fsubname='{$subelement}'";
        $res = $aobj_context->mobj_db->GetRow($query);

        $query1 = "select distinct s.fexamno, d.fexamname from subdet s
                  inner join degree d on d.fdegree = s.fdegree
                  and d.fexamno = s.fexamno where 
                  fcollcode='{$collcode}'
                  and fsubname='{$subelement}' order by s.fexamno";
        $res1 = $aobj_context->mobj_db->GetAll($query1);
        
        if($res){
            $arr['notest'] = $res;
            $arr['sem'] = $res1;
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
        }else{
            $arr['msg'] = 'No data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            return;
        }

    }

    function getSubDetDegree($aobj_context){
        $collcode = $_SESSION['collcode'];
        $subelement = $aobj_context->mobj_data['subElement'];
        $test = $aobj_context->mobj_data['test'];
        $sem = $aobj_context->mobj_data['sem'];
        
        $query = "select distinct s.fdegree, d.fdescpn from subdet s 
                  inner join degree d on d.fdegree = s.fdegree and 
                  d.fexamno = s.fexamno where fcollcode='{$collcode}'
                  and fsubname='{$subelement}' and s.fexamno='{$sem}'";
        $res = $aobj_context->mobj_db->GetAll($query);
        if($res){
            echo $aobj_context->mobj_output->ToJSONEnvelope($res, 0, "success");
        }else{
            $arr['msg'] = 'No data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            return;
        }

    }

    function getMarksEntryStats($aobj_context){
        $collcode = $_SESSION['collcode'];
        $subelement = $aobj_context->mobj_data['subElement'];
        $test = $aobj_context->mobj_data['test'];
        $sem = $aobj_context->mobj_data['sem'];
        $degree = $aobj_context->mobj_data['degree'];

        if($degree === 'all'){
            $degCond = '';
            $attCond = '';
        }else{
            $degCond = "and m.fdegree='{$degree}'";
            $attCond = "and a.fdegree='{$degree}'";
        }
        
        $query = "select a.fdegree, d.fdescpn, count(a.fregno)as count, 
                  ifnull(mak.entered, '0')as entered from attendsum a left join 
                  (select m.fdegree,  m.fexamno, m.fsubcode, sum(case when ifnull(m.ftotal,'-1.0')='-1.0' then 0 else 1 end)as entered from marksint m 
                  inner join subdet s on concat(s.fcsubcode, s.fsubcode) = m.fsubcode 
                  and s.fdegree = m.fdegree and s.fexamno = m.fexamno 
                  where ftest='{$test}' and s.fsubname='{$subelement}' 
                  and m.fexamno='{$sem}' {$degCond} group  by m.fdegree) mak on mak.fdegree = a.fdegree and 
                  mak.fexamno = a.fexamno and left(mak.fsubcode, 4) = left(a.fsubcode, 4)
                  inner join degree d on d.fdegree = a.fdegree and 
                  a.fexamno = d.fexamno 
                  where a.fexamno='{$sem}' {$attCond} group  by a.fdegree";
                //var_dump($query);die();

        $res = $aobj_context->mobj_db->GetAll($query);
        echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
    }

    function viewSubjectWiseMarksStats($aobj_context){
        $collcode = $_SESSION['collcode'];
        $subelement = $aobj_context->mobj_data['subelement'];
        $test = $aobj_context->mobj_data['test'];
        $sem = $aobj_context->mobj_data['sem'];
        $degree = $aobj_context->mobj_data['degree'];

        if($subelement == "CIE-Activity 1" || $subelement == "CIE-Activity 2"){
            $cond = "and s.fintass='T'";
        }else{
            $cond = "";
        }
        
        $query = "select count(a.fregno)as count, a.fdegree, a.fsubcode, 
                  s.fsubname, s.fsubshort, ifnull(mak.entered, '0')as entered 
                  from attendsum a inner join subject s 
                  on s.fcsubcode = a.fsubcode and a.fdegree = s.fdegree 
                  and s.fexamno = a.fexamno 
                  inner join subdet x on x.fdegree = s.fdegree and x.fexamno = s.fexamno
                  and left(x.fcsubcode,4) = left(s.fcsubcode,4)
                  and x.fsubname = '{$subelement}'
                  left join 
                  (select distinct left(m.fsubcode, 4)as fsubcode, m.fexamno, m.fsubcode as fcsubcode, 
                  m.fdegree, m.fregno,
                  sum(case when ifnull(m.ftotal, 	'-1.0')='-1.0' then 0 else 1 end)as entered from marksint m 
                  inner join subdet sd on sd.fdegree = m.fdegree and sd.fexamno = m.fexamno 
                  and concat(sd.fcsubcode, sd.fsubcode) = m.fsubcode and sd.fcollcode = m.fcollcode
                  where m.ftest='{$test}' and m.fdegree='{$degree}' and sd.fsubname='{$subelement}' and m.fexamno='{$sem}'
                  group by left(m.fsubcode, 4)) mak on mak.fsubcode = left(a.fsubcode, 4) 
                  and mak.fregno= a.fregno and mak.fexamno = a.fexamno and mak.fdegree = a.fdegree
                  where a.fdegree='{$degree}' and a.fexamno='{$sem}' 
                  {$cond}
                  group by s.fsubcode";
                // var_dump($query);die();
        $res = $aobj_context->mobj_db->GetAll($query);
        echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
    }
?>