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


Current Path : /var/www/html/stph/src/
Upload File :
Current File : /var/www/html/stph/src/degree.php

<?php
/* 
 *
 * FOR THE IDENTIFY TRANSACTION FORM
 * PROGRAMED BY NAVEEN
 * DATE: 31/03/09
 * TIME: 10:45 AM 
 *
 */
 
function getITModuleData($aobj_context)
{
	session_start();
	$college_code = $_SESSION['collcode'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$degree_code=trim($aobj_context->mobj_data["degree_range"]);
	$degreeType=trim($aobj_context->mobj_data["degreeType"]);
	
	if($degreeType === 'selected')
	{
		$get_degree_code="select B.FDEGREE,B.FDESCPN,A.FDELETED ,
		IF(A.FDELETED='F','CHECKED',' ') AS CHECKED from colldeg A 
		left join degree B on A.FDEGREE = B.FDEGREE 
		Where A.FCOLLCODE='{$college_code}' and A.FDELETED='F'  
		group by A.FDEGREE";
	}
	else
	{
		$degree_code=($degree_code=='')?" ":" where FDEGREE like '%{$degree_code}%'";
		$get_degree_code = "select A.FDEGREE, A.FDESCPN, IF(B.FDELETED='F','CHECKED',' ') AS CHECKED from
			(select FDEGREE, FDESCPN from degree   {$degree_code} 
			group by FDEGREE) A	
			LEFT JOIN colldeg B on A.FDEGREE = B.FDEGREE and B.FCOLLCODE='{$college_code}' and B.FDELETED='F'	
			group by A.FDEGREE";	
	}
    $lobj_get_degree_code = $aobj_context->mobj_db->getAll($get_degree_code);
   
	$arr['error']=1;
	if(!empty($lobj_get_degree_code))
	{
		$e_data.="<table  align = 'center' width='100%' cellspacing='0' cellpadding='1' border='0' >";
		$e_data.="<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Degree List</th>";
		$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
		$e_data.="<td align='center' style='width:30px; font-size:12px;  border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl.<br>No.</td>";
		$e_data.="<td align='center' style='width:85px; font-size:12px;  border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Degree</td>";
		$e_data.="<td align='center' style='width:355px; font-size:12px; padding:5px 5px;  border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Description</td>";
		$e_data.="<td align='center' style='width:55px; font-size:12px;  border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Select</td>";
		$e_data.="</tr>";							
			
		$k=0;
		$id=0;
		$m=0;
		//var_dump($lobj_get_moudle_names); die();
		$counter_degree = 1;
		foreach($lobj_get_degree_code as $key=>$value)
		{
			if($k%2==0)
			{
				$class='tbl_row';
				$inp_class='tbl_row_input';
			}
			else
			{
				$input_class='tbl_row1'; 
				$inp_class='tbl_row1_input';
			}  
			$checked=($value['CHECKED']!='CHECKED')?" ":"checked";
			$e_data.="<tr class='ui-widget-content jqgrow'>";	
			$e_data.="<td class='tbl_row_new' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:center; ' id='it_cnt_{$id}' >{$counter_degree}</td>";				
			$e_data.="<td class='tbl_row_new' style='border-right:1px solid #C5DBEC; padding:2px; font-size:12px;text-align:left;  ' id='it_mname_{$id}' >{$value['FDEGREE']}</td>";
			$e_data.="<td class='tbl_row_new' style=' border-right:1px solid #C5DBEC; padding:2px; font-size:12px; '  id='it_dname_{$id}' >{$value['FDESCPN']}</td>";
			$e_data.="<td align='center' class='tbl_row_new' style=' border-right:1px solid #C5DBEC; padding:2px; font-size:12px; '  id='it_dname_{$id}' ><input type='checkbox' id='it_fmodule_{$id}' {$checked} ></td>";
			$e_data.="</tr>";
			$k++;
			$id++;
			$m++;
			$counter_degree++;
		}
		$e_data.="</table>";
		$arr['total_count']= $m;						
		$arr['html']=$e_data;
		$arr['error']=0;
	}
	if($arr['error']==0)	
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	else
	{
		$error_msg = "Invalid Degree Code..!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,-1,"success"); 
	}	
	return;		
}

function saveIdentifyTransactions($aobj_context)
{
	session_start();
	$college_code = $_SESSION['collcode'];
	$log_name=$_SESSION['usr'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	
	include_once("/JSON.php"); 
	$json = new Services_JSON();
	 
	$lstr_param = stripslashes($aobj_context->mobj_data["mod_arr"]);
	$mobj_jsondata = $json->decode($lstr_param);
	$mod_arr_data = get_object_vars($mobj_jsondata);
	
	for($k=0;$k<count($mod_arr_data);$k++)
	{
		//----query to check whether degree details exists in colldeg table
		$check_dup = "select count(*) as count from colldeg where  
		FCOLLCODE='{$college_code}' and FDEGREE='{$mod_arr_data[$k]->name}'";
		$lobj_check_dup = $aobj_context->mobj_db->getRow($check_dup); 
		$dup_flag = $lobj_check_dup[count];
		
		if($mod_arr_data[$k]->it_fmodule == 0)
		{
			
		}
		if($mod_arr_data[$k]->it_fmodule && $dup_flag == 0 )
		{
			$insert_colldeg =" insert into colldeg( FCOLLCODE,FDEGREE,FDELETED,FLOGNAME,FLOGDATE)	value	
								('{$college_code}','{$mod_arr_data[$k]->name}','F','{$log_name}',now())";	
			$lobj_insert_colldeg = $aobj_context->mobj_db->Execute($insert_colldeg);
		}
		else
		{
			$update_colldeg_pre_data =  " update colldeg set  FDELETED = if('{$mod_arr_data[$k]->it_fmodule} = 0','F','T')
										where FCOLLCODE='{$college_code}' 
										and FDEGREE='{$mod_arr_data[$k]->name}'"; 
									//	var_dump($update_colldeg_pre_data);
			$lobj_update_colldeg_pre_data = $aobj_context->mobj_db->Execute($update_colldeg_pre_data);
		}
		
		
		//----query to check whether degree details exists in collexam table
		$qury = "select  count(*) as count from collexam where  
		FCOLLCODE='{$college_code}' and FDEGREE='{$mod_arr_data[$k]->name}'";
		$result = $aobj_context->mobj_db->getRow($qury); 
		$dup_flagcoll = $result[count];
		
		//if($mod_arr_data[$k]->it_fmodule && $dup_flagcoll == 0 )
		//{
			$query ="insert ignore into collexam(fcollcode, fdegree, fexamno, fsuspend, fdeleted)
			select '{$college_code}', fdegree, fexamno, 'F','F' 
			from degree where fdegree = '{$mod_arr_data[$k]->name}'";
			$lobj_insert_collexam = $aobj_context->mobj_db->Execute($query);
		//}
		if($dup_flagcoll != 0)
		{
			$update_colldeg_pre_data =  " update collexam set  FDELETED = if('{$mod_arr_data[$k]->it_fmodule} = 0','F','T')
										where FCOLLCODE='{$college_code}' 
										and FDEGREE='{$mod_arr_data[$k]->name}'"; 
										
			$lobj_update_colldeg_pre_data = $aobj_context->mobj_db->Execute($update_colldeg_pre_data);
		}
		
	}
	if($lobj_insert_colldeg || $update_colldeg_pre_data) 
	{
		$arr='Updated Successfully';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}	
	else
	{
		$arr='Error in Update ';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}
	
}
?>