public function getRepresentante() { if (!Sesion::isResponsable()) { if (!Sesion::isAdmin()) { return Redirect::to('administracion/logout'); } } $data = Input::all(); $seleccionar = Responsables::where('resId', $data['i'])->get()->toArray(); 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); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Responsables the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Responsables::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
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); }
<th>Insttitucion</th> <th>Responsable legal</th> <th>Responsable Contacto</th> </tr> </thead> <br> <tbody id="bodyt"> <?php if (isset($_SESSION['institucion'])) { for ($i = 1; $i < count($_SESSION['institucion']); $i++) { $institucion_contraparte = explode('.', $_SESSION['institucion'][$i]); $institucion = Instituciones::model()->find('idInstitucion=' . $institucion_contraparte[0]); $resp_legal = Responsables::model()->find('idResponsable=' . $institucion_contraparte[1]); $resp_cont = Responsables::model()->find('idResponsable=' . $institucion_contraparte[2]); echo '<tr id=' . $i . '>'; echo '<td>' . $institucion->nombreInstitucion . '</td>'; echo '<td>' . $resp_legal->primerApellidoResponsable . ' ' . $resp_legal->primerNombreResponsable . '</td>'; echo '<td>' . $resp_cont->primerApellidoResponsable . ' ' . $resp_cont->primerNombreResponsable . '</td>'; echo '</tr>'; } } ?> </tbody> </table> </div> </div> </div> <a href="#demo3" class="list-group-item opcion" data-toggle="collapse"><h4>Acta de Intención<span class="glyphicon glyphicon-plus-sign pull-right"></span></h4></a>
public function actionValidacionautocomplete() { if (isset($_POST['widget'])) { $campo_widget = explode(' ', $_POST['widget']); } //echo $_POST['widget']; $criteria = new CDbCriteria(); $criteria->select = 'idResponsable'; $criteria->condition = 'CONCAT(CONCAT(primerApellidoResponsable," "),primerNombreResponsable)=:ins OR CONCAT(CONCAT(primerNombreResponsable," "),primerApellidoResponsable)=:ins '; $criteria->params = array(':ins' => $_POST['widget']); $result = Responsables::model()->findAll($criteria); if (count($result) == 1) { foreach ($result as $key => $resultado) { echo $resultado->idResponsable; // echo " "; } } if (count($result) > 1) { echo "varios resultados para el mismo nombre seleccione de la lista autocompletada"; } if (count($result) < 1) { echo "El nombre indicado no existe en la base de datos. Agregue un nuevo responsable"; } //echo "Nombre". $resul->primerNombreResponsable; # code... // foreach ($resul as $key => $resultado) { # code... // echo $resultado->primerNombreResponsable; // } }
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'); }