Ejemplo n.º 1
0
 public function categoriesbackupAction()
 {
     $categories = new Model_Categories();
     if ($this->_getParam('edit')) {
         $category_id = $this->_getParam('edit');
         $category = $categories->listCategories($category_id);
         $this->view->data = $category[0];
         $parents = $categories->listParentCategories($category_id);
         $this->view->parentcategories = $parents;
         if ($_POST) {
             $categories->update($_POST['ID'], $_POST);
             $this->_redirect('/admin/categories/edit/' . $_POST['ID']);
         }
     }
     if ($this->_getParam('delete')) {
         $category_id = $this->_getParam('delete');
         $category = $categories->delete($category_id);
         $this->_redirect('/admin/categories/');
     }
     //create
     if ($_POST) {
         $new_category = $categories->create($_POST);
         $this->_redirect('/admin/categories/');
     }
     if (!$this->_getParam('edit')) {
         $parents = $categories->listParentCategories();
         $this->view->parentcategories = $parents;
     }
     $this->view->category_tree = $categories->listCategoryTree();
     $this->view->orphan_categories = $categories->listOrphanCategories();
     #$categories_list = $categories->listCategories();
     #$this->paginator($categories_list);
 }