$arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, ($statusID == global_common::STATUS_ACTIVE ? 'Bán lại' : 'Dừng bán') . ' thành công'), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, ($isActivate ? 'Xóa' : 'Deactivate') . ' unsuccessfully'), array(0, 1)); return; } } return; } elseif ($_pgR['act'] == Model_Product::ACT_ACTIVE_PRODUCT) { if (global_common::isCLogin()) { $productID = $_pgR['id']; $statusID = $_pgR['statusid']; $currentUserID = $_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID]; $product = $objProduct->getProductByID($productID); $createBy = $product[global_mapping::CreatedBy]; if ($createBy != $currentUserID && global_common::isAdmin() == false) { return; } $result = global_common::updateDeleteFlag($productID, global_mapping::ProductID, $currentUserID, Model_Product::TBL_SL_PRODUCT, $statusID, $objConnection); if ($result) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, ($statusID == global_common::STATUS_ACTIVE ? 'Phục hồi' : 'Xóa') . ' thành công'), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, ($isActivate ? 'Xóa' : 'Bán lại') . ' không thành công'), array(0, 1)); return; } }
$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 echo $_objSystem->locateJs('user_user.js'); ?> "></script>
$resultID = $objComment->insert($retailerID, $content, $createdby, $status); //echo global_common::convertToXML($arrHeader, array("rs","info"), array(0,$resultID), array(0,1)); //return; if ($resultID) { $commentHTML = $objComment->getCommentHTMLByArticle($retailerID, 0); $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf", "form"), array(1, 'Gửi bình luận thành công', $commentHTML), array(0, 1, 1)); try { //echo $retailerID; $retailer = $objRetailer->getRetailerByID($retailerID); //print_r($retailer); //recieve email when got a comment if ($retailer[global_mapping::Status]) { //echo 'send mail:'; $product = $objProduct->getProductByID($retailer[global_mapping::ProductID]); $userRetailer = $objUser->getUserByID($retailer[global_mapping::CreatedBy]); $fullNameRetailer = $userRetailer[global_mapping::FullName]; $emailRetailer = $userRetailer[global_mapping::Email]; $fullName = $c_userInfo[global_mapping::FullName]; $linkArticle = global_common::getHostName() . '/retailer_detail.php?rid=' . $retailerID; $commentDate = global_common::formatDateTimeVN($comment[global_mapping::CreatedDate]); $commentContent = $comment[global_mapping::Content]; $linkPolicy = global_common::getHostName() . '/' . global_common::PAGE_TERM_KM; $arrMailContent = global_common::formatMailContent(global_common::TEMPLATE_NEW_COMMENT, null, array(global_common::formatOutputText($fullName), global_common::formatOutputText($fullNameRetailer), $product[global_mapping::ProductName], global_common::formatOutputText($content), $linkArticle)); $emailSubject = $arrMailContent[0]; $emailContent = $arrMailContent[1]; //echo $emailContent; global_mail::send($emailRetailer, $fullNameRetailer, $emailSubject, $emailContent, null, global_common::SUPPORT_MAIL_USERNAME, global_common::SUPPORT_MAIL_PASSWORD, global_common::SUPPORT_MAIL_DISPLAY_NAME); } } catch (Exception $e) {
$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]; $cmManufactory = $preferProduct[global_mapping::ManufactoryID]; $txtKeyword = $preferProduct[global_mapping::ProductName]; } if ($cmArea) { $lastPage .= 'cmArea=' . $cmArea . '&'; $currentParentType = $cmArea; } if ($cmCategory) { //echo '$currentTypeID'; if ($lastPage) { $lastPage .= 'cmCategory=' . $cmCategory . '&'; } else {
include_once 'class/model_status.php'; include_once 'class/model_retailer.php'; $objProduct = new Model_Product($objConnection); $objArticleType = new Model_ArticleType($objConnection); $objCity = new Model_City($objConnection); $objDistrict = new Model_District($objConnection); $objStatus = new Model_Status($objConnection); $objRetailer = new Model_Retailer($objConnection); $productStatuses = $objStatus->getAllStatus(0, '*', global_mapping::Type . '=' . global_common::STATUS_PRODUCT_TYPE); $intMode = 0; //add mode $allCities = $objCity->getAllCity(); //echo 'get city:'; //echo($allCities); if ($_pgR["pid"]) { $currentProduct = $objProduct->getProductByID($_pgR["pid"]); } if ($_pgR["rid"]) { $retailerID = $_pgR["rid"]; $retailter = $objRetailer->getRetailerByID($retailerID); $intMode = 1; //edit mode $createBy = $retailter[global_mapping::CreatedBy]; $currentUserID = $_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID]; if ($createBy != $currentUserID) { global_common::redirectByScript("index.php"); return; } $currentProduct = $objProduct->getProductByID($retailter[global_mapping::ProductID]); $currentProductType = $retailter[global_mapping::ProductStatusID]; $currentPrice = $retailter[global_mapping::Price];
} else { echo global_common::convertToXML($arrHeader, array("rs"), array(0), array(0)); 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_Product::ACT_CHANGE_PAGE) { $intPage = $_pgR['p']; $outPutHTML = $objProduct->getListProduct($intPage); echo global_common::convertToXML($strMessageHeader, array('rs', 'inf'), array(1, $outPutHTML), array(0, 1)); return; } elseif ($_pgR['act'] == model_Product::ACT_SHOW_EDIT) { $strProductID = $_pgR['id']; $arrProduct = $objProduct->getProductByID($strProductID); echo global_common::convertToXML($strMessageHeader, array('rs', 'ProductID', 'ProductName', 'CatalogueID', 'ImageLink', 'ManufactoryID', 'PaymentModeID', 'NumberaireID', 'StorageDate', 'Price', 'Amount', 'Description', 'Status'), array(1, 'ProductID', 'ProductName', 'CatalogueID', 'ImageLink', 'ManufactoryID', 'PaymentModeID', 'NumberaireID', 'StorageDate', 'Price', 'Amount', 'Description', 'Status'), array(0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1)); return; } elseif ($_pgR["act"] == model_Product::ACT_GET) { $sectionID = $_pgR["sect"]; $arrSection = $objMenu->getAllMenuBySection($sectionID); if ($arrSection) { $strHTML = $objMenu->outputHTMLMenu($arrSection); echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, $strHTML), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", 'inf'), array(0, 'Kh?ng c? nh?m h?ng'), array(0, 0)); return; } } elseif ($_pgR['act'] == model_Product::ACT_DELETE) { $IDName = "menu_id";