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); $objCity = new Model_City($objConnection); $_arrCategories = $objArticleType->getAllArticleType(0, null, '`ParentID`=0', 'Level'); if ($_pgR["rid"]) { $retailerID = $_pgR["rid"]; $retailer = $objRetailer->getRetailerByID($retailerID, '*', '`Status`=1'); $_currentProductID = $retailer[global_mapping::ProductID]; //product properties $productProperties = $objProperty->getPropertyByProduct($retailerID, global_common::STATUS_RETAILER_PROPERTY); //shipping properties $shippingProperty = $objProperty->getPropertyByProduct($retailerID, global_common::STATUS_RETAILER_SHIPPING); $_SESSION[global_common::SES_C_CUR_PAGE] = 'retailer_detail.php?rid=' . $retailerID; } //$_currentParentCatID = $catID; if ($_currentProductID) { $_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';
} else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, "Cập nhật thất bại. Xin vui lòng thử lại sau!"), array(0, 1)); return; } } //end check act } else { echo global_common::convertToXML($arrHeader, array("rs", 'info'), array(0, global_common::STRING_REQUIRE_LOGIN), array(0, 1)); } return; } elseif ($_pgR['act'] == Model_Retailer::ACT_ACTIVE_RETAILER) { if (global_common::isCLogin()) { $retailerID = $_pgR['id']; $statusID = $_pgR['statusid']; $currentUserID = $_SESSION[global_common::SES_C_USERINFO][global_mapping::UserID]; $retailter = $objRetailer->getRetailerByID($retailerID); $createBy = $retailter[global_mapping::CreatedBy]; if ($createBy != $currentUserID && global_common::isAdmin() == false) { return; } $result = $objRetailer->activeRetailer($retailerID, $statusID); if ($result) { $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; } }
$retailerID = $_pgR[global_mapping::RetailerID]; $content = html_entity_decode($_pgR[global_mapping::Content], ENT_COMPAT, 'UTF-8'); $createdby = $c_userInfo[global_mapping::UserID]; $status = 1; $createdBy = $c_userInfo[global_mapping::UserID]; $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];