3 # FILE: SavedSearchFactory.php 5 # Part of the Collection Workflow Integration System (CWIS) 6 # Copyright 2009-2017 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu/cwis/ 16 # ---- PUBLIC INTERFACE -------------------------------------------------- 23 # set up item factory base class 24 parent::__construct(
"SavedSearch",
"SavedSearches",
"SearchId",
"SearchName");
35 # return list of searches to caller 36 return $this->
GetItems(
"UserId = ".intval($UserId));
46 # retrieve searches with frequency/time values that indicate need to be run 49 .
" AND (DateLastRun < '" 50 .date(
"Y-m-d H:i:s", (strtotime(
"1 hour ago") + 15)).
"'))" 52 .
" AND (DateLastRun < '" 53 .date(
"Y-m-d H:i:s", (strtotime(
"1 day ago") + 15)).
"'))" 55 .
" AND (DateLastRun < '" 56 .date(
"Y-m-d H:i:s", (strtotime(
"1 week ago") + 15)).
"'))" 58 .
" AND (DateLastRun < '" 59 .date(
"Y-m-d H:i:s", (strtotime(
"2 weeks ago") + 15)).
"'))" 61 .
" AND (DateLastRun < '" 62 .date(
"Y-m-d H:i:s", (strtotime(
"1 month ago") + 15)).
"'))" 64 .
" AND (DateLastRun < '" 65 .date(
"Y-m-d H:i:s", (strtotime(
"3 months ago") + 15)).
"'))" 67 .
" AND (DateLastRun < '" 68 .date(
"Y-m-d H:i:s", (strtotime(
"1 year ago") + 15)).
"'))");
77 return $this->DB->Query(
78 "SELECT COUNT(DISTINCT UserId) AS UserCount FROM SavedSearches",
83 # ---- 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.