コード例 #1
0
 public function categoryAction()
 {
     $catId = (int) $this->getRequestParam('id', 0);
     $categoriesTbl = new Category();
     $cat = $categoriesTbl->getCategory($catId);
     if (!$cat) {
         $this->notFound();
     }
     $componentMenu = new TopMenuComponent($this);
     $componentMenuResp = $componentMenu->toString();
     $componentNotify = new NotifyComponent($this);
     $componentNotifyResp = $componentNotify->toString();
     $form = new CategoryFormType($this);
     $form->fill($cat);
     if ($_POST) {
         if ($form->fillAndIsValid()) {
             if ($idNew = $form->save()) {
                 if (is_array($idNew)) {
                     $idNew = $catId;
                 }
                 $this->redirect('backend_category', array('id' => $idNew));
             }
         }
     }
     $formR = $form->render();
     $this->render(array('componentMenu' => $componentMenuResp, 'componentNotify' => $componentNotifyResp, 'form' => $formR), 'Backend/Category/category.html');
 }
コード例 #2
0
 public function categoryAction()
 {
     $catId = (int) $this->getRequestParam('id', 0);
     $catTbl = new Category();
     $category = $catTbl->getCategory($catId);
     if (!$category) {
         $this->notFound();
     }
     $categories = $catTbl->getAllThisLevelCategories($catId);
     $products = $catTbl->getProductsFromCategory($catId);
     $componentMenu = new TopMenuComponent($this);
     $componentMenuResp = $componentMenu->toString();
     $this->render(array('category' => $category, 'categories' => $categories, 'products' => $products, 'leftMenu' => $componentMenuResp), 'App/Category/products.html');
 }