Esempio n. 1
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();
        }
    }
}
Esempio n. 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();
    }
}
Esempio n. 3
0
function TrataDadosHipotesesDlg()
{
    $dados = new HashTable();
    if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) {
        $h = new Hipoteses();
        $tiporesp = Caso::BuscaConfiguracao($_SESSION['caso'], "hipoteses", "TipoResp");
        if ($_POST['r'] != "") {
            $codhipotese = base64_decode($_POST['r']);
            $_SESSION['hipotese'] = $codhipotese;
            $h->Carrega($_SESSION['caso'], $codhipotese);
            $dados->AddItem("txtDescricao", $h->getDescricao());
            $dados->AddItem("txtJustificativa", $h->getJustificativa());
            $dados->AddItem("txtAdicional", $h->getConteudoadicional());
            if ($tiporesp == "CE") {
                $dados->AddItem("selCorreto", SimNao::SelectSimNao($h->getCorreto()));
            } else {
                if ($tiporesp == "ORD") {
                    $n = $h->getNHipoteses();
                    $opcoes = SelectNumerico::MontaSelect($n, 1, "@lng[Selecione]", $h->getCorreto());
                    $dados->AddItem("selCorreto", $opcoes);
                }
            }
        } else {
            $_SESSION['hipotese'] = 0;
            $dados->AddItem("txtDescricao", "");
            $dados->AddItem("txtJustificativa", "");
            $dados->AddItem("txtAdicional", "");
            if ($tiporesp == "CE") {
                $dados->AddItem("selCorreto", SimNao::SelectSimNao());
            } else {
                if ($tiporesp == "ORD") {
                    $h->setCodcaso($_SESSION['caso']);
                    $n = $h->getNHipoteses() + 1;
                    $dados->AddItem("selCorreto", SelectNumerico::MontaSelect($n, 1, "@lng[Selecione]"));
                }
            }
        }
        return $dados->ToXML();
    } else {
        return "@lng[Erro ao localilzar o caso de estudo]";
    }
}