<?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";

 if($_SESSION["aCollegeId"]!="" && isset($_SESSION["aCollegeId"]))
 {
	if($_REQUEST['memberno']!="" || $_REQUEST['membername']!=""){
		
		$start   = isset($_REQUEST['start'])  ? $_REQUEST['start']  :  0;
		$limit   = isset($_REQUEST['limit'])  ? $_REQUEST['limit']  : 30;
		$condition="";
		
		if($_REQUEST['radiomemberno'] == "true"){
			$condition .= " AND member_id like '%".Escape($_REQUEST['memberno'])."%'";
		}
		else{
			$condition .= " AND member_name like '%".Escape($_REQUEST['membername'])."%'";
		}
		$condition .= "AND member_active='1' ";
		
		$objMemberMgmt = new MemberMgmt();
		
		$result = $objMemberMgmt ->getAllRecords($limit,$start,$condition,"","");
		$result1 = $objMemberMgmt ->getAllRecords(0,0,$condition,"","");
		$total = dbRows($result1);
		
		$arr = array();
		$i=0;
					
		$generalsearchData = array("count" => $total, "result" => array());
		
		if(dbRows($result) > 0){
			$temparray = array();
			
			while($row = dbArray($result)){
			
				$temparray["member_id"]  			= $row["member_id"];
				$temparray["member_name"]  			= $row["member_name"];
				$temparray["member_group"]  		= $row["member_group"];
				$temparray["member_approvedfrom"]   = $row["member_approvedfrom"];
				$temparray["member_approvedto"]  	= $row["member_approvedto"];
				$temparray["member_maxissuelimit"]  = $row["member_maxissuelimit"];
				
				$result_count = $objMemberMgmt ->getTotalNoofIssueBook($temparray["member_id"]);
				
				$temparray["getTotalNoofIssueBook"]  = $result_count;
				$generalsearchData["result"][$i] 	 = $temparray;   
				$i++;
			}										
		}	
		echo json_encode($generalsearchData);
	}	
}
?>