<?php
include("conexao.php");
include_once("functions.php");
include_once(Idioma(1));
global $_TRA;
if(ProtegePag() == true){
$UserOnline = InfoUser(2);
$AcessoOnline = InfoUser(3);
?>
<script type="text/javascript" src="js/plugins/jquery/jquery.min.js"></script>
<script type='text/javascript'>  
$(function(){  
 $("a.Sair").click(function() { 
 
 		var titulo = '<?php echo $_TRA['sair']; ?>?';
		var texto = '<?php echo $_TRA['tcds']; ?>';
		var tipo = 'danger';
		var link = 'sair.php';
		var fa = 'fa-sign-out';  
			
		$.post('ScriptAlerta.php', {titulo: titulo, texto: texto, tipo: tipo, link: link, fa: fa}, function(resposta) {
				$("#StatusGeral").html('');
				$("#StatusGeral").html(resposta);
		});
	});
});
</script>

<style>
.SpanIco{
	color:#FFF;
	height: 50px;
    display: flex;
	align-items: center; 
	justify-content: center;
}
</style>

<div id="StatusGeral"></div>

<!-- START X-NAVIGATION VERTICAL -->
                <ul class="x-navigation x-navigation-horizontal x-navigation-panel">
                
                    <!-- TOGGLE NAVIGATION -->
                    <li class="xn-icon-button">
                        <a href="#" class="x-navigation-minimize"><span class="fa fa-dedent"></span></a>
                    </li>
                    <!-- END TOGGLE NAVIGATION -->
                    
                    <?php
					if($AcessoOnline != 1){
						$PrePago = empty($_SESSION['PrePago']) ? "N" : $_SESSION['PrePago'];
						$ConvertDataPremium = ConvertDataPremiumMenu($_SESSION['data_premio'], $PrePago);
					}
					else{
						$ConvertDataPremium = ConvertDataPremiumMenu('Admin');
					}
					echo "<li class=\"xn-icon-button\">
                        <span class=\"SpanIco\" style=\"width: 120px;\">".$ConvertDataPremium."</span>
                    </li>";
					?>
                                
                    <!-- POWER OFF -->
                    				<li class="xn-icon-button pull-right">
		<a href="javascript:void(0)" class="Sair"><span class="fa fa-power-off"></span></a>               
	</li>  
                    <!-- END POWER OFF -->                     
                    <!-- MESSAGES -->
                    <?php
					$LidaReceptor = "N";
					$SQLSuporte = "SELECT id, UserEmissor, UserReceptor, Assunto, PastaReceptor, PastaEmissor FROM suporte WHERE UserReceptor = :UserReceptor AND LidaReceptor = :LidaReceptor OR UserEmissor = :UserEmissor AND LidaEmissor = :LidaEmissor";
					$SQLSuporte = $painel_geral->prepare($SQLSuporte);
					$SQLSuporte->bindParam(':UserReceptor', $UserOnline, PDO::PARAM_STR);
					$SQLSuporte->bindParam(':LidaReceptor', $LidaReceptor, PDO::PARAM_STR);
					$SQLSuporte->bindParam(':UserEmissor', $UserOnline, PDO::PARAM_STR);
					$SQLSuporte->bindParam(':LidaEmissor', $LidaReceptor, PDO::PARAM_STR);
					$SQLSuporte->execute();
  					$TotalSuporte = count($SQLSuporte->fetchAll());
					
					
					
                               
                            
						           
						
                    echo "</li>";
					?>
                    <!-- END MESSAGES -->
                    
                    <li class="xn-icon-button pull-right">
                        <a href="?p=editar-perfil" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="<?php echo $ExibirNome; ?>"><span class="fa fa-user stroke-transparent"></span></a> 						
                    </li>
                    <?php echo RedesSociais(); ?> 
                    <!-- END LANG BAR -->
                </ul>
                <!-- END X-NAVIGATION VERTICAL --> 
                
<?php
}else{
	echo Redirecionar('login.php');
}
?>