$commentID = global_editor::rteSafe(html_entity_decode($commentID, ENT_COMPAT, 'UTF-8')); $commentType = $_pgR['CommentType']; $commentType = global_editor::rteSafe(html_entity_decode($commentType, ENT_COMPAT, 'UTF-8')); $articleID = $_pgR['ArticleID']; $articleID = global_editor::rteSafe(html_entity_decode($articleID, ENT_COMPAT, 'UTF-8')); $content = $_pgR['Content']; $content = global_editor::rteSafe(html_entity_decode($content, ENT_COMPAT, 'UTF-8')); $status = $_pgR['Status']; $status = global_editor::rteSafe(html_entity_decode($status, ENT_COMPAT, 'UTF-8')); //$strName = $_pgR['name']; //$strName = global_editor::rteSafe(html_entity_decode($strName,ENT_COMPAT ,'UTF-8' )); $resultID = $objComment->insert($commentType, $articleID, $content); if ($resultID) { $intPage = 1; $total = 0; $comments = $objComment->getCommentByArticle($intPage, $total, $articleID, '*', '', ' CreatedDate DESC'); $path = 'include/_comment_list.inc'; ob_start(); include $path; $contents = ob_get_contents(); ob_end_clean(); $arrHeader = global_common::getMessageHeaderArr($banCode); //$banCode echo global_common::convertToXML($arrHeader, array('rs', 'inf', 'list'), array(1, 'Your comment was posted successfully', $contents), array(0, 1, 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));
public function getCommentHTMLByArticle($articleID) { $comments = Model_Comment::getCommentByArticle($articleID, 0, '*', '', 'ModifiedDate Desc'); $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> '; $commentHTML .= ' </div>'; $commentHTML .= '</div>'; } return $commentHTML; }