Пример #1
0
 public function addAction()
 {
     $form = new DataForm();
     if ($form->isPosted()) {
         if ($form->isValidForAdd()) {
             $id = Data::create(["name" => Input::get("name"), "description" => Input::get("description"), "mobile" => Input::get("mobile"), "email" => Input::get("email"), "address" => Input::get("address"), "web" => Input::get("web"), "ranking" => 50])->id;
             $this->associateUser(Auth::user()->id, $id);
             return Redirect::route($this->routeAdd);
         }
         return Redirect::route($this->routeAdd)->withInput(["errors" => $form->getErrors()]);
         //die(var_dump($form->getErrors()));
         return Redirect::route($this->routeAdd)->withErrors($form->getErrors())->withInput();
     }
     return View::make($this->routeAdd, ["form" => $form, "HeaderTitle" => trans('addData.title')]);
 }
 public function addAction()
 {
     $form = new ProductoForm();
     if ($form->isPosted()) {
         if ($form->isValidForAdd()) {
             $ID_INVENTARIO = Data::create(["ID_INVENTARIO" => Input::get("ID_INVENTARIO"), "ID_VENTA" => Input::get("ID_VENTA"), "ID_PRODUCTO" => Input::get("ID_PRODUCTO"), "ID_RUTA" => Input::get("ID_RUTA"), "NOMBRE_PRODUCTO" => Input::get("NOMBRE_PRODUCTO"), "DISPONIBLE" => 1])->ID_INVENTARIO;
             //$this->associateUser(Auth::user()->id,$id);
             return Redirect::route($this->routeAdd);
         }
         return Redirect::route($this->routeAdd)->withInput(["errors" => $form->getErrors()]);
         //die(var_dump($form->getErrors()));
         return Redirect::route($this->routeAdd)->withErrors($form->getErrors())->withInput();
     }
     return View::make($this->routeAdd, ["form" => $form, "HeaderTitle" => trans('addData.title')]);
 }
Пример #3
0
       
      	<nav class="navbar navbar-full navbar-inverse">
		<div class="navbar-brand center-block"> 
			<h3>php :: mon </h3>
		</div> 
		
	</nav>

  <div class="container">
  
<?php 
if ($_POST) {
    $product->name = $_POST['name'];
    $product->url = $_POST['url'];
    $product->host = $_POST['host'];
    if ($product->create()) {
        ?>
<div class="alert alert-success alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>Success!</strong> <a href="index.php">View Data</a>.
</div>
<?php 
    } else {
        ?>
<div class="alert alert-danger alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>Fail!</strong></div>
<?php 
    }
}
?>
Пример #4
0
 /**
  * checkIntegrity
  * --------------------------------------------------
  * Checking a widget's overall integrity,
  * setting state accordingly.
  * --------------------------------------------------
  */
 protected function checkIntegrity($commit = TRUE)
 {
     // Data integrity validation.
     if ($this instanceof iDataWidget) {
         // Exception variables.
         $valid = TRUE;
         $save = FALSE;
         try {
             $this->checkData();
         } catch (MissingData $e) {
             // Data object is not present but it should be.
             $valid = FALSE;
             $save = TRUE;
             $data = Data::create(array('raw_value' => $this->createDataScheme()));
             $this->data()->associate($data);
             $data->save();
         } catch (InvalidData $e) {
             // Invalid data found in db, doing cleanup.
             $valid = FALSE;
             $save = TRUE;
             $this->data->raw_value = $this->createDataScheme();
             $this->data->save();
         } catch (EmptyData $e) {
             // Data not yet populated.
             $valid = FALSE;
         }
         // Updating widget state accordingly.
         if (!$valid && $this->state == 'active') {
             $this->state = 'missing_data';
             $save = TRUE;
         } elseif ($valid && $this->state == 'missing_data') {
             // Valid and was missing_data -> set to active.
             $this->state = 'active';
             $save = TRUE;
         }
         if ($save && $commit) {
             $this->save();
         }
     }
 }