public function getEdit($id) { $result['isEditor'] = Auth::isUserInRole(array('editor', 'admin')); $result['isAdmin'] = Auth::isUserInRole(array('admin')); if ($result['isEditor']) { $result = array('product' => $this->product->getProductWitnUnavailable($id)); } else { $result = array('product' => $this->product->getProduct($id)); } $result['title'] = 'Shop'; $result['action'] = '/product/edit/' . $result['product']['id']; $result['submit'] = 'edit'; $categories = $this->category->getCategories(); foreach ($categories as $c) { $currentCategory = array(); $currentCategory['text'] = $c['name']; $currentCategory['options'] = array('value' => $c['id']); if ($id == $c['id']) { $currentCategory['options']['selected'] = 'true'; } $result['categories'][] = $currentCategory; } View::make('product.add', $result); if (Auth::isAuth()) { View::appendTemplateToLayout('topBar', 'top_bar/user'); } else { View::appendTemplateToLayout('topBar', 'top_bar/guest'); } View::appendTemplateToLayout('header', 'includes/header')->appendTemplateToLayout('footer', 'includes/footer')->render(); }