3 # FILE: SavedSearchFactory.php
5 # Part of the Collection Workflow Integration System (CWIS)
6 # Copyright 2009-2013 Edward Almasy and Internet Scout Research Group
7 # http://scout.wisc.edu/cwis/
15 # ---- PUBLIC INTERFACE --------------------------------------------------
22 # set up item factory base class
23 $this->
ItemFactory(
"SavedSearch",
"SavedSearches",
"SearchId",
"SearchName");
34 # return list of searches to caller
35 return $this->
GetItems(
"UserId = ".intval($UserId));
45 # retrieve searches with frequency/time values that indicate need to be run
48 .
" AND (DateLastRun < '"
49 .date(
"Y-m-d H:i:s", (strtotime(
"1 hour ago") + 15)).
"'))"
51 .
" AND (DateLastRun < '"
52 .date(
"Y-m-d H:i:s", (strtotime(
"1 day ago") + 15)).
"'))"
54 .
" AND (DateLastRun < '"
55 .date(
"Y-m-d H:i:s", (strtotime(
"1 week ago") + 15)).
"'))"
57 .
" AND (DateLastRun < '"
58 .date(
"Y-m-d H:i:s", (strtotime(
"2 weeks ago") + 15)).
"'))"
60 .
" AND (DateLastRun < '"
61 .date(
"Y-m-d H:i:s", (strtotime(
"1 month ago") + 15)).
"'))"
63 .
" AND (DateLastRun < '"
64 .date(
"Y-m-d H:i:s", (strtotime(
"3 months ago") + 15)).
"'))"
66 .
" AND (DateLastRun < '"
67 .date(
"Y-m-d H:i:s", (strtotime(
"1 year ago") + 15)).
"'))");
76 return $this->DB->Query(
77 "SELECT COUNT(DISTINCT UserId) AS UserCount FROM SavedSearches",
82 # ---- PRIVATE INTERFACE -------------------------------------------------
GetSearchesForUser($UserId)
Get all saved searches for a specified user.
__construct()
Object constructor.
Factory for manipulating SavedSearch objects.
const SEARCHFREQ_QUARTERLY
const SEARCHFREQ_BIWEEKLY
GetSearchUserCount()
Get number of users with saved searches.
GetItems($SqlCondition=NULL)
Retrieve items.
Common factory class for item manipulation.
GetSearchesDueToRun()
Get all searches that should be run according to frequency and last run time.
ItemFactory($ItemClassName, $ItemTableName, $ItemIdFieldName, $ItemNameFieldName=NULL, $OrderOpsAllowed=FALSE, $SqlCondition=NULL)
Class constructor.