Exemplo n.º 1
0
     $uploadFile = $uploadDir . $name_atual;
     $extension = pathinfo($file_atual['name'], PATHINFO_EXTENSION);
     $uploadFile = $uploadFile . '.' . $extension;
     $name_atual = $name_atual . '.' . $extension;
     /*Subir o arquivo*/
     move_uploaded_file($file_atual['tmp_name'], $uploadFile);
 }
 $retorno = $DAO->Gravar($cadastro, $name_atual);
 if (is_array($retorno)) {
     print_r($retorno);
 } else {
     $retorno_obs = $DAO->GravarComentario($cadastro->getObservacao(), $retorno, 'U', userId());
     if ($retorno_obs == 1) {
         // ---------Envio de e-mail-Inicio-----------------
         $msg = $cadastro->getObservacao();
         $retorno = $DAO->Listar("SELECT DISTINCT B.id, C.nome_guerra, B.email\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_PESSOAS . " B\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_USUARIOS . " C ON C.id_pessoa = B.id\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE B.id=35");
         $to = "";
         $cc = "";
         $to = substr($to, 0, -1);
         $return = sendEmail('*****@*****.**', $retorno, "Documento para Traducao", $msg, '2');
         $return = true;
         if ($return != true) {
             die($return);
         } else {
             echo '<script language= "JavaScript">alert("Registro cadastrado com sucesso");</script>';
             echo '<script language= "JavaScript">location.href="index.php";</script>';
         }
     } else {
         echo '<script language= "JavaScript">alert("Erro ao salvar comentario");</script>';
         echo '<script language= "JavaScript">location.href="new.php";</script>';
     }
Exemplo n.º 2
0
 function listarProjeto($id_check_list = null)
 {
     $DAO = new CadastroDAO();
     $retorno = $DAO->Listar("SELECT\r\n\t\t\t\t\t\t\t\t\tA.id,\r\n\t\t\t\t\t\t\t\t    A.nome_arquivo,\r\n\t\t\t\t\t\t\t\t\tB.nome AS disciplina\r\n\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_CHECK_LISTS . " A\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " B ON A.id_disciplina = B.id\r\n\t\t\t\t\t\t\t\tWHERE A.ativo = 'S' AND \r\n\t\t\t\t\t\t\t\t\t  A.status IN ('A', 'AC')");
     foreach ($retorno as $item) {
         if ($item['id'] == $id_check_list) {
             echo '<option selected="selected" value="' . $item['id'] . '">' . $item['nome_arquivo'] . ' (' . $item['disciplina'] . ')</option>';
         } else {
             echo '<option value="' . $item['id'] . '">' . $item['nome_arquivo'] . ' (' . $item['disciplina'] . ')</option>';
         }
     }
 }
Exemplo n.º 3
0
                echo '<script language= "JavaScript">alert("Documento Finalizado com sucesso");</script>';
                echo '<script language= "JavaScript">location.href="index.php";</script>';
            } else {
                print_r($retorno_obs);
            }
        } else {
            echo '<script language= "JavaScript">alert("Documento não foi finalizado!");</script>';
            echo '<script language= "JavaScript">location.href="index.php";</script>';
        }
    } else {
        echo '<script language= "JavaScript">alert("Anexe documento para Finalizar!");</script>';
        echo '<script language= "JavaScript">location.href="finaliza.php?id=' . $cadastro->getId() . '";</script>';
    }
} else {
    $id = limpaTexto($_GET['id']);
    $resultado = $DAO->Listar("SELECT\r\n\t\t\t\t\t\t\t\t\tA.id,\r\n\t\t\t\t\t\t\t\t\tB.id AS id_check_list,\r\n\t\t\t\t\t\t\t\t\tSUBSTRING(B.nome_arquivo, 1, 35) AS nome_arquivo,\r\n\t\t\t\t\t\t\t\t\tA.traducao,\r\n\t\t\t\t\t\t\t\t\tA.arquivo_atual,\r\n\t\t\t\t\t\t\t\t\tC.comentario,\r\n\t\t\t\t\t\t\t\t\tC.id AS id_comentario,\r\n\t\t\t\t\t\t\t\t\tD.nome AS disciplina\r\n\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_CHECK_LISTS . " B ON A.id_check_list = B.id\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_COMENTARIOS . " C ON A.id = C.id_documento\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " D ON B.id_disciplina = D.id\r\n\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\tA.excluido IS NULL\r\n\t\t\t\t\t\t\t\tAND B.status IN ('A', 'AC')\r\n\t\t\t\t\t\t\t\tAND A.id=" . $id);
    if ($resultado) {
        foreach ($resultado as $item) {
            $cadastro->setId($item['id']);
            $cadastro->setNomeArquivo($item['nome_arquivo']);
            $cadastro->setObservacao($item['comentario']);
            $cadastro->setDisciplina($item['disciplina']);
            if ($item['arquivo_atual'] != null) {
                $arquivo_atual = '<a href="' . EXTERNAL_ROOT_PORTAL . '/arquivos/' . $item['arquivo_atual'] . '" target="_blank">Baixar</a>';
                /*Edicao do nome, pra permanecer o mesmo quando for salvar*/
            } else {
                $arquivo_atual = '';
            }
        }
    } else {
        $cadastro->setId("");
Exemplo n.º 4
0
	    </thead>
	</table>
   <table style="width: 90%; max-height: 80%" class="corpo">
   <thead style="display: table-header-group;">
	    <tr>
	    	<th align="left">N&ordm;</th>
	    	<th align="left">Grupo</th>
	    	<th align="left">Obra</th>
	    	<th align="left" width="28%">C&oacute;digo do Documento</th>
	    	<th align="left">Disciplina</th>
	    </tr>
	</thead>
	
	<tbody class="bordasimples">
			<?php 
$resultado = $DAO->Listar("SELECT * FROM\n\t\t\t\t\t\t\t\t\t\t(SELECT\n\t\t\t\t\t\t\t\t\t\t\tA.id,\n\t\t\t\t\t\t\t\t\t\t\tB.nome_arquivo,\n\t\t\t\t\t\t\t\t\t\t    A.finalizado,\n\t\t\t\t\t\t\t\t\t\t\tC.nome AS disciplina,\n\t\t\t\t\t\t\t\t\t\t\tD.nome AS obra,\n\t\t\t\t\t\t\t\t\t\t\tE.nome AS grupo\n\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_CHECK_LISTS . " B \tON A.id_check_list = B.id\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " C \tON B.id_disciplina = C.id\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PROJETO_OBRA . " D \tON B.id_obra_codigo = D.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_GRUPOS . " E \tON A.id_grupo = E.id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\tA.excluido IS NULL\n\t\t\t\t\t\t\t\t\t\tAND B.status IN ('A', 'AC')\n\t\t\t\t\t\t\t\t\t\tAND A.finalizado IS NOT NULL\n\t\t\t\t\t\t\t\t\t\tORDER BY E.nome, D.nome, C.nome) X\n\t\t\t\t\t\t\t\t\t\tUNION ALL\n\t\t\t\t\t\t\t\t\t\tSELECT * FROM\n\t\t\t\t\t\t\t\t\t\t(SELECT\n\t\t\t\t\t\t\t\t\t\t\tA.id,\n\t\t\t\t\t\t\t\t\t\t\tB.nome AS nome_arquivo,\n\t\t\t\t\t\t\t\t\t\t    A.finalizado,\n\t\t\t\t\t\t\t\t\t\t\tC.nome AS disciplina,\n\t\t\t\t\t\t\t\t\t\t\tD.nome AS obra,\n\t\t\t\t\t\t\t\t\t\t\tE.nome AS grupo\n\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_TRADUCAO_ARQUIVOS . " B \tON SUBSTRING(A.id_check_list, 3, 11) = B.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_DISCIPLINAS . " C \t\t\tON B.id_disciplina = C.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_PROJETO_OBRA . " D \t\tON B.id_obra = D.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_GRUPOS . " E \t\tON A.id_grupo = E.id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t\tA.excluido IS NULL\n\t\t\t\t\t\t\t\t\t\tAND A.finalizado IS NOT NULL\n\t\t\t\t\t\t\t\t\t\tORDER BY E.nome, D.nome, C.nome) Y");
$count = 1;
foreach ($resultado as $item) {
    //Verifica se o usuario e o NGTM, se for so deixar visualizar se tiver permissao
    if ($id_empresa == 7 && $item['ntgm'] == 'S' || $id_empresa != 7) {
        echo '<tr>';
        echo '	<td align="right">' . $count . '</td>';
        echo '	<td>' . $item['grupo'] . '</td>';
        echo '	<td>' . $item['obra'] . '</td>';
        echo '	<td>' . $item['nome_arquivo'] . '</td>';
        echo '	<td>' . $item['disciplina'] . '</td>';
        echo '</tr>';
        $count += 1;
    }
}
?>
Exemplo n.º 5
0
 function listarEmpresa($id = null)
 {
     $DAO = new CadastroDAO();
     $retorno = $DAO->Listar("SELECT id, nome FROM " . MYSQL_BASE_EMPRESAS . " WHERE ativo = 'S'");
     foreach ($retorno as $item) {
         if ($item['id'] == $id) {
             echo '<option selected="selected" value="' . $item['id'] . '">' . $item['nome'] . '</option>';
         } else {
             echo '<option value="' . $item['id'] . '">' . $item['nome'] . '</option>';
         }
     }
 }
Exemplo n.º 6
0
<?php

include_once '../../includes.sys/ini.php';
include_once '../../includes.sys/metodos.php';
include_once '../DAO/CadastroDAO.php';
include_once '../Cadastro.class.php';
checkUserAuth(EXTERNAL_ROOT_PORTAL . '/index.php?error=true');
include_once '../../head.php';
if (!in_array(282, listarAcesso())) {
    echo '<script language= "JavaScript">location.href="index.php";</script>';
}
$cadastro = new Cadastro();
$DAO = new CadastroDAO();
$cadastro->setId($_GET['id']);
$resultado = $DAO->Listar("SELECT \t\r\n\t\t\t\t\t\t\t\t\tA.id, \r\n\t\t\t\t\t\t\t\t\tSUBSTRING(B.nome_arquivo, 1, 35) AS nome_arquivo, \r\n\t\t\t\t\t\t\t\t\tA.traducao,\r\n\t\t\t\t\t\t\t\t\tB.nome_arquivo AS arquivo_atual,\r\n\t\t\t\t\t\t\t\t\tA.arquivo_ingles,\r\n\t\t\t\t\t\t\t\t\tC.comentario,\r\n\t\t\t\t\t\t\t\t\tC.id AS id_comentario,\r\n\t\t\t\t\t\t\t\t\tD.nome AS disciplina\r\n\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_CHECK_LISTS . " B ON A.id_check_list = B.id\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_COMENTARIOS . " C ON A.id = C.id_documento\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " D ON B.id_disciplina = D.id\r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tA.excluido IS NULL\r\n\t\t\t\t\t\t\t\tAND B.status IN ('A', 'AC')\r\n\t\t\t\t\t\t\t\tAND C.pertence = 'U'\r\n\t\t\t\t\t\t\t\tAND A.id=" . $cadastro->getId() . "\r\n\t\t\t\t\t\t\t\tUNION ALL\r\n\t\t\t\t\t\t\t\tSELECT \t\r\n\t\t\t\t\t\t\t\t\tA.id, \r\n\t\t\t\t\t\t\t\t\tB.nome AS nome_arquivo, \r\n\t\t\t\t\t\t\t\t\tA.traducao,\r\n\t\t\t\t\t\t\t\t\tB.arquivo AS arquivo_atual,\r\n\t\t\t\t\t\t\t\t\tA.arquivo_ingles,\r\n\t\t\t\t\t\t\t\t\tC.comentario,\r\n\t\t\t\t\t\t\t\t\tC.id AS id_comentario,\r\n\t\t\t\t\t\t\t\t\t'' AS disciplina\r\n\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_TRADUCAO_ARQUIVOS . " B ON SUBSTRING(A.id_check_list, 3, 11) = B.id\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_COMENTARIOS . " C ON A.id = C.id_documento\r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tA.excluido IS NULL\r\n\t\t\t\t\t\t\t\tAND C.pertence = 'U'\r\n\t\t\t\t\t\t\t\tAND A.id=" . $cadastro->getId() . "\r\n\t\t\t\t\t\t\t\tGROUP BY A.id");
if ($resultado) {
    foreach ($resultado as $item) {
        $cadastro->setProjetoRelacionado($item['nome_arquivo']);
        $cadastro->setDisciplina($item['disciplina']);
        if ($item['arquivo_atual'] != null) {
            if ($cadastro->getDisciplina() == '') {
                $pasta_traducao = 'traducao_docs/';
            } else {
                $pasta_traducao = '';
            }
            $arquivo_atual = '<a href="' . EXTERNAL_ROOT_PORTAL . '/arquivos/' . $pasta_traducao . $item['arquivo_atual'] . '" target="_blank">Baixar</a>';
        } else {
            $arquivo_atual = '';
        }
        if ($item['arquivo_ingles'] != null) {
            $arquivo_ingles = '<a href="' . EXTERNAL_ROOT_PORTAL . '/arquivos/' . $item['arquivo_ingles'] . '" target="_blank">Baixar</a>';
Exemplo n.º 7
0
    $retorno = $DAO->Atualizar($cadastro, $name_atual);
    if ($retorno == 1) {
        $retorno_obs = $DAO->AtualizarComentario($cadastro->getObservacao(), $cadastro->getIdObservacao(), userId());
        if ($retorno_obs == 1) {
            echo '<script language= "JavaScript">alert("Registro alterado com sucesso");</script>';
            echo '<script language= "JavaScript">location.href="index.php";</script>';
        } else {
            echo '<script language= "JavaScript">alert("Erro ao salvar comentario");</script>';
            echo '<script language= "JavaScript">location.href="new.php";</script>';
        }
    } else {
        print_r($retorno);
    }
} else {
    $cadastro->setId($_GET['id']);
    $resultado = $DAO->Listar("SELECT \t\r\n\t\t\t\t\t\t\t\t\tA.id, \r\n\t\t\t\t\t\t\t\t\tB.id AS id_check_list, \r\n\t\t\t\t\t\t\t\t\tA.traducao,\r\n\t\t\t\t\t\t\t\t\tA.arquivo_atual,\r\n\t\t\t\t\t\t\t\t\tC.comentario,\r\n\t\t\t\t\t\t\t\t\tC.id \tAS id_comentario,\r\n\t\t\t\t\t\t\t\t\tD.nome \tAS disciplina,\r\n\t\t\t\t\t\t\t\t\tE.id \tAS id_grupo,\r\n\t\t\t\t\t\t\t\t\tF.nome \tAS empresa\r\n\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_CHECK_LISTS . " B \t\tON A.id_check_list = B.id\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_COMENTARIOS . " C ON A.id = C.id_documento\r\n\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " D \t\tON B.id_disciplina = D.id\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_GRUPOS . " E \t\tON A.id_grupo = E.id\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_EMPRESAS . " F \t\t\tON A.id_empresa = F.id\r\n\t\t\t\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t\t\t\tA.excluido IS NULL\r\n\t\t\t\t\t\t\t\tAND B.status IN ('A', 'AC')\r\n\t\t\t\t\t\t\t\tAND C.pertence = 'U'\r\n\t\t\t\t\t\t\t\tAND A.id=" . $cadastro->getId() . "\r\n\t\t\t\t\t\t\t\tUNION ALL\r\n\t\t\t\t\t\t\t\tSELECT \r\n\t\t\t\t\t\t\t\t    A.id,\r\n\t\t\t\t\t\t\t\t    id_check_list,\r\n\t\t\t\t\t\t\t\t    A.traducao,\r\n\t\t\t\t\t\t\t\t    A.arquivo_atual,\r\n\t\t\t\t\t\t\t\t    C.comentario,\r\n\t\t\t\t\t\t\t\t    C.id AS id_comentario,\r\n\t\t\t\t\t\t\t\t    ' ' AS disciplina,\r\n\t\t\t\t\t\t\t\t\tE.id AS id_grupo,\r\n\t\t\t\t\t\t\t\t\tF.nome \tAS empresa\r\n\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t    tb_traducao_documentos A\r\n\t\t\t\t\t\t\t\t\tINNER JOIN tb_traducao_arquivos B ON SUBSTRING(A.id_check_list, 3, 11) = B.id\r\n\t\t\t\t\t\t\t\t    LEFT JOIN " . MYSQL_BASE_TRADUCAO_COMENTARIOS . " C ON A.id = C.id_documento\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_GRUPOS . " E ON A.id_grupo = E.id\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_EMPRESAS . " F \t\t\tON A.id_empresa = F.id\r\n\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t    A.excluido IS NULL\r\n\t\t\t\t\t\t\t\tAND B.excluido IS NULL\r\n\t\t\t\t\t\t\t\tAND C.pertence = 'U'\r\n\t\t\t\t\t\t\t\tAND A.id = " . $cadastro->getId() . "\r\n\t\t\t\t\t\t\t\tGROUP BY A.id");
    if ($resultado) {
        foreach ($resultado as $item) {
            // 			$cadastro->setProjetoRelacionado();
            if (substr($item['id_check_list'], 0, 1) == 'D') {
                $id_check_list = '';
                $id_documento = substr($item['id_check_list'], 2, 11);
            } else {
                $id_check_list = $item['id_check_list'];
                $id_documento = '';
            }
            $cadastro->setDisciplina($item['disciplina']);
            if ($item['arquivo_atual'] != null) {
                $arquivo_atual = '<a href="' . EXTERNAL_ROOT_PORTAL . '/arquivos/' . $item['arquivo_atual'] . '" target="_blank">Baixar</a>';
                /*Edicao do nome, pra permanecer o mesmo quando for salvar*/
                $nome_atual = $item['arquivo_atual'];
Exemplo n.º 8
0
	</table>
   <table style="width: 90%; max-height: 80%" class="corpo">
   <thead style="display: table-header-group;">
	    <tr>
	    	<th align="left">N&ordm;</th>
	    	<th align="left">Grupo</th>
	    	<th align="left">Obra</th>
	    	<th align="left" width="28%">C&oacute;digo do Documento</th>
	    	<th align="left">Disciplina</th>
	    	<th align="left">Tradu&ccedil;&atilde;o</th>
	    </tr>
	</thead>
	
	<tbody class="bordasimples">
			<?php 
$resultado = $DAO->Listar("SELECT * FROM (SELECT \t\n\t\t\t\t\t\t\t\t\t\t\tA.id, \n\t\t\t\t\t\t\t\t\t\t\tB.nome_arquivo, \n\t\t\t\t\t\t\t\t\t\t\tA.traducao,\n\t\t\t\t\t\t\t\t\t\t\tCASE A.traducao\n\t\t\t\t\t\t\t\t\t\t\tWHEN 'S' THEN 'Liberado para Tradu&ccedil;&atilde;o' \n\t\t\t\t\t\t\t\t\t        WHEN 'N' THEN 'Aguardando o Arquivo' \n\t\t\t\t\t\t\t\t\t        ELSE 'N&atilde;o se Aplica'\n\t\t\t\t\t\t\t\t\t        END AS nome_traducao,\n\t\t\t\t\t\t\t\t\t\t    A.finalizado,\n\t\t\t\t\t\t\t\t\t\t\tC.nome AS disciplina,\n\t\t\t\t\t\t\t\t\t\t\tD.nome AS obra,\n\t\t\t\t\t\t\t\t\t\t\tE.nome AS grupo\n\t\t\t\t\t\t\t\t\t\tFROM " . MYSQL_BASE_TRADUCAO_DOCUMENTOS . " A\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_CHECK_LISTS . " B \tON A.id_check_list = B.id\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_DISCIPLINAS . " C \tON B.id_disciplina = C.id\n\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PROJETO_OBRA . " D \tON B.id_obra_codigo = D.id\n\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_GRUPOS . " E \tON A.id_grupo = E.id\n\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\tA.excluido IS NULL\n\t\t\t\t\t\t\t\t\t\tAND B.status IN ('A', 'AC')\n\t\t\t\t\t\t\t\t\t\tAND A.finalizado IS NULL \n\t\t\t\t\t\t\t\t\t\tORDER BY E.nome, D.nome, C.nome) X\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tUNION ALL\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tSELECT * FROM \n\t\t\t\t\t\t\t\t\t\t(SELECT \n\t\t\t\t\t\t\t\t\t\t    A.id,\n\t\t\t\t\t\t\t\t\t\t    B.nome AS nome_arquivo,\n\t\t\t\t\t\t\t\t\t\t    A.traducao,\n\t\t\t\t\t\t\t\t\t\t    CASE A.traducao\n\t\t\t\t\t\t\t\t\t\t        WHEN 'S' THEN 'Liberado para Tradu&ccedil;&atilde;o'\n\t\t\t\t\t\t\t\t\t\t        WHEN 'N' THEN 'Aguardando o Arquivo'\n\t\t\t\t\t\t\t\t\t\t        ELSE 'N�o se Aplica'\n\t\t\t\t\t\t\t\t\t\t    END AS nome_traducao,\n\t\t\t\t\t\t\t\t\t\t    A.finalizado,\n\t\t\t\t\t\t\t\t\t\t    C.nome AS disciplina,\n\t\t\t\t\t\t\t\t\t\t\tD.nome AS obra,\n\t\t\t\t\t\t\t\t\t\t\tE.nome AS grupo\n\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t    tb_traducao_documentos A\n\t\t\t\t\t\t\t\t\t\t    INNER JOIN " . MYSQL_BASE_TRADUCAO_ARQUIVOS . " B ON SUBSTRING(A.id_check_list, 3, 11) = B.id\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_DISCIPLINAS . " C \t\tON B.id_disciplina = C.id\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_PROJETO_OBRA . " D \tON B.id_obra = D.id\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . MYSQL_BASE_TRADUCAO_GRUPOS . " E \tON A.id_grupo = E.id\n\t\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t\t    A.excluido IS NULL\n\t\t\t\t\t\t\t\t\t\tAND A.finalizado IS NULL\n\t\t\t\t\t\t\t\t\t\tAND B.excluido IS NULL \n\t\t\t\t\t\t\t\t\t\tORDER BY E.nome, D.nome, C.nome) Y;");
$count = 1;
foreach ($resultado as $item) {
    //Verifica se o usuario e o NGTM, se for so deixar visualizar se tiver permissao
    if ($id_empresa == 7 && $item['ntgm'] == 'S' || $id_empresa != 7) {
        echo '<tr>';
        echo '	<td align="right">' . $count . '</td>';
        echo '	<td>' . $item['grupo'] . '</td>';
        echo '	<td>' . $item['obra'] . '</td>';
        echo '	<td>' . $item['nome_arquivo'] . '</td>';
        echo '	<td>' . $item['disciplina'] . '</td>';
        echo '	<td>' . $item['nome_traducao'] . '</td>';
        echo '</tr>';
        $count += 1;
    }
}