<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";
include_once "classes/cls_user.php";
include_once "classes/cls_store.php";

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE); 
} 
if(isset( $_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= ""){
	$userid = $_SESSION["sess_userid"];
}else{
	header("Location:login.php");
	exit;
}

if (isset($_SESSION["sess_userid"]) and $_SESSION["sess_userid"] != "") {
    $userid = $_SESSION["sess_userid"];
    $favourites_count   = User::total_product_favourites_count($userid);
}

//check user account exists

if (isset($_SESSION["sess_userid"]) and $_SESSION["sess_userid"] != "") {
    $buyerdelStatus  = User::getBuyerAccountExists($_SESSION["sess_userid"]);

    if($buyerdelStatus=='Y')
        {
            $_SESSION["sess_userid"]    =   '';
            unset($_SESSION["sess_userid"]);
            generalMethods::redirect('login.php?msg=accerror');
        }
 }


/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

//**************************************************Multicart3.0 Additions*************************
$seller_favourites_count = 0;
if (isset($_SESSION["sess_userid"]) and $_SESSION["sess_userid"] != "") {
    $userid                     = $_SESSION["sess_userid"];
    $seller_favourites_count    = User::total_seller_favourites_count($userid);

    //Check Seller Privelege added to this account

    $sellerAccObj   =    User::is_seller_account_activated($_SESSION["sess_userid"]);

    $seller_activated_status        =   'N';

    //echopre($sellerAccObj);

        if($sellerAccObj->status==SUCCESS)
            {
                    $sellerAccObjVal            =   $sellerAccObj->data;
                    $seller_activated_status    =   $sellerAccObjVal->is_seller;
                    $activated_seller_id        =   $sellerAccObjVal->seller_id;

                    // check user exists with the same id 
             $sellerObj  =    Store::get_seller_account_info($activated_seller_id);

            if($sellerObj->status==SUCCESS)
                    {
                        $sellerObjVal                       =   $sellerObj->data;
                        $vapproved                          =   $sellerObjVal->vapproved;
                        $deleted                            =   $sellerObjVal->deleted;

                        if($deleted=='Y')
                            {
                                 $seller_activated_status            = 'NN';
                            }
                    }
                    else {
                            $seller_activated_status            = 'N';
                         }



            }
    
            if($_SESSION['SELLER_ACCOUNT_ACTIVATED_MSG']!='')
            {
                $message    =   $_SESSION['SELLER_ACCOUNT_ACTIVATED_MSG'];
                
                $_SESSION['SELLER_ACCOUNT_ACTIVATED_MSG'] = '';
            }
}
//**************************************************Multicart3.0 Additions*************************
?>
<script src="<?php echo SITE_URL?>/js/common.js"></script>
<link href="<?php echo SITE_URL; ?>/style/jquery-confirm.css" rel="stylesheet" type="text/css">
<script src="<?php echo SITE_URL?>/js/jquery-confirm.js"></script>

<!--mainbody area start -->
<div class="main_body">
	<div class="container">
		<div class="row">
		<!--center content area start-->		
		
		
		<div id="item_details">
		<!--items display area start -->
		<section class="sec_marg">
		<div class="col-sm-12 col-lg-12 col-md-12 ">
			<h3><?php echo MY_ACCOUNT_TEXT;?></h3>
		</div>
		</section>
		<div class="clear"></div>
		<div class="text_information"><?php echo $message?></div>
		<div class="col-sm-12 col-lg-12 col-md-12">
		<div class="myaccount_list">
			<div class="row">
                                <div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img">
                    <a href="orders.php"><img src="<?php echo $site_url;?>/images/my_orders_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="orders.php"><?php echo MY_ORDERS_TEXT;?></a>
				</div>	
                
                			
				<div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img">

                    <a href="profile.php"><img src="<?php echo $site_url;?>/images/acount_edit_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="profile.php"><?php echo EDIT_PROFILE_TEXT;?></a>
				</div>				
				<div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img">
                    <a href="myreturns.php"><img src="<?php echo $site_url;?>/images/req_return_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="myreturns.php"><?php echo RETURN_REQUEST_TEXT;?></a>
				</div>                            
                                <div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img"><a href="changepassword.php"><img src="<?php echo $site_url;?>/images/passoerd_chng_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="changepassword.php"><?php echo CHANGE_PWD_TEXT;?></a>
				</div>
                
                
                
                <?php
                       
                        if(getSettingsValue('enable_subscription_products')=='Y') { ?>
                            <!--<div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img"><img src="<?php echo $site_url;?>/images/subscription.png" border="0"/></div>
					<div class="clear"></div>
					<a href="#" ><?php echo MY_SUBSCRIPTION_TEXT;?></a>
                            </div>-->
                            <?php } ?>
                
                
                
                
                
                        <?php
                        if(getSettingsValue('enable_favourites')=='Y' ||  $favourites_count>0) {
                            
                        ?>
                            <div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img"><a href="myfavourites.php"><img src="<?php echo $site_url;?>/images/favourite_product_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="myfavourites.php"><?php echo MY_FAVOURITES_TEXT;?></a>
				</div>
                            
                        <?php } ?>
			

                      <?php
                        if(getSettingsValue('enable_favourites')=='Y' ||  $seller_favourites_count>0) {

                        ?>
                            <div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img"><a href="myfavouriteseller.php"><img src="<?php echo $site_url;?>/images/favourite_sellers_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="myfavouriteseller.php"><?php echo MY_FAVOURITES_SELLER_TEXT;?></a>
				</div>

                        <?php } ?>

                        <?php
                       
                        if(getSettingsValue('enable_seller_account')=='Y' && $seller_activated_status=='N') { ?>
                            <div class="col-sm-12 col-lg-3 col-md-3">
                                <div class="myaccount_list_img"><a href="javascript:void(0);" class="activate_seller"><img src="<?php echo $site_url;?>/images/activate_seller_account_icon.png" border="0"/></a></div>
					<div class="clear"></div>
					<a href="javascript:void(0);" class="activate_seller"><?php echo ACTIVATE_SELLER_ACCOUNT_TEXT;?></a>
                            </div>
                            <?php } 
                            
                            if(getSettingsValue('enable_seller_account')=='Y' && $seller_activated_status=='NN') { ?>
                            <div class="col-sm-12 col-lg-3 col-md-3">
					<div class="myaccount_list_img"><img src="<?php echo $site_url;?>/images/activate_seller_account_icon.png" border="0"/></div>
					<div class="clear"></div>
					<a href="#" ><?php echo SELLER_ACCOUNT_DEACTIVATED;?></a>
                            </div>
                            <?php } 

                            

                                 if($seller_activated_status=='Y') { ?>
                                        <div class="col-sm-12 col-lg-3 col-md-3">
                                                    <div class="myaccount_list_img"><a href="#" id="seller_approval"  onclick="return validateAccount('<?php echo $activated_seller_id;?>','<?php echo $vapproved;?>','<?php echo $deleted?>');"><img src="<?php echo $site_url;?>/images/activate_seller_account_icon.png" border="0"/></a></div>
                                                    <div class="clear"></div>
                                                    <a href="#" id="seller_approval"  onclick="return validateAccount('<?php echo $activated_seller_id;?>','<?php echo $vapproved;?>','<?php echo $deleted?>');"><?php echo HOME_LINK_SELLER_DASHBOARD;?></a>
                                        </div>
                            <?php } ?>
                            



                        










                            </div>
			</div>
		
		
		<div class="clear"></div>
		</div> 
		</div>

					
					
		 <!--items display area end -->
		  </div>
		
			</form>
		<!--center content area end-->	
	</div>
	</div>
</div>		
<!--mainbody area end -->

<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>																																									