Commit 7ff5192437911dc6fbc8e120b5d561e29e62d1a8
1 parent
03518bb8
#3497 changed some method names to more accurately reflect function, and added getList method
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2799 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
37 additions
and
3 deletions
lib/discussions/DiscussionThread.inc
| @@ -101,11 +101,17 @@ class DiscussionThread { | @@ -101,11 +101,17 @@ class DiscussionThread { | ||
| 101 | function getNumberOfViews(){ | 101 | function getNumberOfViews(){ |
| 102 | return $this->iNumberOfViews; | 102 | return $this->iNumberOfViews; |
| 103 | } | 103 | } |
| 104 | - | 104 | + /** |
| 105 | + * Set the total number of times the thread was viewed | ||
| 106 | + */ | ||
| 107 | + function setNumberOfViews($iValue) { | ||
| 108 | + $this->iNumberOfViews = $iValue; | ||
| 109 | + } | ||
| 110 | + | ||
| 105 | /** | 111 | /** |
| 106 | * Increment the total number of times the thread was viewed | 112 | * Increment the total number of times the thread was viewed |
| 107 | */ | 113 | */ |
| 108 | - function setNumberOfViews(){ | 114 | + function incrementNumberOfViews() { |
| 109 | $this->iNumberOfViews += 1; | 115 | $this->iNumberOfViews += 1; |
| 110 | } | 116 | } |
| 111 | 117 | ||
| @@ -119,9 +125,15 @@ class DiscussionThread { | @@ -119,9 +125,15 @@ class DiscussionThread { | ||
| 119 | /** | 125 | /** |
| 120 | * Increment the total number of replies (comments) in a thread | 126 | * Increment the total number of replies (comments) in a thread |
| 121 | */ | 127 | */ |
| 122 | - function setNumberOfReplies(){ | 128 | + function incrementNumberOfReplies(){ |
| 123 | $this->iNumberOfReplies += 1; | 129 | $this->iNumberOfReplies += 1; |
| 124 | } | 130 | } |
| 131 | + /** | ||
| 132 | + * Set the total number of number of replies (comments) in a thread | ||
| 133 | + */ | ||
| 134 | + function setNumberOfReplies($iValue){ | ||
| 135 | + $this->iNumberOfReplies = $iValue; | ||
| 136 | + } | ||
| 125 | 137 | ||
| 126 | /** | 138 | /** |
| 127 | * Get a All commentID's seperated by a comma "," | 139 | * Get a All commentID's seperated by a comma "," |
| @@ -155,6 +167,28 @@ class DiscussionThread { | @@ -155,6 +167,28 @@ class DiscussionThread { | ||
| 155 | } | 167 | } |
| 156 | } | 168 | } |
| 157 | 169 | ||
| 170 | + /** | ||
| 171 | + * Static function | ||
| 172 | + * Get a list of DiscussionThreads | ||
| 173 | + * | ||
| 174 | + * @param String Where clause (optional) | ||
| 175 | + * | ||
| 176 | + * @return Array array of DiscussionThreads objects, false otherwise | ||
| 177 | + */ | ||
| 178 | + function getList($sWhereClause = null) { | ||
| 179 | + global $default; | ||
| 180 | + $aDiscussionThreads = array(); | ||
| 181 | + $sql = $default->db; | ||
| 182 | + $result = $sql->query("SELECT * FROM " . $default->discussion_threads_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); | ||
| 183 | + if ($result) { | ||
| 184 | + while ($sql->next_record()) { | ||
| 185 | + $aDiscussionThreads[] = & DiscussionThread::get($sql->f("id")); | ||
| 186 | + } | ||
| 187 | + return $aDiscussionThreads; | ||
| 188 | + } | ||
| 189 | + return false; | ||
| 190 | + } | ||
| 191 | + | ||
| 158 | function getThreadIDforDoc($iDocumentID){ | 192 | function getThreadIDforDoc($iDocumentID){ |
| 159 | global $default; | 193 | global $default; |
| 160 | $sql = $default->db; | 194 | $sql = $default->db; |