educar_cliente_det.php
5.81 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
<?php
/**
*
* @author Prefeitura Municipal de Itajaí
* @updated 29/03/2007
* Pacote: i-PLB Software Público Livre e Brasileiro
*
* Copyright (C) 2006 PMI - Prefeitura Municipal de Itajaí
* ctima@itajai.sc.gov.br
*
* Este programa é software livre, você pode redistribuí-lo e/ou
* modificá-lo sob os termos da Licença Pública Geral GNU, conforme
* publicada pela Free Software Foundation, tanto a versão 2 da
* Licença como (a seu critério) qualquer versão mais nova.
*
* Este programa é distribuído na expectativa de ser útil, mas SEM
* QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI-
* ZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con-
* sulte a Licença Pública Geral GNU para obter mais detalhes.
*
* Você deve ter recebido uma cópia da Licença Pública Geral GNU
* junto com este programa. Se não, escreva para a Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307, USA.
*
*/
require_once ("include/clsBase.inc.php");
require_once ("include/clsDetalhe.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 - Cliente" );
$this->processoAp = "603";
}
}
class indice extends clsDetalhe
{
/**
* Titulo no topo da pagina
*
* @var int
*/
var $titulo;
var $cod_cliente;
var $ref_cod_cliente_tipo;
var $ref_usuario_exc;
var $ref_usuario_cad;
var $ref_idpes;
var $login;
var $senha;
var $data_cadastro;
var $data_exclusao;
var $ativo;
var $suspenso;
var $pessoa_logada;
var $ref_cod_biblioteca;
function Gerar()
{
$this->titulo = "Cliente - Detalhe";
$this->cod_cliente = $_GET["cod_cliente"];
$this->ref_cod_biblioteca = $_GET["ref_cod_biblioteca"];
$tmp_obj = new clsPmieducarCliente( $this->cod_cliente );
$registro = $tmp_obj->lista( $this->cod_cliente, null, null, null, null, null, null, null, null, null, null, null, null, $this->ref_cod_biblioteca );
if( ! $registro )
{
$this->simpleRedirect('educar_cliente_lst.php');
}
else {
foreach ( $registro as $cliente )
{
if( $cliente["nome"] )
{
$this->addDetalhe( array( "Cliente", "{$cliente["nome"]}") );
}
if( $cliente["login"] )
{
$this->addDetalhe( array( "Login", "{$cliente["login"]}") );
}
$obj_banco = new clsBanco();
$sql_unico = "SELECT ref_cod_motivo_suspensao
FROM pmieducar.cliente_suspensao
WHERE ref_cod_cliente = {$cliente["cod_cliente"]}
AND data_liberacao IS NULL
AND EXTRACT ( DAY FROM ( NOW() - data_suspensao ) ) < dias";
$motivo = $obj_banco->CampoUnico( $sql_unico );
if ( is_numeric( $motivo ) ) {
$this->addDetalhe( array( "Status", "Suspenso" ) );
$obj_motivo_suspensao = new clsPmieducarMotivoSuspensao( $motivo );
$det_motivo_suspensao = $obj_motivo_suspensao->detalhe();
$this->suspenso = $motivo;
$this->addDetalhe( array( "Motivo da Suspensão", "{$det_motivo_suspensao["nm_motivo"]}" ) );
$this->addDetalhe( array( "Descrição", "{$det_motivo_suspensao["descricao"]}" ) );
}
else
$this->addDetalhe( array( "Status", "Regular" ) );
$tipo_cliente = $obj_banco->CampoUnico("SELECT nm_tipo FROM pmieducar.cliente_tipo WHERE ref_cod_biblioteca IN (SELECT ref_cod_biblioteca FROM pmieducar.biblioteca_usuario WHERE ref_cod_usuario = '$this->pessoa_logada') AND cod_cliente_tipo = (SELECT ref_cod_cliente_tipo FROM pmieducar.cliente_tipo_cliente WHERE ref_cod_cliente = '$this->cod_cliente' AND ref_cod_biblioteca = '$this->ref_cod_biblioteca')");
if(is_string($tipo_cliente))
{
$this->addDetalhe(array("Tipo", $tipo_cliente));
}
}
}
$obj_permissoes = new clsPermissoes();
if( $obj_permissoes->permissao_cadastra( 603, $this->pessoa_logada, 11 ) )
{
$this->url_novo = "educar_cliente_cad.php";
$this->url_editar = "educar_cliente_cad.php?cod_cliente={$cliente["cod_cliente"]}&ref_cod_biblioteca={$this->ref_cod_biblioteca}";
if ( is_numeric( $this->suspenso ) ) {
$this->array_botao = array( "Liberar" );
$this->array_botao_url = array( "educar_define_status_cliente_cad.php?cod_cliente={$cliente["cod_cliente"]}&ref_cod_biblioteca={$this->ref_cod_biblioteca}&status=liberar" );
}
else {
$this->array_botao = array( "Suspender" );
$this->array_botao_url = array( "educar_define_status_cliente_cad.php?cod_cliente={$cliente["cod_cliente"]}&ref_cod_biblioteca={$this->ref_cod_biblioteca}&status=suspender" );
}
}
$this->url_cancelar = "educar_cliente_lst.php";
$this->largura = "100%";
$this->breadcrumb('Detalhe do cliente', [
url('intranet/educar_biblioteca_index.php') => 'Biblioteca',
]);
}
}
// 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();
?>