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


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

<?php
  function getDegSemSubDetnew($aobj_context){
   
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = trim($aobj_context->mobj_data['collcode']);
	  $univcode = trim($aobj_context->mobj_data['univcode']);
	  $techcode = trim($aobj_context->mobj_data["teach"]);

	$classid = trim($aobj_context->mobj_data["cls"]);
	
	$query = "select s.fsubshort, a.fdegree,d.fdescpn,a.fexamno,d.fexamname,a.fsubcode,s.fsubname 
	from attendsum a inner join degree d on a.fdegree = d.fdegree 
	and a.fexamno = d.fexamno
	inner join subject s on a.fdegree = s.fdegree 
	and a.fexamno = s.fexamno and a.fsubcode = s.fcsubcode
	where a.fteachcode = '{$techcode}'
	and fclassid = '{$classid}'";
 

	$res = $aobj_context->mobj_db->GetRow($query);

	$fdegree = $res['fdegree'];
	$fdescpn = $res['fdescpn'];
	$fexamname = $res['fexamname'];
	$fexamno = $res['fexamno'];
	$fsubshort = $res['fsubshort'];
	$fsubcode = $res['fsubcode'];
	$fsubname = $res['fsubname'];


	$arry['fdegree'] = $fdegree;
	$arry['fdescpn'] = $fdescpn;
	$arry['fexamname'] = $fexamname;
	$arry['fexamno'] = $fexamno;
	$arry['fsubcode'] = $fsubcode;
	$arry['fsubname'] = $fsubname;


	if($univcode == '052')
	{
		$query = "select concat(s.fcsubcode,s.fsubcode) as `value`,
		s.FSUBNAME as subname,
		 concat(s.fcsubcode,s.fsubcode) as as `key`,
      CONCAT(ifnull(s.FSUBNAME,''),'-','[',ifnull('{$fsubshort}',''),']') as label
		from attendsum a inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno 
		inner join subdet s on a.fdegree = s.fdegree and a.fexamno = s.fexamno 
		and left(a.fsubcode,4) = left(s.fcsubcode,4) 
		where a.fteachcode = '{$techcode}' and fclassid = '{$classid}' 
		group by s.fsubcode";
	}else
	{
		$query = "select  distinct concat(s.fcsubcode,s.fsubcode) as `value`,
		s.FSUBNAME as subname,
		concat(s.fcsubcode,s.fsubcode) as  `key`,
      CONCAT(ifnull(s.FSUBNAME,''),'-','[',ifnull('{$fsubshort}',''),']') as label
		from attendsum a inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno 
		inner join subdet s on a.fdegree = s.fdegree and a.fexamno = s.fexamno 
		and left(a.fsubcode,4) = left(s.fcsubcode,4) 
		where a.fteachcode = '{$techcode}' and fclassid = '{$classid}' 
		group by s.fcsubcode,s.fsubcode";
	}


    $result = $aobj_context->mobj_db->GetAll($query);
	
	if($result)
	{
		$arry['subelement'] = $result;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arry,0,"success"); 
	}
	else
	{
		$data['msg'] = 'Failed to load students';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}
  }

  function getTestMaxQnnew($aobj_context){

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
      $collcode = trim($aobj_context->mobj_data["collcode"]);
    $univcode = trim($aobj_context->mobj_data["univcode"]);
    $techcode = trim($aobj_context->mobj_data["teach"]);
    $classid = trim($aobj_context->mobj_data["cls"]);
    $subelement = trim($aobj_context->mobj_data["subelement"]);
  
      $remarks = "select distinct ifnull(m.fremarks,'') as fremarks from marksint m inner join attendsum a 
            on a.fdegree=m.fdegree and a.fexamno=m.fexamno and 
            a.fregno = m.fregno and left(a.fsubcode, 4) = left(m.fsubcode, 4) 
            where a.fclassid='{$classid}' and m.fsubcode='{$subelement}' 
            and ifnull(m.fremarks, '') <> ''";
        
      $resRemarks = $aobj_context->mobj_db->GetRow($remarks);
    
  
  
    if($univcode == '052')
    {
      $subarry = explode("*",$subelement);
      $subelement = $subarry[0];
      
  
      $query = "select  s.fnotest as ftest, if(s.fqnno = '1',s.fu1max,(s.fu1max+s.fu2max)) as fvalmax, 
      s.fqnno as FNOQN from attendsum a 
      inner join degree d on a.fdegree = d.fdegree 
      and a.fexamno = d.fexamno
      inner join subdet s on a.fdegree = s.fdegree 
      and a.fexamno = s.fexamno 
      and left(a.fsubcode,4) = left(s.fcsubcode,4)
      where a.fteachcode = '{$techcode}' 
      and concat(s.fcsubcode,s.fsubcode) = '{$subelement}'
      and fclassid = '{$classid}' and left(s.fcsubcode,4) = left('{$subelement}',4)
      group by a.fdegree";
  
    }else
    {
      $subarry = explode("*",$subelement);
      $subelement = $subarry[0];
      
      // $query = "select  s.fnotest as ftest, if(s.fqnno = '1',s.fu1max,(s.fu1max+s.fu2max)) as fvalmax, 
      // s.fqnno as FNOQN from attendsum a 
      // inner join degree d on a.fdegree = d.fdegree 
      // and a.fexamno = d.fexamno
      // inner join subdet s on a.fdegree = s.fdegree 
      // and a.fexamno = s.fexamno 
      // and left(a.fsubcode,4) = left(s.fcsubcode,4)
      // where a.fteachcode = '{$techcode}' 
      // and concat(s.fcsubcode,s.fsubcode) = '{$subelement}'
      // and fclassid = '{$classid}' and left(s.fcsubcode,4) = left('{$subelement}',4)
      // group by a.fdegree";
      $query="SELECT IFNULL(s.fnotest,'') AS `key`,IFNULL(s.fnotest,'1') AS  `value`,IFNULL(s.fnotest,'') AS `label`,
      IF(s.fqnno = '1',s.fu1max,(s.fu1max+s.fu2max)) AS fvalmax, 
      s.fqnno AS FNOQN,a.fteachcode,CONCAT(s.fcsubcode,s.fsubcode)AS subcode,fclassid FROM attendsum a 
      INNER JOIN degree d ON a.fdegree = d.fdegree 
      AND a.fexamno = d.fexamno
      INNER JOIN subdet s ON a.fdegree = s.fdegree 
      AND a.fexamno = s.fexamno 
      AND LEFT(a.fsubcode,4) = LEFT(s.fcsubcode,4)
      WHERE a.fteachcode = '{$techcode}' 
      AND CONCAT(s.fcsubcode,s.fsubcode) = '{$subelement}'
      AND fclassid = '{$classid}' AND LEFT(s.fcsubcode,4) = LEFT('{$subelement}',4)
      GROUP BY a.fdegree";
      
    }
  

    $result = $aobj_context->mobj_db->GetRow($query);
  
    if($result){
      $arr['remarks']=$resRemarks;
      $arr['sub']=$result;
    
      echo($aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"));
        return $result;
    }else{
        $rdata = "No data found..!";
        echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
        return $result;	
    }
  }

  function viewCOMarks($aobj_context){
    $classid = $aobj_context->mobj_data["clscode"];
    $subcode = $aobj_context->mobj_data["subcode"];
    $testname = $aobj_context->mobj_data["test"];


    $query = "select ifnull(FMARKS, '')as FMARKS, ifnull(FCO, '')as FCO, 
              IFNULL(FQNNO, '')AS fqnno,ifnull(FQNNO,'')as `key`,ifnull(FQNNO,'') as `value`,
              ifnull(FQNNO,'') as `label`
              from maxmarksint where 
              fclassid='{$classid}' and ftestname='{$testname}'
              and fsubcode='{$subcode}'";
    // $query = " SELECT IFNULL(FMARKS, '')AS FMARKS, IFNULL(FCO, '')AS FCO, 
    //           IFNULL(FQNNO, '')AS fqnno,IFNULL(FQNNO,'')AS `key`,IFNULL(FQNNO,'') AS `value`,
    //           IFNULL(FQNNO,'') AS `label`,fclassid
    //           FROM maxmarksint WHERE 
    //           fclassid='21185' AND ftestname='Test 1'
    //           AND fsubcode='A00122'";
        
    $res = $aobj_context->mobj_db->GetAll($query);
 
    if($res){
        echo($aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"));
        return $msg;
    } else {
        $msg = "No data found";
        echo($aobj_context->mobj_output->ToJSONEnvelope($msg,-1,"Failure"));  
        return $msg;			
    }
}

function saveCoMarksNew($aobj_context){
  
  $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
  $collcode = trim($aobj_context->mobj_data['collcode']);
  $usr = trim($aobj_context->mobj_data['user']);

  $testName = trim($aobj_context->mobj_data["testName"]);
  $classId = trim($aobj_context->mobj_data["classId"]);
  $subcode = trim($aobj_context->mobj_data["subelement"]);
  $data = json_decode(($aobj_context->mobj_data["data"]), true);
  // $data = $aobj_context->mobj_data["data"];
  //   $array = json_decode($data,true);


  $query1="delete from maxmarksint where 
            fclassid='{$classId}' and ftestname='{$testName}'
            and fsubcode='{$subcode}'";
          
  $res1 = $aobj_context->mobj_db->Execute($query1);

  foreach($data as $val){
   
    if($val['maxmarks'] !== NULL && $val['maxmarks'] !== ''){
          $query="insert into maxmarksint(fclassid, ftestname, fsubcode, fqn, fqnno, fmarks, fco, fcusr, fcdate, fdeleted)
                  values('{$classId}', '{$testName}', '{$subcode}', '{$val['slno']}', '{$val['qnno']}', '{$val['maxmarks']}', '{$val['co']}', '{$usr}', now(), 'F')
                  on duplicate key update 
                  fmarks='{$val['maxmarks']}', fco='{$val['co']}', fcusr='{$usr}', fcdate=now(), fdeleted='F'";
              
            
          $res = $aobj_context->mobj_db->Execute($query);  
    }
  }

  if($res){
      $msg = "Updated Successfully.";
      echo($aobj_context->mobj_output->ToJSONEnvelope($msg,0,"success"));
      return $msg;
  } else {
      $msg = "No Updation / Add..!";
      echo($aobj_context->mobj_output->ToJSONEnvelope($msg,-1,"Failure"));  
      return $msg;			
  }
}
?>