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

	}

//*************************************************************************************************************************************************
	function GetBranches()
	{
  		global $objSmarty;
  		$SelQuery		= 'SELECT * FROM `branches` WHERE `w_status` = "1" AND is_deleted="0" ORDER BY name ASC';
		$BranchList		= $this->ExecuteQuery($SelQuery, 'select');
		
  $objSmarty->assign('BranchList', $BranchList);//print_r($BranchList);
  
  	$SelQuery4		= 'SELECT * FROM `branches` WHERE `w_status` = "0" AND b_status="1" AND status="0" AND is_deleted="0" ORDER BY name ASC';
		$PageList3		= $this->ExecuteQuery($SelQuery4, 'select');
		
  $objSmarty->assign('PageList3', $PageList3);//print_r($PageList3);
  return $PageList3;
 
 }
/**********************************************************************************************/
	function GetSubscriptionPlan()
	{
  		global $objSmarty;
  		$SelQuery		= 'SELECT DISTINCT subscription_plan_name,sl_no FROM `subscription_plan_master` WHERE `status` = "1" AND subscription_plan_name!="Registration" AND subscription_plan_name!="Platinum Membership" GROUP BY subscription_plan_name ORDER BY subscription_plan_name ASC';
		$SubPlanList		= $this->ExecuteQuery($SelQuery, 'select');
		
  $objSmarty->assign('SubPlanList', $SubPlanList);//print_r($SubPlanList);
 
 }
/**********************************************************************************************/
function GetMembershipPlan()
	{
  		global $objSmarty;
  		$SelQuery		= 'SELECT DISTINCT subscription_plan_name,sl_no FROM `subscription_plan_master` WHERE `status` = "1" AND subscription_plan_name="Registration" OR subscription_plan_name="Platinum Membership" GROUP BY subscription_plan_name ORDER BY subscription_plan_name ASC';
		$MemPlanList		= $this->ExecuteQuery($SelQuery, 'select');
		
  $objSmarty->assign('MemPlanList', $MemPlanList);//print_r($SubPlanList);
 
 }
 
 /*************************************************Insert Employee/***************************************************************/
function InsertMember($objArray)
{
global $objSmarty;

if((!$objArray['regName'])){
$objSmarty->assign('ErrorMessage', 'Member Name should not be blank');
return false;
}elseif(!$objArray['dob']){
$objSmarty->assign('ErrorMessage', 'Date of birth should not be blank');
return false;
}elseif(!$objArray['branchName']){
$objSmarty->assign('ErrorMessage', 'Branch Name should not be blank');
return false;
}/*elseif(!$objArray['pType']){
$objSmarty->assign('ErrorMessage', 'Plan Type should not be blank');
return false;
}/*elseif(!$objArray['pPeriod']){
$objSmarty->assign('ErrorMessage', 'Plan Period should not be blank');
return false;
}*/elseif(!$objArray['emailId']){
$objSmarty->assign('ErrorMessage', 'Email Id should not be blank');
return false;
}elseif(!$objArray['mobileNo']){
$objSmarty->assign('ErrorMessage', 'Mobile Number should not be blank');
return false;
}elseif(!$objArray['address']){
$objSmarty->assign('ErrorMessage', 'Address should not be blank');
return false;
}elseif(!$objArray['pincode']){
$objSmarty->assign('ErrorMessage', 'Pincode should not be blank');
return false;
}

if($objArray['pType'] == '1'){
	$memSubPlan = trim(addslashes($objArray['memPlanName']));
	$memId = $objArray['memPlanName'];
	$memIdSplit = explode("|",$memId);
	$memSubPlanId = $memIdSplit[0];
}else
{
	$memSubPlan = trim(addslashes($objArray['subPlanName']));
	$subId = $objArray['subPlanName'];
	$subIdSplit = explode("|",$subId);
	$memSubPlanId = $subIdSplit[0];
}

    $bId = $objArray['branchName'];
	$bIdSplit = explode("|",$bId);
	$branchId = $bIdSplit[0];
	
$objSmarty->assign('regName', $objArray['regName']);
if($objArray['emailId'] && $objArray['mobileNo']){
$InsQuery = 'INSERT INTO online_registered_users
(
`name`,
`email_id`,
`dob`,
`mobile_no`,
`branch_id`,
`address`,
`pincode`

) 
VALUES(
"'.trim(addslashes($objArray['regName'])).'",
"'.trim(addslashes($objArray['emailId'])).'",
"'.trim(addslashes($objArray['dob'])).'",
"'.trim(addslashes($objArray['mobileNo'])).'",
"'.$branchId.'",
"'.trim(addslashes($objArray['address'])).'",
"'.trim(addslashes($objArray['pincode'])).'")';
$this->ExecuteQuery($InsQuery, 'insert');
}
header('Location:register.php?success_msg_for_insert');
}


/**********************************************************************************************/
public function GetMembershipCode($objArray = '')
    {
      
		global $objSmarty;
		$SelQuery5 = 'SELECT member_code  FROM member_master WHERE member_master.status="1"';
        $MemList = $this->ExecuteQuery($SelQuery5, "select");
        $objSmarty->assign('MemList', $MemList);
    }
function MemberUpdate($objArray='')
{
	global $objSmarty;
	
	$UpQuery = 'UPDATE  `members`  SET `password`= "' . $_POST['confirmPassword'] . '"  WHERE `member_code`="' .$_POST['memberCode']  . '" AND contact_number="'. $_POST['mobileNo'] .'"';
	$this->ExecuteQuery($UpQuery, "update");
	header('Location:member.php?q_mode=update&message=success');
}

 }
?>


