D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso_ant
/
adm
/
app
/
gre
/
Models
/
Filename :
GreApagarFilial.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreApagarFilial * * @copyright (c) year, Carlos Marques - CM */ class GreApagarFilial { private $DadosId; private $Resultado; private $Dados; private $DadosFilialInferior; function getResultado() { return $this->Resultado; } public function apagarFili($DadosId = null) { $this->DadosId = (int) $DadosId; $this->verfAla(); if ($this->Resultado) { $apagarFili = new \App\adms\Models\helper\AdmsDelete(); $apagarFili->exeDelete("gre_filial", "WHERE id =:id", "id={$this->DadosId}"); if ($apagarFili->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Unidade excluida 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: Unidade não foi excluida! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } } private function verfAla() { $verAla = new \App\adms\Models\helper\AdmsRead(); $verAla->fullRead("SELECT id FROM gre_alas a WHERE a.gre_filial_id = {$this->DadosId} and a.gre_empr_princ_id = {$_SESSION['id_user']} LIMIT 1"); if ($verAla->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Filial não pode ser apagada, existem Alas com essa Filial <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } else { $this->Resultado = true; } } }