Please try your search" ." again later, or log in before searching, if you have an account."; $MaintFile = is_readable("local/interface/default/MaintenanceMode.html") ? "local/interface/default/MaintenanceMode.html" : "interface/default/MaintenanceMode.html"; include($MaintFile); $AF->suppressStandardPageStartAndEnd(); return; } # bail out if this access came from an unwanted bot if (!isset($H_IsBot)) { throw new Exception("Required variable \$H_IsBot was not initialized"); } if ($H_IsBot) { print "

Please do not spider search results in an automated fashion. " ."It can generate significant system load. "; if (PluginManager::getInstance()->pluginReady("XmlSitemap")) { print "Instead, please use the " ."XML Sitemap " ."that we provide."; } print "

"; return; } if (!isset($H_SearchParams)) { throw new Exception("Required variable \$H_SearchParams was not initialized"); } # set page title $AF->setPageTitle("Search Results - ".StdLib::NeatlyTruncateString( $H_SearchParams->TextDescription(false), 120 )); # ----- LOCAL FUNCTIONS ------------------------------------------------------ /** * Get hidden tags needed by the sort controls for sorting and ordering. * @param int $ItemType Type of item handled by sort controls. * @param ?MetadataField $SortField The field to sort by. * @param string $UrlParameterString String with all URL parameters. * @return array Two-element array of strings where the first gives the hidden * tags for sort fields and the second gives the hidden tags for the sort * direction. */ function getSortFieldHiddenTags( int $ItemType, ?MetadataField $SortField, string $UrlParameterString ) : array { # split out URL parameters to build hidden tags for sort field and direction parse_str($UrlParameterString, $UrlParameters); $SortFieldHiddenTags = ""; $SortDirectionHiddenTags = ""; # for each URL parameter foreach ($UrlParameters as $Param => $Values) { $VarNameSuffix = $ItemType ? $ItemType : ""; # if multiple values were (or may be) provided if (is_array($Values)) { # for each value foreach ($Values as $Index => $Value) { # build hidden tag $Tag = "\n"; if ((($Param != TransportControlsUI::PNAME_SORTFIELD.$VarNameSuffix) && ($Param != TransportControlsUI::PNAME_STARTINGINDEX.$VarNameSuffix)) || ($Index != $ItemType)) { # add tag to sort field tags $SortFieldHiddenTags .= $Tag; } # if not reverse sort parameter for this item type if (($Param != TransportControlsUI::PNAME_REVERSESORT.$VarNameSuffix) || ($Index != $ItemType)) { # add tag to sort direction tags $SortDirectionHiddenTags .= $Tag; } } } else { # build hidden tag $Tag = "\n"; # if param isn't reverse sort tag if ($Param != TransportControlsUI::PNAME_REVERSESORT.$VarNameSuffix) { # add to direction tags $SortDirectionHiddenTags .= $Tag; # and if param also isn't sort field tag or start index tag if ($Param != TransportControlsUI::PNAME_SORTFIELD.$VarNameSuffix || $Param != TransportControlsUI::PNAME_STARTINGINDEX.$VarNameSuffix) { # add to sort field tags $SortFieldHiddenTags .= $Tag; } } } } return [$SortFieldHiddenTags, $SortDirectionHiddenTags]; } /** * Get the controls for sorting and ordering. * @param int $ItemType Type of item handled by sort controls. * @param MetadataField|null $SortField The field to sort by. * @param bool $SortDescending Set to TRUE to indicate that sorting is in * descending order. * @param array $SortableFields Array of sortable fields. * @param string $UrlParameterString String with all URL parameters. * @param SearchParameterSet $SearchParams Search parameters for this search * @param int $NumSearchResults Number of search results * @return string Returns the sort controls HTML as a string. */ function GetSortControls( int $ItemType, ?MetadataField $SortField, bool $SortDescending, array $SortableFields, string $UrlParameterString, SearchParameterSet $SearchParams, int $NumSearchResults ) : string { # get hidden tags list($SortFieldHiddenTags, $SortDirectionHiddenTags) = getSortFieldHiddenTags( $ItemType, $SortField, $UrlParameterString ); # retrieve specifications for sort direction button list($AscOrderInfo, $DescOrderInfo) = GetSortOrderButton($SortField); # grab unique ID for use in the JavaScript below $SafeUniqId = defaulthtmlentities(uniqid()); $ForwardSortValue = (is_null($SortField) || $SortField->Type() == MetadataSchema::MDFTYPE_DATE || $SortField->Type() == MetadataSchema::MDFTYPE_TIMESTAMP) ? 1 : 0; $VarNameSuffix = $ItemType ? $ItemType : ""; $SortFieldVarName = TransportControlsUI::PNAME_SORTFIELD.$VarNameSuffix; $ReverseSortVarName = TransportControlsUI::PNAME_REVERSESORT.$VarNameSuffix; $SortButton = new HtmlButton("Sort"); $SortButton->setSize(HtmlButton::SIZE_SMALL); $SortButton->addClass("mv-search-sort-submit-button"); $SortOptions = []; $SortFieldId = is_object($SortField) ? $SortField->Id() : "R"; foreach ($SortableFields as $FieldId => $FieldName) { $SortOptions[$FieldId] = $FieldName; } $SortOptionList = new HtmlOptionList($SortFieldVarName, $SortOptions, $SortFieldId); ob_start(); ?>
Sort by: getHtml(); ?> getHtml(); ?> ".$DescOrderInfo["Text"][0]."" ."➜" ."".$DescOrderInfo["Text"][1].""; $AscOrderLabel = "".$AscOrderInfo["Text"][0]."" ."➜" ."".$AscOrderInfo["Text"][1].""; $SortHiLoButton = new HtmlButton($SortDescending ? $DescOrderLabel : $AscOrderLabel); $SortHiLoButton->setValue(""); $SortHiLoButton->setSize(HtmlButton::SIZE_SMALL); $SortHiLoButton->makeHtmlLabel(); $SortHiLoButton->addClass("mv-search-toggle-order-button"); ?>
getHtml(); ?>
Order: /> />
"Display the results in ascending order", "Text" => ["", ""], "Width" => 25 ]; $Descending = [ "Message" => "Display the results in descending order", "Text" => ["", ""], "Width" => 25 ]; # relevance or rating if (is_null($Field) || $Field->Name() == "Cumulative Rating") { $Ascending["Text"] = ["Lo", "Hi"]; $Descending["Text"] = ["Hi", "Lo"]; $Ascending["Width"] = 30; $Descending["Width"] = 30; } else { # based on field type switch ($Field->Type()) { case MetadataSchema::MDFTYPE_NUMBER: $Ascending["Text"] = ["1", "10"]; $Descending["Text"] = ["10", "1"]; break; case MetadataSchema::MDFTYPE_DATE: case MetadataSchema::MDFTYPE_TIMESTAMP: $Ascending["Text"] = ["JAN", "DEC"]; $Descending["Text"] = ["DEC", "JAN"]; $Ascending["Width"] = 35; $Descending["Width"] = 35; break; default: $Ascending["Text"] = ["A", "Z"]; $Descending["Text"] = ["Z", "A"]; break; } } return [$Ascending, $Descending]; } /** * Print the search results display for specified item type. * @param int $ItemType Type of item. * @param SearchParameterSet $SearchParams Search parameters. * @param array $SearchResults Array of search results, with item IDs for the * index and relevance scores for the values. * @param int $StartingIndex Starting index into search results for current page. * @param int $ResultsPerPage Number of results to display per page. * @param int|string $SortFieldId ID of field currently used for sorting results. * @param bool $SortDescending TRUE if results are currently sorted in descending * order, otherwise FALSE. * @param bool $UseTabs TRUE to indicate that a tabbed interface should be * displayed, otherwise FALSE. * @param TransportControlsUI $TransportUI Transport controls user interface object. * @param array $ListChecksums List of index=>checksum values. */ function printSearchResults( int $ItemType, SearchParameterSet $SearchParams, array $SearchResults, int $StartingIndex, int $ResultsPerPage, $SortFieldId, bool $SortDescending, bool $UseTabs, TransportControlsUI $TransportUI, array $ListChecksums ): void { # ----- SETUP (STRING BUILDING) ---------------------------------------------- $AF = ApplicationFramework::getInstance(); # get text description of search parameters $SearchDescription = $SearchParams->TextDescription(); # build description of where we are in search results $ResultCount = count($SearchResults); # ----- SETUP (DATA LOADING) ------------------------------------------------- # load sort controls HTML $Schema = new MetadataSchema($ItemType); $SortField = (($SortFieldId != "R") && $Schema->itemExists((int)$SortFieldId)) ? MetadataField::getField((int)$SortFieldId) : null; # add a new local default sort field option (Relevance) to the list of available sort fields $SortableFields = ["R" => "(Relevance)"] + $Schema->getSortFields(); $FullUrlParameterString = "P=SearchResults&" .$SearchParams->UrlParameterString() .$TransportUI->UrlParameterString(false); # get data for faceted search $BaseLink = "index.php?P=SearchResults"; # if a sort field was set, preserve it if ($SortField !== null) { $VarNameSuffix = $Schema->id() ? $Schema->id() : ""; $BaseLink .= "&" .TransportControlsUI::PNAME_SORTFIELD.$VarNameSuffix."=".$SortField->id(); } $FacetUI = new SearchFacetUI( $SearchParams, $SearchResults ); $FacetUI->setBaseLink($BaseLink); # load resources to be displayed $ResultsToDisplay = []; $ResultSliceIds = array_keys(array_slice( $SearchResults, $StartingIndex, $ResultsPerPage, true )); foreach ($ResultSliceIds as $Id) { $ResultsToDisplay[] = new Record($Id); } $BaseLinkWithSearchParams = "index.php?P=SearchResults&" .http_build_query($SearchParams->UrlParameters(), "&"); foreach ($ListChecksums as $Index => $Checksum) { $BaseLinkWithSearchParams .= "&" . $Index . "=" . $Checksum; } $OurLink = urlencode("index.php?".http_build_query($_GET)); $TransportUI->baseLink($BaseLinkWithSearchParams); $RefineLink = "index.php?P=AdvancedSearch&RF=1&" .$SearchParams->UrlParameterString(); ob_start(); $AF->signalEvent( "EVENT_HTML_INSERTION_POINT", [ $AF->getPageName(), "Search Results Buttons", [ "ItemType" => $ItemType, "SearchParameters" => $SearchParams, "SortParamsForUrl" => $FullUrlParameterString, "NumberSearchResults" => $ResultCount, "ReturnToString" => $OurLink, "SearchResults" => $ResultsToDisplay, ] ] ); $ButtonHtml = ob_get_clean(); if ($ResultCount == 0) { $ResultsHtml = ($SearchParams->parameterCount() > 0) ? "
No matching results were found.
" : "
No search parameters were specified.
"; } else { $ShowScreenshots = RecordFactory::recordListHasAnyScreenshots($ResultsToDisplay); ob_start(); foreach ($ResultsToDisplay as $Resource) { $Summary = ResourceSummary::create($Resource->id()); $Summary->showScreenshot($ShowScreenshots); $Summary->termsToHighlight(implode(" ", $SearchParams->GetKeywordSearchStrings())); $Summary->display(); } $ResultsHtml = ob_get_clean(); } $SortControlsHtml = getSortControls( $ItemType, $SortField, $SortDescending, $SortableFields, $FullUrlParameterString, $SearchParams, count($SearchResults) ); $ContainerCssClasses = "container-fluid h-100"; $ContainerAttrs = ''; if ($UseTabs) { $ContainerCssClasses .= " mv-tabs-container"; $ContainerAttrs .= ' id="mv-tabs-'.$ItemType.'"'; } # ----- SETUP (PLUGINS) --------------------------------------------------- $PluginMgr = PluginManager::getInstance(); $CalendarFeedNoticeHtml = ""; if ($PluginMgr->pluginReady("CalendarEvents")) { $EventsPlugin = $PluginMgr->getPlugin("CalendarEvents"); if ($ItemType == $EventsPlugin->getSchemaId()) { $CalendarFeedNoticeHtml = "{{P-CALENDARFEED-FEEDNOTICE}}"; } } ?>
>
Searched for:
display(); ?>
getHtml() ?>
UrlParameterString(); ?>

# Search Results

Advanced Search
1); if ($UseTabs) { $AF->requireUIFile('jquery-ui.js'); $AF->requireUIFile('jquery-ui.css', ApplicationFramework::ORDER_FIRST); ?>
$TypeResults) { if (!isset($H_TransportUIs)) { throw new Exception("Required variable \$H_SearchResults was not initialized"); } if (!isset($H_ResultsPerPage)) { throw new Exception("Required variable \$H_ResultsPerPage was not initialized"); } if (!isset($H_SortDescending)) { throw new Exception("Required variable \$H_SortDescending was not initialized"); } if (!isset($H_ListChecksums)) { throw new Exception("Required variable \$H_ListChecksums was not initialized"); } PrintSearchResults( $ItemType, $H_SearchParams, $TypeResults, $H_TransportUIs[$ItemType]->startingIndex(), $H_ResultsPerPage, $H_TransportUIs[$ItemType]->sortField(), $H_SortDescending[$ItemType], $UseTabs, $H_TransportUIs[$ItemType], $H_ListChecksums ); } if ($UseTabs) { print "
"; } # ----- SUPPORTING JAVASCRIPT ----------------------------------------------- # (ORDER_FIRST is needed so that jquery.cookie.js will be loaded at the top of # the page such that the JS code below can actually use it) $AF->requireUIFile('jquery.cookie.js', ApplicationFramework::ORDER_FIRST); ?>