public function displayUploadInterface() { $categoryObj = new CategoryController(); $languageObj = new LanguageController(); $categoryList = $categoryObj->getCategoryList(); $languageList = $languageObj->getLanguageList(); $this->smarty->assign("CATEGORY_LIST", $categoryList); $this->smarty->assign("LANGUAGE_LIST", $languageList); $this->smarty->assign("FILE_UPLOAD_ACTION_VALUE", UploadController::FILE_UPLOAD_ACTION_VALUE); $this->render($this->currModule); }
public function index() { ClassLoader::import('application.controller.CategoryController'); $this->request->set('id', Category::ROOT_ID); $this->request->set('cathandle', '-'); $response = parent::index(); // load site news $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('NewsPost', 'isEnabled'), true)); $f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC'); $f->setLimit($this->config->get('NUM_NEWS_INDEX') + 1); $news = ActiveRecordModel::getRecordSetArray('NewsPost', $f); $response->set('news', $news); $response->set('isNewsArchive', count($news) > $this->config->get('NUM_NEWS_INDEX')); return $response; }
public function dataTable() { $param['city'] = $this->getUrlVar('city', NULL); $data = DBproxy::getProcedure('Manage')->setDimension(2)->getCategory($param); CategoryController::$data = $data['data']; Doo::loadClassAt('html/DataTable', 'default'); Doo::loadClassAt('html/DooFormExt', 'default'); $dt = new DataTable(); function table_button($row, $rowData, $val) { $a = ' <a class="btn blue-stripe mini" href="' . CategoryController::$modUrl . $rowData['id'] . '">' . '编辑</a>'; $a .= ' <a class="red-stripe btn mini js-datatable-del" href="' . CategoryController::$delUrl . $rowData['id'] . '" >删除</a>'; return $a; } function table_status($row, $rowData, $val) { $status = CategoryController::$data[$rowData['id']]['status']; if (trim($status) == '0') { $a = '<span class="label label-success">正常可用</span>'; } else { $a = '<span class="label">失效'; } return $a; } function table_prentid($row, $rowData, $val) { $pname = CategoryController::$data[$rowData['id']]['pname']; if (trim($pname) == '') { $a = '顶级父类'; } else { $a = CategoryController::$data[$rowData['id']]['pname']; } return $a; } // 表头 $header = array('name' => array('name' => '分类名称'), 'pname' => array('name' => '所属分类', 'callback' => 'table_prentid'), 'status' => array('name' => '状态', 'callback' => 'table_status'), 'action' => array('name' => '操作', 'callback' => 'table_button')); $name = Category::cateToOption(0, false, 'array', $data); $form = new DooFormExt(array('method' => 'get', 'renderFormat' => 'html', 'action' => '', 'attributes' => array('id' => 'js-get-form', 'class' => 'form-horizontal'), 'elements' => array('add' => array('display', array('left' => ' ', 'hide-label' => true, 'div' => false, 'content' => '<a href="' . CategoryController::$addUrl . '" class="btn green-stripe"><i class="icon-plus"></i>添加分类</a>', 'attributes' => array('class' => "m-wrap")))))); // 生产表格 $content = $dt->setTitle('')->setAttr(array('class' => 'table table-hover', 'id' => 'js-queryTable'))->setHeader($header)->setData($name)->setTopContent($form->render())->setDefaultValue('unkown')->render(false); // 显示模版 $this->contentlayoutRender($content); }
$qryfld = array('code', 'name'); foreach ($qryfld as $Key => $Value) { $p[$Value] = $_GET[$Value]; } #$p['code'] = $_GET['code']; #$p['name'] = $_GET['name']; $pos = 1; $_SESSION['p'] = $p; } else { $p = $_SESSION['p']; } if ($pos == "") { $pos = $_SESSION['page']; } $_SESSION['page'] = $pos; $a = new CategoryController($conn); $a->lang = $lang; $a->UserLevel = $UserLevel; $a->UserID = $UserID; $a->lang_str = $lang_str; switch ($action) { case "list": $a->browse($p, 20, $pos); break; case "add": $a->add(); break; case "edit": $a->edit($id); break; case "show":
public function index() { $this->loadLanguageFile('Category'); $product = Product::getInstanceByID($this->request->get('id'), Product::LOAD_DATA, array('ProductImage', 'Manufacturer', 'Category')); $this->product = $product; if (!$product->isEnabled->get() || $product->parent->get()) { throw new ARNotFoundException('Product', $product->getID()); } $product->loadPricing(); $this->category = $product->getCategory(); $this->categoryID = $product->getCategory()->getID(); // get category path for breadcrumb $path = $product->category->get()->getPathNodeArray(); include_once ClassLoader::getRealPath('application.helper.smarty') . '/function.categoryUrl.php'; include_once ClassLoader::getRealPath('application.helper.smarty') . '/function.productUrl.php'; foreach ($path as $nodeArray) { $url = createCategoryUrl(array('data' => $nodeArray), $this->application); if ($nodeArray['isEnabled']) { $this->addBreadCrumb($nodeArray['name_lang'], $url); } } // add filters to breadcrumb CategoryController::getAppliedFilters(); // for root category products if (!isset($nodeArray)) { $nodeArray = array(); } $params = array('data' => $nodeArray, 'filters' => array()); foreach ($this->filters as $filter) { $f = $filter->toArray(); $params['filters'][] = $f; $url = createCategoryUrl($params, $this->application); $this->addBreadCrumb($f['name_lang'], $url); } $productArray = $product->toArray(); $handle = empty($productArray['URL']) ? $productArray['name_lang'] : $productArray['URL']; $this->redirect301($this->request->get('producthandle'), createHandleString($handle)); //ProductSpecification::loadSpecificationForProductArray($productArray); // filter empty attributes foreach ($productArray['attributes'] as $key => $attr) { if (empty($attr['value']) && empty($attr['values']) && empty($attr['value_lang'])) { unset($productArray['attributes'][$key]); } } // attribute summary $productArray['listAttributes'] = array(); foreach ($productArray['attributes'] as $key => $attr) { if ($attr['SpecField']['isDisplayedInList']) { $productArray['listAttributes'][] = $attr; } if (!$attr['SpecField']['isDisplayed']) { unset($productArray['attributes'][$key]); } } // add product title to breacrumb $this->addBreadCrumb($productArray['name_lang'], createProductUrl(array('product' => $productArray), $this->application)); // manufacturer filter if ($product->manufacturer->get()) { $manFilter = new ManufacturerFilter($product->manufacturer->get()->getID(), $product->manufacturer->get()->name->get()); } // get category page route end($this->breadCrumb); $last = prev($this->breadCrumb); $catRoute = $this->router->getRouteFromUrl($last['url']); $response = new ActionResponse(); $response->set('product', $productArray); $response->set('category', $productArray['Category']); $response->set('quantity', $this->getQuantities($product)); $response->set('currency', $this->request->get('currency', $this->application->getDefaultCurrencyCode())); $response->set('catRoute', $catRoute); // ratings if ($this->config->get('ENABLE_RATINGS')) { if ($product->ratingCount->get() > 0) { // rating summaries ClassLoader::import('application.model.product.ProductRatingSummary'); $response->set('rating', ProductRatingSummary::getProductRatingsArray($product)); } ClassLoader::import('application.model.category.ProductRatingType'); $ratingTypes = ProductRatingType::getProductRatingTypeArray($product); $response->set('ratingTypes', $ratingTypes); $response->set('ratingForm', $this->buildRatingForm($ratingTypes, $product)); $response->set('isRated', $this->isRated($product)); $response->set('isLoginRequiredToRate', $this->isLoginRequiredToRate()); $response->set('isPurchaseRequiredToRate', $this->isPurchaseRequiredToRate($product)); } // add to cart form $response->set('cartForm', $this->buildAddToCartForm($this->getOptions(), $this->getVariations())); // related products $related = $this->getRelatedProducts($product); // items purchased together $together = $product->getProductsPurchasedTogether($this->config->get('NUM_PURCHASED_TOGETHER'), true); $spec = array(); foreach ($related as $key => $group) { foreach ($related[$key] as $i => &$prod) { $spec[] =& $related[$key][$i]; } } foreach ($together as &$prod) { $spec[] =& $prod; } ProductSpecification::loadSpecificationForRecordSetArray($spec); $response->set('related', $related); $response->set('together', $together); if (isset($manFilter)) { $response->set('manufacturerFilter', $manFilter); } $response->set('variations', $this->getVariations()); // reviews if ($this->config->get('ENABLE_REVIEWS') && $product->reviewCount->get() && ($numReviews = $this->config->get('NUM_REVIEWS_IN_PRODUCT_PAGE'))) { $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('ProductReview', 'isEnabled'), true)); $f->setLimit($numReviews); $reviews = $product->getRelatedRecordSetArray('ProductReview', $f); $this->pullRatingDetailsForReviewArray($reviews); $response->set('reviews', $reviews); } // bundled products if ($product->isBundle()) { $bundleData = ProductBundle::getBundledProductArray($product); $bundledProducts = array(); foreach ($bundleData as &$bundled) { $bundledProducts[] =& $bundled['RelatedProduct']; } ProductPrice::loadPricesForRecordSetArray($bundledProducts); $response->set('bundleData', $bundleData); $currency = Currency::getInstanceByID($this->getRequestCurrency()); $total = ProductBundle::getTotalBundlePrice($product, $currency); $response->set('bundleTotal', $currency->getFormattedPrice($total)); $saving = $total - $product->getPrice($currency); $response->set('bundleSavingTotal', $currency->getFormattedPrice($saving)); $response->set('bundleSavingPercent', $total ? round($saving / $total * 100) : 0); } // contact form if ($this->config->get('PRODUCT_INQUIRY_FORM')) { $response->set('contactForm', $this->buildContactForm()); } // display theme if ($theme = CategoryPresentation::getThemeByProduct($product)) { if ($theme->getTheme()) { $this->application->setTheme($theme->getTheme()); } $response->set('presentation', $theme->toFlatArray()); } // product images $images = $product->getImageArray(); if ($theme && $theme->isVariationImages->get()) { if ($variations = $this->getVariations()) { foreach ($variations['products'] as $prod) { if (!empty($prod['DefaultImage']['ID'])) { $images[] = $prod['DefaultImage']; } } } } $response->set('images', $images); // discounted pricing $response->set('quantityPricing', $product->getPricingHandler()->getDiscountPrices($this->user, $this->getRequestCurrency())); $response->set('files', $this->getPublicFiles()); // additional categories $f = new ARSelectFilter(); $f->setOrder(new ARFieldHandle('Category', 'lft')); $f->mergeCondition(new EqualsCond(new ARFieldHandle('Category', 'isEnabled'), true)); $pathC = new OrChainCondition(); $pathF = new ARSelectFilter($pathC); $categories = array(); foreach ($product->getRelatedRecordSetArray('ProductCategory', $f, array('Category')) as $cat) { $categories[] = array($cat['Category']); $cond = new OperatorCond(new ARFieldHandle('Category', 'lft'), $cat['Category']['lft'], "<"); $cond->addAND(new OperatorCond(new ARFieldHandle('Category', 'rgt'), $cat['Category']['rgt'], ">")); $pathC->addAnd($cond); } if ($categories) { $pathF->setOrder(new ARFieldHandle('Category', 'lft'), 'DESC'); $pathF->mergeCondition(new EqualsCond(new ARFieldHandle('Category', 'isEnabled'), true)); foreach (ActiveRecordModel::getRecordSetArray('Category', $pathF, array('Category')) as $parent) { if (!$parent['isEnabled']) { continue; } foreach ($categories as &$cat) { if ($cat[0]['lft'] > $parent['lft'] && $cat[0]['rgt'] < $parent['rgt'] && $parent['ID'] > Category::ROOT_ID) { $cat[] = $parent; } } } foreach ($categories as &$cat) { $cat = array_reverse($cat); } $response->set('additionalCategories', $categories); } $response->set('enlargeProductThumbnailOnMouseOver', $this->config->get('_ENLARGE_PRODUCT_THUMBNAILS_ON') == 'P_THUMB_ENLARGE_MOUSEOVER'); return $response; }
$userId = $_SESSION['userId']; if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') { /* get all the post data from */ $poiName = decodeInput($_POST['poiName']); $poiAddress = decodeInput($_POST['poiAddress']); $poiCategory = decodeInput($_POST['poiCategory']); $poiPhone = decodeInput($_POST['poiPhone']); $poiEmail = decodeInput($_POST['poiEmail']); $poiWebsite = decodeInput($_POST['poiWebsite']); $poiLatitude = decodeInput($_POST['poiLat']); $poiLongitude = decodeInput($_POST['poiLong']); $poiPosition = $poiLatitude . "," . $poiLongitude; $poiContribution = decodeInput($_POST['poiContribution']); $userController = new UsersController(); $poiController = new PoiController(); $categoryController = new CategoryController(); $contributionController = new ContributionController(); /* since we are letting the validation of the data on the client side, we will skip the validation here and just go on with insertion */ /* so first create the poi object, also the required objects to initialize the poi */ $poi = new POI(); $poi->init($poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", $userController->find($user->getId())); if ($poiContribution != 0) { if (is_numeric($poiContribution)) { if ($contribution = $contributionController->find($poiContribution)) { $poi->setContribution($contribution); } } } $poiController->add($poi); }
require_once "../../model/ParentCategoryController.php"; require_once "../../model/objects/Contribution.php"; require_once "../../model/objects/Category.php"; require_once "../../model/objects/POI.php"; require_once "../../model/objects/User.php"; require_once "../../model/UsersController.php"; require_once "Helpers.php"; header('Content-Type: text/event-stream'); // recommended to prevent caching of event data. header('Cache-Control: no-cache'); $userController = new UsersController(); $userId = $_SESSION['userId']; $user = $userController->find($userId); if ($user->getPrevilege() == 1) { $parentController = new ParentCategoryController(); $categoryController = new CategoryController(); $poiController = new PoiController(); /* start extracting the data from file and initialize the data into the database*/ $inputFile = fopen(Route::getAdminDirectory() . "assets/raw/part4_data.txt", "r"); $skippedData = ""; $insertCount = 0; if ($inputFile) { /* read from the file and write to the database here*/ while (($line = fgets($inputFile)) !== false) { try { $row = explode('||', $line); if (count($row) == 5) { /* the data has valid number of elements, filter for any abnormalities in the data*/ $name = $row[0]; $name = str_replace("'", "''", $name); $address = $row[1];
if (!isset($_COOKIE['session'])) { die("Your session has expired due to inactivity.\n\nPlease reload the page."); } else { $key = $_COOKIE['session']; if (IsValidKey($key)) { RemoveKey($key); $key = InsertKey(); setcookie('session', $key, time() + KEY_TIMEOUT, '/', '', false, true); } else { setcookie('session', $key, time() - 86400, '/', '', false, true); die("Your session has expired due to inactivity.\n\nPlease reload the page."); } } RemoveExpiredKeys(); $value = json_decode($_GET['value']); $category_controller = new CategoryController($value->categories); $centre_latitude = $value->position[0]; $centre_longitude = $value->position[1]; $sql = <<<SQL \t\t\t\tSELECT \t\t\t\t\t* \t\t\t\tFROM \t\t\t\t\tplaces SQL; if (!($list = $db->query($sql))) { Error('There was an error running the query [' . $db->error . ']'); } $image_extensions = array('jpg', 'png', 'gif'); $rows = array(); while ($row = $list->fetch_assoc()) { $latitude = (double) $row['latitude'];
break; case 'POST': CategoryController::create($_POST); break; case 'GET': if (isset($request) && !empty($request) && $request[0] !== '') { if ($request[0] == 'check') { $field = $request[1]; $value = $request[2]; CategoryController::check($field, $value); } elseif ($request[0] == 'quiz') { CategoryController::readCategoryQuiz(); } else { $id = $request[0]; CategoryController::detail($id); } } else { CategoryController::read(); } break; case 'DELETE': if (isset($request) && !empty($request) && $request[0] !== '') { $id = $request[0]; CategoryController::delete($id); } break; default: print json_encode('ENTRANCE EXAM API v.0.1 developed by: Philip Cesar B. Garay'); break; } exit;
*/ include_once "../model/objects/POI.php"; include_once "../model/CategoryController.php"; include_once "../model/PoiController.php"; include_once "../model/ContributionController.php"; include_once "../model/UsersController.php"; $userId = $_SESSION['userId']; if ($_SERVER['REQUEST_METHOD'] == 'POST' || $_SERVER['REQUEST_METHOD'] == 'post') { /* get all the post data from */ $id = decodeInput($_POST['id']); $poiName = decodeInput($_POST['poiName']); $poiAddress = decodeInput($_POST['poiAddress']); $poiCategory = decodeInput($_POST['poiCategory']); $poiPhone = decodeInput($_POST['poiPhone']); $poiEmail = decodeInput($_POST['poiEmail']); $poiWebsite = decodeInput($_POST['poiWebsite']); $poiLatitude = decodeInput($_POST['poiLat']); $poiLongitude = decodeInput($_POST['poiLong']); $poiPosition = $poiLatitude . "," . $poiLongitude; $poiContribution = decodeInput($_POST['poiContribution']); $userController = new UsersController(); $poiController = new PoiController(); $categoryController = new CategoryController(); $contributionController = new ContributionController(); /* since we are letting the validation of the data on the client side, we will skip the validation here and just go on with insertion */ /* so first create the poi object, also the required objects to initialize the poi */ $poi = new POI(); $poi->initWithId($id, $poiName, $poiAddress, $poiPosition, $categoryController->find($poiCategory), $poiPhone, $poiEmail, $poiWebsite, "", "", new Contribution(), $userController->find($user->getId())); $poiController->update($poi); }
<?php include "../header.php"; require_once "../model/ParentCategoryController.php"; require_once "../model/objects/Category.php"; require_once "../model/objects/ParentCategory.php"; require_once "../model/CategoryController.php"; $parentController = new ParentCategoryController(); $categoryController = new CategoryController(); ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Create Category </h1> </section> <!-- Main content --> <section class="content"> <div class="row"> <!-- left column --> <div class="col-md-4"> <!-- general form elements --> <div class="box box-primary"> <div class="box-header with-border"> <h3 class="box-title">Create Parent Category</h3> </div> <!-- form start --> <form role="form" class="form-horizontal">
}); //分类回收站 Macaw::get('/admin/category/recycle/', 'CategoryController@category_recycle'); //分类回收站分页 Macaw::get('/admin/category/recycle/(:num)', function ($slug) { $CategoryController = new CategoryController(); $CategoryController->category_recycle($slug); }); //恢复分类 Macaw::get('/admin/category/getrecycle/(:num)', function ($slug) { $CategoryController = new CategoryController(); $CategoryController->category_getrecycle($slug); }); //删除分类 Macaw::get('/admin/category/reldel/(:num)', function ($slug) { $CategoryController = new CategoryController(); $CategoryController->category_reldel($slug); }); //内容管理 Macaw::get('/admin/article/', 'ArticleController@home'); //内容分页 Macaw::get('/admin/article/(:num)', function ($slug) { $article = new ArticleController(); $article->home($slug); }); //添加内容 Macaw::get('/admin/article/add/', 'ArticleController@articel_add'); Macaw::post('/admin/article/add/', 'ArticleController@articel_add'); //修改文章 Macaw::get('/admin/article/update/', 'ArticleController@article_update'); Macaw::get('/admin/article/update/(:num)', function ($slug) {
<?php include "../header.php"; include_once "../model/PoiController.php"; include_once "../model/UsersController.php"; require_once "../model/CategoryController.php"; include_once "../model/objects/User.php"; include_once "../model/objects/POI.php"; $categoryController = new CategoryController(); $poiController = new PoiController(); $filterCatId = 0; $searchKey = ""; if (array_key_exists("category", $_REQUEST)) { if (is_numeric(decodeInput($_REQUEST['category']))) { $filterCatId = decodeInput($_REQUEST['category']); } } if (array_key_exists("search", $_REQUEST)) { $searchKey = decodeInput($_REQUEST['search']); } // by default we show first page $rowsPerPage = 100; $pageNum = 1; $offset = 0; if (isset($_GET['page'])) { $pageNum = $_GET['page']; $offset = ($pageNum - 1) * $rowsPerPage; } ?> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper">
Route::get('/back_end/addCategory', function () { return View::make('/back_end/addCategory'); }); Route::get('/back_end/manageCategory', array('uses' => 'CategoryController@displayCategory', 'as' => 'managecategory.displayCategory')); /*Route::get('/back_end/manageCategory', function() { return View::make('/back_end/manageCategory'); }); */ Route::get('/back_end/editCategory', function () { return View::make('/back_end/editCategory'); }); Route::post('/back_end/addproduct', function () { $addproduct = new InventoryController(); return $addproduct->store(); }); Route::get('/back_end/makePurchase', function () { return View::make('/back_end/makePurchase'); }); Route::get('/back_end/purchaseManagement', function () { return View::make('/back_end/purchaseManagement'); }); Route::get('/back_end/editCategories', function () { return View::make('/back_end/editCategories'); }); Route::post('/back_end/addcategory', function () { $addcategory = new CategoryController(); return $addcategory->store(); }); Route::post('/back_end/deletec/{idc}', array('uses' => 'CategoryController@destroy', 'as' => 'deleteCategory')); Route::get('/back_end/manageCategory', array('uses' => 'CategoryController@displayCategory', 'as' => 'managecategory.displayCategory'));
ini_set('display_errors', 1); define("APPPATH", realpath(__DIR__ . "/../app") . DIRECTORY_SEPARATOR); require_once APPPATH . "/ClassLoader.php"; system\core\ClassLoader::registerDir(APPPATH . "/models/lib"); system\core\ClassLoader::registerDir(APPPATH . "/models"); system\core\ClassLoader::registerDir(APPPATH . "/models/util"); system\core\ClassLoader::registerDir(APPPATH . "/controllers"); system\core\ClassLoader::registerDir(APPPATH . "/views"); system\core\ClassLoader::registerDir(APPPATH . "/views/helper"); system\core\ClassLoader::registerDir(APPPATH . "/views/util"); if (!empty($_SERVER["PATH_INFO"])) { $path = $_SERVER["PATH_INFO"]; } else { $controller = new ErrorController(); $controller->render($_GET, 400, "PATH_INFO doesn't exist"); exit; } if (preg_match("!/item/([0-9]+)/?!", $path, $match)) { $_GET["id"] = $match[1]; $controller = new ItemController(); $controller->detail($_GET); } elseif (preg_match("!/items/?(.?+)!", $path, $match)) { $controller = new ItemController(); $controller->search($_GET); } elseif (preg_match("!/categories/?(.?+)!", $path, $match)) { $controller = new CategoryController(); $controller->search($_GET); } else { $controller = new ErrorController(); $controller->render($_GET, 404, "Request URL is no longer available"); }