DocumentacaoPadrao.php
4.36 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
require_once ("include/clsBase.inc.php");
require_once ("include/clsCadastro.inc.php");
require_once ("include/clsBanco.inc.php");
require_once( "include/pmieducar/geral.inc.php" );
class clsIndexBase extends clsBase
{
function Formular()
{
$this->SetTitulo( "{$this->_instituicao} i-Educar - Documentação padrão" );
$this->processoAp = "578";
}
}
class indice extends clsCadastro
{
/**
* Referencia pega da session para o idpes do usuario atual
*
* @var int
*/
var $pessoa_logada;
/**
* Titulo no topo da pagina
*
* @var int
*/
var $titulo;
/**
* Quantidade de registros a ser apresentada em cada pagina
*
* @var int
*/
var $limite;
/**
* Inicio dos registros a serem exibidos (limit)
*
* @var int
*/
var $offset;
function Gerar()
{
$obj_usuario = new clsPmieducarUsuario($this->pessoa_logada);
$obj_usuario_det = $obj_usuario->detalhe();
$this->ref_cod_instituicao = $obj_usuario_det["ref_cod_instituicao"];
$obj_permissoes = new clsPermissoes();
$nivelUsuario = $obj_permissoes->nivel_acesso($this->pessoa_logada);
if ($nivelUsuario == 4){
$this->campoOculto( "ref_cod_instituicao", $this->ref_cod_instituicao );
$obj_instituicao = new clsPmieducarInstituicao();
$lst_instituicao = $obj_instituicao->lista($this->ref_cod_instituicao);
if (is_array($lst_instituicao)) {
$det_instituicao = array_shift($lst_instituicao);
$this->nm_instituicao = $det_instituicao['nm_instituicao'];
$this->campoRotulo('nm_instituicao', 'Institução', $this->nm_instituicao);
}
}
$this->largura = "100%";
$localizacao = new LocalizacaoSistema();
$localizacao->entradaCaminhos( array(
$_SERVER['SERVER_NAME']."/intranet" => "Início",
"educar_escola_index.php" => "Escola",
"" => "Documentação padrão"
));
$this->enviaLocalizacao($localizacao->montar());
$this->inputsHelper()->dynamic(array('instituicao'));
$opcoes_relatorio = array();
$opcoes_relatorio[""] = "Selecione";
$this->campoLista("relatorio", "Relatório", $opcoes_relatorio);
}
}
// cria uma extensao da classe base
$pagina = new clsIndexBase();
// cria o conteudo
$miolo = new indice();
// adiciona o conteudo na clsBase
$pagina->addForm( $miolo );
// gera o html
$pagina->MakeAll();
?>
<style type="text/css">
select#relatorio{
min-width: 180px;
}
</style>
<script>
var instituicaoId = document.getElementById('ref_cod_instituicao').value;
if (instituicaoId != '') {
var selectRelatorio = document.getElementById('relatorio');
selectRelatorio.length = 1;
getDocumento(instituicaoId);
}
document.getElementById('btn_enviar').style.display = 'none';
document.getElementById('ref_cod_instituicao').onchange = function()
{
var selectRelatorio = document.getElementById('relatorio');
if (this.selectedIndex!==0) {
selectRelatorio.length = 1;
selectRelatorio.disabled = true;
selectRelatorio.options[0].text = 'Carregando Relatorios';
var instituicaoId = document.getElementById('ref_cod_instituicao').value;
getDocumento(instituicaoId);
}else{
selectRelatorio.length = 1;
selectRelatorio.options[0].text = 'Selecione';
}
}
document.getElementById('relatorio').onchange = function()
{
if (this.selectedIndex!==0) {
window.open(this.value,'_blank');
}
}
function getDocumento(instituicaoId) {
var searchPath = '../module/Api/InstituicaoDocumentacao?oper=get&resource=getDocuments';
var params = {instituicao_id : instituicaoId}
var id = '';
var titulo = '';
var url = '';
$j.get(searchPath, params, function(data){
var documentos = data.documentos;
for (var i = 0; i < documentos.length; i++) {
var selectRelatorio = document.getElementById("relatorio");
var option = document.createElement("option");
selectRelatorio.options[0].text = 'Selecione um relatório';
selectRelatorio.disabled = false;
option.text = documentos[i].titulo_documento;
option.value = documentos[i].url_documento;
selectRelatorio.add(option);
}
});
}
</script>