<?php @session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/templateCliente.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>E-TIcons, Empresa de tecnologia</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<link rel="stylesheet" href="jquery/skin.css" media="screen" />
<link rel="stylesheet" href="css/cssCliente.css" media="screen"/>
<script type="text/javascript" src="jquery/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="jquery/jquery-themeswitchertool.js"></script>
<script type="text/javascript" src="jquery/jquery-clientes.js"></script>
</head>
<body>
<?php
$usuarioLogado = $_SESSION['usuarioCliente'];
if($usuarioLogado == NULL || $usuarioLogado == ""){ 
	header('location: ../login.php');
} else {
	$nivel = $_SESSION['nivel'];
	$display = ($nivel == '2' ? '' : 'none');
?>
<div class="tudo">
  <div class="topoAdmin">
    <div class="topo_int"> <img src="imagens/bg_topo_esq_preto.png" align="left"/>
      <div class="opcoes_topo"> 
        <form action="./Servico.php" method="post" name="formSair">
          <input type="hidden" name="metodo" value="GerenciadorUsuario.sair" />
          <ul id="menuTopo">
            <li class="usuario" id="usuario"><?php echo @utf8_encode($usuarioLogado); ?></li>
            <li><span class="ui-icon ui-icon-close"></span><a onclick="javascript:formSair.submit();">Sair</a></li>
            <li><span class="ui-icon ui-icon-gear"></span><a href="configuracoes.php" title="Configurações">Opções</a></li>
            <li><span class="ui-icon ui-icon-home"></span><a href="inicio.php" title="Inicio">Home</a></li>
            <li><span class="ui-icon ui-icon-help"></span><a href="ajuda.php" title="Ajuda/Help-Desk">Ajuda</a></li>
            <li><span class="ui-icon ui-icon-contact"></span><a href="contato.php" title="Contato">Contato</a></li>
            <li style="display:<?php echo $display; ?>;"><span class="ui-icon ui-icon-mail-closed"></span><a href="email.php" title="Enviar E-mail">E-mail</a></li>
          </ul>
        </form>
      </div>
      <!-- opcoes_topo -->
      <div class="logomarca"><img src="imagens/areacliente.png"/></div>
      <img src="imagens/bg_topo_dir_preto.png" align="right"/> </div>
    <!-- topo_int --> 
  </div>
  <!-- topo -->
  <div class="menu_sup">
    <ul>
      <li><a href="inicio.php"><img src="imagens/home.png" align="absmiddle" /> Home</a></li>
      <li><a href="downloads.php"><img src="imagens/downloads.png" align="absmiddle"/> Downloads</a></li>
      <li><a href="sugestoes.php"><img src="imagens/sugestoes.png" align="absmiddle"/> Sugestões</a></li>
      <li style="display:<?php echo $display; ?>"><a href="usuarios.php"><img src="imagens/usuarios.png" align="absmiddle" /> Usuários</a></li>
      <li style="display:<?php echo $display; ?>"><a href="clientes.php"><img src="imagens/clientes.png" align="absmiddle" /> Clientes</a></li>
      <li style="display:<?php echo $display; ?>"><a href="sistemas.php"><img src="imagens/sistemas.png" align="absmiddle"/> Sistemas</a></li>
      <li style="display:<?php echo $display; ?>"><a href="noticias.php"><img src="imagens/noticias.png" align="absmiddle" /> Notícias</a></li>
      <li style="display:<?php echo $display; ?>"><a href="interessados.php"><img src="imagens/interessados.png" align="absmiddle" /> Interessados</a></li>
    </ul>
    <div class="titulo_pagina"><!-- InstanceBeginEditable name="titulo" --><div class="ui-corner-all ui-widget ui-widget-header"><span class="ui-icon ui-icon-mail-open"></span><span class="titulo">Meus Chamados</span></div><!-- InstanceEndEditable --> </div>
  </div>
  <!-- menu_sup -->
  <div class="conteudo"> <!-- InstanceBeginEditable name="conteudo" -->
  <script type="text/javascript" src="jquery/jquery.maskedinput-1.3.min.js"></script>
  <script type="text/javascript">
  $(function(){
		$('#dialogChamado').dialog({autoOpen: false, width: 700, modal:true, position: 'top'});
		$('#data').datepicker({dateFormat:'dd/mm/yy',showOn:"button",buttonImage:"imagens/calendar.png",buttonImageOnly:true });
		$("#data").mask("99/99/9999");
		$('#todos').button();
	});
  	function editarChamado(codigo){
		$('#dialogChamado').dialog('open');
		$.post('detalheChamado.php',{ codigo: codigo }, function(data){ $('#chamado').html(data); $('#dialogChamado').dialog('open');});
	}
  </script>
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
include 'beans/GerenciadorHelpDesk.class.php';
/****** Verificação temporária para usuário 'admin' ********/
$verficador = unserialize($_SESSION['usuarioLogadoSerial']);
if($verficador->getId() != 1){
	
$service = ServiceMessages::getInstancia(); $service->printMessage();

$assunto = (!empty($_REQUEST['assunto']) ? $_REQUEST['assunto'] : "");
$status = (!empty($_REQUEST['status']) ? $_REQUEST['status'] : "");
$data = (!empty($_REQUEST['data']) ? $_REQUEST['data'] : "");
$todos = (!empty($_REQUEST['todos']) ? $_REQUEST['todos'] : "");
?>
<div class="formulario">

<div align="center"><img src="imagens/cone.png"/><h2>Ainda não disponível.</h2></div>

<!--
<div style="overflow:hidden;"><button type="button" onclick="javascript: window.history.back();" class="botao"><span class="voltar">Voltar</span></button>
<img src="imagens/status/legenda.jpg" align="right"/></div>
<div class="ui-widget ui-widget-content ui-corner-top menu_extra">
  	<form action="meusChamados.php" method="get">
    	<table>
        	<tr>
            <td>Assunto:</td><td><input type="text" name="assunto" id="assunto" class="ui-widget ui-widget-content ui-corner-right campoLogin" value="<?php echo $assunto; ?>"/></td>
            <td>Status:</td><td><select name="status" id="status" class="ui-widget ui-widget-content campoSelect">
                <option value="">...</option>
            		<?php 
						$statuss = array(1=>"Novo",2=>"Recebido",3=>"Finalizado",4=>"Cancelado",5=>"Pendente",6=>"Andamento");
						foreach($statuss as $i => $s){
							if($status == $i) { echo "<option value=\"".$status."\" selected>".$s."</option>"; }
							else { echo "<option value=\"".$i."\">".$s."</option>"; }
						}
					?>
                </select></td>
            <td>Data:</td><td><input type="text" name="data" id="data" maxlength="10" size="10" value="<?php echo $data; ?>"/></td>
            <td><input type="checkbox" id="todos" name="todos" value="todos" <?php echo ($todos != "" ? "checked" : ""); ?>/><label for="todos">Todos</label></td>
            	<td align="right"><button type="submit" class="botao"><span class="buscar">Buscar</span></button></td>
            </tr>
        </table>
    </form>
  </div>
<?php
  if($assunto != "" || $status != "" || $data != "" || $todos != ""){
  	$helpdeskMB = new GerenciadorHelpDesk();
  	$chamados = $helpdeskMB->buscaChamadosUsuario($assunto, $status, $data, $todos);
  } else { $chamados = array(); }
?>
<div class="sistemas" id="chamados">
<ul>
<?php
foreach($chamados as $c){
	echo "<li class=\"ui-widget ui-widget-content ui-corner-all\">
			<div class=\"arquivo\"><img src=\"imagens/status/".$c->getStatusChamado().".png\">
				<span class=\"titulo\">".utf8_encode($c->getUsuario())."</span><br />".utf8_encode($c->getCliente())."
		  	<div class=\"data\">".utf8_encode($c->getDataEnvio())."</div></div>
			<div class=\"download\"><div class=\"versao\"><span class=\"miniTexto\">Código:</span> ".$c->getCodigo()."
			<br /><span class=\"miniTexto\">Sistema:</span> ".utf8_encode($c->getSistema())."</div>
			<img src=\"imagens/visualizar.png\" title=\"Detalhar chamado\" onclick=\"editarChamado(".$c->getCodigo().");\"/></div></li>";
}
?></ul>
</div>

-->
</div>

<div id="dialogChamado" title="Detalhe do chamado" class="dialogs">
	<p id="chamado">Aguarde...</p>
</div>
<?php
} else {
	echo '<h2 style="margin:100px 0;" align="center">Para utilizar estas funcionalidades você deverá se <a href="../usuario.php">cadastrar</a> com um Login e uma Senha própria!</h2>';
}
?>
  <!-- InstanceEndEditable --> </div>
  <!-- conteudo -->
  <div class="rodape" id="rodape">&copy; 2008 E-Ticons, Todos os direitos reservados
    <div align="center">- www.e-ticons.com.br, fone/fax: (83) 3241-9973 -</div>
  </div>
  <span id="log" class="ajaxStatus"><img src="imagens/ajaxload.gif"/></span> </div>
<!-- tudo --> 
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-27091929-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
<?php } ?>
</body>
<!-- InstanceEnd --></html>
