D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
crsys_ant
/
adm
/
app
/
gre
/
Controllers
/
Filename :
AmbienteEditar.php
back
Copy
<?php namespace App\gre\Controllers; if (!defined('URL')) { header("Location: /"); exit(); } class AmbienteEditar { private $Dados; private $DadosId; public function editAmbiente($DadosId = null) { $this->Dados = filter_input_array(INPUT_POST, FILTER_DEFAULT); $this->DadosId = (int) $DadosId; if (!empty($this->DadosId)) { $this->editAmbientePriv(); } else { $_SESSION['msg'] = "<div class='alert alert-success alert-dismissible fade show' role='alert'> Erro: Ambiente não encontrado! <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'> </button> </div>"; $UrlDestino = URLADM . 'ambiente/listar'; header("Location: $UrlDestino"); } } private function editAmbientePriv() { if (!empty($this->Dados['EditAmbiente'])) { unset($this->Dados['EditAmbiente']); $editarAmbiente = new \App\gre\Models\Ambiente\ModEditarAmbiente(); $editarAmbiente->altAmbiente($this->Dados); if ($editarAmbiente->getResultado()) { $UrlDestino = URLADM . 'ambiente/listar/'; header("Location: $UrlDestino"); } else { $this->Dados['form'] = $this->Dados; $this->editAmbienteViewPriv(); } } else { $verAmbiente = new \App\gre\Models\Ambiente\ModEditarAmbiente(); $this->Dados['form'] = $verAmbiente->verAmbiente($this->DadosId); $this->editAmbienteViewPriv(); } } private function editAmbienteViewPriv() { if ($this->Dados['form']) { $botao = ['lis_ambiente' => ['menu_controller' => 'ambiente', 'menu_metodo' => 'listar']]; $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 \Core\ConfigView("gre/Views/Ambiente/VieEditarAmbiente", $this->Dados); $carregarView->renderizar(); } else { $_SESSION['msg'] = "<div class='alert alert-success alert-dismissible fade show' role='alert'> Erro: Tipo de Ambiente não encontrado! <button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'> </button> </div>"; $UrlDestino = URLADM . 'ambiente/listar'; header("Location: $UrlDestino"); } } }