//$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, 'Cập nhật thành công'), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", "info"), array(0, "Input data is invalid"), array(0, 1)); return; } } } //else //{ // echo global_common::convertToXML($arrHeader, array("rs",'info'), array(0,global_common::STRING_REQUIRE_LOGIN), array(0,1)); //} return; } elseif ($_pgR['act'] == Model_ArticleType::ACT_GET_ALL) { $types = $objArticleType->getAllArticleType(0); echo json_encode($types); return; } elseif ($_pgR['act'] == model_Article::ACT_CHANGE_PAGE) { $intPage = $_pgR['p']; $outPutHTML = $objArticle->getListArticle($intPage); echo global_common::convertToXML($strMessageHeader, array('rs', 'inf'), array(1, $outPutHTML), array(0, 1)); return; } elseif ($_pgR['act'] == model_Article::ACT_SHOW_EDIT) { $strArticleID = $_pgR['id']; $arrArticle = $objArticle->getArticleByID($strArticleID); echo global_common::convertToXML($strMessageHeader, array('rs', 'ArticleID', 'Prefix', 'Title', 'FileName', 'ArticleType', 'Content', 'NotificationType', 'Tags', 'CatalogueID', 'SectionID', 'NumView', 'NumComment', 'Status', 'comments', 'RenewedDate', 'RenewedNum'), array(1, 'ArticleID', 'Prefix', 'Title', 'FileName', 'ArticleType', 'Content', 'NotificationType', 'Tags', 'CatalogueID', 'SectionID', 'NumView', 'NumComment', 'Status', 'comments', 'RenewedDate', 'RenewedNum'), array(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0)); return; } elseif ($_pgR["act"] == model_Article::ACT_GET) { $sectionID = $_pgR["sect"]; $arrSection = $objMenu->getAllMenuBySection($sectionID);
include_once 'class/model_propertygroup.php'; include_once 'class/model_datatype.php'; include_once 'class/model_manufactory.php'; $objStatus = new Model_Status($objConnection); $objProduct = new Model_Product($objConnection); $objProductProperty = new Model_ProductProperty($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objProductPrice = new Model_ProductPrice($objConnection); $objProperty = new Model_Property($objConnection); $objComment = new Model_Comment($objConnection); $objManufactory = new Model_Manufactory($objConnection); $objRetailer = new Model_Retailer($objConnection); $_currentProductID = $_pgR["pid"]; $city = $_pgR['ct']; $_SESSION[global_common::SES_C_CUR_PAGE] = 'product_detail.php?pid=' . $_currentProductID; $_arrCategories = $objArticleType->getAllArticleType(0, null, '`ParentID`=0', 'Level'); //$_currentParentCatID = $catID; if ($_pgR["pid"]) { $_currentProduct = $objProduct->getProductByID($_currentProductID); $catID = $objArticleType->getArticleTypeByID($_currentProduct[global_mapping::CatalogueID]); $_currentParentCatID = $catID[global_mapping::ParentID]; } include_once 'include/_header.inc'; include_once 'include/_menu.inc'; //include_once('include/_cat_list.inc'); ?> <script type="text/javascript" src="<?php echo $_objSystem->locateJs('user_product.js'); ?> "></script> <script type="text/javascript" src="<?php
include_once 'class/model_propertygroup.php'; include_once 'class/model_datatype.php'; include_once 'class/model_manufactory.php'; include_once 'class/model_city.php'; $objProduct = new Model_Product($objConnection); $objCity = new Model_City($objConnection); $objProductProperty = new Model_ProductProperty($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objProductPrice = new Model_ProductPrice($objConnection); $objProperty = new Model_Property($objConnection); $objManufactory = new Model_Manufactory($objConnection); $objRetailer = new Model_Retailer($objConnection); $page = $_pgR["p"] ? $_pgR["p"] : 1; $catID = $_pgR["cid"]; $manu = $_pgR["manu"]; $allCats = $objArticleType->getAllArticleType(0, null, '', null); $allCities = $objCity->getAllCity(); if ($catID == 0) { $allCatIDs = ''; } else { $allSubCats = $objArticleType->getAllArticleType(0, null, 'ParentID=' . $catID, null); //print_r($allSubCats); if (count($allSubCats) <= 0) { $allCatIDs = $catID; } else { $allCatIDs = global_common::getArrayColumn($allSubCats, global_mapping::ArticleTypeID); } } if ($allCatIDs) { $search = '`' . global_mapping::CatalogueID . '` IN ( ' . global_common::convertToQueryIN($allCatIDs) . ' )'; }
/* TODO: Add code here */ require 'config/globalconfig.php'; $_SESSION[global_common::SES_C_CUR_PAGE] = "post_search.php"; include_once 'include/_permission.inc'; include_once 'include/_header.inc'; include_once 'class/model_articletype.php'; include_once 'class/model_user.php'; include_once 'class/model_product.php'; include_once 'class/model_manufactory.php'; $objArticleType = new Model_ArticleType($objConnection); $objManufactory = new Model_Manufactory($objConnection); $objProduct = new Model_Product($objConnection); $intMode = 0; //add mode $parentTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=0', 'Level'); $allTypes = $objArticleType->getAllArticleType(0, null, 'ParentID!=0', 'Level'); //set default selected section $currentParentType = $parentTypes[0][global_mapping::ArticleTypeID]; $allManuFactories = $objManufactory->getAllManufactory(0, '*', '', global_mapping::ManufactoryName); $cmArea = $_pgR["cmArea"]; $cmCategory = $_pgR["cmCategory"]; $cmManufactory = $_pgR["cmManufactory"]; $txtKeyword = $_pgR["txtKeyword"]; $lastPage = ''; $condition = '(' . global_mapping::IsDeleted . ' IS NULL or ' . global_mapping::IsDeleted . ' = \'0\') '; if ($_pgR["pid"]) { $preferProduct = $objProduct->getProductByID($_pgR["pid"]); $preferedCat = $objArticleType->getArticleTypeByID($preferProduct[global_mapping::CatalogueID]); $cmArea = $preferedCat[global_mapping::ParentID]; $cmCategory = $preferedCat[global_mapping::ArticleTypeID];
include_once 'include/_header.inc'; include_once 'class/model_articletype.php'; include_once 'class/model_article.php'; include_once 'class/model_comment.php'; include_once 'class/model_user.php'; include_once 'class/model_city.php'; include_once 'class/model_district.php'; include_once 'class/model_partner.php'; $objPartner = new Model_Partner($objConnection); $objArticle = new Model_Article($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objCity = new Model_City($objConnection); $objDistrict = new Model_District($objConnection); $intMode = 0; //add mode $parentTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=0', 'Level'); $allTypes = $objArticleType->getAllArticleType(0, null, 'ParentID=' . $parentTypes[0][global_mapping::ArticleTypeID], 'Level'); $allCities = $objCity->getAllCity(); //echo 'get city:'; //echo($allCities); $allDistricts = $objDistrict->getAllDistrict(); $currentPartner = $objPartner->getPartnerByUserID($_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID]); if ($_pgR["aid"]) { //reset partner info $currentPartner = null; $articleID = $_pgR["aid"]; $article = $objArticle->getArticleByID($articleID); $intMode = 1; //edit mode $createBy = $article[global_mapping::CreatedBy]; $currentUserID = $_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID];
$catName = $cat['Name']; $checkExisted = $objArticleType->getArticleTypeByName($catName); //print_r($checkExisted); ; if (!$checkExisted) { echo 'Adding...' . $catName . '<br>'; $result = $objArticleType->insert($catName, $createdBy, global_common::nowSQL(), $updatedBy, global_common::nowSQL(), null, null, null, $cat['Id'], 0, 0); if ($result) { echo 'Added ' . $catName . ' successfull'; echo '<br>'; } else { echo 'Add ' . $catName . ' failed'; echo '<br>'; } } } $allCats = $objArticleType->getAllArticleType(0); $allFiles = scandir($folder); //print_r($allFiles); //return; foreach ($allFiles as $file) { echo 'Process...' . $file . '<br>'; if (strpos($file, 'Foody_stores_of_cat') !== FALSE) { $jsonStores = global_common::readFromFile($folder . $file); //echo $jsonStores; $rootElements = json_decode($jsonStores, true); $stores = $rootElements['searchItems']; //print_r($stores); //return; echo 'Start import stores with file :' . $file . ' Count:' . count($stores) . '<br>'; foreach ($stores as $store) { //print_r($store);
public function getAllPropertyGroup($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '', &$total) { if (!$selectField) { $selectField = '*'; } if ($whereClause) { $whereClause = ' WHERE ' . $whereClause; } if ($orderBy) { $orderBy = ' ORDER BY ' . $orderBy . ' ,`Order`'; } else { $orderBy = ' ORDER BY `Order`'; } if ($intPage > 0) { $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_PropertyGroup::TBL_SL_PROPERTY_GROUP, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE)); } else { $strSQL .= global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_PropertyGroup::TBL_SL_PROPERTY_GROUP, $whereClause . $orderBy)); } //echo '<br>SQL:'.$strSQL; $arrResult = $this->_objConnection->selectCommand($strSQL); if (!$arrResult) { global_common::writeLog('get All sl_property_group:' . $strSQL, 1, $_mainFrame->pPage); return null; } $total = count($arrResult); $objCat = new Model_ArticleType($this->_objConnection); $allCats = $objCat->getAllArticleType(0); $convertedCats = array(); foreach ($allCats as $key => $info) { $convertedCats[$info[global_mapping::ArticleTypeID]] = $info; unset($allCats[$key]); } $count = count($arrResult); for ($index = 0; $index < $count; $index++) { $arrResult[$index][global_mapping::ArticleTypeName] = $convertedCats[$arrResult[$index][global_mapping::ArticleTypeID]][global_mapping::ArticleTypeName]; } //print_r($arrResult); return $arrResult; }
chdir(".."); /* TODO: Add code here */ require 'config/globalconfig.php'; require 'include/_permission_admin.inc'; include_once 'class/model_user.php'; include_once 'class/model_property.php'; include_once 'class/model_propertygroup.php'; include_once 'class/model_adtype.php'; include_once 'class/model_articletype.php'; include_once 'class/model_datatype.php'; $objArticleType = new Model_ArticleType($objConnection); $objProperty = new Model_Property($objConnection); $objAdType = new Model_AdType($objConnection); $objDataType = new Model_Datatype($objConnection); $objGroup = new Model_PropertyGroup($objConnection); $allCats = $objArticleType->getAllArticleType(0, null, '', null); if ($_pgR["act"] == Model_Property::ACT_ADD || $_pgR["act"] == Model_Property::ACT_UPDATE) { //get user info $c_userInfo = $_SESSION[global_common::SES_C_USERINFO]; $propertyName = $_pgR[global_mapping::PropertyName]; $propertyName = html_entity_decode($propertyName, ENT_COMPAT, 'UTF-8'); $dataTypeID = html_entity_decode($_pgR[global_mapping::DataTypeID], ENT_COMPAT, 'UTF-8'); $propertyGroupID = html_entity_decode($_pgR[global_mapping::PropertyGroupID], ENT_COMPAT, 'UTF-8'); $propertyValue = html_entity_decode($_pgR[global_mapping::PropertyValue], ENT_COMPAT, 'UTF-8'); $order = html_entity_decode($_pgR[global_mapping::Order], ENT_COMPAT, 'UTF-8'); $status = 1; if ($_pgR["act"] == Model_Property::ACT_ADD) { $createdBy = $c_userInfo[global_mapping::UserID]; $resultID = $objProperty->insert($propertyGroupID, $propertyName, $propertyValue, $dataTypeID, $order, $createdBy, $status); if ($resultID) { $arrHeader = global_common::getMessageHeaderArr($banCode);
public function getAllProduct($intPage = 0, $selectField = '*', $whereClause = '', $orderBy = '', &$total) { if ($whereClause) { $whereClause = ' WHERE ' . $whereClause; } if ($orderBy) { $orderBy = ' ORDER BY ' . $orderBy; } if ($intPage > 0) { $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Product::TBL_SL_PRODUCT, $whereClause . $orderBy . ' limit ' . ($intPage - 1) * self::NUM_PER_PAGE . ',' . self::NUM_PER_PAGE)); $strSQLCount = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array('count(*)', Model_Product::TBL_SL_PRODUCT, $whereClause . $orderBy)); } else { $strSQL = global_common::prepareQuery(global_common::SQL_SELECT_FREE, array($selectField, Model_Product::TBL_SL_PRODUCT, $whereClause . $orderBy)); } //echo '<br>SQL:'.$strSQL; $arrResult = $this->_objConnection->selectCommand($strSQL); if (!$arrResult) { global_common::writeLog('get All sl_product:' . $strSQL, 1, $_mainFrame->pPage); return null; } //echo '<br>$strSQLCount:'.$strSQLCount; if ($strSQLCount) { $arrTotal = $this->_objConnection->selectCommand($strSQLCount); $total = $arrTotal[0][0]; } $objManu = new Model_Manufactory($this->_objConnection); $objArticleType = new Model_ArticleType($this->_objConnection); $allManus = $objManu->getAllManufactory(); $allCats = $objArticleType->getAllArticleType(); $manus = array(); foreach ($allManus as $key => $info) { $manus[$info[global_mapping::ManufactoryID]] = $info; unset($allManus[$key]); } $cats = array(); foreach ($allCats as $key => $info) { $cats[$info[global_mapping::ArticleTypeID]] = $info; unset($allCats[$key]); } $count = count($arrResult); for ($index = 0; $index < $count; $index++) { if ($manus[$arrResult[$index][global_mapping::ManufactoryID]]) { $arrResult[$index][global_mapping::ManufactoryName] = $manus[$arrResult[$index][global_mapping::ManufactoryID]][global_mapping::ManufactoryName]; } if ($cats[$arrResult[$index][global_mapping::CatalogueID]]) { $arrResult[$index][global_mapping::ArticleTypeName] = $cats[$arrResult[$index][global_mapping::CatalogueID]][global_mapping::ArticleTypeName]; } } $arrResult = global_common::mergeUserInfo($arrResult, $this->_objConnection); //print_r($arrResult); return $arrResult; }
//echo $address; $location = global_common::getLocation($_gmapAPI,$address); } else { //echo 'lat & long'; $location = array('lat' =>global_common::convertToDecimal( $_pgR["lat"]), 'long' => global_common::convertToDecimal($_pgR["lng"])); } */ $location = array('lat' => global_common::convertToDecimal($_pgR["lat"]), 'long' => global_common::convertToDecimal($_pgR["lng"])); //echo $address; //echo $address; $condition = ''; if ($cat && $cat != 'undefined') { $childCats = $objArticleType->getAllArticleType(0, '*', global_mapping::ParentID . '=' . $cat); if (count($childCats) > 0) { $arrCatID = global_common::getArrayColumn($childCats, global_mapping::ArticleTypeID); $condition = '`' . global_mapping::MainCategoryId . '` IN (' . global_common::convertToQueryIN($arrCatID) . ')'; } else { $condition = '`' . global_mapping::MainCategoryId . '` =' . $cat; } } else { $cat = '0'; } if ($address) { if ($condition) { $condition .= ' AND '; } $condition .= '`' . global_mapping::Name . '` like \'%' . $address . '%\''; }