include_once 'class/master.inc.php'; $usuario = new Usuario(); $chamado = new Chamado(); $categoria = new Categoria(); if (isset($_GET)) { switch ($_GET['action']) { case 'abrir': $chamado->CriarChamado($usuario->GetId($_SESSION['login']), utf8_decode($_POST['titulo']), utf8_decode($_POST['mensagem']), $_POST['os'], $_POST['categoria']); $tplMensagem = '<p class="success" id="sucesso">Helpdesk aberto com sucesso.</p>'; break; } } $tplCategoria = "<option>(vazio)</option>"; if ($categoria->RetornarCategorias()) { foreach ($categoria->RetornarCategorias() as $cat) { $tplCategoria .= "<option value='" . $cat['id_categoria'] . "'>" . $cat['descricao'] . "</option>"; } } $tplHelpdeskAberto = ""; $todosChamados = $chamado->GetTodosChamados('', $usuario->GetId($_SESSION['login']), ''); if ($todosChamados != "") { foreach ($todosChamados as $helpdesk) { $tplHelpdeskAberto .= '<p><a href="detalhe.php?id=' . $helpdesk['id_chamado'] . '" class="tooltip" title="' . utf8_encode($helpdesk['titulo']) . '">' . $helpdesk['id_chamado'] . '</a> - <strong>' . $categoria->GetDescricao($helpdesk['categoria']) . '</strong> - OS ' . $helpdesk['os'] . ' - ' . utf8_encode($helpdesk['titulo']) . ' </p>'; } } else { $tplHelpdeskAberto = "<blockquote>Nenhum helpdesk aberto no momento.</blockquote>"; } $pagina = new Template('templates/principal.tpl'); $pagina->trocarTags(array('CABECALHO' => 'templates/cabecalho.tpl', 'RODAPE' => 'templates/rodape.tpl', 'MENU' => getMenu(), 'USUARIO' => $usuario->GetNome($_SESSION['login']), 'CATEGORIA' => $tplCategoria, 'HELPDESK_ABERTO' => $tplHelpdeskAberto, 'MENSAGEM' => $tplMensagem)); $pagina->mostrar();
$helpdesk = $chamado->GetTodosChamados($_SESSION['filtros'], $_SESSION['grupo'] == "USUARIO" ? $usuario->GetId($_SESSION['login']) : ''); if ($helpdesk) { foreach ($helpdesk as $hd) { if ($hd['atendimento'] == 0) { $atendimento = "<span class='tooltip' title='Não Atendido'><img src='images/atender.png' /></span>"; $class = "atender"; } else { if (!$hd['finalizado']) { $atendimento = "<span class='tooltip' title='Em Atendimento'><img src='images/atendendo.png' /></span>"; $class = "atendendo"; } else { $atendimento = "<span class='tooltip' title='Finalizado'><img src='images/atendido.png' /></span>"; $class = "atendido"; } } $tplHelpdesks .= '<tr><td><a href="detalhe.php?id=' . $hd['id_chamado'] . '">' . $hd['id_chamado'] . '</a></td><td>' . $hd['data_abertura'] . '</td><td>' . $hd['ultima_resp'] . '</td><td>' . $hd['totalGasto'] . '</td><td>' . $hd['usuario'] . '</td><td>' . $categoria->GetDescricao($hd['categoria']) . '</td><td>' . $hd['os'] . '</td><td><a href="#' . $hd['id_chamado'] . '" class="toggle id">' . utf8_encode($hd['titulo']) . '</a></td><td>' . $atendimento . '</td><td>' . $hd['atendente'] . '</td></tr>'; $tplHelpdesks .= '<tr id="' . $hd['id_chamado'] . '" class="mensagem ' . $class . '"><td colspan="11">' . utf8_encode($hd['mensagem']) . '</td></tr>'; } } $tplOsSelect = "<option value=''>(vazio)</option>\n\t\t\t\t\t<option value='5048'\t" . ($_SESSION['filtros']['os'] == '5048' ? 'selected' : '') . "\t>5048</option>\n\t\t\t\t\t<option value='5000'\t" . ($_SESSION['filtros']['os'] == '5000' ? 'selected' : '') . "\t>5000</option>"; $tplStatus = "<option value=''>(vazio)</option>\n\t\t\t\t\t\t<option value='naoAtendido'\t\t" . ($_SESSION['filtros']['status'] == 'naoAtendido' ? 'selected' : '') . "\t>Não Atendido</option>\n\t\t\t\t\t\t<option value='emAtendimento'\t" . ($_SESSION['filtros']['status'] == 'emAtendimento' ? 'selected' : '') . "\t>Em Atendimento</option>\n\t\t\t\t\t\t<option value='finalizado'\t\t" . ($_SESSION['filtros']['status'] == 'finalizado' ? 'selected' : '') . "\t>Finalizado</option>"; $tplCategoria = "<option value=''>(vazio)</option>"; if ($categoria->RetornarCategorias()) { foreach ($categoria->RetornarCategorias() as $cat) { $tplCategoria .= "<option value='" . $cat['id_categoria'] . "' " . ($_SESSION['filtros']['categoria'] == $cat['id_categoria'] ? 'selected' : '') . ">" . $cat['descricao'] . "</option>"; } } if (isset($_SESSION['filtros'])) { $tplLimparFiltro = "<a href='?action=limparFiltro' class='tooltip' title='Limpar Filtro'><img id='deletar' src='images/delete.png' /></a>"; } $pagina = new Template('templates/consultar.tpl');