GetFieldByMappedName("Title"); if ($Resource->UserCanViewField($User, $TitleField)) { $Title = strip_tags(GetResourceFieldValue($Resource, $TitleField), "<"."b><"."i><"."u><"."sub><"."sup><"."strike><"."a>"); } $UrlField = $Schema->GetFieldByMappedName("Url"); $FileField = $Schema->GetFieldByMappedName("File"); $UrlLink = "index.php?P=GoTo&ID=".$Resource->Id()."&MF=".$UrlField->Id(); if ($Resource->UserCanViewField($User, $UrlField)) { # maximum length of the URL $MaxLength = 60; $Url = GetResourceFieldValue($Resource, $UrlField); if (!strlen($Url)) { unset($Url); } else if (strlen($Url) > $MaxLength && strlen(strip_tags($Url))==strlen($Url)) { $Url = substr($Url, 0, $MaxLength)."..."; } } if ($DisplayDescription) { $DescriptionField = $Schema->GetFieldByMappedName("Description"); if ($DescriptionField instanceof MetadataField && $Resource->UserCanViewField($User, $DescriptionField)) { # maximum length of description (in characters) $MaxLength = 200; # get stripped and length-limited version of description $Description = strip_tags(GetResourceFieldValue($Resource, $DescriptionField), "<"."b><"."i><"."u><"."sub><"."sup><"."strike><"."a>"); $Description = NeatlyTruncateString($Description, $MaxLength); # if list of search terms was supplied if (is_array($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); } } } $ScreenshotField = $Schema->GetFieldByMappedName("Screenshot"); if ($Resource->UserCanViewField($User, $ScreenshotField)) { $Screenshot = GetResourceFieldValue($Resource, $ScreenshotField, TRUE); if (is_null($Screenshot) || ($Screenshot instanceof SPTImage && !is_readable($Screenshot->ThumbnailUrl()))) { unset($Screenshot); } } $RatingField = $Schema->GetFieldByName("Cumulative Rating"); $RatingsEnabled = $SysConfig->ResourceRatingsEnabled(); if ($RatingsEnabled && $Resource->UserCanViewField($User, $RatingField)) { if ($User->IsLoggedIn()) { $UserRating = $Resource->Rating(); } $BaseRatingGraphic = "StarRating--"; if (!is_null($Resource->ScaledCumulativeRating())) { switch ($Resource->ScaledCumulativeRating()) { case 1: $Rating["Graphic"] = $BaseRatingGraphic."1_0.gif"; $Rating["Alt"] = "This resource has a 1 star rating"; break; case 2: $Rating["Graphic"] = $BaseRatingGraphic."1_0.gif"; $Rating["Alt"] = "This resource has a 1 star rating"; break; case 3: $Rating["Graphic"] = $BaseRatingGraphic."1_5.gif"; $Rating["Alt"] = "This resource has a 1.5 star rating"; break; case 4: $Rating["Graphic"] = $BaseRatingGraphic."2_0.gif"; $Rating["Alt"] = "This resource has a 2 star rating"; break; case 5: $Rating["Graphic"] = $BaseRatingGraphic."2_5.gif"; $Rating["Alt"] = "This resource has a 2.5 star rating"; break; case 6: $Rating["Graphic"] = $BaseRatingGraphic."3_0.gif"; $Rating["Alt"] = "This resource has a 3 star rating"; break; case 7: $Rating["Graphic"] = $BaseRatingGraphic."3_5.gif"; $Rating["Alt"] = "This resource has a 3.5 star rating"; break; case 8: $Rating["Graphic"] = $BaseRatingGraphic."4_0.gif"; $Rating["Alt"] = "This resource has a 4 star rating"; break; case 9: $Rating["Graphic"] = $BaseRatingGraphic."4_5.gif"; $Rating["Alt"] = "This resource has a 4.5 star rating"; break; case 10: $Rating["Graphic"] = $BaseRatingGraphic."5_0.gif"; $Rating["Alt"] = "This resource has a 5 star rating"; break; } } } $UrlLooksValid = preg_match('/^\s*[a-zA-Z]+:\/\//', $Url); ?>

"ResourceLaunchesNewWindowEnabled()) { print " target=\"_blank\""; } ?>> " border="0" width="21" height="22" alt="" /> |  | ResourceLaunchesNewWindowEnabled()) { print " target=\"_blank\""; } ?>> |  | " title="" alt="" /> Full Record Edit
"; } ?> "> Id(), $UserRating); } ?> ResourceLaunchesNewWindowEnabled()) { print " target=\"_blank\""; } ?>>