array_push($datos, $rs->fields); $rs->moveNext(); } $smarty->assign("lista", $datos); break; case 'cconsultas': switch ($objModulo->getAction()) { case 'add': $db = TBase::conectaDB(); $rs = $db->Execute("select idReporte from reporte where idDoctor = " . $sesion['usuario'] . " and idConsultorio = " . $_POST['consultorio'] . " and fecha = '" . $_POST['fecha'] . "'"); $obj = new TReporte($rs->fields["idReporte"]); if ($rs->EOF) { $obj->setDoctor($sesion['usuario']); $obj->setConsultorio($_POST['consultorio']); $obj->setFecha($_POST['fecha']); $obj->guardar(); } echo json_encode(array("band" => $obj->addConsulta($_POST['servicio'], $_POST['turno'], str_replace("_", "", $_POST['cantidad']), $_POST['cubiculo']))); break; case 'del': $obj = new TConsultorio($_POST['id']); echo json_encode(array("band" => $obj->eliminar())); break; case 'addTurno': $obj = new TConsultorio($_POST['consultorio']); echo json_encode(array("band" => $obj->addTurno($_POST['turno']))); break; case 'delTurno': $obj = new TConsultorio($_POST['consultorio']); echo json_encode(array("band" => $obj->delTurno($_POST['turno']))); break;
$rs = $db->Execute("select * from reporte where idUsuario = " . $sesion['usuario'] . " order by fecha desc"); $band = false; if ($rs->EOF) { $proxTimeStamp = strtotime("now"); $nuevaFecha = date("Y-m-d H:i:s"); } else { $proxTimeStamp = strtotime('+' . $tiempo . ' minutes', strtotime($rs->fields['fecha'])); $nuevaFecha = date("Y-m-d H:i:s", $proxTimeStamp); } if ($proxTimeStamp <= strtotime("now")) { $obj = new TReporte(); $obj->setUsuario($sesion['usuario']); $obj->setLatitud($_POST['latitud']); $obj->setLongitud($_POST['longitud']); $obj->setDireccion($_POST['direccion']); $band = $obj->guardar(); $proxTimeStamp = strtotime('+' . $tiempo . ' minutes', strtotime("now")); $nuevaFecha = date("Y-m-d H:i:s", $proxTimeStamp); } echo json_encode(array("band" => $band, "proxima" => $nuevaFecha, "proximoTimeStamp" => $proxTimeStamp, "proximo" => $tiempo * 1000 * 60, "aux" => strtotime("now"))); break; case 'reportarViaEMail': $db = TBase::conectaDB(); $email = new TMail(); $usuario = new TUsuario(); $reporte = new TReporte($_GET['reporte']); $email->setTema(utf8_decode("Reporte de ubicación")); $rs = $db->Execute("select * from usuario where idTipo = 1" . ($_GET['usuario'] == '' ? '' : " and idUsuario = " . $_GET['usuario'])); $img = "temporal/img.jpg"; file_put_contents($img, file_get_contents("https://maps.googleapis.com/maps/api/staticmap?center=" . $reporte->getLatitud() . "," . $reporte->getLongitud() . "&zoom=16&size=300x250&format=JPG&markers=color:green|label:M|" . $reporte->getLatitud() . "," . $reporte->getLongitud() . "")); $documento = "";