Exemplo n.º 1
0
 public function enviarAhora()
 {
     $format = "Y-m-d";
     $timestamp = time();
     $fecha = date($format, $timestamp);
     $fechaInicio = $fecha . " 00:00:00";
     $fechaFin = $fecha . " 23:59:59";
     $formatEnv = "Y-m-d";
     $fechaEnv = date($formatEnv, $timestamp);
     $body = "";
     $diaSemForm = "N";
     $mesForm = "n";
     $diaForm = "j";
     $anioForm = "Y";
     $diaSemEnvio = date($diaSemForm, $timestamp);
     $mesEnvio = date($mesForm, $timestamp);
     $diaEnvio = date($diaForm, $timestamp);
     $anioEnvio = date($anioForm, $timestamp);
     $diaSemana = CorreoController::getDia($diaSemEnvio);
     $mes = CorreoController::getMes($mesEnvio);
     $seleccionar = NoticiasController::consultaNoticiasEnvio($fechaInicio, $fechaFin);
     $fueNombreAnterior = "";
     foreach ($seleccionar as $valor) {
         $fueNombre = $valor['fueNombre'];
         $notTitulo = $valor['notTitulo'];
         $notContenido = $valor['notContenido'];
         $notAutor = $valor['notAutor'];
         $notEnlace = $valor['notEnlace'];
         $fuenteIgual = strcmp($fueNombre, $fueNombreAnterior);
         if ($fuenteIgual == 0) {
             $mostrarFuente = "";
         } else {
             $mostrarFuente = $fueNombre;
         }
         $fueNombreAnterior = $fueNombre;
         $body = $body . '<br>';
         $body = $body . '<div>';
         $body = $body . '<h2 style="text-align: center; color:#1565c0;"> <u>' . $mostrarFuente . '</u></h2>';
         $body = $body . '<h4 style="text-align: left; color:#1565c0;">' . $notTitulo . '</h4>';
         $body = $body . '<p style="text-align: justify;" >' . $notContenido . '</p>';
         $body = $body . '<br><p style="text-align: justify;" ><small>' . $notAutor . '</small></p>';
         $body = $body . '<p style="text-align: justify;" ><small> <a href="' . $notEnlace . '">' . $notEnlace . '</a></small></p>';
         $body = $body . '</div>';
     }
     $dataCorreo = array('fechaEnv' => $fechaEnv, 'body' => $body, 'diaSem' => $diaSemana, 'dia' => $diaEnvio, 'mes' => $mes, 'anio' => $anioEnvio);
     $correoInt = Integrantes::where('intActivo', TRUE)->get(array('intCorreo'))->toArray();
     $correoRes = Responsables::where('resActivo', TRUE)->get(array('resCorreo'))->toArray();
     $correoInv = Invitados::where('invActivo', TRUE)->get(array('invCorreo'))->toArray();
     foreach ($correoInt as $valor) {
         $toEmail[] = $valor['intCorreo'];
     }
     foreach ($correoRes as $valor) {
         $toEmail[] = $valor['resCorreo'];
     }
     foreach ($correoInv as $valor) {
         $toEmail[] = $valor['invCorreo'];
     }
     $asunto = 'noticias-' . $fechaEnv;
     //  $toEmail = "*****@*****.**";
     /*            Mail::send('emails.envioNoticiasMail', $dataCorreo, function($message) use($toEmail, $asunto){
                       $message->to($toEmail);
                       $message->subject($asunto);
                     });
     
     */
     if (count($seleccionar) > 0) {
         $response = array('status' => 'OK', 'data' => $toEmail, 'message' => 'Se enviaron correos correctamente.');
     } else {
         $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.');
     }
     return Response::json($response);
 }
Exemplo n.º 2
0
 public static function consultaActivoIntegrantesRep($idPeriodo)
 {
     $seleccionar = Integrantes::join('asignacionIntegrantes', 'integrantes.intId', '=', 'asignacionIntegrantes.ainIntegrantes')->where('intActivo', 1)->where('ainPeriodos', '=', $idPeriodo)->orderBy('intId')->get(array('intId', 'intNombre', 'intNombreCompleto', 'intCorreo'))->toArray();
     return $seleccionar;
 }
Exemplo n.º 3
0
 public function login()
 {
     $datos = Input::all();
     if (!array_key_exists('usuario', $datos) || $datos['usuario'] === "") {
         Session::flush();
         return Redirect::to('/?e=01');
     }
     if (!array_key_exists('pass', $datos) || $datos['pass'] === "") {
         Session::flush();
         return Redirect::to('/?e=01');
     }
     /* Reglas de validación */
     $rules = array('usuario' => array('required', 'email', 'max:50'), 'pass' => array('required', 'regex:/^([0-9a-zA-Z@\\.\\-_])+$/'));
     $validator = Validator::make($datos, $rules);
     if ($validator->fails()) {
         Session::flush();
         return Redirect::to('/?e=10VAlidacion');
     }
     $admIn = 0;
     //integrante  ************
     $admIn = Integrantes::where('intCorreo', $datos['usuario'])->where('intActivo', 1)->get(array('intPass', 'intId', 'intNombre'))->toArray();
     if (count($admIn) > 0) {
         $resAdm = $admIn[0];
         $passAdm = $resAdm['intPass'];
         if ($datos['pass'] == $passAdm) {
             Session::put('tipo', '100');
             Session::put('id', $resAdm['intId']);
             Session::put('nombre', $resAdm['intNombre']);
             return Redirect::to('/integrante');
         }
         /*  else{
               Session::flush();
               return Redirect::to('/?e=11IR');
             }*/
     }
     $admVH = 0;
     //Representante *********
     $admVH = Responsables::where('resCorreo', $datos['usuario'])->where('resActivo', 1)->get(array('resNombre', 'resId', 'resPass', 'resEspecial'))->toArray();
     if (count($admVH) > 0) {
         $resAdm = $admVH[0];
         $passAdm = $resAdm['resPass'];
         if ($datos['pass'] == $passAdm) {
             Session::put('tipo', '010');
             Session::put('id', $resAdm['resId']);
             Session::put('nombre', $resAdm['resNombre']);
             Session::put('especial', $resAdm['resEspecial']);
             return Redirect::to('/inicio2');
         } else {
             Session::flush();
             return Redirect::to('/?e=11ADM');
         }
     }
     $admVH = 0;
     //ADM
     $admVH = Adm::where('admCorreo', $datos['usuario'])->where('admTipo', 1)->get(array('admPass', 'admId'))->toArray();
     if (count($admVH) > 0) {
         $resAdm = $admVH[0];
         $passAdm = $resAdm['admPass'];
         if ($datos['pass'] == $passAdm) {
             Session::put('tipo', '001');
             Session::put('id', $resAdm['admId']);
             Session::put('nombre', "Administrador");
             return Redirect::to('/administracion');
         } else {
             Session::flush();
             return Redirect::to('/?e=11ADM');
         }
     }
     return Redirect::to('/?e=100');
 }