Esempio n. 1
0
 public function edit_dish($idDish = null)
 {
     $flash_string = '';
     if (Session::exists('account')) {
         $flash_string = Session::flash('account');
     }
     $user = new User();
     if ($user->isLoggedIn()) {
         if (isset($idDish)) {
             $dish = Dish::toArray($idRecipe);
             $units = Unit::toArray();
             $product = Product::toArray();
             $this->view('account/dish_edit', ['register' => true, 'loggedIn' => 1, 'flash' => $flash_string, 'name' => $user->data()->name, 'page_name' => "Edit dish", 'products' => json_encode($product), 'user_id' => $user->data()->id, 'dish' => json_encode($dish), 'units' => json_encode($units)]);
         } else {
             Redirect::to('account/dishes');
         }
     } else {
         Session::flash('home', 'You have been logged out, please log back in');
         Redirect::to('home');
     }
 }