D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
idoso
/
adm
/
app
/
gre
/
Models
/
Filename :
GreCadastrarAlas.php
back
Copy
<?php namespace App\gre\Models; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GreCadastrarAlas * * @copyright (c) year,Carlos Marques CM */ class GreCadastrarAlas { private $Resultado; private $Dados; private $UltimoAlas; function getResultado() { return $this->Resultado; } public function cadAlas(array $Dados) { $this->Dados = $Dados; $this->Dados['created'] = date("Y-m-d H:i:s"); $this->verUltimoAlas(); $this->Dados['ordem'] = $this->UltimoAlas[0]['ordem'] + 1; $this->Dados['adms_sit_id'] = 1; $cadAlas = new \App\adms\Models\helper\AdmsCreate; $cadAlas->exeCreate("gre_alas", $this->Dados); if ($cadAlas->getResultado()) { $_SESSION['msg'] = "<div class='alert alert-success' role='alert'> Ala cadastrada 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: Ala não foi cadastrada! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } } private function verUltimoAlas() { $verAlas = new \App\adms\Models\helper\AdmsRead(); $verAlas->fullRead("SELECT ordem FROM gre_alas ORDER BY ordem DESC LIMIT :limit", "limit=1"); $this->UltimoAlas = $verAlas->getResultado(); } /** * <b>Listar registros para chave estrangeira:</b> Buscar informações na tabela "adms_sits" para utilizar como chave estrangeira */ }