Example #1
0
 /**
  * funkce updatne kategorii
  * @param int $category_id
  * @param object $data
  * @return bool
  */
 public function updateCategory($category_id, $data)
 {
     try {
         return Categories::updateCategory($category_id, $data);
     } catch (Exception $e) {
         throw new RPCFault($e->getMessage(), $e->getCode(), $e->getCode());
     }
 }
Example #2
0
                    break;
                } else {
                    $id = $categories[$i]['id_parent'];
                    array_push($parent_path, $id);
                    $i = 0;
                }
            }
        }
        $parent_path = array_reverse($parent_path);
        return $parent_path;
    }
}
switch ($action) {
    case "add":
        $category = new Categories();
        $category->saveData($_POST['name'], $_POST['id_parent']);
        header("Location: " . PATHSITE . "/admin-categories");
        break;
    case "remove":
        $category = new Categories();
        $category->deleteData("categories", $_POST['id_category']);
        header("Location: " . PATHSITE . "/admin-categories");
        break;
    case "update":
        $category = new Categories();
        $category->updateCategory($_POST['id_category'], $_POST['name'], $_POST['id_parent']);
        header("Location: " . $_SERVER['HTTP_REFERER']);
        break;
    default:
        break;
}