/**
  * @see		Controller::handle()
  */
 public function handle()
 {
     $cart = Registry::getInstance()->get('modelFactory')->createCart();
     if (isset($_GET['a'])) {
         if (isset($_GET['p']) && is_numeric($_GET['p'])) {
             switch ($_GET['a']) {
                 case 'add':
                     $cart->addProduct($_GET['p']);
                     break;
                 case 'change':
                     $cart->changeProduct($_GET['p']);
                     break;
                 default:
                     throw new RuntimeException('Não entendemos sua requisição.');
             }
         } else {
             throw new RuntimeException('Não entendemos sua requisição.');
         }
     }
     $view = new CartView($cart);
     $view->show();
 }
Exemple #2
0
     ContactView::show();
     MasterView::showFooter();
     break;
 case "about":
     MasterView::showHeader();
     AboutView::show();
     MasterView::showFooter();
     break;
 case "cart":
     MasterView::showHeader();
     CartView::show();
     MasterView::showFooter();
     break;
 case "suggestions":
     MasterView::showHeader();
     CartView::show();
     MasterView::showFooter();
     break;
 case "orderConfirmed":
     MasterView::showHeader();
     orderConfirmationView::show();
     MasterView::showFooter();
     break;
 case "showProduct":
     MasterView::showHeader();
     productDetail::showProduct();
     MasterView::showFooter();
     break;
 case "categories":
     MasterView::showHeader();
     categoriesView::show();