Id(); # Check for Viewable and Enabled status on Cumulative Rating $Schema = new MetadataSchema(); $CumulativeRatingField = $Schema->GetFieldByName('Cumulative Rating'); $DisplayCumulativeRating = $CumulativeRatingField->Viewable() && $SysConfig->ResourceRatingsEnabled() && $CumulativeRating; $DescriptionField = $Schema->GetFieldByName('Description'); $DisplayDescription = $DisplayDescription && $DescriptionField->Viewable(); $UrlField = $Schema->GetFieldByName('Url'); if(is_object($UrlField)) $DisplayUrl = $DisplayUrl && $UrlField->Viewable(); $ScreenshotField = $Schema->GetFieldByName('Screenshot'); $DisplayScreenshot = FALSE; if(is_object($ScreenshotField)) { $DisplayScreenshot = $ScreenshotField->Viewable() && $ScreenshotField->Enabled(); $Screenshot = $Resource->Get("Screenshot", TRUE); if(is_object($Screenshot)) { $ImageOkay = is_readable($Screenshot->ThumbnailUrl()); if ($ImageOkay) { $ThumbnailUrl = $Screenshot->ThumbnailUrl(); $ImageUrl = "index.php?P=FullImage&ResourceId=".$Resource->Id()."&FieldName=Screenshot"; $AltText = $Screenshot->AltText(); if ($Screenshot->ThumbnailWidth() > 0) { $ThumbnailWidthAttrib = " width='".$Screenshot->ThumbnailWidth()."'"; } if ($Screenshot->ThumbnailHeight() > 0) { $ThumbnailHeightAttrib = " height='".$Screenshot->ThumbnailHeight()."'"; } } } else { $ImageOkay = false; } } # retrieve alt text for accessibility match icon (if needed) $AccessMatchText = GetAccessMatchText($Resource, $Schema, $User); if($DisplayDescription) { # maximum length of description (in characters) $MaxDescriptionLength = 200; # get stripped and length-limited version of description $Description = strip_tags($Resource->Get("Description"), ""); $Description = NeatlyTruncateString( $Description, $MaxDescriptionLength); # if list of search terms was supplied if ($TermsToHighlight && count($TermsToHighlight)) { # highlight terms in description foreach ($TermsToHighlight as $Term) { $Patterns[] = "/([^a-z]{1})(".$Term.")([^a-z]{1})/i"; $Replacements[] = "\\1\\2\\3"; $Patterns[] = "/^(".$Term.")([^a-z]{1})/i"; $Replacements[] = "\\1\\2"; $Patterns[] = "/([^a-z]{1})(".$Term.")$/i"; $Replacements[] = "\\1\\2"; } $Description = preg_replace( $Patterns, $Replacements, $Description); } } if($DisplayUrl) { # maximum length of url $MaxUrlLength = 60; # truncate URL so it fits (if necessary) if(is_object($UrlField)) { $Url = $Resource->Get("Url"); if (strlen($Url) > $MaxUrlLength) { $UrlForDisplay = substr($Url, 0, $MaxUrlLength)."..."; } else { $UrlForDisplay = $Url; } } } # determine rating graphic name if ( $SysConfig->ResourceRatingsEnabled() ) { if ($User->IsLoggedIn()) { $UserRating = $Resource->Rating(); } $BaseRatingGraphic = "StarRating--"; switch ($CumulativeRating) { case 0: $RatingGraphic = $BaseRatingGraphic."1_0.gif"; break; case 1: $RatingGraphic = $BaseRatingGraphic."1_0.gif"; break; case 2: $RatingGraphic = $BaseRatingGraphic."1_0.gif"; break; case 3: $RatingGraphic = $BaseRatingGraphic."1_5.gif"; break; case 4: $RatingGraphic = $BaseRatingGraphic."2_0.gif"; break; case 5: $RatingGraphic = $BaseRatingGraphic."2_5.gif"; break; case 6: $RatingGraphic = $BaseRatingGraphic."3_0.gif"; break; case 7: $RatingGraphic = $BaseRatingGraphic."3_5.gif"; break; case 8: $RatingGraphic = $BaseRatingGraphic."4_0.gif"; break; case 9: $RatingGraphic = $BaseRatingGraphic."4_5.gif"; break; case 10: $RatingGraphic = $BaseRatingGraphic."5_0.gif"; break; } } # determine rating graphic alt tag if ($CumulativeRating && $SysConfig->ResourceRatingsEnabled()) { switch ($CumulativeRating) { case 0: $RatingGraphicAlt = "This resource has a 1 star rating"; break; case 1: $RatingGraphicAlt = "This resource has a 1 star rating"; break; case 2: $RatingGraphicAlt = "This resource has a 1 star rating"; break; case 3: $RatingGraphicAlt = "This resource has a 1.5 star rating"; break; case 4: $RatingGraphicAlt = "This resource has a 2 star rating"; break; case 5: $RatingGraphicAlt = "This resource has a 2.5 star rating"; break; case 6: $RatingGraphicAlt = "This resource has a 3 star rating"; break; case 7: $RatingGraphicAlt = "This resource has a 3.5 star rating"; break; case 8: $RatingGraphicAlt = "This resource has a 4 star rating"; break; case 9: $RatingGraphicAlt = "This resource has a 4.5 star rating"; break; case 10: $RatingGraphicAlt = "This resource has a 5 star rating"; break; } } ?>
0) { ?> title="" alt="" style="margin-left: 10px; border: 1px solid #DDD; padding: 10px; background: #F0F0F0;">
<?PHP  print($RatingGraphicAlt);  ?>
" alt="" title="">
Full Record
"> ResourceRatingsEnabled() && UserIsLoggedIn()) PrintFastRating( $ResourceId, $UserRating ); ?> 0)) { ?>ResourceLaunchesNewWindowEnabled()) { print " target=\"_blank\" "; } ?>>