<?php
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 * PHP version 5
 *
 * @category Admin_Tool
 * @package  Admin_Tool
 * @author   Aum Infosys <admin@auminfosys.com>
 * @license  ACE
 * @version  CVS:1.0.1
 * @link     http://auminfosys.com/
 * @filesource
 */
 
/**
 * This is general file which contains
 * connection file, common function file, etc.,
 *
 */
 require "commonincludefiles.php";

// The ext grid script will send  a task field which will specify what it wants to do
$task = '';
if ( isset($_POST['task'])){
  $task = $_POST['task'];
}
switch($task){
    
    case "DELETEUSER":
        deleteUsers();
        break;
    default:
        echo "{failure:true}";
        break;
}

function deleteUsers(){
   $User_Ids = $_POST['ids']; // Get our array back and translate it :
  
    $deleteUser_Id = json_decode(stripslashes($User_Ids));
   
    // You could do some checkups here and return '0' or other error consts.
    
    // Make a single query to delete all of the student at the same time :
    if(sizeof($deleteUser_Id)<1)// || sizeof($deleteSection_Id)<1)
	{
	  echo "0";
    }
	else {

		$objUserMgmt= new UserMgmt();
		$objUserMgmt->deleteUser_Id = implode(",",$deleteUser_Id);
		$objUserMgmt ->delete();
		
		$objUserAccessMgmt = new UserAccessMgmt();
		$objUserAccessMgmt->deleteUser_Id = implode(",",$deleteUser_Id);
		$objUserAccessMgmt->delete();
		
		echo "1";		
	}        
}
?> 