D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso_ant
/
adm
/
app
/
gre
/
Models
/
Filename :
GreEditarIntercorrencia.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreEditarAcomo * * @copyright (c) year, Carlos Marques - CM */ class GreEditarIntercorrencia { private $Resultado; private $Dados; private $DadosId; private $substituicao = array( ' ' => '', '_' => '', '/' => '', '.' => '', ',' => '.', '(' => '', ')' => ''); function getResultado() { return $this->Resultado; } public function verIntercor($DadosId) { // var_dump($DadosId); $this->DadosId = (int) $DadosId; $verIntercor = new \App\adms\Models\helper\AdmsRead(); $verIntercor->fullRead("select intercor.*, tipo.nome tipo_nome, resid.id resid_id, resid.nome resid_nome, sit.nome nome_sit, cr.cor cor_cr FROM gre_intercorrencia intercor join gre_residente resid on resid.id = intercor.gre_residente_id join gre_tipo_intercorrencia tipo on tipo.id = intercor.gre_tipo_intercorrencia_id INNER JOIN gre_status_intercor sit ON sit.id=intercor.adms_sit_id INNER JOIN adms_cors cr ON cr.id= sit.adms_cor_id WHERE intercor.id =:intercor_id LIMIT :limit", "intercor_id=" . $this->DadosId . "&limit=1"); $this->Resultado = $verIntercor->getResultado(); return $this->Resultado; } public function altIntercor(array $Dados) { $this->Dados = $Dados; $this->updateEditIntercor(); } private function updateEditIntercor() { $this->Dados['modified'] = date("Y-m-d H:i:s"); $this->Dados['gre_empr_princ_id'] = $_SESSION['id_user']; $this->Dados['modified'] = date("Y-m-d H:i:s"); // var_dump($this->Dados); $upAltIntercor = new \App\adms\Models\helper\AdmsUpdate(); $upAltIntercor->exeUpdate("gre_intercorrencia", $this->Dados, "WHERE id =:id", "id=" . $this->Dados['id']); if ($upAltIntercor->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Intercorrência atualizada com sucesso! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = true; } else { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Intercorrência não foi atualizada! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></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 gre_status_intercor ORDER BY nome ASC"); $registro['sit'] = $listar->getResultado(); $this->Resultado = ['sit' => $registro['sit']]; return $this->Resultado; } }