/
ajaxcomponentesexame.php
81 lines (63 loc) · 2.43 KB
/
ajaxcomponentesexame.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
//--utf8_encode --
include_once 'cls/conexao.class.php';
include_once 'cls/tipoexame.class.php';
include_once 'cls/componenteexame.class.php';
include_once 'inc/comuns.inc.php';
function Main()
{
header('Content-Type: text/html; charset=iso-8859-1');
$tpl = file_get_contents("tpl/cad-componenteexame.html");
$codexame = base64_decode($_POST["c"]);
$registro = base64_decode($_POST['r']);
$tpl = str_replace("<!--hdnCodigoExame-->", $_POST["c"], $tpl);
$tpl = str_replace("<!--nomeexame-->", TipoExame::ConsultaNomeExame($codexame), $tpl);
// Lista os componentes já cadastrados
$componentes = new Componente();
$componentes->setCodexame($codexame);
if ($registro == "")
{
$tpl = str_replace("<!--txtDescricao-->", "", $tpl);
$tpl = str_replace("<!--hdnCodigoComp-->", "", $tpl);
}
else
{
$componentes->setCodcomponente($registro);
$retorno = $componentes->Carrega();
$tpl = str_replace("<!--txtDescricao-->", $retorno->getDescricao(), $tpl);
$tpl = str_replace("<!--hdnCodigoComp-->", base64_encode($retorno->getCodcomponente()), $tpl);
}
$rs = $componentes->Lista();
if ( count($rs) > 0 )
{
$tab = Comuns::TopoTabelaListagem(
"Componentes cadastrados",
"componentes",
array('Descrição', 'Ações')
);
foreach ($rs as $comp)
{
$excri = base64_encode($comp->CodExame);
$compcri = base64_encode($comp->Codigo);
$tab .= ' <tr id="' . $excri . '_' . $compcri . '">';
$tab .= ' <td>' . $comp->Descricao . '</td>';
$tab .= ' <td>';
$tab .= ' <a href="javascript:void(0);" onclick="javascript:fntEditaComponente(\'' . $excri . '\',\'' . $compcri . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
$tab .= ' <a href="javascript:void(0);" onclick="javascript:fntDeletaComponente(\'' . $excri . '\',\'' . $compcri . '\')">' . Comuns::IMG_ACAO_DELETAR . '</a>';
$tab .= ' <a href="javascript:void(0);" onclick="javascript:fntAbreValorRef(\'' . $excri . '\',\'' . $compcri . '\')">' . Comuns::IMG_ACAO_VALORES_REF . '</a>';
$tab .= ' <a href="javascript:void(0);" onclick="javascript:fntMoverComponente(\'' . $excri . '\',\'' . $compcri . '\')">' . Comuns::IMG_ACAO_MOVER . '</a>';
$tab .= ' </td>';
$tab .= ' </tr>';
}
$tab .= ' </tbody>';
$tab .= '</table>';
}
else
{
$tab = "<br />@lng[Nenhum componente cadastrado]";
}
$tpl = str_replace("<!--tabela-->", $tab, $tpl);
echo( Comuns::Idioma($tpl) );
}
Main();
?>