$result = $objUser->setRoleAdmin($userID, $isAdmin); if ($result) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, 'Update successfully'), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, 'Update failed'), array(0, 1)); return; } } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, 'Update failed. You have no permision to perform this'), array(0, 1)); return; } } elseif ($_pgR['act'] == Model_User::ACT_SET_PASWORD) { if (global_common::isAdmin()) { $userID = $_pgR[global_mapping::UserID]; $password = $_pgR[global_mapping::Password]; $confirmedPassword = $_pgR['ConfirmedPassword']; if ($password == $confirmedPassword) { $result = $objUser->changeResetPassword($userID, $password); if ($result) { $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(1, 'Update successfully'), array(0, 1)); return; } else { echo global_common::convertToXML($arrHeader, array("rs", "inf"), array(0, 'Update failed'), array(0, 1)); return; } } else {
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; } } return; } elseif ($_pgR['act'] == Model_Product::ACT_CLONE) {
public function getCommentHTMLByArticle($articleID, $page) { if (!$page) { $page = 1; } $comments = $this->getCommentByArticle($articleID, $page, '*', '', 'ModifiedDate Desc'); $condition = ' where `' . global_mapping::ArticleID . '` = \'' . $articleID . '\' AND CommentID NOT IN (SELECT CommentID FROM sl_comment_bad WHERE `STATUS` =\'1\')'; $total = global_common::getTotalRecord(Model_Comment::TBL_SL_COMMENT, $this->_objConnection, $condition); $commentHTML = ''; foreach ($comments as $item) { $commentHTML .= '<div class="item">'; $commentHTML .= ' <div class="avatar">'; $commentHTML .= ' <img src="' . $item[global_mapping::CreatedBy][global_mapping::Avatar] . '" />'; $commentHTML .= ' </div>'; $commentHTML .= ' <div class="comment-detail">'; $commentHTML .= ' <div class="username">'; $commentHTML .= ' <a href="#">' . $item[global_mapping::CreatedBy][global_mapping::FullName] . '</a> '; $commentHTML .= ' <p class="created-date">' . global_common::formatDateTimeVN($item[global_mapping::CreatedDate]) . '</p> '; $commentHTML .= ' </div>'; $commentHTML .= ' <div class="comment-detail-content">'; $commentHTML .= ' ' . $item[global_mapping::Content]; $commentHTML .= ' </div> '; if (global_common::isAdmin()) { $commentHTML .= ' <div class="comment-controls">'; $commentHTML .= ' <a href="javascript:comment.badComment(\'' . $item[global_mapping::CommentID] . '\',1)">Delete</a>'; $commentHTML .= ' </div> '; } $commentHTML .= ' </div>'; $commentHTML .= '</div>'; } $commentHTML .= global_common::getPagingHTMLByNum($page, Model_Comment::NUM_PER_PAGE, $total, 'comment.changePage'); return $commentHTML; }