public function consultaContacto()
 {
     $data = Input::all();
     Input::flashOnly('nombre', 'email', 'telefono', 'consulta');
     $reglas = array('email' => array('required', 'email'), 'nombre' => array('required'));
     $validator = Validator::make($data, $reglas);
     if ($validator->fails()) {
         $messages = $validator->messages();
         if ($messages->has('nombre')) {
             $mensaje = $messages->first('nombre');
         } elseif ($messages->has('email')) {
             $mensaje = $messages->first('email');
         } else {
             $mensaje = Lang::get('controllers.cliente.datos_consulta_contacto_incorrectos');
         }
         return Redirect::to('/contacto')->with('mensaje', $mensaje)->with('error', true)->withInput();
     } else {
         $this->array_view['data'] = $data;
         Mail::send('emails.consulta-contacto', $this->array_view, function ($message) use($data) {
             $message->from($data['email'], $data['nombre'])->to('*****@*****.**')->subject('Consulta');
         });
         if (count(Mail::failures()) > 0) {
             $mensaje = Lang::get('controllers.cliente.consulta_no_enviada');
         } else {
             $data['nombre_apellido'] = $data['nombre'];
             Cliente::agregar($data);
             $mensaje = Lang::get('controllers.cliente.consulta_enviada');
         }
         if (isset($data['continue']) && $data['continue'] != "") {
             switch ($data['continue']) {
                 case "contacto":
                     return Redirect::to('contacto')->with('mensaje', $mensaje);
                     break;
                 case "menu":
                     $menu = Menu::find($data['menu_id']);
                     return Redirect::to('/' . $menu->url)->with('mensaje', $mensaje);
                     break;
             }
         }
         return Redirect::to("/")->with('mensaje', $mensaje);
         //return View::make('producto.editar', $this->array_view);
     }
 }
Exemple #2
0
 public function insert()
 {
     $respuesta = Cliente::agregar(Input::all());
     if ($respuesta['error'] == true) {
         return Redirect::to('cliente/add.html')->withErrors($respuesta['mensaje'])->withInput();
     } else {
         return Redirect::to('clientes')->with('mensaje', $respuesta['mensaje']);
     }
 }
Exemple #3
0
<?php

session_start();
// inicia sesion
include '../../db/seguridad/Cliente.php';
if (!empty($_SESSION["nombre"])) {
    if (isset($_POST['Registrar'])) {
        $instanciaCliente = new Cliente();
        $registroCorrecto = $instanciaCliente->agregar($_REQUEST['CI'], $_REQUEST['nombre'], $_REQUEST['paterno'], $_REQUEST['materno'], $_REQUEST['direccion'], $_REQUEST['telefono'], $_REQUEST['correo']);
        print_r($registroCorrecto);
        if ($registroCorrecto[0] > 0) {
            echo "<script language='JavaScript'>alert('Registro Correcto');\n            location.href='../../principal.php';</script>";
        } else {
            echo "<script language='JavaScript'>alert('Se produjeron errores en el registro');\n            location.href='../../principal.php';</script>";
        }
    } else {
        ?>
<html>
<head>
  <link rel ="stylesheet" href = "../botones.css" type = "text/css">
  <link rel ="stylesheet" href = "../seguridad/agperfil.css" type = "text/css">
<title>Agregar Persona</title>
</head>
<body>
  <section class="contenido">
<form action="agregar.php" method="post">
  <section class="datos">
     * Campos con asterisco son obligatorios
  <h2 align="center">AGREGAR CLIENTE</h2>
<h3>CI:
<input class="in" type="number" name="CI" size="8" pattern="[0-9]{5,10}" maxlength="8" required>*</h3>