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


Current Path : /var/www/html/admission/src/
Upload File :
Current File : /var/www/html/admission/src/dateupdate.php

<?php
function getdatedeg($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $collcode = $aobj_context->mobj_data['collcode'];

    // var_dump($collcode);
    // die();

    $query = "SELECT DISTINCT FDEGREE, FDEscpn FROM degree";
   
    $result = $aobj_context->pobj_db->GetAll($query);
    // var_dump($result);
    // die();
    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not Found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    } 
}                

function getdatesem($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $collcode = $aobj_context->mobj_data['collcode'];
    $degree = $aobj_context->mobj_data['degree'];

    $query = "SELECT DISTINCT fexamno,fexamname FROM degree  WHERE fdegree='{$degree}'";
   
    $result = $aobj_context->pobj_db->GetAll($query);

    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not Found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    } 
}

function getdatesub($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $collcode = $aobj_context->mobj_data['collcode'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];

    // var_dump($degree,$sem);
    // die();

    $query = " SELECT DISTINCT s.fsubcode,s.fsubname,s.fcsubcode  FROM `subject` s INNER JOIN subdet sd ON s.fdegree = sd.fdegree AND 
    s.fexamno = sd.fexamno AND s.fcsubcode = sd.fcsubcode		
        WHERE s.fdegree='{$degree}' AND s.fexamno='{$sem}'";
    
    $result = $aobj_context->pobj_db->GetAll($query);

// var_dump($query);
// die();
   
    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not Found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    } 
}

function getdatelement($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $collcode = $aobj_context->mobj_data['collcode'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];
    $sub = $aobj_context->mobj_data['sub'];
 
    if($sub=="All")
    {
        $cond="fcsubcode  BETWEEN '0' AND 'Z'";
    }
    else{
        $cond=" fcsubcode = '{$sub}'";
    }
   
    $query = "SELECT fsubname FROM subdet WHERE $cond AND fexamno='{$sem}' AND fdegree='{$degree}'  GROUP BY fsubname;";
    
    $result = $aobj_context->pobj_db->GetAll($query);

    // var_dump($query);
    // die();
    
    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not Found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    } 
}

function viewdatesentry($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $collcode = $aobj_context->mobj_data['collcode'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];
    $sub = $aobj_context->mobj_data['sub'];
    $Element = $aobj_context->mobj_data['Element'];
    $test = $aobj_context->mobj_data['test'];

    if($sub=="All"){
        $cond="";
    } else{
        $cond="and sd.fcsubcode = '{$sub}'";
    }
    
    if($Element=="All"){
        $cond1="";
    } else{
        $cond1="and sd.fsubname='{$Element}'";
    }

    if($univcode === "055"){
        if($test == "Test 1"){
            $testColCond = "'Test 1' as subdetname, DATE_FORMAT(sd.fia1from, '%d/%m/%Y') AS fiafrom, DATE_FORMAT(sd.fia1to, '%d/%m/%Y') AS fiato";
        }else if($test == "Test 2"){
            $testColCond = "'Test 2' as subdetname, DATE_FORMAT(sd.fia2from, '%d/%m/%Y') AS fiafrom, DATE_FORMAT(sd.fia2to, '%d/%m/%Y') AS fiato";
        }else if($test == "Test 3"){
            $testColCond = "'Test 3' as subdetname, DATE_FORMAT(sd.fia3from, '%d/%m/%Y') AS fiafrom, DATE_FORMAT(sd.fia3to, '%d/%m/%Y') AS fiato";
        }else if($test == "Test 4"){
            $testColCond = "'Test 4' as subdetname, DATE_FORMAT(sd.fia4from, '%d/%m/%Y') AS fiafrom, DATE_FORMAT(sd.fia4to, '%d/%m/%Y') AS fiato";
        }
    }else{
        $testColCond = "DATE_FORMAT(sd.fiafrom, '%d/%m/%Y') AS fiafrom, DATE_FORMAT(sd.fiato, '%d/%m/%Y') AS fiato";
    }
    

    $query = "SELECT DISTINCT sd.fsubname as factivity, sd.fsubname AS subdetname,s.fsubcode ,s.fsubname AS subjectname,
              sd.fcsubcode, {$testColCond} 
              FROM subdet sd INNER JOIN `subject` s ON sd.fdegree = s.fdegree AND sd.fexamno = s.fexamno 
              AND  s.fcsubcode=sd.fcsubcode 
              WHERE sd.fdegree='{$degree}' and sd.fexamno='{$sem}' 
              {$cond} {$cond1}";
 
//  var_dump($query);die();
    $result = $aobj_context->pobj_db->GetAll($query);

    
    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
        return;
    }else{
        $arr['msg'] = "Data not Found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failure");
        return;
    }
}

function updatefromandto($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    // $collcode = $aobj_context->mobj_data['collcode'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];
    $sub = $aobj_context->mobj_data['sub'];
    $Element= $aobj_context->mobj_data['Element'];
    $datefrom = $aobj_context->mobj_data['datefrom'];
    $todate = $aobj_context->mobj_data['todate'];
    $test = $aobj_context->mobj_data['test'];

    if($sub=="All"){
        $cond="";
    } else {
        $cond="and fcsubcode = '{$sub}'";
    }

    if($Element=="All"){
        $cond1="";
    } else{
        $cond1="and fsubname='{$Element}'";
    }

    if($univcode === "055"){
        if($test == "All"){
            $testColCond = "fia1from ='{$datefrom}', fia1to ='{$todate}', 
                            fia2from ='{$datefrom}', fia2to ='{$todate}', 
                            fia3from ='{$datefrom}', fia3to ='{$todate}', 
                            fia4from ='{$datefrom}', fia4to ='{$todate}'";
        }else if($test == "Test 1"){
            $testColCond = "fia1from ='{$datefrom}', fia1to ='{$todate}'";
        }else if($test == "Test 2"){
            $testColCond = "fia2from ='{$datefrom}', fia2to ='{$todate}'";
        }else if($test == "Test 3"){
            $testColCond = "fia3from ='{$datefrom}', fia3to ='{$todate}'";
        }else if($test == "Test 4"){
            $testColCond = "fia4from ='{$datefrom}', fia4to ='{$todate}'";
        }
    }else{
        $testColCond = "fiafrom ='{$datefrom}', fiato ='{$todate}'";
    }

    $query = "update subdet set {$testColCond}
    WHERE fdegree='{$degree}' and fexamno='{$sem}' {$cond} {$cond1}"; 
    $result = $aobj_context->pobj_db->Execute($query);

    if($result){
        $arr['msg'] = "Date Updated Successfully";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr,0,"success");
        return;
    }else{
        $arr1['msg'] = "Data not Found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr1,-1,"failure");
        return;
    } 
}


function getMaxTest($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data['univcode'];
    $degree = $aobj_context->mobj_data['degree'];
    $sem = $aobj_context->mobj_data['sem'];
    $sub = $aobj_context->mobj_data['sub'];
    $Element= $aobj_context->mobj_data['element'];

    if($sub === "All"){
        $subCond='';
    }else{
        $subCond = "and fcsubcode='{$sub}'";
    }

    if($Element === "All"){
         $eleCond = '';
    }else{
        $eleCond = "and fsubname='{$Element}'";
    }

    $query = "select max(fnotest) as fnotest from subdet where fdegree='{$degree}' 
              and fexamno='{$sem}' {$subCond} {$eleCond}";

    $result = $aobj_context->pobj_db->GetRow($query);

    if($result){
        echo $aobj_context->mobj_output->TOJSONEnvelope($result, 0, "success");
        return;
    }else{
        $arr1['msg'] = "data not found";
        echo $aobj_context->mobj_output->TOJSONEnvelope($arr1, -1, "failure");
        return;
    } 
}

?>