6 # Message->Message($MessageId)
10 # Message->ParentyType()
11 # Message->DatePosted()
15 # - methods to retrieve resource attributes
17 # Part of the Collection Workflow Integration System (CWIS)
18 # Copyright 2012 Internet Scout Project
19 # http://scout.wisc.edu/
29 # ---- PUBLIC INTERFACE --------------------------------------------------
49 $this->ErrorStatus = self::NONEXISTENT;
53 if (is_null($MessageId))
55 # add record to database with that ID
56 $this->DB->Query(
"INSERT INTO Messages (MessageId) VALUES (NULL)");
57 $this->DB->Query(
"SELECT LAST_INSERT_ID() AS Id FROM Messages");
59 if ($this->DB->NumRowsSelected())
61 $this->
MessageId = intval($this->DB->FetchField(
"Id"));
62 $this->ErrorStatus = self::OK;
70 SELECT * FROM Messages
71 WHERE MessageId = '".intval($MessageId).
"'");
73 if ($this->DB->NumRowsSelected())
75 # set attributes to values returned by database
76 $this->DBFields = $this->DB->FetchRow();
77 $this->
MessageId = intval($this->DBFields[
"MessageId"]);
90 $this->DB->Query(
"DELETE FROM Messages WHERE MessageId = ".$this->
MessageId);
111 $PosterName =
new User($this->DB, (
int)$this->
PosterId());
112 return $PosterName->Get(
"UserName");
121 $PosterName =
new User($this->DB, (
int)$this->
PosterId());
122 return $PosterName->Get(
"EMail");
182 function Body($NewValue =
DB_NOVALUE) {
return $this->UpdateValue(
"Body", $NewValue); }
192 # ---- PRIVATE INTERFACE -------------------------------------------------
197 private $ErrorStatus;
199 # convenience function to supply parameters to Database->UpdateValue()
200 private function UpdateValue($FieldName, $NewValue)
204 return $this->DB->UpdateValue(
"Messages", $FieldName, $NewValue,
205 "MessageId = '".$this->
MessageId.
"'", $this->DBFields, TRUE);