public function cardProductAction()
 {
     $fc = FrontController::getInstance();
     $db = CatalogDB::getInstance();
     $model = new CatalogModel();
     $params = $fc->getParams();
     $model->search = $params['search'];
     $model->cardProduct = $db->getItem($params['id']);
     $fc->setBody($model->render('cardProduct.php', TEMPLATE));
 }
示例#2
0
 public function __construct()
 {
     $catalogList = CatalogModel::getList();
     $tree = array();
     mkTree($catalogList, $tree);
     $this->catalogList = $tree;
     $this->_initNavi();
 }
示例#3
0
 public function __construct()
 {
     $catalogList = CatalogModel::getList();
     $tree = array();
     $this->mkTree($catalogList, $tree);
     $this->assign('catalogList', $tree);
     $this->assign('status', ArchiveModel::$STATUS);
     parent::__construct();
 }
示例#4
0
 public function delete()
 {
     $id = request('id');
     $catalogList = CatalogModel::getList();
     $subs = array();
     mkTree($catalogList, $subs, $id);
     $ids = array_keys($subs);
     if (CatalogModel::deleteBatch($ids)) {
         $this->success($this->reffer());
     } else {
         $this->error();
     }
 }
示例#5
0
<?php

require "vendor/autoload.php";
error_reporting(E_ALL);
ini_set("display_errors", "On");
//simpler routing mechanism for serving pages
$link = $_SERVER['REQUEST_URI'];
$userModel = new UserModel();
$userController = new UserController($userModel);
$catalogModel = new CatalogModel();
$catalogModel->setCatalog();
$catalogController = new CatalogController($catalogModel);
if ($link === '/') {
    $userController->index();
} elseif ($link === '/login') {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $form_token = $_POST['form_token'];
    $userController->login($username, $password, $form_token);
} elseif ($link === '/logout') {
    $userController->logout();
} elseif ($link === '/catalog') {
    $catalogController->index();
} elseif ($link === '/order') {
    $json = $_POST['order'];
    $catalogController->order($json);
}