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


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/theoryMarksEntry.php

<?php
function getExamdates($aobj_context){
 $query = "SELECT CONCAT (IFNULL(fexamdate,''),' [',IFNULL(fyear, '') , 
        ' - ', IFNULL(fexamtype, ''),']')AS exam FROM examdate";
 $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");
       }
}
function getNameDegree($aobj_context){
 
   session_start();
   $collcode = $_SESSION['collcode'];
   $regno = $aobj_context->mobj_data["reg"];  
   
   $query = "SELECT DISTINCT r.fregno,CONCAT(IFNULL(r.fexamno,''),' - ',IFNULL(d.fexamname,''))AS fexamno,
            CONCAT(IFNULL(r.fdegree,''),' - ',IFNULL(d.fdescpn,''))AS fdegree,s.fname
            FROM regcanddet r INNER JOIN student s ON r.fregno=s.fregno 
            INNER JOIN degree d ON  r.fexamno=d.fexamno AND s.fdegree= d.fdegree
            WHERE r.fregno='{$regno}' AND r.fcollcode='{$collcode}'	AND IFNULL(r.fregno,'')<>''" ;           

   $result = $aobj_context->mobj_db->GetRow($query);
           if($result){
             echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success");
           }
           else{
            $arr['msg']="Invalid Reg. No";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
           }
}  

function getSemForThMarks($aobj_context){
  $query = "SELECT DISTINCT CONCAT(IFNULL(fexamno,''),' - ',IFNULL(fexamname,''))AS fexamno FROM degree  
          GROUP BY fexamno ORDER BY fexamno";

  $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");
  }
}

function theorymarksEntries($aobj_context){
  $regno = $aobj_context->mobj_data["reg"];  
  $deg = $aobj_context->mobj_data["degree"];  
  $sem = $aobj_context->mobj_data["s_semister"];
  $exam = $aobj_context->mobj_data["examdate"];
 
  $split=explode('-',$deg);
  $degree=$split[0];

  $split=explode('[', $exam );
        $split2=explode('-',$split[1]);
        $year=trim($split2[0]);
        $split3=explode(']',$split2[1]);
        $examtype=trim($split3[0]);
  
        $semsplit=explode("-",$sem);
    $semester=trim($semsplit[0]);
     
$query =  "SELECT DISTINCT CONCAT(s.fsubname,' - ',s.fssubname)AS fsubname,s.fvalmax, 
           s.fcsubcode,r.fregno,r.fdegree,r.fexamno,IFNULL(c.fmarks,'') AS fmarks ,ifnull(c.fpassmth,'') as fpassmth
          FROM regcanddet r INNER JOIN subject s ON s.fdegree=r.fdegree AND s.fexamno=r.fexamno 
          AND LEFT(s.fcsubcode,4)=r.fsubcode
          LEFT JOIN cumarks c ON r.fregno = c.fregno 
          AND r.fsubcode = LEFT(c.fsubcode,4) AND c.fsubcode = s.fcsubcode
          WHERE r.fregno='{$regno}' AND r.fdegree='{$degree}' 
          AND r.fexamno='{$semester}'
          AND IFNULL(c.fyear,'{$year}')='{$year}' AND IFNULL(c.fexamtype,'{$examtype}')='{$examtype}' ";
    

  $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");
         }
}


function savetocurrentmarkstable($aobj_context){
  $exam = $aobj_context->mobj_data["examdate"];
  $theorymarks = json_decode($aobj_context->mobj_data["data"],true);

      session_start();
      $collcode = $_SESSION['collcode'];
      $user = $_SESSION['usr'];  
      $now = date("Y/m/d");

     foreach ($theorymarks as $data)
     {
      
       if(!empty($data['fmarks'])){
        $split=explode('[', $exam );
        $split2=explode('-',$split[1]);
        $year=trim($split2[0]);
        $split3=explode(']',$split2[1]);
        $examtype=trim($split3[0]);
        $query = "INSERT INTO cumarks (fregno,fdegree, fcollcode,fsubcode, fmarks,fyear,fexamtype,fcrdate,fcruser,fupddate,fupduser,fpassmth)
                values('{$data['fregno']}', '{$data['fdegree']}', '{$collcode}', '{$data['fcsubcode']}', 
                '{$data['fmarks']}','{$year}','{$examtype}', '{$now}','{$user}', '','','{$data['fpassmth']}') on duplicate key update fmarks='{$data['fmarks']}',
                fupddate='{$now}',fupduser='{$user}',fpassmth='{$data['fpassmth']}'";
        $result = $aobj_context->mobj_db->Execute($query);
       }
    } 
     if ($result){
            $data['data'] = $result;
            echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success"); 
      } else 
      {
          $data['data'] = "Failed to update";
          echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail");   
       }
 
}

?>