LabelToDisplay) * @param SearchParameterSet $SearchParameters Values set for this search * @param int $TypeMask Bitmask of MetadataSchema::MDFTYPE_ values * specifying which fields to display * @return void */ function DisplayLimits($Fields, $SearchParameters, $TypeMask) : void { if (count($Fields) == 0) { return; } $NumberOfListItems = 6; $NumberOfListItemsForFlags = 2; print "
"; foreach ($Fields as $FieldId => $DisplayName) { $Field = MetadataField::getField($FieldId); if ($Field->type() & $TypeMask) { $CurrentValues = $SearchParameters->getSearchStringsForField($FieldId); # (ignore phpstan errors for functions defined in AdvancedSearch.php) // @phpstan-ignore function.notFound $CurrentValues = ConvertValueNamesToIds($Field, $CurrentValues); // @phpstan-ignore function.notFound $PossibleValues = DeterminePossibleValues($Field); // @phpstan-ignore function.notFound $DisabledOptions = DetermineDisabledValues($Field, $PossibleValues); $AllowMultiple = ($Field->searchGroupLogic() == SearchEngine::LOGIC_OR) || ($Field->allowMultiple()); if (count($PossibleValues) > 0) { print "
" ."" .htmlspecialchars($DisplayName)."
"; $OptionList = new HtmlOptionList( "F_SearchLimit".$FieldId."[]", $PossibleValues, $CurrentValues ); $OptionList->multipleAllowed($AllowMultiple); $OptionList->disabledOptions($DisabledOptions); $OptionList->size( ($Field->type() == MetadataSchema::MDFTYPE_FLAG) ? $NumberOfListItemsForFlags : $NumberOfListItems ); $OptionList->printHtml(); print "
"; } } } print "
"; } # ----- SETUP ---------------------------------------------------------------- if (!isset($H_FieldsHavingTextForms)) { throw new Exception("H_FieldsHavingTextForms not defined."); } if (!isset($H_OpenByDefault)) { throw new Exception("H_OpenByDefault not defined."); } if (!isset($H_OpenSearchLimits)) { throw new Exception("H_OpenSearchLimits not defined."); } if (!isset($H_RecordsPerPage)) { throw new Exception("H_RecordsPerPage not defined."); } if (!isset($H_SavedSearches)) { throw new Exception("H_SavedSearches not defined."); } if (!isset($H_SchemaNames)) { throw new Exception("H_SchemaNames not defined."); } if (!isset($H_SearchLimits)) { throw new Exception("H_SearchLimits not defined."); } if (!isset($H_SearchParameters)) { throw new Exception("H_SearchParameters not defined."); } if (!isset($H_SelectedFields)) { throw new Exception("H_SelectedFields not defined."); } if (!isset($H_SelectedSortField)) { throw new Exception("H_SelectedSortField not defined."); } if (!isset($H_SortFields)) { throw new Exception("H_SortFields not defined."); } $AF = ApplicationFramework::getInstance(); $SearchButton = new HtmlButton("Search"); $SearchButton->setIcon("MagnifyingGlass.svg"); $SearchButton->setSize(HtmlButton::SIZE_SMALL); $SearchButton->makeSubmitButton(); $ShowAllButton = new HtmlButton("Show All"); $ShowAllButton->setIcon("Maximize.svg"); $ShowAllButton->addClass("mv-limits-showall"); $ShowAllButton->setOnclick("showAllLimits()"); $ShowAllButton->setSize(HtmlButton::SIZE_SMALL); $HideAllButton = new HtmlButton("Hide All"); $HideAllButton->setIcon("Minimize.svg"); $HideAllButton->addClass("mv-limits-hideall"); $HideAllButton->setOnclick("hideAllLimits()"); $HideAllButton->setSize(HtmlButton::SIZE_SMALL); $SaveButton = new HtmlButton("Save"); $SaveButton->setIcon("Disk.svg"); $SaveButton->setSize(HtmlButton::SIZE_SMALL); $SaveButton->makeSubmitButton(); $ClearButton = new HtmlButton("Clear"); $ClearButton->setIcon("Broom.svg"); $ClearButton->setSize(HtmlButton::SIZE_SMALL); $ClearButton->setTitle("Reset all search terms"); $ClearButton->setLink("index.php?P=AdvancedSearch"); $CheckIfButton = new HtmlButton("Allow Unassigned Values"); $CheckIfButton->setIcon("Check.svg"); $CheckIfButton->addClass("toggle-disabled"); $CheckIfButton->setSize(HtmlButton::SIZE_SMALL); $AddFieldButton = new HtmlButton("Add Field"); $AddFieldButton->setIcon("Plus.svg"); $AddFieldButton->addClass("mv-content-addfield"); $AddFieldButton->setSize(HtmlButton::SIZE_SMALL); $AddFieldButton->setOnclick("addFieldClick()"); $IsResourceAdmin = User::getCurrentUser()->hasPriv(PRIV_RESOURCEADMIN); # ----- DISPLAY -------------------------------------------------------------- $AF->setPageTitle("Advanced Search"); ?>

# Advanced Search

- ".$H_Error."
"; } ?>
Field
Search Terms
GetKeywordSearchStrings(); } else { # if this is a multi-field search, display the value from # the first field as the remainder should all be identical $FieldIds = explode("-", $FieldId); $CurrentValues = $H_SearchParameters->GetSearchStringsForField( current($FieldIds) ); } # if we have no values for this field, add a single empty value # so that the field is still displayed if (count($CurrentValues) == 0) { $CurrentValues = [""]; } # iterate over all the currently set values, printing # corresponding HTML elements for each foreach ($CurrentValues as $CurrentValue) { print "
" ."
"; $OptionList = new HtmlOptionList( "F_SearchCat".$SearchCatIndex, $H_FieldsHavingTextForms, $FieldId ); $OptionList->addAttribute("title", "Search Field ".$SearchCatIndex); $OptionList->addAttribute("aria-labelledby", "mv-adv-field-label"); $OptionList->printHtml(); print "
" ."" ."
" ."
" ."
"; $SearchCatIndex++; } } ?>

## Limits (Optional)

getHtml() ?> getHtml() ?> getHtml() ?>
$Limits) { ?>
1) { ?> [+–]
getHtml() ?> isLoggedIn()) { ?> getHtml() ?> getHtml(); ?>
Save Search As: Sort by: printHtml(); ?> Records per page: 5, 10 => 10, 20 => 20, 30 => 30, 50 => 50, 100 => 100 ]; $OptList = new HtmlOptionList("F_RecordsPerPage", $DisplayOptions, $H_RecordsPerPage); $OptList->printHtml(); ?>

## Load Saved Search:

" ."

\n"; foreach ($H_SavedSearches as $SearchId => $Search) { try { $Descrip = addslashes(strip_tags( $Search->SearchParameters()->TextDescription() )); print "
- " .htmlspecialchars($Search->SearchName())."
\n" ; } catch (Exception $e) { ; # continue on if search data was invalid } } print "

\n"; } ?>

### Advanced Search Tips

Phrase Searching

  You can search for several words next to each other by enclosing them in quotation marks:

  > `"a key phrase"`

  This also works for keyword searches.

Excluding Terms

  If you want only results that do not mention a specific term, you can exclude that term by prepending a minus sign:

  > `-unwanted`
  > `good words -bad -words`
  > `words we want -"phrase to exclude"`

  This also works for keyword searches.

Comparisons

  To search for values before or after a certain date, precede the date with the appropriate operator:

  > `> 2018` (after 2018)
  > `<= Feb 20 2021` (on or before 2/20/21)

  It is also possible to specify relative to the current time:

  > `< 90 minutes ago` (less than 90 minutes ago)
  > `>= ten days ago` (10 or more days ago)

  Comparisons also work with numeric fields:

  > `>= 42` (greater than or equal to 42)
  > `!= 65535` (not equal to 65535)

  For dates, most common formats will work. Comparisons are only for Date, Timestamp, and Number fields.

Exact Matches

  To match a word or phrase exactly, immediately precede it with an equals sign:

  > `=National Nanotechnology Network`
  > `=http://www.science.org/journals`

  This is usually used with URL and Controlled Name fields. Exact match differs from phrase searching in that with an exact match, the content of the field has to be identical to the search string to be considered a match.

Date Ranges

  You can search for dates within a specific range by entering a beginning and end date separated by spaces and a dash:

  > `June 10 2021 - March 19 2022`
  > `5/1/16 - 2/10/20`

  Ranges are inclusive, and most common date formats will work.

Last Modified

  To search for when a field was last modified, enter a `@` symbol followed by a date:

  > `@ Feb 20 2022` (changed on or since 2/20/22)
  > `@ five days ago` (changed within the past 5 days)

  Comparison operators can also be used:

  > `@< January 10 2022` (last changed before 1/10/22)

  Dates are inclusive, and most common date formats will work.