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; } # if this access came from an unwanted bot, bail and complain 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 ($PluginMgr->PluginReady("XmlSitemap")) { print "Instead, please use the " ."XML Sitemap " ."that we provide."; } print "

"; return; } # 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 mixed $SortField The field to sort by. * @param string $UrlParameterString String with all URL parameters. * @param int $NumSearchResults Number of search results * @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, $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 mixed $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, $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()); $SafeSortFieldId = null; $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; ob_start(); ?>
Sort by:
Order: /> ↓ Ascending (*) /> ↓ Descending (*) SignalEvent( "EVENT_HTML_INSERTION_POINT", [ $AF->GetPageName(), "Search Results Buttons", [ "ItemType" => $ItemType, "SearchParameters" => $SearchParams, "SortParamsForUrl" => $UrlParameterString, "NumberSearchResults" => $NumSearchResults, "ReturnToString" => $OurLink ] ] ); ?>
"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 object $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 $SortFieldId ID of field currently used for sorting results. * @param bool $SortDescending TRUE if results are currently sorted in descending * order, otherwise FALSE. * @param float $SearchTime Time it took to conduct search, in seconds. * @param bool $UseTabs TRUE to indicate that a tabbed interface should be * displayed, otherwise FALSE. * @param object $TransportUI Transport controls user interface object. */ function printSearchResults( $ItemType, $SearchParams, $SearchResults, $StartingIndex, $ResultsPerPage, $SortFieldId, $SortDescending, $SearchTime, $UseTabs, $TransportUI, $ListChecksums ) { $PluginMgr = PluginManager::getInstance(); # ----- SETUP (STRING BUILDING) ---------------------------------------------- # get text description of search parameters $SearchDescription = $SearchParams->TextDescription(); # build description of where we are in search results $ResultCount = count($SearchResults); $ResultPositionDescription = "Results " .number_format(min(($StartingIndex + 1), $ResultCount)) ." - " .number_format(min(($StartingIndex + $ResultsPerPage), $ResultCount)) ." of " .number_format($ResultCount) .""; # build blurb for footer if ((rand(0, 100) > 50) || !$PluginMgr->PluginReady("RSSExport") || !$PluginMgr->GetPlugin("RSSExport")->ConfigSetting("SearchFeed")) { $RefineLink = "index.php?P=AdvancedSearch&RF=1&" .$SearchParams->UrlParameterString(); $FooterBlurb = "Too many (or not the right) results?" ." Refine your search!"; } else { $FooterBlurb = "This search is also available as an" ." UrlParameterString()."\">RSS feed."; } # ----- SETUP (DATA LOADING) ------------------------------------------------- # load sort controls HTML $Schema = new MetadataSchema($ItemType); $SortField = (($SortFieldId != "R") && $Schema->ItemExists($SortFieldId)) ? MetadataField::getField($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); $SortControlsTop = GetSortControls( $ItemType, $SortField, $SortDescending, $SortableFields, $FullUrlParameterString, $SearchParams, count($SearchResults) ); $SortControlsBottom = GetSortControls( $ItemType, $SortField, $SortDescending, $SortableFields, $FullUrlParameterString, $SearchParams, count($SearchResults) ); # 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); } # ----- TAB CONTAINER (if any) BEGIN ------------------------------------ if ($UseTabs) { ?>
UrlParameters(), "&"); foreach ($ListChecksums as $Index => $Checksum) { $BaseLinkWithSearchParams .= "&" . $Index . "=" . $Checksum; } $TransportUI->baseLink($BaseLinkWithSearchParams); $TransportUI->message($SortControlsTop); $TransportUI->display(); $RefineLink = "index.php?P=AdvancedSearch&RF=1&".$SearchParams->UrlParameterString(); ?>
Searched for:

Narrow Your Search

getHtml(); ?>
ParameterCount()) { ?>
No matching results were found.
No search parameters were specified.
id()); $Summary->showScreenshot($ShowScreenshots); $Summary->TermsToHighlight(implode( " ", $SearchParams->GetKeywordSearchStrings() )); $Summary->Display(); } } ?>

Search time: seconds |

message($SortControlsBottom); $TransportUI->display(); ?>

# Search Results

UrlParameterString(); ?> Refine Search
1); if ($UseTabs) { $AF->requireUIFile('jquery-ui.js'); $AF->requireUIFile('jquery-ui.css', ApplicationFramework::ORDER_FIRST); ?>
$TypeResults) { if ($ItemType != MetadataSchema::SCHEMAID_USER) { PrintSearchResults( $ItemType, $H_SearchParams, $TypeResults, $H_TransportUIs[$ItemType]->startingIndex(), $H_ResultsPerPage, $H_TransportUIs[$ItemType]->sortField(), $H_SortDescending[$ItemType], $H_SearchTime, $UseTabs, $H_TransportUIs[$ItemType], $H_ListChecksums ); } } # ----- TAB FOOTER ---------------------------------------------------------- if ($UseTabs) { ?>
requireUIFile('jquery.cookie.js', ApplicationFramework::ORDER_FIRST); if ($UseTabs) { # (get array with item types for index and indexes of item tabs # for values because JS active tab parameter expects an index) $ItemTypeIndexes = array_flip(array_keys($H_SearchResults)); $TabParameter = "{active: ".$ItemTypeIndexes[$H_ActiveTab]."}"; ?>