<?php
#####Class For Adding Content Management ######
class travel extends MysqlFns
{
 /* class constructor */
	function travel()
	{
 		$this->LDDisplayPath= $config['SiteGlobalPath']."class.travel.php";
  		global $config;
  		global $objSmarty;
  		$this->MysqlFns();
  		$this->Limit = 12;

  }
  
//*************************************************************************************************************************************************
	function category()
	{
  		global $objSmarty;
  		$SelQuery3		= 'SELECT * FROM `book` WHERE `category` Like "teens fantasy"';
		// $SelQuery3 =	"select * from `book` br left join `images` b on br.isbn =b.isbn  where (br.category like 'teens fantasy')";
			/*if($_SESSION['branchname'] != '')
{
 $SelQuery3	= "select *,br.book_id,b.book_name,b.category from `book_receipt` br left join `book` b on br.book_id =b.id left join `images` m on m.isbn =b.isbn  where (b.category like 'teens fantasy' and br.branch_name='".$_SESSION['branchname']."')";
}
else
{
 $SelQuery3	= "select *,br.book_id,b.book_name,b.category from `book_receipt` br left join `book` b on br.book_id =b.id left join `images` m on m.isbn =b.isbn  where (b.category like 'teens fantasy')";
}*/
		$listing_split2 = new MsplitPageResults($SelQuery3, $this->Limit);
  if ( ($listing_split2->number_of_rows > 0) )  {
   $objSmarty->assign('LinkPage_amc_view_tab',$listing_split2->display_count (TEXT_DISPLAY_NUMBER_OF_RESULT));
   $objSmarty->assign('PerPageNavigation_amc_view_tab',TEXT_RESULT_PAGE1 . ' ' . $listing_split2->display_links($this->Limit, get_all_get_params(array('page', 'info', 'x', 'y'))));   $PageList2 = $this->ExecuteQuery($listing_split2->sql_query, 'selectassoc');
  }
   if(!empty($PageList2) && is_array($PageList2))
  {
  $objSmarty->assign('i', $listing_split2->i);
  $objSmarty->assign('PageList2', $PageList2);
  return $PageList2;
  }
  elseif(empty($PageList2) && is_array($PageList2))
    $objSmarty->assign('ErrorMessage', 'No Records Found');
 }
/**********************************************************************************************/
function Getbooks()
{
global $objSmarty;
 	$SelQuery2		= 'SELECT * FROM `book` WHERE `category` Like "%'.$_GET['category'].'%"';
 //$SelQuery2 =	"select * from `book` br left join `images` b on br.isbn =b.isbn  where (br.category =  '".$_GET['category']."')";
/* if($_SESSION['branchname'] != '')
{
 $SelQuery2	= "select *,br.book_id,b.book_name,b.isbn,b.category from `book_receipt` br left join `book` b on br.book_id =b.id left join `images` m on m.isbn =b.isbn  where (b.category ='".$_GET['category']."' and br.branch_name='".$_SESSION['branchname']."')";
}
else
{
 $SelQuery2	= "select *,br.book_id,b.book_name,b.isbn,b.category from `book_receipt` br left join `book` b on br.book_id =b.id left join `images` m on m.isbn =b.isbn  where (b.category ='".$_GET['category']."')";
}*/
		$listing_split = new MsplitPageResults($SelQuery2, $this->Limit);
  if ( ($listing_split->number_of_rows > 0) )  {
   $objSmarty->assign('LinkPage_amc_view_tab2',$listing_split->display_count (TEXT_DISPLAY_NUMBER_OF_RESULT));
   $objSmarty->assign('PerPageNavigation_amc_view_tab2',TEXT_RESULT_PAGE1 . ' ' . $listing_split->display_links($this->Limit, get_all_get_params(array('page', 'info', 'x', 'y')))); 
   $PageList = $this->ExecuteQuery($listing_split->sql_query, 'selectassoc');
  }
   if(!empty($PageList) && is_array($PageList))
  {
  $objSmarty->assign('i', $listing_split->i);
  $objSmarty->assign('PageList', $PageList);
  return $PageList;
  }
  elseif(empty($PageList) && is_array($PageList))
    $objSmarty->assign('ErrorMessage', 'No Records Found');
}
/**********************************************************************************************/
function searchbooks()
{
global $objSmarty;
 $name= $_POST['search_text'];
// echo $name;
//cart table data check
	$SelQuery4		= "SELECT * FROM `book` WHERE  book_name like '$name%' or author like '$name%' or isbn like '%$name%' "; 
	//$SelQuery4 =	"select * from `book` br left join `images` b on br.isbn =b.isbn  where (br.book_name like '$name%' or br.author like '$name%' or br.isbn like '%$name%')";
	/*if($_SESSION['branchname'] != '')
{
 $SelQuery4	= "select *,br.book_id,b.book_name,b.isbn,b.category from `book_receipt` br left join `book` b on br.book_id =b.id left join `images` m on m.isbn =b.isbn  where (b.book_name like '$name%' or b.author like '$name%' or b.isbn like '%$name%' and br.branch_name='".$_SESSION['branchname']."')";
}
else
{
 $SelQuery4	= "select *,br.book_id,b.book_name,b.isbn,b.category from `book_receipt` br left join `book` b on br.book_id =b.id left join `images` m on m.isbn =b.isbn  where (b.book_name like '$name%' or b.author like '$name%' or b.isbn like '%$name%')";
}*/

		$listing_split3 = new MsplitPageResults($SelQuery4, $this->Limit);
		
  if ( ($listing_split3->number_of_rows > 0) )  {
   $objSmarty->assign('LinkPage_amc_view_tab3',$listing_split3->display_count (TEXT_DISPLAY_NUMBER_OF_RESULT));
  $objSmarty->assign('PerPageNavigation_amc_view_tab3',TEXT_RESULT_PAGE1 . ' ' . $listing_split3->display_links($this->Limit, get_all_get_params(array('page', 'info', 'x', 'y'))));   $PageList3 = $this->ExecuteQuery($listing_split3->sql_query, 'selectassoc');
  }
   if(!empty($PageList3) && is_array($PageList3))
  {
  $objSmarty->assign('i', $listing_split3->i);
  $objSmarty->assign('PageList3', $PageList3);//print_r($PageList3);
  return $PageList3;
  }
  elseif(empty($PageList3) && is_array($PageList3))
    $objSmarty->assign('ErrorMessage', 'No Records Found');
}
 }
?>


