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


Current Path : /proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/sectionwisepermission.php

<?php
function PopulateUserSectionList($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$user_type = $aobj_context->mobj_data["userType"];

	$collegeCode = $_SESSION['collcode'];
	
	

	$query = "select distinct d.fdegree,d.fexamno,fexamname,d.fdescpn,s.fsection,
	IFNULL(u.fuserid,'') as checked from degree d inner join student s on d.fdegree = s.fdegree 
	inner join marks m on d.fdegree = m.fdegree and d.fexamno = m.fexamno
	left join usrsection u on 
	s.fcollcode = u.fcollcode and s.fdegree = u.fdegree and d.fexamno = u.fexamno
	and s.fsection = u.fsection
	and u.fuserid = '{$user_type}'
	where s.fcollcode = '{$collegeCode}' 
	and IFNULL(s.fsection,'') <> ''
	order by d.fdegree";
	//var_dump($query);die();
	$lobj_subj_query = $aobj_context->mobj_db->GetAll($query);	
	
	
	
	$module_data="<table style='padding:3px 4px 3px 3px;' class='tr_ventor_row' id='user_rights_table_data' width='99%' 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:28px;'>Section Wise Permission</th>";
	
	$module_data.="<tr class='ui-state-default ui-jqgrid-hdiv' style='height:28px'>";
	$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;'>Degree</td>";
	$module_data.="<td align='center' 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='width:35px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Exam</td>";
	$module_data.="<td align='center' style='width:55px; font-size:12px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Section</td>";
	$module_data.="<td align='center' style='  font-size:12px;   border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><input type=checkbox id=check_Allrow onclick='selectAllUserSectiont();'/ ></td>";
	$module_data.="</tr>";
	$i = 0;

	foreach($lobj_subj_query as $key =>$value)
	{	
		$is_subject_checked='';
					
		if($value['checked'] != '')
		{   
			$is_subject_checked="checked";
		}
	
		$value1 = $value['fdegree']."_".$value['fexamno']."_".$value['fsection'];

		$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; width:51px;text-align:center;' id='degcode_{$i}'>
			{$value['fdegree']}
		</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:200px;' id='degname_{$i}'>{$value['fdescpn']}</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:100px;text-align:center;text-align:center' id='degexam_{$i}'>{$value['fexamname']}</td>";
		$module_data.="<td class='tbl_row_new' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:5px; font-size:12px;text-align:center; width:51px;' id='section_{$i}'>{$value['fsection']}</td>";

		$module_data.="<td class='tbl_row_new' style='  border-right:1px solid #C5DBEC; padding:2px; font-size:12px;  width:20px;text-align:center;' id=row_check_{$i}><input type=checkbox id='check_row_{$i}' {$is_subject_checked} value='{$value1}' ></input></td>";
		$module_data.="</tr>";
		$i++;
	}	
	$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 saveUserSectionList($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	session_start();
	$user_type = $aobj_context->mobj_data["userType"];
	$subjSelected = $aobj_context->mobj_data["subjSelected"];
	$module = $aobj_context->mobj_data["module"];
	$collegeCode = $_SESSION['collcode'];

	$section_arr = explode('*', $subjSelected);
	if(count($section_arr) >1)
	{
		$query = "delete from usrsection where fcollcode = '{$collegeCode}' 
		and fuserid = '{$user_type}'";
		$lobj_subjInsert_query = $aobj_context->mobj_db->Execute($query);
	}

	foreach ($section_arr as $key => $value) 
	{
		$section = explode('_', $value);
		if($section[0] != '')
		{	
			$query = "insert into usrsection(fuserid,fcollcode,fdegree,fexamno,fsection)
			values('{$user_type}','{$collegeCode}','{$section[0]}','{$section[1]}','{$section[2]}')";
			
			$lobj_subjInsert_query = $aobj_context->mobj_db->Execute($query);
		}	
	}

	$error_blog="Error in Inserting Data";
	
	if($lobj_subjInsert_query)
	{	
		$sucess_blog = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($sucess_blog,0,"success"); 
	}	
	else
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_blog,-1,"error"); 
}

function getsection($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$degree = $aobj_context->mobj_data["degree"];
	$collcode = $_SESSION['collcode'];
	
	$query = "select distinct ifnull(FSECTION,'') as value from student  
	where fcollcode = '{$collcode}' and fdegree = '{$degree}' 
	and ifnull(FSECTION,'') <> ''";

	$result = $aobj_context->mobj_db->GetAll($query);
	
	if($result)
	{
		$arr['section'] = $result;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
		return;	
	}else
	{
		$arr = "no data found";
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");	
		return;
	}	

	
}

?>