예제 #1
0
 function viewAction()
 {
     $fc = FrontController::getInstance();
     $model = new FrontModel();
     $id = filter_var($fc->getParams()['id'], FILTER_SANITIZE_NUMBER_INT);
     if (!$id) {
         header('Location: /admin/notFound');
         exit;
     }
     $productModel = new ProductTableModel();
     $productModel->setId($id);
     $productModel->setTable('product');
     $ImageModel = new ImageTableModel();
     $ImageModel->setId($id);
     $ImageModel->setTable('image');
     $images = $ImageModel->readRecordsById('product_id', '*', 'ORDER BY main');
     $product = $productModel->readRecordsById()[0];
     $categoryModel = new CategoryTableModel();
     $product['category'] = $categoryModel->getCategoryById($product['category_id'])['category_name'];
     $product['subCategory'] = $categoryModel->getSubCategoryById($product['subcategory_id'])['subcategory_name'];
     if (!$product) {
         header('Location: /admin/notFound');
         exit;
     }
     $recProducts = (new IndexWidgets())->recAndPopProductsWidget('recommended');
     $model->setData(['product' => $product, 'images' => $images, 'recommendedProducts' => Generator::recommendedProducts($recProducts)]);
     $output = $model->render('../views/product/product.php', 'withoutSlider');
     $fc->setPage($output);
 }
예제 #2
0
 public function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new FrontModel();
     $model->setData(['basket' => Basket::getProductsFromBasket(TRUE)]);
     $output = $model->render('../views/order/order.php', 'withoutSliderAndSidebar');
     $fc->setPage($output);
 }
예제 #3
0
 function indexAction()
 {
     $fc = FrontController::getInstance();
     $model = new FrontModel();
     $popProducts = (new IndexWidgets())->recAndPopProductsWidget('popular', 6);
     $recProducts = (new IndexWidgets())->recAndPopProductsWidget('recommended');
     $model->setData(['slides' => IndexWidgets::getSliderWidget(), 'currentCategory' => (new IndexWidgets())->currentCategoryWidget(Helper::getSiteConfig()->currentCategoryWidget), 'popularProducts' => Generator::popularProducts($popProducts, 6), 'recommendedProducts' => Generator::recommendedProducts($recProducts)]);
     $output = $model->render('../views/index.php', 'main');
     $fc->setPage($output);
 }
예제 #4
0
 public function profileAction()
 {
     $fc = FrontController::getInstance();
     $model = new FrontModel();
     $userModel = new UserTableModel();
     $userModel->setTable('user');
     $id = filter_var($fc->getParams()['id'], FILTER_SANITIZE_NUMBER_INT);
     if (!$id || $id !== Session::get('user_id')) {
         header('Location: /');
         exit;
     }
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
     } else {
         $manager = $userModel->getUserProfileManager($id);
         $userProfile = $manager->getFullUserProfile();
         $model->setData(['profile' => $userProfile]);
         $output = $model->render('../views/user/profile.php', 'withoutSliderAndSidebar');
         $fc->setPage($output);
     }
 }
예제 #5
0
 public function viewAction()
 {
     $fc = FrontController::getInstance();
     $model = new FrontModel();
     $articleModel = new ArticleTableModel();
     $userModel = new UserTableModel();
     $id = filter_var($fc->getParams()['id'], FILTER_SANITIZE_NUMBER_INT);
     if (!$id) {
         header('Location: /admin/notFound');
         exit;
     }
     $articleModel->setId($id);
     $articleModel->setTable('article');
     $article = $articleModel->readRecordsById();
     $userModel->setId($article[0]['author']);
     $userModel->setTable('user');
     $model->setData(['article' => $article, 'author' => $userModel->readRecordsById('id', 'id, username')]);
     $output = $model->render('../views/blog/view.php', 'withoutSlider');
     $fc->setPage($output);
 }