if($data->get_value('selected') == '0')
	{
		$sql = 'delete from login_role_link where lro_id ='.$_GET['roleid'].' and dep_id ='.$data->get_id().';';
	}else{

		$sql = 'insert into login_role_link(lro_id,dep_id) values('.$_GET['roleid'].','.$data->get_id().');';
	}


	<?php
	require_once '../../autoload.php';
	
	// RightsCheck ("VIEW_LOGINROLE");
	
	$afg_id	 		= -1;
	$mod_id	 		= -1;
	$selected		= 0;
	
	if ( isset ( $_REQUEST['afg_id'] )		)	$afg_id		= $_REQUEST['afg_id'];
	if ( isset ( $_REQUEST['mod_id'] )		)	$mod_id		= $_REQUEST['mod_id'];
	if ( isset ( $_REQUEST['selected'] )	)	$selected	= $_REQUEST['selected'];
					
	$conn = get_dbconnection();
	
	$response = -1;
	
	if ( $conn )
	{
		$sql = '';

		if ( $selected == 0 )
			$sql = 'delete from alertfilter_group_link where afg_id ='.$afg_id.' and mod_id ='.$mod_id.';';
		else
			$sql = 'insert into alertfilter_group_link(afg_id,mod_id) values('.$afg_id.','.$mod_id.');';

		error_log ( "sql : " .$sql);
		
		$result = pg_query ( $conn, $sql );
		
		if ( $result )
		{
			$response = $mod_id;
		}
	}
	
	header ('Content-type: text/xml' );
	
	echo $response;
?>