Beispiel #1
0
 function repFuentePer()
 {
     $token = Input::get('token');
     if (isset($token)) {
         $data = array('id' => Input::get('i'), 'id2' => Input::get('i2'), 'id3' => Input::get('i3'), 'id4' => Input::get('i4'), 'id5' => Input::get('i5'), 'id6' => Input::get('i6'), 'fI' => Input::get('fi'), 'fF' => Input::get('ff'));
         $validaciones = array('id' => array('required'));
         $validator = Validator::make($data, $validaciones);
         if ($validator->fails()) {
             $respuesta;
             $mensajes = $validator->messages();
             foreach ($mensajes->all() as $mensaje) {
                 $respuesta = $mensaje;
             }
             $response = array('status' => 'ERRORV', 'message' => $respuesta);
         } else {
             $fechaInicio = $data['fI'] . " 00:00:00";
             $fechaFin = $data['fF'] . " 23:59:59";
             $seleccionar = NoticiasController::consultaRepFuentePer($data['id'], $data['id2'], $data['id3'], $data['id4'], $data['id5'], $data['id6'], $fechaInicio, $fechaFin);
             //$seleccionar=DB::select('SELECT n.notId, f.fueNombre, r.resNombre, n.notFecha, n.notTitulo, n.notContenido FROM noticias n, fuentes f, responsables r WHERE f.fueId = '.$data['id'].' AND f.fueId=n.notFuente AND n.notResponsables = r.resId AND n.notFecha >="'.$fechaInicio.'" AND n.notFecha <="'.$fechaFin.'";');
             if (count($seleccionar) > 0) {
                 $response = array('status' => 'OK', 'data' => $seleccionar, 'message' => 'Resultados obtenidos');
             } else {
                 $response = array('status' => 'ERROR', 'message' => 'No se encontraron noticias registradas para la fuente en dicho período.');
             }
         }
     } else {
         $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento');
     }
     return Response::json($response);
 }
Beispiel #2
0
 public function envioFuentePer()
 {
     /***********/
     $data = array('id' => Input::get('i'), 'id2' => Input::get('i2'), 'id3' => Input::get('i3'), 'id4' => Input::get('i4'), 'id5' => Input::get('i5'), 'id6' => Input::get('i6'), 'ff' => Input::get('ff'), 'fi' => Input::get('fi'), 'correo' => trim(Input::get('correo')), 'relevante' => Input::get('relevante'), 'publicacion' => Input::get('publicacion'), 'representante' => Input::get('representante'), 'hora' => Input::get('hora'), 'contenido' => Input::get('contenido'));
     $seleccionar = array();
     $seleccionar = NoticiasController::consultaRepFuentePer($data['id'], $data['id2'], $data['id3'], $data['id4'], $data['id5'], $data['id6'], $data['fi'], $data['ff']);
     if (count($seleccionar) > 0) {
         $body = CorreoController::crearBody($seleccionar, $data['fi'], $data['ff'], $data['relevante'], $data['publicacion'], $data['representante'], $data['hora'], $data['contenido'], NULL);
         $va = 0;
         $head = '';
         $titulo = 'Reporte por fuente y período';
         $i = 1;
         $dataCorreo = array('body' => $body, 'head' => $head, 'titulo' => $titulo);
         //$toEmail = "*****@*****.**";
         $toEmail = $data['correo'];
         Mail::send('emails.envioEquiposMail', $dataCorreo, function ($message) use($toEmail) {
             $message->to($toEmail);
             $message->subject('REPORTE FUENTES Y PERÍODOS.');
         });
         $response = array('status' => 'OK', 'message' => 'Correo enviado.');
     } else {
         $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.');
     }
     return Response::json($response);
 }