function fntSalvaTextoHipoteses()
{
    if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) {
        $hip = new Hipoteses();
        $texto = isset($_POST['txtPerguntaGuia']) && $_POST['txtPerguntaGuia'] != "" ? urldecode($_POST['txtPerguntaGuia']) : null;
        $ret = $hip->SalvaPerguntaNorteadora($_SESSION['caso'], $texto);
        if ($ret == false) {
            throw new Exception(Comuns::Idioma("@lng[Erro ao salvar.] ") + $hip->getErro(), 1002);
        }
    } else {
        throw new Exception(Comuns::Idioma("@lng[Caso não encontrado]"), 1003);
    }
}
Exemple #2
0
function fntDeletaHipoteses()
{
    $t = new Hipoteses();
    $t->setCodcaso($_SESSION['caso']);
    $t->setCodhipotese(base64_decode($_POST['id']));
    if ($t->Deleta()) {
        return "@lng[Hipótese diagnóstica deletada com sucesso!]";
    } else {
        return "ERRO. @lng[Não foi possível excluir a hipótese diagnóstica.] " . $t->getErro();
    }
}
Exemple #3
0
function fntProcessaDadosHipoteses()
{
    if ($_SESSION['caso'] > 0) {
        $descricao = urldecode($_POST['txtDescricao']);
        $correto = $_POST['selCorreto'];
        $justificativa = stripcslashes(urldecode($_POST['txtJustificativa']));
        $adicional = stripcslashes(urldecode($_POST['txtAdicional']));
        $h = new Hipoteses();
        $h->setCodcaso($_SESSION['caso']);
        if ($descricao != "") {
            $h->setDescricao($descricao);
        }
        if ($correto != "") {
            $h->setCorreto($correto);
        }
        if ($justificativa != "") {
            $h->setJustificativa($justificativa);
        }
        if ($adicional != "") {
            $h->setConteudoadicional($adicional);
        }
        $ret = "";
        if ($_SESSION['hipotese'] > 0) {
            $h->setCodhipotese($_SESSION['hipotese']);
            $ret = $h->Atualiza();
            $_SESSION['hipotese'] = 0;
        } else {
            $ret = $h->Insere();
            $_SESSION['hipotese'] = 0;
        }
        if ($ret == true) {
            echo "OK";
        } else {
            echo $h->getErro();
        }
    }
}