コード例 #1
0
ファイル: NoticiasController.php プロジェクト: vvvhh/not
 function repPeriodo()
 {
     $token = Input::get('token');
     if (isset($token)) {
         $data = array('fInicio' => Input::get('fi'), 'fFin' => Input::get('ff'));
         $validaciones = array('fInicio' => array('date'), 'fFin' => array('date'));
         $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['fInicio'] . " 00:00:00";
             $fechaFin = $data['fFin'] . " 23:59:59";
             //  $seleccionar=DB::select('SELECT f.fueNombre, r.resNombre, n.notFecha, n.notTitulo, n.notContenido FROM noticias n, fuentes f, responsables r WHERE n.notFuente = f.fueId AND n.notResponsables = r.resId  AND n.notFecha >= "'.$fechaInicio.'" AND n.notFecha <= "'.$fechaFin.'" GROUP BY n.notId ORDER BY f.fueId, n.notFecha;');
             $seleccionar = NoticiasController::consultaPorPeriodo($fechaInicio, $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.');
             }
         }
     } else {
         $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento');
     }
     return Response::json($response);
 }
コード例 #2
0
ファイル: CorreoController.php プロジェクト: vvvhh/not
 public function envioRepPeriodo()
 {
     /***********/
     $data = array('fechaInicio' => Input::get('fi'), 'fechaFin' => Input::get('ff'), '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 = NoticiasController::consultaPorPeriodo($data['fechaInicio'], $data['fechaFin']);
     if (count($seleccionar) > 0) {
         $body = CorreoController::crearBody($seleccionar, $data['fechaInicio'], $data['fechaFin'], $data['relevante'], $data['publicacion'], $data['representante'], $data['hora'], $data['contenido'], NULL);
         $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 GENERAL.');
         });
         $response = array('status' => 'OK', 'message' => 'Correo enviado.');
     } else {
         $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.');
     }
     return Response::json($response);
 }