Example #1
0
     $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 = "";
     while (!$rs->EOF) {
         $email->setDestino($rs->fields['email'], utf8_decode($rs->fiels['nombre']));
         $documento .= " " . $rs->fields['email'];
         $datos = array();
         $usuario->setId($rs->fields['idUsuario']);
         $datos['nombreCompleto'] = $usuario->getNombre();
         $usuario->setId($reporte->getIdUsuario());
         $datos['nombreCompletoReportado'] = $usuario->getNombre();
         $datos['Latitud'] = $reporte->getLatitud();
         $datos['Longitud'] = $reporte->getLongitud();
         $datos['Fecha'] = $reporte->getFecha();
         $datos['Direccion'] = $reporte->getDireccion();
         $datos['comentario1'] = $reporte->getCampo1();
         $datos['comentario2'] = $reporte->getCampo2();
         $datos['comentario3'] = $reporte->getCampo3();
         $email->setBodyHTML(utf8_decode($email->construyeMail(file_get_contents("repositorio/mail/ubicacion.txt"), $datos)));
         $email->adjuntar($img);
         $email->send();
         $rs->moveNext();
     }
     $result = array("doc" => $documento, "band" => true);
     echo json_encode($result);
     break;
 case 'solicitarUbicacionMail':
     $db = TBase::conectaDB();
     $email = new TMail();
     $usuario = new TUsuario($_GET['user']);