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


Current Path : /proc/thread-self/root/var/www/html/ssa/src_16042016/
Upload File :
Current File : //proc/thread-self/root/var/www/html/ssa/src_16042016/usersubj_identification.php

<?php

function PopulateUserSubjectList($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$user_type=$aobj_context->mobj_data["userType"];
	$degree=$aobj_context->mobj_data["degree"];
	$collegeCode=$_SESSION['collcode'];

	
	$subj_query	= "select fsubcode,fcsubcode as id,fcsubcode,fsubname,fssubname,CONCAT(fshortname,'(',fsubshort,')') as fshortname,fsmaxmarks from 
			subject s inner join colldeg c on s.FDEGREE = c.FDEGREE and s.fdegree = '{$degree}' 
			where c.FCOLLCODE ='{$collegeCode}'  AND IFNULL(FRETAIN,'F')='T' order by fsubname";
	$lobj_subj_query = $aobj_context->mobj_db->GetAll($subj_query);	
	
	$subj_selected_query="select * from usersub where Fuser ='{$user_type}' and Fcollegecode='{$collegeCode}' and FDEGREE='{$degree}'";
	$lobj_subj_selected=$aobj_context->mobj_db->GetRow($subj_selected_query);

	$lobj_subj=$lobj_subj_selected[FSUBCODE];
	$subjArry=Array();
	$subjArry=explode('*',$lobj_subj);
	
	
	$module_data="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='user_rights_table_data' width='80%' border='0' cellspacing='0' cellpadding='0'>";
	$module_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;'>Subjects</th>";
	$module_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";
	$module_data.="<td align='center' style='width:35px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Subject</td>";
	$module_data.="<td  style='width:155px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Description</td>";
	$module_data.="<td align='center' style='  font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>All<input type=checkbox id=check_Allrow onclick='selectAllUserSubject();'/ ></td>";
	$module_data.="</tr>";
	
	foreach($lobj_subj_query	as $key =>$value)
	{	
		$is_subject_checked='';
					
		for($j=0;$j<count($subjArry);$j++)
		{  
			if($value[fsubcode] == $subjArry[$j])
			{   
				$is_subject_checked="checked";
				break;
			}
		}
	
		$module_data.="<tr class='ui-widget-content jqgrow'>";		
		$module_data.="<td class='tbl_row_new' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; font-size:12px; {$group_color} width:51px;text-align:center;' id=subjcode_{$value[fsubcode]}>{$value[fsubcode]}</td>";
		$module_data.="<td class='tbl_row_new' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:5px; font-size:12px; {$group_color} width:151px;' id=subjname_{$value[fsubname]}>{$value[fsubname]}</td>";
		$module_data.="<td class='tbl_row_new' style='  border-right:1px solid #C5DBEC; padding:2px; font-size:12px; {$group_color} width:20px;text-align:center;' id=row_check_{$value[fsubcode]}><input type=checkbox id=check_row_{$value[fsubcode]} {$is_subject_checked} value={$value[fsubcode]} ></input></td>";
		$module_data.="</tr>";
	}	
	$module_data.="</table>";
	$arr['module_id_details']=$lobj_subj_query;
	$arr['html_data']=$module_data;
	
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
}

function saveUserSelectedSubjectList($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$user_type=$aobj_context->mobj_data["userType"];
	$degree=$aobj_context->mobj_data["degree"];
	$subjSelected=$aobj_context->mobj_data["subjSelected"];
	$collegeCode=$_SESSION['collcode'];
	
	$check_user="select count(*) as userCnt from usersub where Fuser ='{$user_type}' and Fcollegecode='{$collegeCode}' and FDEGREE='{$degree}'";
	$lobj_rs = $aobj_context->mobj_db->GetRow($check_user);
	 if(($lobj_rs[userCnt]) > 0)
	{	
		$subjUpdate_query	= "UPDATE usersub set FSUBCODE='{$subjSelected}' where Fuser ='{$user_type}' and Fcollegecode='{$collegeCode}' and FDEGREE='{$degree}'";
		$lobj_subjInsert_query = $aobj_context->mobj_db->Execute($subjUpdate_query);
		$sucess_blog="Successfully Updated";
	}
	else
	{
		$subjInsert_query	= "INSERT INTO usersub(FUSER,FDEGREE,FSUBCODE,FCOLLEGECODE)values('{$user_type}','{$degree}','{$subjSelected}','{$collegeCode}')";
		$lobj_subjInsert_query = $aobj_context->mobj_db->Execute($subjInsert_query);
		$sucess_blog="Updated Successfully ";
	}
	
	$error_blog="Error in Update ";
	
	if($lobj_subjInsert_query)
		echo $aobj_context->mobj_output->ToJSONEnvelope($sucess_blog,0,"success"); 
	else
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_blog,-1,"error"); 
}
?>