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


Current Path : /proc/thread-self/root/var/www/html/admission/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/src/subjectEntryScrn.php

<?php

function getSubExamNo($aobj_context){

	// $univcode = $aobj_context->mobj_data["univcode"];
  $degree = $aobj_context->mobj_data["deggrp"];
  $degree = $aobj_context->mobj_data["degree"];

  $query = "SELECT distinct * FROM tdegree 
  WHERE fdegree = '{$degree}'";
  $result = $aobj_context->pobj_db->GetAll($query);
  // var_dump($query);
  // var_dump($result);
  if(count($result) > 0)
  {
    echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
    return;
  }
  else
	{
    echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
    return;
  }
}


function getSubDet($aobj_context){

	// $univcode = $aobj_context->mobj_data["univcode"];
  $degree = $aobj_context->mobj_data["fdegree"];
  $fexamno = $aobj_context->mobj_data["fexamno"];

$query = "SELECT distinct fsubcode, fsubname FROM subject 
WHERE fdegree = '{$degree}' and fexamno = '{$fexamno}'";
  $result = $aobj_context->pobj_db->GetAll($query);
  // var_dump($query);
  // var_dump($result);
  if(count($result) > 0)
  {
    echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
    return;
  }
  else
	{
    echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
    return;
  }
}


function getSubjectData($aobj_context){

	// $univcode = $aobj_context->mobj_data["univcode"];
  $degree = $aobj_context->mobj_data["fdegree"];
  $fexamno = $aobj_context->mobj_data["fexamno"];
  $fsubcode = $aobj_context->mobj_data["fsubcode"];

  $query = "SELECT  fdegree, fexamno, fsubcode, fsubshort, fsubname, fmaxmarks, fminmarks, ftheorymin,
  fpractmin, fcredits, fthcr, fprcr, fblockno, fcarryupto, fdeptcode, fmandatory, fsuspend,
  fltp, fsubsidary, fmarkdesc1, fmarkdesc2, fboard,fprintord,fexsubcode, fthhrs, fprhrs, fthelig,fprelig
  FROM subject 
  WHERE fdegree = '{$degree}' 
  
  and fsubcode = '{$fsubcode}'";
  $result = $aobj_context->pobj_db->GetRow($query);

  $arr['mainlvl'] = $result;

  $query = "SELECT  fssubcode, fssubname, fshortname, ftheory, fintass, fretain, fgroup, fsmaxmarks, fsminmarks, fparentsub, fmodmarks,
  fgrace, fcodeno, fqpcode, fvalmax  FROM subject WHERE fdegree = '{$degree}' 
  and fsubcode = '{$fsubcode}'";
  $result = $aobj_context->pobj_db->GetAll($query);

  $arr['sublvl'] = $result;
  // var_dump($query);
  // var_dump($result);
  if(count($result) > 0)
  {
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
    return;
  }
  else
	{
    echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
    return;
  }
}

function saveSubDet($aobj_context){

	// $univcode = $aobj_context->mobj_data["univcode"];
  $mainlvl = $aobj_context->mobj_data["mainlvl"];
  $sublvl = $aobj_context->mobj_data["sublvl"];
  $req = $aobj_context->req_body;
  $data = $req['data'];
  $mainlvl = $data['mainlvl'];
  $sublvl = $data['sublvl'];


  $query = "select * from subject 
  where fsubshort = '{$mainlvl['fsubshort']}'";
  $res = $aobj_context->pobj_db->getRow($query);

  if($res)
  {
    $fdegree = $res['FDEGREE'];
    $fsubcode = $res['FSUBCODE'];
    
    if($fdegree == $mainlvl['fdegree'] && $fsubcode == $mainlvl['fsubcode'])
    {

    }else
    {
      $arr['msg'] = 'Same Short Name Not not Allowed.';
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
      return;
    }


  }


  foreach($sublvl as $value)
  {
    $fcsubcode = $mainlvl['fsubcode'].$value['fssubcode'];

    if($value['fdeleted'] == 'T')
    {

      $query = "delete from subject where 
    fdegree = '{$mainlvl['fdegree']}' 
    and fexamno = '{$mainlvl['fexamno']}'
    and fsubcode = '{$mainlvl['fsubcode']}'
    and fcsubcode = '{$fcsubcode}'";  
    $result = $aobj_context->pobj_db->Execute($query);

    }else
    {
        $query = "INSERT INTO subject (FDEGREE, FEXAMNO, FSUBCODE, FSUBNAME, FSUBSHORT, FSSUBCODE, FSSUBNAME, FSMAXMARKS, FSHORTNAME, FQPCODE, 
        FTHEORY, FINTASS, FRETAIN, FMANDATORY, FSUSPEND, FCSUBCODE, FPARENTSUB, FLTP, FSUBSIDARY, FVALMAX, 
        fmarkdesc1, fmarkdesc2, FMAXMARKS, FMINMARKS, FGROUP, FBLOCKNO, FTHEORYMIN, 
        FPRACTMIN, FMODMARKS, FGRACE, 
        fcarryupto, FCREDITS, FTHCR, FPRCR, FDEPTCODE, fboard,fprintord,fexsubcode,fthhrs,fprhrs,fthelig,fprelig,fsminmarks)
      VALUES ('{$mainlvl['fdegree']}','{$mainlvl['fexamno']}','{$mainlvl['fsubcode']}','{$mainlvl['fsubname']}','{$mainlvl['fsubshort']}'
      ,'{$value['fssubcode']}','{$value['fssubname']}','{$value['fsmaxmarks']}','{$value['fshortname']}','{$value['fqpcode']}'
      ,'{$value['ftheory']}','{$value['fintass']}','{$value['fretain']}','{$mainlvl['fmandatory']}','{$mainlvl['fsuspend']}'
      ,'{$fcsubcode}','{$value['fparentsub']}','{$mainlvl['fltp']}','{$mainlvl['fsubsidary']}','{$value['fvalmax']}'
      ,'{$mainlvl['fmarkdesc1']}','{$mainlvl['fmarkdesc2']}','{$mainlvl['fmaxmarks']}','{$mainlvl['fminmarks']}','{$value['fgroup']}'
      ,'{$mainlvl['fblockno']}','{$mainlvl['ftheorymin']}','{$mainlvl['fpractmin']}','{$value['fmodmarks']}','{$value['fgrace']}'
      ,'{$mainlvl['fcarryupto']}','{$mainlvl['fcredits']}','{$mainlvl['fthcr']}','{$mainlvl['fprcr']}','{$mainlvl['fdeptcode']}','{$mainlvl['fboard']}'
      ,'{$mainlvl['fprintord']}','{$mainlvl['fexsubcode']}','{$mainlvl['fthhrs']}','{$mainlvl['fprhrs']}','{$mainlvl['fthelig']}','{$mainlvl['fprelig']}',
      '{$value['fsminmarks']}')
      ON DUPLICATE KEY UPDATE 
      FSUBNAME = '{$mainlvl['fsubname']}',
      FSUBSHORT = '{$mainlvl['fsubshort']}',
      FSSUBCODE = '{$value['fssubcode']}', 
      FSSUBNAME = '{$value['fssubname']}', 
      FSMAXMARKS = '{$value['fsmaxmarks']}', 
      FSHORTNAME = '{$value['fshortname']}', 
      FQPCODE = '{$value['fqpcode']}', 
      FTHEORY = '{$value['ftheory']}', 
      FINTASS = '{$value['fintass']}', 
      FRETAIN = '{$value['fretain']}', 
      FMANDATORY = '{$mainlvl['fmandatory']}', 
      FSUSPEND = '{$mainlvl['fsuspend']}', 
      FPARENTSUB = '{$value['fparentsub']}',
      FLTP = '{$mainlvl['fltp']}',
      FSUBSIDARY = '{$mainlvl['fsubsidary']}', 
      FVALMAX = '{$value['fvalmax']}', 
      fmarkdesc1 = '{$mainlvl['fmarkdesc1']}', 
      fmarkdesc2 = '{$mainlvl['fmarkdesc2']}', 
      FMAXMARKS = '{$mainlvl['fmaxmarks']}', 
      FMINMARKS = '{$mainlvl['fminmarks']}', 
      FGROUP = '{$value['fgroup']}', 
      FBLOCKNO = '{$mainlvl['fblockno']}', 
      FTHEORYMIN = '{$mainlvl['ftheorymin']}', 
      FPRACTMIN = '{$mainlvl['fpractmin']}', 
      FMODMARKS = '{$value['fmodmarks']}', 
      FGRACE = '{$value['fgrace']}', 
      fcarryupto = '{$mainlvl['fcarryupto']}', 
      FCREDITS = '{$mainlvl['fcredits']}', 
      FTHCR = '{$mainlvl['fthcr']}', 
      FPRCR = '{$mainlvl['fprcr']}', 
      FDEPTCODE = '{$mainlvl['fdeptcode']}', 
      fboard = '{$mainlvl['fboard']}',
      fprintord = '{$mainlvl['fprintord']}',
      fexsubcode = '{$mainlvl['fexsubcode']}',
      fthhrs = '{$mainlvl['fthhrs']}',
      fprhrs = '{$mainlvl['fprhrs']}',
      fthelig = '{$mainlvl['fthelig']}',
      fprelig = '{$mainlvl['fprelig']}',
      fsminmarks = '{$value['fsminmarks']}'
      ";

      $result = $aobj_context->pobj_db->Execute($query);
    }
  //var_dump($query);
   
  }
  
  
  if ($result) {
    $arr['msg'] = 'Successfully Updated';
    echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success");
    return;
  } else {
      $arr['msg'] = 'Insertion / Updation Failed';
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
      return;
  }

  
}


function deleteSub($aobj_context){

	// $univcode = $aobj_context->mobj_data["univcode"];
  $degree = $aobj_context->mobj_data["fdegree"];
  $fexamno = $aobj_context->mobj_data["fexamno"];
  $fsubcode = $aobj_context->mobj_data["fsubcode"];

  $query = "delete from subject where 
  fdegree = '{$degree}' 
  and fexamno = '{$fexamno}'
  and fsubcode = '{$fsubcode}'";
  $result = $aobj_context->pobj_db->Execute($query);

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