Exemple #1
0
 public static function GetPanel()
 {
     $tpl = new Template();
     $items = Category_Model::GetCategories();
     $tpl->SetParam('cart', $_SESSION['cart']);
     return $tpl->Fetch('templates/cart/cart-panel.tpl');
 }
Exemple #2
0
 public function categories($id = null)
 {
     if ($_SERVER['REQUEST_METHOD'] == "DELETE") {
         return Category_Model::DeleteCategory($id);
     }
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $data = json_decode(file_get_contents("php://input"), true);
         return Category_Model::CreateCategory($data);
     }
     if ($_SERVER['REQUEST_METHOD'] == "PUT") {
         $data = json_decode(file_get_contents("php://input"), true);
         return Category_Model::UpdateCategory($data, $id);
     }
     if (isset($id)) {
         return Category_Model::GetCategoryById($id);
     }
     return Category_Model::GetCategories();
 }