id()); $Summary->Display(); ?>

id() ?>" class="mv-why-recommend-link lightgray"> "/> Why was the above resource recommended?

$Score) { # export resource ID for use by other functions $CurrentResourceId = $ResourceId; # print entry $Resource = new Record($ResourceId); PrintRecommendation( $Resource, $Resource->getViewPageUrl(), $Resource->UserCanEdit(User::getCurrentUser()), $Resource->getEditPageUrl(), $Resource->ScaledCumulativeRating() ); } } /** * Output total number of resource recommendations. */ function PrintTotalNumberOfResults(): void { global $Recommender; # make sure recommendations have been generated GetRecommendations(); print($Recommender->NumberOfResults()); } /** * Out number of first result shown on this page. */ function PrintStartingResultNumber(): void { global $StartingResult; global $Recommender; # make sure recommendations have been generated GetRecommendations(); if ($Recommender->NumberOfResults() == 0) { print("0"); } else { print($StartingResult + 1); } } /** * Output number of the last result shown on this page. */ function PrintEndingResultNumber(): void { global $StartingResult; global $ResultsPerPage; global $Recommender; # make sure recommendations have been generated GetRecommendations(); print(min(($StartingResult + $ResultsPerPage), $Recommender->NumberOfResults())); } /** * Determine if additional results are available. * @return bool TRUE when additional results exists. */ function NextResultsAvailable(): bool { global $StartingResult; global $ResultsPerPage; global $Recommender; # make sure recommendations have been generated GetRecommendations(); return (($StartingResult + $ResultsPerPage) < $Recommender->NumberOfResults()) ? true : false; } /** * Print link to previous page of results. */ function PrintPreviousResultsLink(): void { global $StartingResult; global $ResultsPerPage; global $SearchString; $NewStartingResult = max(($StartingResult - $ResultsPerPage), 0); print("index.php?P=RecommendResources&sr=".$NewStartingResult); } /** * Print link to next page of results. */ function PrintNextResultsLink(): void { global $StartingResult; global $ResultsPerPage; global $SearchString; $NewStartingResult = $StartingResult + $ResultsPerPage; print("index.php?P=RecommendResources&sr=".$NewStartingResult); } /** * Determine if there are no results. * @return bool TRUE when no results exist. FALSE otherwise. */ function NoResultsFound(): bool { global $Recommender; # make sure recommendations have been generated GetRecommendations(); return ($Recommender->NumberOfResults() == 0) ? true : false; } /** * Output number of next results. */ function PrintNumberOfNextResults(): void { global $ResultsPerPage; global $StartingResult; global $Recommender; # make sure recommendations have been generated GetRecommendations(); print(min($ResultsPerPage, ($Recommender->NumberOfResults() - ($StartingResult + $ResultsPerPage)))); } /** * Get resource recommendations. */ function GetRecommendations(): void { global $Recommender; global $Recommendations; global $StartingResult; global $ResultsPerPage; # bail out if we've already gotten recommendations static $AlreadyGotRecommendations; if ($AlreadyGotRecommendations) { return; } $AlreadyGotRecommendations = true; # create recommender $Recommender = new Recommender(); # add filter function to return only released records $Recommender->AddResultFilterFunction("FilterRecommendationsForReleasedRecords"); # get recommendations $Recommendations = $Recommender->Recommend( User::getCurrentUser()->Get("UserId"), $StartingResult, $ResultsPerPage ); } /** * Filter function to show only released recommendations. * @param int $ResourceId Resource to test. * @return bool TRUE for resources that should be shown. FALSE otherwise. */ function FilterRecommendationsForReleasedRecords(int $ResourceId): bool { $Resource = new Record($ResourceId); return ($Resource->UserCanView(User::getCurrentUser())); } # ----- SETUP ---------------------------------------------------------------- # verify that required incoming variable are set if (!isset($StartingResult)) { throw new Exception("Variable \$StartingResult not set."); } global $ResultsPerPage; $PreviousButton = new HtmlButton("← Previous"); $PreviousButton->setLink("index.php?P=RecommendResources&sr=" . max(($StartingResult - $ResultsPerPage), 0)); $NextButton = new HtmlButton("Next →"); $NextButton->setLink("index.php?P=RecommendResources&sr=" . ($StartingResult + $ResultsPerPage)); # ----- DISPLAY -------------------------------------------------------------- ?>

# Recommended Resources

IsLoggedIn()) { ?>

You must have an account and be logged in to get recommendations.If you have an existing account, please log in.If you do not have an account, create one to start rating resources and receiving recommendations.

There was not enough information available to recommend new resources. Please rate additional resources so that recommendations can be made.

The following recommendations are being made based on how you have rated other resources. You can improve recommendations by rating more resources.

Results - of

0 || NextResultsAvailable()) { ?>
0) { print $PreviousButton->getHtml(); } ?> | getHtml(); } ?>