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

  }
  
  

//*************************************************************************************************************************************************
function  getMembershipPlan()
 {
  global $objSmarty;
   $SelQuery		= 'SELECT * FROM `subscription_plan_master` WHERE `m_package`="Annual" AND `subscription_plan_name`="Registration" AND `status`=1'; 
  $MemberPlanDetail		= $this->ExecuteQuery($SelQuery, 'select');
  $objSmarty->assign('MemberPlanDetail', $MemberPlanDetail);
  
 }
 //************************************************************************************************************************************************* 
function  getHalfYearPlan()
 {
  global $objSmarty;
  $SelQuery		= 'SELECT * FROM `subscription_plan_master` WHERE `m_package`="Half Yearly" AND `status`=1';
  $HalfDetail		= $this->ExecuteQuery($SelQuery, 'select');
  $objSmarty->assign('HalfDetail', $HalfDetail);
  
 }
//************************************************************************************************************************************************* 
 function  getAnnualPlan()
 {
  global $objSmarty;
  $SelQuery		= 'SELECT * FROM `subscription_plan_master` WHERE `m_package`="Annual" AND `subscription_plan_name`!="Platinum Membership" AND `subscription_plan_name`!="Registration" AND `status`=1';
  $AnuualDetail		= $this->ExecuteQuery($SelQuery, 'select');
  $objSmarty->assign('AnuualDetail', $AnuualDetail);
  
 }
	function category()
	{
  		global $objSmarty;
  		$SelQuery3		= 'SELECT * FROM `book` WHERE `category` = "astrology"';
		$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);//print_r($PageList2);
  return $PageList2;
  }
  elseif(empty($PageList2) && is_array($PageList2))
    $objSmarty->assign('ErrorMessage', 'No Records Found');
 }
/**********************************************************************************************/
function Getbooks()
{
global $objSmarty;
 echo	$SelQuery2		= 'SELECT * FROM `book` WHERE `category` = "'.$_GET['category'].'"';
		$listing_split = new MsplitPageResults($SelQuery2, $this->Limit);
  if ( ($listing_split->number_of_rows > 0) )  {
   $objSmarty->assign('LinkPage_amc_view_tab',$listing_split->display_count (TEXT_DISPLAY_NUMBER_OF_RESULT));
   $objSmarty->assign('PerPageNavigation_amc_view_tab',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 weekauthor()
{
global $objSmarty;
//SET DATEFIRST { number | @number_var };
//SET DATEFIRST 7 ; 
/*$SelQuery3		='SELECT * FROM `check_out_in_history` AND WorkDate >= dateadd(day, 1-datepart(dw, getdate()), CONVERT(date,getdate())) AND WorkDate <  dateadd(day, 8-datepart(dw, getdate()), CONVERT(date,getdate()))';
$AutDetail		= $this->ExecuteQuery($SelQuery3, 'select');*/

// $SelQuery4		='SELECT * FROM `check_out_in_history` WHERE check_out_date >= DATEADD(wk, DATEDIFF((wk,0,GETDATE()), -1) AND check_out_date <= DATEADD(wk, DATEDIFF((wk,0,GETDATE()), 5) ';
//$AutDetail2		= $this->ExecuteQuery($SelQuery4, 'select');//print_r($AutDetail2);
}
function  GetMemberList()
 {
  global $objSmarty;
  $SelQuery2		= 'SELECT * FROM `membership` WHERE `status`=1';
  $MemDetail		= $this->ExecuteQuery($SelQuery2, 'select');
  $objSmarty->assign('MemDetail', $MemDetail);
  
 }
 function  GetMemberPlanList()
 {
  global $objSmarty;
  $SelQuery2		= 'SELECT DISTINCT(membership_plan) FROM `membership` WHERE `status`=1';
  $MemPDetail		= $this->ExecuteQuery($SelQuery2, 'select');
  $objSmarty->assign('MemPDetail', $MemPDetail);
  
 }
 function  GetMemberSPlanList()
 {
  global $objSmarty;
  if($_GET['name'] == 'all')
  {
  $SelQuery2		= 'SELECT * FROM `membership` WHERE `status`=1';
  }
  else
  {
   $SelQuery2		= 'SELECT * FROM `membership` WHERE membership_plan="'.$_GET['name'].'" AND `status`=1';
  }
  $MemPlanDetail		= $this->ExecuteQuery($SelQuery2, 'select');
  $objSmarty->assign('MemPlanDetail', $MemPlanDetail);
  
 }
/************************************************************************************/
function monthbooks()
{
 $SelQuery5		='SELECT * FROM `check_out_in_history` WHERE check_out_date Between DATEADD(month, DATEDIFF(month, 0, @mydate), 0) AND DATE(NOW())';
$BookDetail2		= $this->ExecuteQuery($SelQuery4, 'select');//print_r($BookDetail2);

 $SelQuery6		='SELECT * FROM `check_out_in_history` WHERE check_out_date Between "CONVERT(DATE,dateadd(dd,-(day(getdate())-1),getdate()))" AND "DATE(NOW())"';
$BookDetail3		= $this->ExecuteQuery($SelQuery6, 'select');//print_r($BookDetail3);

 }
 /**********************************************************************************************/
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%' "; 
		$listing_split3 = new MsplitPageResults($SelQuery4, $this->Limit);
		
  if ( ($listing_split3->number_of_rows > 0) )  {
   $objSmarty->assign('LinkPage_amc_view_tab2',$listing_split3->display_count (TEXT_DISPLAY_NUMBER_OF_RESULT));
  $objSmarty->assign('PerPageNavigation_amc_view_tab2',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');
}
 }
?>

