public function ingresoIntegrante() { /**INGRESO **/ if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } $token = Input::get('token'); if (isset($token)) { $data = array('nombre' => Input::get('n'), 'correo' => Input::get('c'), 'nCompleto' => Input::get('nc'), 'responsable' => Input::get('r'), 'contra' => Input::get('ct'), 'envio' => Input::get('e')); $validaciones = array('nombre' => array('required', 'regex:/^([0-9a-zA-ñÑZáéíóúñÁÉÍÓÚ\\-\\s\\,\\.\\?\\¿\\¡\\!])+$/')); $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 { $duplicado = Integrantes::where('intCorreo', $data['correo'])->where('intNombre', $data['nombre'])->get()->toArray(); if (count($duplicado) > 0) { return Response::json(array('status' => 'Error', 'message' => 'Ya existe un integrante con el mismo nombre y correo, verifique')); } else { $insert = Integrantes::insert(array('intNombre' => trim($data['nombre']), 'intCorreo' => trim($data['correo']), 'intNombreCompleto' => trim($data['nCompleto']), 'intPass' => $data['contra'], 'intActivo' => true)); if ($insert) { if ($data['envio'] == 1) { $tipo = "Integrante"; //$correoE=$data['correo']; $correoE = "*****@*****.**"; CorreoController::enviarRegistro($correoE, $data['contra'], $data['nCompleto'], $tipo); } $response = array('status' => 'OK', 'message' => 'Integrante agregado correctamente.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo realizar el responsable, intente de nuevo'); } } } } else { $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento'); } return Response::json($response); }
public function envioRepReprePer() { /***********/ $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'), 'fechaInicio' => Input::get('fi'), 'fechaFin' => Input::get('ff'), 'correo' => 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::consultaReprePer($data['id'], $data['id2'], $data['id3'], $data['id4'], $data['id5'], $data['id6'], $data['fechaInicio'], $data['fechaFin']); if (count($seleccionar) > 0) { //$body=''; $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; /* foreach ($seleccionar as $valor) { $fueNombre= $valor['fueNombre']; $notTitulo= $valor['notTitulo']; $notContenido= $valor['notContenido']; $notFecha= $valor['notFecha']; $resNombre= $valor['resNombre']; $body=$body.'<br>'; $body=$body.'<div>'; $body=$body.'<h2 style="text-align: center; color:#1565c0;"> <u>'.$fueNombre.'</u></h2>'; $body=$body.'<h4 style="text-align: left; color:#1565c0;">'.$notTitulo.'</h4>'; $body=$body.'<p style="text-align: justify;" >'.$notContenido.'</p>'; $body=$body.'<p style="text-align: left;" >Fecha: '.$notFecha.'</p>'; $body=$body.'<p style="text-align: left;" >Responsable: '.$resNombre.'</p>'; $body=$body.'</div>'; $i++; }*/ $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 POR REPRESENTANTE Y PERÍODO.'); }); $response = array('status' => 'OK', 'message' => 'Correo enviado.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.'); } return Response::json($response); }