public function getAsignacionActual() { if (!Sesion::isResponsable()) { if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } } $seleccionar = AsignacionesController::consultaGetAsignacionesActual(); if (count($seleccionar) > 0) { $response = array('status' => 'OK', 'data' => $seleccionar, 'message' => 'Resultados obtenidos'); } else { $response = array('status' => 'ERROR', 'message' => 'No se encontraron fuentes registradas.'); } return Response::json($response); }
public function enviarAsignaciones() { /************/ if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } $data = array('idPeriodo' => Input::get('i')); $seleccionar = AsignacionesController::consultaGetAsignaciones($data['idPeriodo']); if (count($seleccionar) > 0) { /* $correoInt = Integrantes::where('intActivo',TRUE) ->get(array( 'intCorreo' )) ->toArray(); $correoRes = Responsables::where('resActivo',TRUE) ->get(array( 'resCorreo' )) ->toArray(); foreach ($correoInt as $valor) { $toEmail[]= $valor['intCorreo']; } foreach ($correoRes as $valor) { $toEmail[]= $valor['resCorreo']; } */ $body = ''; $i = 1; foreach ($seleccionar as $valor) { $fuente = $valor['fueNombre']; $representante = $valor['resNombre']; $body = $body . '<tr>'; $body = $body . '<td>' . $i . '</td>'; $body = $body . '<td style="text-align: center">' . $fuente . '</td>'; $body = $body . '<td style="text-align: center">' . $representante . '</td>'; $body = $body . '</tr>'; $i++; } $dataCorreo = array('fuente' => "sdas", 'body' => $body); $toEmail = "*****@*****.**"; Mail::send('emails.envioAsignacionesMail', $dataCorreo, function ($message) use($toEmail) { $message->to($toEmail); $message->subject('ASIGNACIONES DE FUENTES.'); }); $response = array('status' => 'OK', 'message' => 'Se enviaron correos.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo enviar correo.'); } return Response::json($response); }
public function editarNot() { $token = Input::get('token'); if (isset($token)) { $data = array('t' => Input::get('t'), 'c' => Input::get('c'), 'f' => Input::get('f'), 'p' => Input::get('p'), 'r' => Input::get('r'), 'id' => Input::get('i'), 'autor' => Input::get('autor'), 'enlace' => Input::get('enlace'), 'fecha' => Input::get('fecha'), 'especial' => Input::get('especial')); $validaciones = array('t' => array('required'), 'f' => array('required', 'alpha_num'), 'id' => array('required', 'alpha_num')); $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 { /* $format = "Y-m-d H:i:s"; $timestamp = time(); $fecha = date($format, $timestamp); */ // $fecha=$data['fecha']." 00:01:00"; if ($data['especial'] == 1) { // $isAsi = AsignacionesController::consultaGetResponsablePeriodoFuente(null,$data['r'],$data['f']); /*$idConPerF=$isAsi[0]; $idAsignacion=$idConPerF['asiId']; */ $editar = Noticias::where('notId', $data['id'])->update(array('notTitulo' => $data['t'], 'notContenido' => $data['c'], 'notEnlace' => $data['enlace'], 'notAutor' => $data['autor'])); } else { $isAsi = AsignacionesController::consultaGetResponsablePeriodoFuente($data['p'], $data['r'], $data['f']); $idConPerF = $isAsi[0]; $idAsignacion = $idConPerF['asiId']; $editar = Noticias::where('notId', $data['id'])->update(array('notTitulo' => $data['t'], 'notContenido' => $data['c'], 'notAsignaciones' => $idAsignacion, 'notEnlace' => $data['enlace'], 'notAutor' => $data['autor'])); } if ($editar) { $response = array('status' => 'OK', 'message' => 'Noticia editada correctamente.'); } else { $response = array('status' => 'ERROR', 'message' => 'No se pudo editar la noticia, intente de nuevo'); } } } else { $response = array('status' => 'ERROR', 'message' => 'Vuelva a intentar en un momento'); } return Response::json($response); }
public static function imprimirAsignacionesA() { $seleccionar = AsignacionesController::consultaGetAsignacionesActual(); $cuerpoTabla = ''; $i = 0; $periodo = ""; foreach ($seleccionar as $value) { $i = $i + 1; $fuenombre = $value['fueNombre']; $resNombre = $value['resNombre']; $periodo = ""; $periodo = $periodo . $value['perInicio'] . " a "; $periodo = $periodo . $value['perFin']; $cuerpoTabla = $cuerpoTabla . '<tr> <td width="3%" > <div align="center"> <CODE style="font-size: 80%;">' . $i . '</code> </div> </td> <td> <div align="center"> <CODE>' . $fuenombre . '</code> </div> </td> <td> <div align="center"> <CODE>' . $resNombre . '</code> </div> </td> </tr>'; } $html = '<html><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><body>' . '<h5 align="right">Sistema de Noticias </h5><h5 align="right">Vázquez Hernández Contadores, S.C.</h5>' . '<h3 align="center">Asignación de fuentes de información</h3>' . '<p> <strong>Período: </strong> ' . $periodo . '</p>' . '<table cellspacing="0" border="1" align="center" width="400" > <tbody > <tr> <td width="3%" > <div align="center"> </div> </td> <td width="20%" > <div align="center"> <h5><strong>Fuente</strong> </h5> </div> </td> <td width="20%"> <div align="center"> <h5><strong>Responsable</strong> </h5> </div> </td> </tr>' . $cuerpoTabla . '</tbody </table>' . '</body></html>'; return PDF::load($html, 'letter', 'portrait')->show(); }