function Main() { try { $up = new Upload(); $e = new Exame(); $descricao = $_POST["txtDesArquivo"] != "" ? $_POST["txtDesArquivo"] : null; $complemento = $_POST["txtComplementoImagem"] != "" ? urldecode($_POST["txtComplementoImagem"]) : null; if ($e->AtualizaImagemExame($_SESSION['caso'], $_SESSION['exame'], $_SESSION['itemexame'], $descricao, $complemento)) { $img = $e->CarregaImagemExame($_SESSION['caso'], $_SESSION['exame'], $_SESSION['itemexame']); $m = new Midia(); $m->setCodCaso($_SESSION['caso']); $m->setCodMidia($img->Valor); $m->setDescricao($descricao); $m->setComplemento($complemento); if (isset($_GET["type"]) && $_GET["type"] == "doc") { //nada de diferente... } else { $m->setURL($img->Url); $m->setLargura($img->Largura); $m->setAltura($img->Altura); } $m->Atualiza(); //doc não tem realupload if (isset($_FILES["realupload"]) && $_FILES["realupload"] != "") { $up->setArquivo($_FILES["realupload"]); if ($up->ValidaImagem($up->getTipo())) { $imgatual = $e->CarregaImagemExame($_SESSION['caso'], $_SESSION['exame'], $_SESSION['itemexame']); if ($imgatual != false) { if ($up->RealizaTrocaImagem($imgatual->Valor)) { $retorno = "OK"; } else { $retorno = $up->getStatus(); } } else { $retorno = $e->getErro(); } } else { $retorno = "@lng[A descrição e o complemento foram atualizados porem o arquivo enviado não é uma imagem válida e a imagem antiga não foi substituída]"; } } else { $retorno = "OK"; } } else { $retorno = $e->getErro(); } } catch (Exception $ex) { $retorno = $ex->getMessage(); } if ($retorno == "OK") { header("Location:vwatualizadetalhe.php?act=redir®=" . base64_encode($_SESSION['itemexame'])); } else { header("Location:vwatualizadetalhe.php?act=fica&ret=" . base64_encode($retorno)); } }
function Main() { if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) { if (isset($_SESSION['exame']) && $_SESSION['exame'] > 0) { if (isset($_SESSION['itemexame']) && $_SESSION['itemexame'] > 0) { if (isset($_GET["type"]) && $_GET["type"] == "doc") { $tpl = file_get_contents("tpl/caso-atualiza-item-doc-exame.html"); } else { $tpl = file_get_contents("tpl/caso-atualiza-item-exame.html"); } $e = new Exame(); $item = $e->CarregaImagemExame($_SESSION['caso'], $_SESSION['exame'], $_SESSION['itemexame']); if ($item != false) { $urlimg = '<img class="thumbatual" src="viewimagem.php?img=' . base64_encode($item->Valor) . '">'; $tpl = str_replace('<!--caminhoimagem-->', $urlimg, $tpl); $tpl = str_replace('<!--txtDesArquivo-->', $item->Descricao, $tpl); $tpl = str_replace('<!--txtComplementoImagem-->', $item->Complemento, $tpl); $tpl = str_replace('<!--tipo-->', $item->TipoItem, $tpl); if ($_GET['act'] == "redir") { $tpl = str_replace('<!--retornoacao-->', "fntExibeRetorno('OK', '" . base64_encode($_SESSION['exame']) . "');", $tpl); } else { if ($_GET['act'] == "fica") { $tpl = str_replace('<!--retornoacao-->', "fntExibeRetorno('" . base64_decode($_GET['act']) . "', '" . base64_decode($_GET['ret']) . "');", $tpl); } else { $tpl = str_replace('<!--retornoacao-->', "", $tpl); } } } else { $tpl = $e->getErro(); } } else { $tpl = "@lng[Item não encontrado]"; } } else { $tpl = "@lng[Exame não encontrado]"; } } else { $tpl = "@lng[Caso de estudo não encontrado]"; } echo Comuns::Idioma($tpl); }