CWIS Developer Documentation

- Home
- Main Page
- Classes
- Files

- File List
- File Members

MessageFactory.php
Go to the documentation of this file.
1 <?PHP
2
3 #
4 # FILE: MessageFactory.php
5 #
6 # Part of the Collection Workflow Integration System (CWIS)
7 # Copyright 2011-2013 Edward Almasy and Internet Scout Research Group
8 # http://scout.wisc.edu/cwis
9 #
10
16 class MessageFactory extends ItemFactory {
17
18 # ---- PUBLIC INTERFACE --------------------------------------------------
19
22
24 public function MessageFactory()
25 {
26 $this->ItemFactory("Message", "Messages", "MessageId", "Subject");
27 }
28
33
40 public function GetMessagesPostedByUser($UserId, $Count = NULL)
41 {
42 # retrieve message IDs posted by specified user
43 $this->DB->Query("SELECT MessageId FROM Messages"
44 ." WHERE PosterId = ".intval($UserId)
45 ." ORDER BY DatePosted DESC"
46 .($Count ? " LIMIT ".intval($Count) : ""));
47 $MessageIds = $this->DB->FetchColumn("MessageId");
48
49 # load messages based on message IDs
50 $Messages = array();
51 foreach ($MessageIds as $Id)
52 {
53 $Messages[$Id] = new Message($Id);
54 }
55
56 # return array of message IDs to caller
57 return $Messages;
58 }
59
62 # ---- PRIVATE INTERFACE -------------------------------------------------
63
64 }
Message
Abstraction for forum messages and resource comments.
Definition: Message.php:15
MessageFactory\MessageFactory
MessageFactory()
Object constructor.
Definition: MessageFactory.php:24
PHP
PHP
Definition: OAIClient.php:39
MessageFactory\GetMessagesPostedByUser
GetMessagesPostedByUser($UserId, $Count=NULL)
Get all messages posted by specified user, in reverse date order.
Definition: MessageFactory.php:40
ItemFactory
Common factory class for item manipulation.
Definition: ItemFactory.php:17
MessageFactory
Factory for forum messages / resource comments.
Definition: MessageFactory.php:16
ItemFactory\ItemFactory
ItemFactory($ItemClassName, $ItemTableName, $ItemIdFieldName, $ItemNameFieldName=NULL, $OrderOpsAllowed=FALSE, $SqlCondition=NULL)
Class constructor.
Definition: ItemFactory.php:36