Commit b4af27b14532f5cc2af9d9046c68ff8de4abbbf0
1 parent
642597c5
Now conforms with use of Patterns
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1861 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
27 additions
and
6 deletions
presentation/lookAndFeel/knowledgeTree/discussions/viewDiscussionBL.php
| ... | ... | @@ -20,6 +20,8 @@ if (checkSession()) { |
| 20 | 20 | require_once("$default->fileSystemRoot/lib/security/permission.inc"); |
| 21 | 21 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 22 | 22 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 23 | + //require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc"); | |
| 24 | + require_once("$default->fileSystemRoot/lib/visualpatterns/PatternBrowsableSearchResults.inc"); | |
| 23 | 25 | require_once("$default->fileSystemRoot/lib/discussions/DiscussionThread.inc"); |
| 24 | 26 | require_once("$default->fileSystemRoot/lib/discussions/DiscussionComment.inc"); |
| 25 | 27 | require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| ... | ... | @@ -37,12 +39,31 @@ if(checkSession()) { |
| 37 | 39 | $sAllCommentID = $oThread->getAllCommentID(); |
| 38 | 40 | $arrAllCommentID = explode(",", $sAllCommentID); |
| 39 | 41 | $iNumMax = $oThread->getNumberOfReplies(); |
| 40 | - for ($i = 0; $i < $iNumMax; $i++) { | |
| 41 | - $iCommentID = $arrAllCommentID[$i]; | |
| 42 | - $oComment = DiscussionComment::get($iCommentID); | |
| 43 | - $oUser = User::get($oComment->getUserID()); | |
| 44 | - $oPatternCustom->addHtml(getViewComment($i+1,$oThread,$oComment,$oUser)); | |
| 45 | - } | |
| 42 | + | |
| 43 | + $sQuery = "SELECT 1 as ForView, subject, username, date, discussion_comments.id as com_id, discussion_threads.document_id as doc_id " . | |
| 44 | + "FROM (discussion_comments INNER JOIN users ON discussion_comments.user_id = users.id) INNER JOIN discussion_threads ON discussion_threads.id = discussion_comments.thread_id " . | |
| 45 | + "WHERE discussion_threads.id = " . $iThreadID . | |
| 46 | + " ORDER BY date DESC"; | |
| 47 | + | |
| 48 | + $aColumns = array("subject", "username", "date"); | |
| 49 | + $aColumnNames = array("Subject", "User", "Date"); | |
| 50 | + $aColumnTypes = array(3,1,1); | |
| 51 | + | |
| 52 | + $aQueryStringVars = array("fViewComment", "iCommentID", "iDocumentID"); | |
| 53 | + $aQueryStringCols = array("ForView", "com_id", "doc_id"); | |
| 54 | + | |
| 55 | + for ($i = 0; $i < $iNumMax; $i++) { | |
| 56 | + $aHyperLinkURL[$i] =$_SERVER['PHP_SELF'] ; | |
| 57 | + } | |
| 58 | + | |
| 59 | + if (!isset($fStartIndex)) { $iStartIndex = 0 ;} | |
| 60 | + else { $iStartIndex = $fStartIndex ;} | |
| 61 | + | |
| 62 | + $oSearchResults = & new PatternBrowseableSearchResults ($sQuery, 14, $aColumns, $aColumnTypes, $aColumnNames, $aHyperLinkURL, $aQueryStringCols, $aQueryStringVars); | |
| 63 | + $oSearchResults->setStartIndex($iStartIndex); | |
| 64 | + $oSearchResults->setQueryString("&fDocumentID=$fDocumentID&fForDiscussion=1"); | |
| 65 | + $oPatternCustom->addHtml($oSearchResults->render()); | |
| 66 | + | |
| 46 | 67 | // On opening, increment the number of views of current thread & update database |
| 47 | 68 | if($_SESSION['Discussion' . $fDocumentID][0]->bViews !=true ){ |
| 48 | 69 | $oThread->setNumberOfViews(); | ... | ... |