<?php ob_start(); @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.8.2.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.9.1.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-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>
          </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">
    <div class="titulo_pagina"><!-- InstanceBeginEditable name="titulo" -->
    <div class="ui-widget ui-corner-top"><span class="ui-icon ui-icon-signal-diag"></span><span class="titulo">Notícias</span></div><!-- InstanceEndEditable --></div>
    <ul id="menu_sup" class="ui-menu-horizontal">
      <li><a href="downloads.php"><span class="ui-icon ui-icon-arrowthickstop-1-s"></span>Downloads</a></li>
      <li><a><span class="ui-icon ui-icon-comment"></span>Sugestões</a>
        <ul><li style="display:<?php echo $display; ?>"><a href="sugestoes.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li><li><a href="cadastroSugestao.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li></ul>
      </li>
      <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-person"></span>Usuários</a>
      	<ul><li><a href="usuarios.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li><li><a href="usuario.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li><li><a href="solicitantes.php"><span class="ui-icon ui-icon-contact"></span>Solicitações</a></li>
        	<li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-contact"></span>Interessados</a><ul><li><a href="interessados.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li></ul></li>
        </ul>
      </li>
      <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-newwin"></span>Sistemas</a>
      	<ul><li><a href="sistemas.php"><span class="ui-icon ui-icon-gear"></span>Gerenciar</a></li><li><a href="cadastroSistema.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li><li><a href="downloads.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li></ul>
      </li>
      <li style="display:<?php echo $display; ?>"><a><span class="ui-icon ui-icon-signal-diag"></span>Notícias</a>
      	<ul><li><a href="noticias.php"><span class="ui-icon ui-icon-search"></span>Consultar</a></li><li><a href="cadastroNoticia.php"><span class="ui-icon ui-icon-plus"></span>Novo</a></li></ul>
      </li>
      <li><a><span class="ui-icon ui-icon-wrench"></span>Ferramentas</a>
      	<ul><li style="display:<?php echo $display; ?>"><a href="clientes.php"><span class="ui-icon ui-icon-suitcase"></span>Gerenciar Clientes</a></li><li style="display:<?php echo $display; ?>;"><a href="email.php"><span class="ui-icon ui-icon-mail-closed"></span>Enviar E-mail</a></li><li><a href="ajuda.php"><span class="ui-icon ui-icon-help"></span>Ajuda</a></li><li><a href="configuracoes.php"><span class="ui-icon ui-icon-gear"></span>Configurações</a></li><li><a href="inicio.php"><span class="ui-icon ui-icon-home"></span>Início</a></li><li><a onclick="javascript:formSair.submit();"><span class="ui-icon ui-icon-close"></span>Sair</a></li></ul>
      </li>
    </ul>
  </div>
  <!-- menu_sup -->
  <div class="conteudo"> <!-- InstanceBeginEditable name="conteudo" -->
  <?php if($nivel != "2"){ header("location: inicio.php"); } ?>
<script type="text/javascript" src="jquery/jquery.maskedinput-1.3.min.js"></script>
  <script type="text/javascript">
  	$(function() {
		$("#menu_opcoes").accordion({ collapsible: true, active: false });
		$("#dataNoticia").datepicker({dateFormat:'dd/mm/yy',showOn:"button",buttonImage:"imagens/calendar.png",buttonImageOnly:true }).css('display','inline-block');
		$("#dataNoticia").mask("99/99/9999");
		$('#dialogExcNot').dialog({autoOpen: false, width: 400, modal:true});
		$('#dialogAltNot').dialog({autoOpen: false, width: 800, modal:true, position:'top'});
	});
	function alterarNoticia(id){
		$.post("cadNoticia.php",{id:id},function(data){$('#altNoticia').html(data);});
		$('#dialogAltNot').dialog('open');
	}
	function deletarNoticia(id){
		$('#idNoticia').val(id);
		$('#dialogExcNot').dialog('open');
	}
  </script>
<div class="formulario">
 <form action="noticias.php" method="get">
  <div class="ui-widget ui-widget-content menus" align="right">
  	<div class="menus_esq">
      <?php
        require 'beans/GerenciadorNoticias.class.php';
		$noticiaMB = new GerenciadorNoticias();
		$noticiaMB->servico->printMessage();
	  	$valor = (!empty($_REQUEST['valor']) ? $_REQUEST['valor'] : "");
		$data = (!empty($_REQUEST['dataNoticia']) ? $_REQUEST['dataNoticia'] : "");
		$todos = (!empty($_REQUEST['todos']) ? $_REQUEST['todos'] : "");
		$total = 0;
		if($valor != "" || $data != "" || $todos != ""){
            $noticias = $noticiaMB->buscarNoticia($valor, $data);
			$total = count($noticias);
	  ?>
      <strong>Total: ( <strong id="totalClientes"> <?php echo $total; ?> </strong> )</strong>
      <a class="icone" title="Fim da página (Totais)" href="#fim"><span class="ui-icon ui-icon-triangle-1-s"></span></a>
      <?php } else { $noticias = array(); } ?>
    </div>
    <div class="menus_dir">
      <input type="checkbox"  name="todos" id="todos" value="todos" <?php echo $todos != "" ? "checked" : ""; ?>/><label for="todos">Todos</label>
      <button type="submit" class="button"><span class="ui-icon ui-icon-search"></span>Buscar</button>
    </div>
  </div>
  <div id="menu_opcoes" class="jquery">
    <h3>Opções de busca</h3>
	<div>
      <ul class="campos-vertical">
        <li>Busca <input type="text" name="valor" id="valor" class="ui-widget ui-widget-content ui-corner-all campo" size="50"/></li>
        <li>Data <br /><input type="text" id="dataNoticia" name="dataNoticia" size="20" class="ui-widget ui-widget-content ui-corner-left campo" value="<?php echo $data; ?>"></li>
      </ul>
     </div>
   </div> 
 </form>
 <ul id="noticias" class="noticias">
		 <?php
            foreach($noticias as $n){
                echo "<li class=\"ui-widget ui-widget-content ui-corner-all\">
						<div><table width=\"100%\"><tr><td class=\"titulo\">".utf8_encode($n->getTitulo())."</td>
							<td align=\"right\" class=\"data\">".$n->getDataNoticia()."</td></tr></table></div>
						<img src=\"noticias/".utf8_encode($n->getImagemUrl())."\"/>
						<div class=\"texto\"><div class=\"subtitulo\">".utf8_encode($n->getSubTitulo())."</div> ".utf8_encode($n->getTexto())."</div>
						<div class=\"ui-widget ui-widget-content ui-corner-all rodapeNoticia\"><div class=\"rodapeNoticiaEsq\">por: ".$n->getAutor()."</div>
						<div class=\"rodapeNoticiaDir\"><img src=\"imagens/editar.png\" title=\"Alterar\" onclick=\"alterarNoticia(".$n->getId().");\"/>
														<img src=\"imagens/del.png\" title=\"Deletar\" onclick=\"deletarNoticia(".$n->getId().");\"/></div></div>
					 </li>";
            }
        ?>
	</ul>
  <div class="ui-widget ui-widget-content menus">
    <a class="icone" title="Voltar ao topo" href="#top"><span class="ui-icon ui-icon-triangle-1-n"></span></a>
    <span class="button"><span class="ui-icon ui-icon-contact"></span> Total: <?php echo $total; ?></span>
  </div>
</div>
    
    <a name="fim"></a>
  
  
  <form method="post" action="Servico.php" id="formExcNoticia">
  	<input type="hidden" name="metodo" value="GerenciadorNoticias.excluirNoticia" />
  	<input type="hidden" id="idNoticia" name="id" />
  </form>
  <div id="dialogExcNot" title="Excluir Notícia" class="dialogs">
  	<p>Tem certeza que deseja excluir esta notícia?</p>
    <div class="ui-widget ui-widget-content ui-corner-all texto-conteudo" align="center">
    	<button type="button" onclick="javascript: $('#formExcNoticia').submit();" class="botao"><span class="ok">OK</span></button>
        <button type="button" onclick="javascript: $('#dialogExcNot').dialog('close');" class="botao"><span class="cancelar">Cancelar</span></button>
    </div>
  </div>
  
  <div id="dialogAltNot" title="Alterar Notícia" class="dialogs">
      <p><div class="formulario">
        <form method="post" action="Servico.php" name="formAltNoticia" onsubmit="return verificarCampos('titulo','subtitulo','data','hora','texto');" enctype="multipart/form-data">
			<input type="hidden" name="metodo" value="GerenciadorNoticias.alterarNoticia" />
        	<div id="altNoticia">carregando...</div>
        	<div class="ui-widget ui-widget-content ui-corner-all texto-conteudo menu_extra" align="center">
            <button type="button" class="button" onclick="javascript: $('#dialogAltNot').dialog('close');"><span class="ui-icon ui-icon-close"></span>Cancelar</button>
            <button type="submit" class="button"><span class="ui-icon ui-icon-check"></span>Salvar Alterações</button>
        	</div>
        </form>
     </div>
    </p>
  </div>
  <!-- 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>
