GetFieldByName('Cumulative Rating');
$DisplayCumulativeRating = $CumulativeRatingField->Viewable()
&& $SysConfig->ResourceRatingsEnabled()
&& $CumulativeRating;
# get screenshot info
if (isset($Fields['Screenshot']))
{
$SPTImage = $Fields['Screenshot'];
$ImageOkay = is_readable($SPTImage->ThumbnailUrl());
$ThumbnailUrl = $SPTImage->ThumbnailUrl();
$ImageUrl = "SPT--FullImage.php?ResourceId=".$Fields["ResourceId"]."&FieldName=Screenshot";
$AltText = $SPTImage->AltText();
if ($SPTImage->ThumbnailWidth() > 0)
{
$ThumbnailWidthAttrib = " width='".$SPTImage->ThumbnailWidth()."'";
}
if ($SPTImage->ThumbnailHeight() > 0)
{
$ThumbnailHeightAttrib = " height='".$SPTImage->ThumbnailHeight()."'";
}
}
# maximum length of text items (in characters)
$MaxDescriptionLength = 200;
$MaxUrlLength = 60;
# get stripped and length-limited version of description
$Description = strip_tags($Fields["Description"], "");
if (strlen($Description) > $MaxDescriptionLength)
{
$Description = substr($Description, 0, $MaxDescriptionLength)."...";
}
$Description = CloseTags("b", $Description);
$Description = CloseTags("i", $Description);
$Description = CloseTags("u", $Description);
# truncate URL so it fits (if necessary)
$Url = $Fields["Url"];
if (strlen($Url) > $MaxUrlLength)
{
$UrlForDisplay = substr($Url, 0, $MaxUrlLength)."...";
}
else
{
$UrlForDisplay = $Url;
}
# determine rating graphic name
if ($CumulativeRating && $SysConfig->ResourceRatingsEnabled())
{
$BaseRatingGraphic = "SPTUI--Default/images/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;
}
}
?>
Subject: Posted by: "> Post Time: