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');
if(is_object($ScreenshotField))
{
$DisplayScreenshot = $ScreenshotField->Viewable();
$Screenshot = $Resource->Get("Screenshot", TRUE);
if(is_object($Screenshot))
{
$ImageOkay = is_readable($Screenshot->ThumbnailUrl());
if($ImageOkay)
{
$ThumbnailUrl = $Screenshot->ThumbnailUrl();
$ImageUrl = "SPT--FullImage.php?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;
}
}
if($DisplayDescription)
{
# maximum length of description (in characters)
$MaxDescriptionLength = 200;
# get stripped and length-limited version of description
$Description = strip_tags($Resource->Get("Description"), "");
if (strlen($Description) > $MaxDescriptionLength)
{
$Description = substr($Description, 0, $MaxDescriptionLength)."...";
}
$Description = CloseTags("b", $Description);
$Description = CloseTags("i", $Description);
$Description = CloseTags("u", $Description);
$Description = CloseTags("sub", $Description);
$Description = CloseTags("sup", $Description);
$Description = CloseTags("strike", $Description);
$Description = CloseTags("a", $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 ($CumulativeRating && $SysConfig->ResourceRatingsEnabled())
{
$BaseRatingGraphic = "SPTUI--Standards/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: