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

"; return; } # set page title PageTitle("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(); ?>
".$DescOrderInfo["Text"][0]."" ."" ."".$DescOrderInfo["Text"][1].""; $AscOrderLabel = "".$AscOrderInfo["Text"][0]."" ."" ."".$AscOrderInfo["Text"][1].""; ?>
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 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 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, $UseTabs, $TransportUI, $ListChecksums ) { # ----- SETUP (STRING BUILDING) ---------------------------------------------- # 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($SortFieldId)) ? new MetadataField($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->baseLink($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 = ApplicationFramework::getInstance(); $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->pluginEnabled("CalendarEvents")) { $EventsPlugin = $PluginMgr->getPlugin("CalendarEvents"); if ($ItemType == $EventsPlugin->getSchemaId()) { $CalendarFeedNoticeHtml = "{{P-CALENDARFEED-FEEDNOTICE}}"; } } ?>
>
Searched for:
display(); ?>
UrlParameterString(); ?>

Search Results

1); if ($UseTabs) { $AF->requireUIFile('jquery-ui.js'); $AF->requireUIFile('jquery-ui.css', ApplicationFramework::ORDER_FIRST); ?>
    $TypeResults) { $Schema = new MetadataSchema($ItemType); ?>
  • Name() ?> ()
 
$TypeResults) { if ($ItemType != MetadataSchema::SCHEMAID_USER) { 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); ?>