D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Controllers
/
Filename :
EditarAcolhimento.php
back
Copy
<?php namespace App\gre\Controllers; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of EditarAcolhimento * * @copyright (c) year, Carlos Marques - CM */ class EditarAcolhimento { private $Dados; private $DadosId; public function editAcolh($DadosId = null) { $this->Dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); $this->DadosId = (int) $DadosId; if (!empty($this->DadosId)) { $this->editAcolhPriv(); } else { $_SESSION['msg'] = "<div class='alert alert-danger'>Erro: Acolhimento do Residente não encontrado!</div>"; $UrlDestino = URLADM . 'acolhimento/listar'; header("Location: $UrlDestino"); } } private function editAcolhPriv() { if (!empty($this->Dados['EditAcolh'])) { unset($this->Dados['EditAcolh']); $editarAcolh = new \App\gre\Models\GreEditarAcolhimento(); $editarAcolh->altAcolh($this->Dados); if ($editarAcolh->getResultado()) { $UrlDestino = URLADM . 'ver-acolhimento/ver-acolh/' . $this->Dados['id']; header("Location: $UrlDestino"); } else { $this->Dados['form'] = $this->Dados; $this->editAcolhViewPriv(); } } else { $verAcolh = new \App\gre\Models\GreEditarAcolhimento(); $this->Dados['form'] = $verAcolh->verAcolh($this->DadosId); $this->editAcolhViewPriv(); } } private function editAcolhViewPriv() { // var_dump($this->Dados['form']); if ($this->Dados['form']) { $listarSelect = new \App\gre\Models\GreEditarAcolhimento(); $this->Dados['select'] = $listarSelect->listarCadastrar($this->Dados['form']); $botao = ['vis_acolh' => ['menu_controller' => 'ver-acolhimento', 'menu_metodo' => 'ver-acolh']]; $listarBotao = new \App\adms\Models\AdmsBotao(); $this->Dados['botao'] = $listarBotao->valBotao($botao); $listarMenu = new \App\adms\Models\AdmsMenu(); $this->Dados['menu'] = $listarMenu->itemMenu(); $carregarView = new \App\gre\core\ConfigView("gre/Views/Acolhimento/editarAcolhimento", $this->Dados); $carregarView->renderizarGre(); } else { $_SESSION['msg'] = "<div class='alert alert-danger'>Erro: Acolhimento do Residente não encontrada!</div>"; $UrlDestino = URLADM . 'acolhimento/listar'; header("Location: $UrlDestino"); } } }