CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SavedSearch Class Reference

## Public Member Functions
| __construct ($SearchId, $SearchName=NULL, $UserId=NULL, $Frequency=NULL, $SearchParameters=NULL)
| Object constructor. More...
| SearchGroups ($NewSearchGroups=NULL)
| Get/set search parameters from legacy array. More...
| SearchParameters ($NewParams=NULL)
| Get/set search parameters. More...
| SearchName ($NewValue=DB_NOVALUE)
| Get/set name of search. More...
| Id ()
| Get ID of search. More...
| UserId ($NewValue=DB_NOVALUE)
| Get/set user ID. More...
| Frequency ($NewValue=DB_NOVALUE)
| Get/set search frequency. More...
| UpdateDateLastRun ()
| Update date this search was last run. More...
| DateLastRun ($NewValue=DB_NOVALUE)
| Get/set the date this search was last run. More...
| SaveLastMatches ($ArrayofMatchingIds)
| Save array of last matches. More...
| LastMatches ()
| Return array of most recently matched ResourceIds for a search. More...
| GetSearchGroupsAsUrlParameters ()
| Get search groups as URL parameters (e.g. More...
| GetSearchGroupsAsUrlParameterArray ()
| Get search groups as an URL parameter array. More...
| GetSearchGroupsAsTextDescription ($IncludeHtml=TRUE, $StartWithBreak=TRUE, $TruncateLongWordsTo=0)
| Get multi-line string describing search criteria. More...
| GetSearchFieldNames ()
| Get list of fields to be searched. More...
| Delete ()
| Delete saved search. More...
| GetSearchId ()
| Get search id. More...

## Static Public Member Functions
static | TranslateSearchGroupsToUrlParameters ($SearchGroups)
| Translate search group array into URL parameters (e.g. More...
static | TranslateSearchGroupsToUrlParameterArray ($SearchGroups)
| Translate a search group array to an URL parameter array. More...
static | TranslateUrlParametersToSearchGroups ($GetVars)
| Translate URL parameters to legacy search group array. More...
static | TranslateSearchGroupsToTextDescription ($SearchGroups, $IncludeHtml=TRUE, $StartWithBreak=TRUE, $TruncateLongWordsTo=0)
| Translate search group array into multi-line string describing search criteria. More...
static | TranslateSearchGroupsToSearchFieldNames ($SearchGroups)
| Extract list of fields to be searched from search group array. More...
static | GetSearchFrequencyList ()
| Get array of possible search frequency descriptions. More...

## Public Attributes
const | SEARCHFREQ_NEVER = 0
const | SEARCHFREQ_HOURLY = 1
const | SEARCHFREQ_DAILY = 2
const | SEARCHFREQ_WEEKLY = 3
const | SEARCHFREQ_BIWEEKLY = 4
const | SEARCHFREQ_MONTHLY = 5
const | SEARCHFREQ_QUARTERLY = 6
const | SEARCHFREQ_YEARLY = 7

## Detailed Description

Definition at line 10 of file SavedSearch.php.

## Constructor & Destructor Documentation

SavedSearch::__construct | ( |  | $SearchId,
|  |  | $SearchName = `NULL`,
|  |  | $UserId = `NULL`,
|  |  | $Frequency = `NULL`,
|  |  | $SearchParameters = `NULL`
| ) |  |

Object constructor.

Parameters

  int | null | $SearchId | Saved search ID or NULL for new search
  string | null | $SearchName | Updated search name (OPTIONAL)
  int | null | $UserId | User who owns this search (OPTIONAL)
  int | null | $Frequency | Search mailing frequency (OPTIONAL)
  mixed | $SearchParameters | SearchParameterSet describing this search (OPTIONAL)

Definition at line 34 of file SavedSearch.php.

References Frequency(), SaveLastMatches(), SearchName(), SearchParameters(), and UserId().

## Member Function Documentation

SavedSearch::DateLastRun | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set the date this search was last run.

Parameters

  mixed | $NewValue | Updated value (OPTIONAL

Returns
  current value

Definition at line 240 of file SavedSearch.php.

SavedSearch::Delete | ( |  | ) |

Delete saved search.

(NOTE: Object is no longer usable after this call!)

Definition at line 817 of file SavedSearch.php.

References MetadataSchema\MDFTYPE_FLAG, MetadataSchema\MDFTYPE_NUMBER, MetadataSchema\MDFTYPE_OPTION, and MetadataSchema\MDFTYPE_USER.

SavedSearch::Frequency | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set search frequency.

Parameters

  int | $NewValue | New search frequency value.

Returns
  Current search frequency value.

Definition at line 219 of file SavedSearch.php.

Referenced by __construct().

Here is the caller graph for this function:

SavedSearch::GetSearchFieldNames | ( |  | ) |

Get list of fields to be searched.

Returns
  Array of field names.

Definition at line 753 of file SavedSearch.php.

References SearchParameters().

static SavedSearch::GetSearchFrequencyList | ( |  | ) |
| static

Get array of possible search frequency descriptions.

Frequencies may be excluded from list by supplying them as arguments.

Returns
  Array of search frequency descriptions indexed by SEARCHFREQ constants.

Definition at line 788 of file SavedSearch.php.

SavedSearch::GetSearchGroupsAsTextDescription | ( |  | $IncludeHtml = `TRUE`,
|  |  | $StartWithBreak = `TRUE`,
|  |  | $TruncateLongWordsTo = `0`
| ) |  |

Get multi-line string describing search criteria.

Parameters

  bool | $IncludeHtml | Whether to include HTML tags for formatting. (OPTIONAL, defaults to TRUE)
  bool | $StartWithBreak | Whether to start string with BR tag. (OPTIONAL, defaults to TRUE)
  int | $TruncateLongWordsTo | Number of characters to truncate long words to (use 0 for no truncation). (OPTIONAL, defaults to 0)

Returns
  String containing text describing search criteria.

Definition at line 572 of file SavedSearch.php.

References SearchParameters().

SavedSearch::GetSearchGroupsAsUrlParameterArray | ( |  | ) |

Get search groups as an URL parameter array.

Returns
  Array with strings like "F4" ("F" or "G" plus field ID) for the index and * "american+history" (search parameter) for the values.

Definition at line 394 of file SavedSearch.php.

References SearchGroups().

SavedSearch::GetSearchGroupsAsUrlParameters | ( |  | ) |

Get search groups as URL parameters (e.g.

something like F2=madison&F4=american+history&G22=17-41).

Returns
  String containing URL parameters (no leading "?").

Definition at line 270 of file SavedSearch.php.

References SearchGroups().

SavedSearch::GetSearchId | ( |  | ) |

Get search id.

Returns
  SearchId

Deprecated:

Definition at line 1027 of file SavedSearch.php.

References Id().

SavedSearch::Id | ( |  | ) |

Get ID of search.

Returns
  Search ID.

Definition at line 199 of file SavedSearch.php.

Referenced by GetSearchId().

Here is the caller graph for this function:

SavedSearch::LastMatches | ( |  | ) |

Return array of most recently matched ResourceIds for a search.

Returns
  Array of Resource Ids for most recent run of a search

Definition at line 259 of file SavedSearch.php.

SavedSearch::SaveLastMatches | ( |  | $ArrayofMatchingIds | ) |

Save array of last matches.

Parameters

  array | $ArrayofMatchingIds | Matching Ids for a current search.

Definition at line 249 of file SavedSearch.php.

Referenced by __construct().

Here is the caller graph for this function:

SavedSearch::SearchGroups | ( |  | $NewSearchGroups = `NULL` | ) |

Get/set search parameters from legacy array.

This function is for backward compatibility only and should not be used in new code.

Parameters

  array | null | $NewSearchGroups | Updated legacy array

Returns
  current search params as legacy array

Deprecated:

Definition at line 143 of file SavedSearch.php.

References SearchParameters().

Referenced by GetSearchGroupsAsUrlParameterArray(), and GetSearchGroupsAsUrlParameters().

Here is the caller graph for this function:

SavedSearch::SearchName | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set name of search.

Parameters

  string | $NewValue | New name of search value.

Returns
  Current name of search value.

Definition at line 190 of file SavedSearch.php.

Referenced by __construct().

Here is the caller graph for this function:

SavedSearch::SearchParameters | ( |  | $NewParams = `NULL` | ) |

Get/set search parameters.

Parameters

  SearchParameterSet | null | $NewParams | Updated search parameters

Returns
  current search parameters

Definition at line 161 of file SavedSearch.php.

Referenced by __construct(), GetSearchFieldNames(), GetSearchGroupsAsTextDescription(), and SearchGroups().

Here is the caller graph for this function:

static SavedSearch::TranslateSearchGroupsToSearchFieldNames | ( |  | $SearchGroups | ) |
| static

Extract list of fields to be searched from search group array.

Parameters

  array | $SearchGroups | Search group array.

Returns
  Array of field names.

Definition at line 763 of file SavedSearch.php.

static SavedSearch::TranslateSearchGroupsToTextDescription | ( |  | $SearchGroups,
|  |  | $IncludeHtml = `TRUE`,
|  |  | $StartWithBreak = `TRUE`,
|  |  | $TruncateLongWordsTo = `0`
| ) |  |
| static

Translate search group array into multi-line string describing search criteria.

Parameters

  array | $SearchGroups | Search group array.
  bool | $IncludeHtml | Whether to include HTML tags for formatting. (OPTIONAL, defaults to TRUE)
  bool | $StartWithBreak | Whether to start string with BR tag. (OPTIONAL, defaults to TRUE)
  int | $TruncateLongWordsTo | Number of characters to truncate long words to (use 0 for no truncation). (OPTIONAL, defaults to 0)

Returns
  String containing text describing search criteria.

Definition at line 590 of file SavedSearch.php.

References SearchEngine\LOGIC_AND.

static SavedSearch::TranslateSearchGroupsToUrlParameterArray | ( |  | $SearchGroups | ) |
| static

Translate a search group array to an URL parameter array.

Parameters

  array | $SearchGroups | Search group array to translate.

Returns
  Array with strings like "F4" ("F" or "G" plus field ID) for the index and * "american+history" (search parameter) for the values.

Definition at line 405 of file SavedSearch.php.

References SearchEngine\LOGIC_AND.

static SavedSearch::TranslateSearchGroupsToUrlParameters | ( |  | $SearchGroups | ) |
| static

Translate search group array into URL parameters (e.g.

something like F2=madison&F4=american+history&G22=17-41). A search group array looks something like this:

$SearchGroups = array(
"MAIN" => array(
"SearchStrings" => array(
"XXXKeywordXXX" => "some words for keyword search",
"Title" => "some words we are looking for in titles",
),
"Logic" => SearchEngine::LOGIC_AND,
),
"23" => array(
"SearchStrings" => array(
"Resource Type" => array(
"=Event",
"=Image",
),
),
"Logic" => SearchEngine::LOGIC_OR,
),
"25" => array(
"SearchStrings" => array(
"Audience" => array(
"=Grades 10-12",
),
),
"Logic" => SearchEngine::LOGIC_OR,
),
);

where "23" and "25" are the field IDs and "Resource Type" and "Audience" are the corresponding field names.

Parameters

  array | $SearchGroups | Search group array.

Returns
  String containing URL parameters (no leading "?").

Definition at line 312 of file SavedSearch.php.

static SavedSearch::TranslateUrlParametersToSearchGroups | ( |  | $GetVars | ) |
| static

Translate URL parameters to legacy search group array.

Parameters

  array | $GetVars | Get variables (as from $_GET)

Returns
  array Legacy search group array

Definition at line 486 of file SavedSearch.php.

References SearchEngine\LOGIC_AND, and SearchEngine\LOGIC_OR.

SavedSearch::UpdateDateLastRun | ( |  | ) |

Update date this search was last run.

Definition at line 228 of file SavedSearch.php.

SavedSearch::UserId | ( |  | $NewValue = `DB_NOVALUE` | ) |

Get/set user ID.

Parameters

  int | $NewValue | New user ID value.

Returns
  Current user ID value.

Definition at line 209 of file SavedSearch.php.

Referenced by __construct().

Here is the caller graph for this function:

## Member Data Documentation

const SavedSearch::SEARCHFREQ_BIWEEKLY = 4

Definition at line 20 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

const SavedSearch::SEARCHFREQ_DAILY = 2

Definition at line 18 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

const SavedSearch::SEARCHFREQ_HOURLY = 1

Definition at line 17 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

const SavedSearch::SEARCHFREQ_MONTHLY = 5

Definition at line 21 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

const SavedSearch::SEARCHFREQ_NEVER = 0

Definition at line 16 of file SavedSearch.php.

const SavedSearch::SEARCHFREQ_QUARTERLY = 6

Definition at line 22 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

const SavedSearch::SEARCHFREQ_WEEKLY = 3

Definition at line 19 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

const SavedSearch::SEARCHFREQ_YEARLY = 7

Definition at line 23 of file SavedSearch.php.

Referenced by SavedSearchFactory\GetSearchesDueToRun().

The documentation for this class was generated from the following file:

- objects/SavedSearch.php