6 # Forum->Forum($ForumId)
10 # Forum->ForumDescription()
12 # Forum->MessageCount()
13 # Forum->ModeratorId()
14 # - methods to retrieve resource attributes
16 # Part of the Scout Portal Toolkit
17 # Copyright 2002 Internet Scout Project
18 # http://scout.cs.wisc.edu
28 # ---- PUBLIC INTERFACE --------------------------------------------------
30 # Error codes for the forum object
46 # locate class in database
50 if ($ForumId !== NULL)
52 $this->
ForumId = intval($ForumId);
53 $DB->Query(
"SELECT * FROM Forums WHERE ForumId = "
57 if ($DB->NumRowsSelected() > 0)
59 # set attributes to values returned by database
60 $this->DBFields = $DB->FetchRow();
67 elseif (func_num_args()==0)
69 # add record to database with that ID
70 $DB->Query(
"INSERT INTO Forums (ForumId) VALUES (NULL)");
71 $this->
ForumId = $DB->Query(
"SELECT LAST_INSERT_ID() AS ForumId"
72 .
" FROM Forums",
"ForumId");
88 $this->DB->Query(
"Select * from Topics where ForumId = ".
89 $this->
ForumId.
" ORDER BY DateCreated Desc");
91 # get list of topics for this forum
92 while ($Entry = $this->DB->FetchRow())
94 $Topic =
new Topic($Entry[
"TopicId"]);
97 # delete record from database
98 $this->DB->Query(
"DELETE FROM Forums WHERE ForumId = ".$this->
ForumId);
120 return $Message->DatePosted().
" by ";
133 return $Message->PosterName();
144 return $Message->PosterEmail();
154 return $ModeratorName->Get(
"UserName");
164 return $ModeratorName->Get(
"EMail");
175 $this->DB->Query(
"Select * from Topics where ForumId = ".
176 $this->
ForumId.
" ORDER BY DateCreated Desc");
178 # get list of topics for this forum
179 while ($Entry = $this->DB->FetchRow())
181 $Topics[$Entry[
"TopicId"]] =
new Topic($Entry[
"TopicId"]);
195 SELECT M.* FROM Messages M
197 ON M.ParentId = T.TopicId
199 AND T.ForumId = '".addslashes($this->
ForumId).
"'
200 ORDER BY DatePosted DESC
203 if ($this->DB->NumRowsSelected())
205 $Row = $this->DB->FetchRow();
206 $Message =
new Message($Row[
"MessageId"]);
255 # ---- PRIVATE INTERFACE -------------------------------------------------
260 private $ErrorStatus;
262 # convenience function to supply parameters to Database->UpdateValue()
263 private function UpdateValue($FieldName, $NewValue)
267 return $this->DB->UpdateValue(
"Forums", $FieldName, $NewValue,
268 "ForumId = '".$this->
ForumId.
"'", $this->DBFields, TRUE);