<?php
session_start();
include_once("../class/class.MySQL.php");
$db	=new MySQL();
if($_GET['action'] == 'load'){
	if($_SESSION['usertype'] == 'Superadmin')
	{	
		$imdsupervisor = $db->fetchAll('employee');
	}
	elseif($_SESSION['branchadmin']=='Y')
	{
		$imdsupervisor = $db->fetchQuery('select * from employee where branchid='.$_SESSION['branch_id'].' and user_type!="Superadmin"');
	}
	else
	{
		$userid = $_SESSION['admin_id'];
		$imdsupervisor = $db->fetchQuery('select * from employee where imd_supervisor_id="'.$userid.'" group by employee.e_id');
	}
	/*if($_SESSION['usertype'] == 'Subadmin')
	{
		$userid = $_SESSION['admin_id'];
		$imdsupervisor = $db->fetchQuery('select * from employee where imd_supervisor_id="'.$userid.'" group by employee.e_id');
	}
	else
	{	
		$imdsupervisor = $db->fetchAll('employee');
	}*/
	echo '{"imdsupervisor":'.json_encode($imdsupervisor).'}';
}

?>