Passed
Pull Request — master (#457)
by Eder
13:02
created

ieducar/intranet/acoes_categoria_cad.php (4 issues)

Labels
Severity
1
<?php
2
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3
    *                                                                        *
4
    *   @author Prefeitura Municipal de Itajaí                               *
5
    *   @updated 29/03/2007                                                  *
6
    *   Pacote: i-PLB Software Público Livre e Brasileiro                    *
7
    *                                                                        *
8
    *   Copyright (C) 2006  PMI - Prefeitura Municipal de Itajaí             *
9
    *                       [email protected]                           *
10
    *                                                                        *
11
    *   Este  programa  é  software livre, você pode redistribuí-lo e/ou     *
12
    *   modificá-lo sob os termos da Licença Pública Geral GNU, conforme     *
13
    *   publicada pela Free  Software  Foundation,  tanto  a versão 2 da     *
14
    *   Licença   como  (a  seu  critério)  qualquer  versão  mais  nova.    *
15
    *                                                                        *
16
    *   Este programa  é distribuído na expectativa de ser útil, mas SEM     *
17
    *   QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI-     *
18
    *   ZAÇÃO  ou  de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con-     *
19
    *   sulte  a  Licença  Pública  Geral  GNU para obter mais detalhes.     *
20
    *                                                                        *
21
    *   Você  deve  ter  recebido uma cópia da Licença Pública Geral GNU     *
22
    *   junto  com  este  programa. Se não, escreva para a Free Software     *
23
    *   Foundation,  Inc.,  59  Temple  Place,  Suite  330,  Boston,  MA     *
24
    *   02111-1307, USA.                                                     *
25
    *                                                                        *
26
    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
27
$desvio_diretorio = "";
28
require_once ("include/clsBase.inc.php");
29
require_once ("include/clsCadastro.inc.php");
30
require_once ("include/pmiacoes/geral.inc.php");
31
require_once( "include/Geral.inc.php" );
32
33
class clsIndex extends clsBase
34
{
35
    function Formular()
36
    {
37
        $this->SetTitulo( "{$this->_instituicao} Sistema de Cadastro de Ações do Governo - Cadastro de Categorias" );
38
        $this->processoAp = "552";
39
    }
40
}
41
42
class indice extends clsCadastro
43
{
44
    var $pessoa_logada;
45
    
46
    var $cod_categoria,
47
        $nm_categoria;
48
        
49
    function Inicializar()
50
    {
51
        $retorno = "Novo";
52
        @session_start();
53
         $this->pessoa_logada = $_SESSION['id_pessoa'];
54
        @session_write_close();
0 ignored issues
show
Are you sure the usage of session_write_close() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
55
        
56
        $this->cod_categoria = $_GET['cod_categoria'];
57
        
58
        if($this->cod_categoria)
59
        {
60
            $obj = new clsPmiacoesCategoria($this->cod_categoria);
61
            $detalhe  = $obj->detalhe();
62
            $this->nm_categoria = $detalhe['nm_categoria'];
63
            
64
            
65
            $obj_acao = new clsPmiacoesAcaoGovernoCategoria();
66
            $lista = $obj_acao->lista($this->cod_categoria);
67
            if(!$lista)
68
                $this->fexcluir = true;     
69
            
70
            
71
            $retorno = "Editar";
72
        }
73
        $this->url_cancelar = ($retorno == "Editar") ? "acoes_categoria_det.php?cod_categoria={$this->cod_categoria}" : "acoes_categoria_lst.php";
74
        $this->nome_url_cancelar = "Cancelar";
75
        return $retorno;
76
    }
77
78
    function Gerar()
79
    {
80
        $this->campoOculto("cod_categoria", $this->cod_categoria);
81
        $this->campoOculto("pessoa_logada", $this->pessoa_logada);
82
        $this->campoTexto("nm_categoria", "Nome", $this->nm_categoria,30,255,true);
83
    }
84
 
85
    function Novo() 
86
    {
87
        @session_start();
88
         $this->pessoa_logada = $_SESSION['id_pessoa'];
89
        @session_write_close();
0 ignored issues
show
Are you sure the usage of session_write_close() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
90
        $obj = new clsPmiacoesCategoria(null, null, $this->pessoa_logada, $this->nm_categoria, null, null, 1);
91
        if($obj->cadastra())
92
        {
93
            header("Location: acoes_categoria_lst.php");
94
        }
95
        return false;
96
    }
97
98
    function Editar() 
99
    {
100
        @session_start();
101
         $this->pessoa_logada = $_SESSION['id_pessoa'];
102
        @session_write_close();
0 ignored issues
show
Are you sure the usage of session_write_close() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
103
        $obj = new clsPmiacoesCategoria($this->cod_categoria, $this->pessoa_logada, null, $this->nm_categoria, null, null, 1);
104
        if($obj->edita())
105
        {
106
            header("Location: acoes_categoria_lst.php");
107
        }
108
        return false;
109
    }
110
111
    function Excluir()
112
    {
113
        @session_start();
114
         $this->pessoa_logada = $_SESSION['id_pessoa'];
115
        @session_write_close();
0 ignored issues
show
Are you sure the usage of session_write_close() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
116
        
117
        $obj_acao = new clsPmiacoesAcaoGovernoCategoria();
118
        $lista = $obj_acao->lista($this->cod_categoria);
119
        if($lista)   
120
            echo "<script>alert('Não é possível excluir o registro! \n Existe ação utilizando esta categoria');window.location = \"acoes_categoria_lst.php\";</script>";
121
        
122
            $obj = new clsPmiacoesCategoria($this->cod_categoria, $this->pessoa_logada, null, $this->nm_categoria, null, null, 0);  
123
        $obj->excluir();
124
        header("Location: acoes_categoria_lst.php");
125
        return true;
126
    }
127
}
128
129
$pagina = new clsIndex();
130
$miolo = new indice();
131
$pagina->addForm( $miolo );
132
$pagina->MakeAll();
133
?>
134