D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
crsys
/
adm
/
app
/
gre
/
Models
/
Beneficiamento
/
Filename :
ModCadastrarBeneficiamento.php
back
Copy
<?php namespace App\gre\Models\Beneficiamento; if (!defined('URL')) { header("Location: /"); exit(); } class ModCadastrarBeneficiamento { private $Resultado; private $Dados; private $substituicao = array( ' ' => '', '_' => '', '-' => '', '/' => '', '.' => '', ',' => '.', '(' => '', ')' => '' ); function getResultado() { return $this->Resultado; } public function cadBeneficiamento(array $Dados) { $this->Dados = $Dados; $this->retiraMasc(); date_default_timezone_set ("America/Sao_Paulo"); $this->Dados['created'] = date("Y-m-d H:i:s"); $this->Dados['usu_created'] = $_SESSION['usuario_id']; $this->Dados['empr_id'] = $_SESSION['id_user']; $this->Dados['gre_sit_id'] = 1; // var_dump( $this->Dados ); // die; $cadBeneficiamento= new \App\adms\Models\helper\AdmsCreate; $cadBeneficiamento->exeCreate("gre_beneficiamentos", $this->Dados); if ($cadBeneficiamento->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success alert-dismissible fade show' role='alert'> Beneficiamento cadastrado com sucesso! <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'> </button> </div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger alert-dismissible fade show' role='alert'> Erro: Beneficiamento não foi cadastrado! <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'> </button> </div>"; $this->Resultado = false; } } public function listarCadastrar() { $listar = new \App\adms\Models\helper\AdmsRead(); $listar->fullRead("SELECT id id_sit, nome nome_sit FROM adms_sits ORDER BY nome ASC"); $registro['sit'] = $listar->getResultado(); $this->Resultado = ['sit' => $registro['sit']]; return $this->Resultado; } private function retiraMasc() { if(isset($this->Dados['preco'])) { $this->Dados['preco'] = strtr($this->Dados['preco'] , $this->substituicao); } } }