Beispiel #1
0
<?php

require_once "config.php";
list($type, $data) = explode(';', $_POST['foto']);
list(, $data) = explode(',', $data);
$data = base64_decode($data);
$conexao = new Conexao();
$dao = new DAOGenerico();
$dados = $dao->findByPk($conexao->getConexao(), "pacientes", (int) $_GET["id"]);
$diretorio = DIR_UPLOADS . SEPARADOR_DIRETORIO . "pacientes" . SEPARADOR_DIRETORIO . $dados["id"];
if (existeArquivo($diretorio . SEPARADOR_DIRETORIO . $dados["foto"])) {
    excluiArquivo($diretorio . SEPARADOR_DIRETORIO . $dados["foto"]);
}
if (!existeDiretorio($diretorio)) {
    criaDiretorio($diretorio);
}
$nomeFoto = date('dmYHis') . '.png';
$file = file_put_contents($diretorio . '/' . $nomeFoto, $data);
if (is_integer($file)) {
    $dados["foto"] = $nomeFoto;
    $dao->salva($conexao->getConexao(), "pacientes", $dados);
    $conexao->getConexao()->commit();
    $conexao->getConexao()->disconnect();
    echo $diretorio . '/' . $nomeFoto;
}
Beispiel #2
0
<?php

header("Access-Control-Allow-Origin: *");
require_once "../../config.php";
$conexao = new Conexao();
$compromissos = array();
$dao = new DAOGenerico();
if (isset($_POST['data'])) {
    list($ano, $mes, $dia) = explode("-", $_POST["data"]);
} else {
    $dia = 1;
    $mes = $_POST["mes"];
    $ano = $_POST["ano"];
}
$prevData = date('Y-m-d', mktime(0, 0, 0, $mes - 1, 1, $ano));
$nextData = date('Y-m-d', mktime(0, 0, 0, $mes + 1, 1, $ano));
$where = array("agenda.mes" => $mes, "agenda.ano" => $ano);
$holidays = Funcoes::getFeriados($mes, $ano);
if (!empty($_POST["fisioterapeuta"])) {
    $idFisioterapeuta = $where["agenda_fisioterapeutas.fisioterapeuta"] = $_POST["fisioterapeuta"];
    $fisioterapeuta = $dao->findByPk($conexao->getConexao(), "vw_usuarios", (int) $_POST["fisioterapeuta"]);
    $fisioterapeuta["diasAtendimento"] = !empty($fisioterapeuta["diasAtendimento"]) ? explode(",", $fisioterapeuta["diasAtendimento"]) : array();
}
$objetos = $dao->findAll($conexao->getConexao(), "agenda", array("dados" => array("agenda.id", "agenda.tipo", "agenda.data", "agenda.hora", "agenda.dia", "agenda.mes", "agenda.ano", "agenda.telefoneResidencial", "agenda.telefoneCelular", "agenda.lembrete", "agenda.observacoes", "agenda.nomePaciente", "agenda.marcador", "CONCAT_WS('T', agenda.data, agenda.hora) as timestamp"), "where" => $where, "leftJoin" => array("agenda_fisioterapeutas" => "agenda.id = agenda_fisioterapeutas.compromisso"), "order" => array("agenda.hora" => "asc")));
$mesRange = rangeMonth($ano . "-" . $mes . "-01");
for ($i = $mesRange["start"]; $i <= $mesRange["end"]; $i++) {
    foreach ($objetos as $objeto) {
        if ($objeto["dia"] == $i) {
            $compromissos[(int) $i][$objeto["hora"]] = $objeto;
        }
    }
Beispiel #3
0
<?php

header("Access-Control-Allow-Origin: *");
require_once "../../config.php";
$conexao = new Conexao();
$dao = new DAOGenerico();
switch ($_GET['acao']) {
    case 'recupera':
        $compromisso = $dao->findByPk($conexao->getConexao(), "agenda", $_POST['id']);
        if (!empty($compromisso["fotoPaciente"])) {
            $diretorio = DIR_UPLOADS . SEPARADOR_DIRETORIO . "pacientes" . SEPARADOR_DIRETORIO . $compromisso["paciente"];
            $diretorio .= SEPARADOR_DIRETORIO . $compromisso["fotoPaciente"];
            if (existeArquivo($diretorio)) {
                $compromisso["pathFoto"] = "uploads/pacientes/" . $compromisso["paciente"] . '/' . $compromisso["fotoPaciente"];
            }
        }
        $fisioterapeutas = $dao->findAll($conexao->getConexao(), "agenda_fisioterapeutas", array("where" => array("compromisso" => $_POST['id'])));
        $arr = array();
        foreach ($fisioterapeutas as $f) {
            $arr[] = $f["fisioterapeuta"];
        }
        $compromisso["fisioterapeutas"] = implode(",", $arr);
        echo json_encode($compromisso);
        break;
    case 'dados':
        $paciente = $dao->find($conexao->getConexao(), "pacientes", array('where' => array('nome' => $_POST['nome'])));
        $diretorio = DIR_UPLOADS . SEPARADOR_DIRETORIO . "pacientes" . SEPARADOR_DIRETORIO . $paciente["id"];
        $diretorio .= SEPARADOR_DIRETORIO . $paciente["foto"];
        if (!existeArquivo($diretorio)) {
            $paciente["pathFoto"] = "imagens/user.gif";
        } else {