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


Current Path : /proc/thread-self/root/var/www/html/phdadm/pgetadm/
Upload File :
Current File : //proc/thread-self/root/var/www/html/phdadm/pgetadm/option-entry-cr.php

<?php

function getCasualOptionEntryDet($aobj_context) 
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);

	$query_pgadmdate = "select * from collexam where fcollcode = 'PGET'
    and fdegree = 'OPCR'
    and date_format(now(),'%Y-%m-%d') between date_format(FPGADMFROM,'%Y-%m-%d') 
    and date_format(FPGADMTO,'%Y-%m-%d')";
    // var_dump($query_pgadmdate);

    $result3 = $aobj_context->mobj_db->GetAll($query_pgadmdate);
    // var_dump($result3);

    if(count($result3) == 0)
    {
      $arr['msg'] = "Last Date to modify option-entry is over";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-2,"Failure"); 
      return;
	}

	$query2 = "select ifnull(fappno,'') as fappno,
	ifnull(ffinsub,'F') as ffinsub,ifnull(fpaystatus,'F') as fpaystatus 
	from entstudadm 
	where fmobileno = '{$_SESSION['MOBILE']}'
	and ifnull(fapprstatus,'') = 'Accepted'";
	$qry2 =  $aobj_context->mobj_db->GetAll($query2);
	if(count($qry2) == 0) {
		$arr['msg'] = 'Option Entry not available.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}

	$fappno = $qry2[0]['fappno'];
	$ffinsub = $qry2[0]['ffinsub'];
	$fpaystatus = $qry2[0]['fpaystatus'];

	$query1 = "select x.fdegree, concat(fdescpn) as degree, 
	concat(fcollname) as college, x.fcollcode
	from entcolldeg x inner join entdeg y on x.fdegree = y.fdegree
	inner join entcoll z on x.fcollcode = z.fcollcode
	inner join entoptdeg deg on deg.fdegree = x.fdegree 
	where deg.fappno ='{$fappno}'
	order by x.fdegree, x.fcollcode";
	//var_dump($query1);
	$obj =  $aobj_context->mobj_db->GetAll($query1);
	
	$query3 = "select * from entoptions 
	where fappno = '{$fappno}' and fentoptround = 'CR' 
	order by fpriority";
		$result2 = $aobj_context->mobj_db->GetAll($query3);
		//var_dump($query3);
	if(count($obj) > 0) {

		$res['fappno'] = $fappno;
		$res['fround'] = $res1['fentoptround'];
		$res['optent'] = $obj;
		$res['priority'] = $result2;
		$res['ffinsub'] = $ffinsub;
		$res['fpaystatus'] = $fpaystatus;
		echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
		return;
	}
	else 
	{
		$arr['msg'] = 'Error in fetching option entry details.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}
}

function saveCasualOptionEntryDet($aobj_context) 
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$data = json_decode($aobj_context->mobj_data['options'], true);

	// $res = true;
	// if($res) {
	// 	$arr['msg'] = 'Last date is over';
	// 	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
	// 	return;
	//  } 
	$query_pgadmdate = "select * from collexam where fcollcode = 'PGET'
    and fdegree = 'OPCR'
    and date_format(now(),'%Y-%m-%d') between date_format(FPGADMFROM,'%Y-%m-%d') 
    and date_format(FPGADMTO,'%Y-%m-%d')";
    // var_dump($query_pgadmdate);

    $result3 = $aobj_context->mobj_db->GetAll($query_pgadmdate);
    // var_dump($result3);

    if(count($result3) == 0)
    {
      $arr['msg'] = "Last Date to modify option-entry is over";
      echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-2,"Failure"); 
      return;
    }

	$query = "select fappno from entstudadm where fmobileno = '{$_SESSION['MOBILE']}'";
	$obj =  $aobj_context->mobj_db->GetRow($query); 
	$appno = $obj['fappno'];

	if($appno == "") {
		$arr['msg'] = 'Application Payment Not done';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		return;
	}

	$values = "";
	foreach($data as $value) {
		$values .= "('{$appno}', '{$value['degree']}', '{$value['college']}', '{$value['priority']}', 'CR','9'),";
	}

	$values = rtrim($values, ',');
	$delete = "delete from entoptions where fappno = '{$appno}' and fentoptround = 'CR'";

	$res =  $aobj_context->mobj_db->Execute($delete); 

	$insert = "insert into entoptions(fappno, fdegree, fcollcode, fpriority, fentoptround,fround) 
	values  $values ";
	$res =  $aobj_context->mobj_db->Execute($insert); 

	if($res) {
		$arr['msg'] = "Preferences saved successfully.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}
	else {
		$arr['msg'] = 'Error While saving preferences.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 	
	}

}

function UpdateCasualforStudent($aobj_context) {

	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);	
	$fappno = $aobj_context->mobj_data['fappno'];
	$response = $aobj_context->mobj_data['response'];

	$query = "update entstudadm set fcaround = '{$response}' where fappno = '{$fappno}'";

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

	if($res) {
		$arr['msg'] = "Updated successfully.";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}
	else {
		$arr['msg'] = 'Error While updating.';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 	
	}

}