Example #1
0
 private function mapearNotificaciones(Notificacion $notificacion, array $props)
 {
     if (array_key_exists('id', $props)) {
         $notificacion->setId($props['id']);
     }
     if (array_key_exists('asunto', $props)) {
         $notificacion->setAsunto($props['asunto']);
     }
     if (array_key_exists('mensaje', $props)) {
         $notificacion->setMensaje($props['mensaje']);
     }
     if (array_key_exists('destino', $props)) {
         $notificacion->setDestino($props['destino']);
     }
     if (array_key_exists('fecha_evento', $props)) {
         $notificacion->setFecha_evento($props['fecha_evento']);
     }
     if (array_key_exists('hora', $props)) {
         $notificacion->setHora($props['hora']);
     }
     if (array_key_exists('fecha_ingreso', $props)) {
         $notificacion->setFecha_ingreso($props['fecha_ingreso']);
     }
 }
 public function registrarNotificacion()
 {
     try {
         $asunto = isset($_POST['asunto']) ? $_POST['asunto'] : NULL;
         $mensaje = isset($_POST['mensaje']) ? $_POST['mensaje'] : NULL;
         $fecha_evento = isset($_POST['fecha']) ? $_POST['fecha'] : NULL;
         $hora = isset($_POST['hora']) ? $_POST['hora'] : NULL;
         $destino = isset($_POST['destino']) ? $_POST['destino'] : NULL;
         $fecha = getdate();
         $fecha_ingreso = $fecha["year"] . "-" . $fecha["mon"] . "-" . $fecha["mday"];
         $notificacion = new Notificacion();
         $notificacion->setAsunto($asunto);
         $notificacion->setMensaje($mensaje);
         $notificacion->setFecha_ingreso($fecha_ingreso);
         $notificacion->setFecha_evento($fecha_evento);
         $notificacion->setHora($hora);
         $notificacion->setDestino($destino);
         $notificacion->crearNotificacion($notificacion);
         echo json_encode(1);
     } catch (Exception $exc) {
         echo json_encode('Error de aplicacion: ' . $exc->getMessage());
     }
 }