"PrefColorAvoidanceFlags", "Text Captioning" => "PrefCaptionType", "Audio Descriptions" => "PrefAudioDescriptionLevel", "Content Type" => "PrefContentView", ); $AccessMatchMsgs = array( "Colors Avoided" => array( array( "Resource" => "Red", "User" => UIPREF_AVOID_RED, "Text" => "Resource avoids red text", ), array( "Resource" => "Red/Green", "User" => UIPREF_AVOID_REDGREEN, "Text" => "Resource avoids red/green text", ), array( "Resource" => "Blue/Yellow", "User" => UIPREF_AVOID_BLUEYELLOW, "Text" => "Resource avoids blue/yellow text", ), array( "Resource" => "Green/Yellow", "User" => UIPREF_AVOID_GREENYELLOW, "Text" => "Resource avoids green/yellow text", ), array( "Resource" => "Orange", "User" => UIPREF_AVOID_ORANGE, "Text" => "Resource avoids orange text", ), array( "Resource" => "Red/Black", "User" => UIPREF_AVOID_REDBLACK, "Text" => "Resource avoids red/black text", ), array( "Resource" => "Purple/Grey", "User" => UIPREF_AVOID_PURPLEGREY, "Text" => "Resource avoids purple/grey text", ), ), "Text Captioning" => array( array( "Resource" => "Verbatim", "User" => UIPREF_CAPTIONTYPE_VERBATIM, "Text" => "Resource offers verbatim text captioning", ), array( "Resource" => "Reduced Reading Level", "User" => UIPREF_CAPTIONTYPE_REDUCEDREADINGLEVEL, "Text" => "Resource offers reduced reading level text captioning", ), ), "Audio Descriptions" => array( array( "Resource" => "Standard", "User" => UIPREF_AUDIODESCRIPTION_STANDARD, "Text" => "Resource offers audio descriptions", ), array( "Resource" => "Expanded", "User" => UIPREF_AUDIODESCRIPTION_EXPANDED, "Text" => "Resource offers expanded audio descriptions", ), ), "Content Type" => array( array( "Resource" => "Text Intensive", "User" => UIPREF_CONTENTVIEW_TEXTINTENSIVE, "Text" => "Resource has text intensive content", ), array( "Resource" => "Image Intensive", "User" => UIPREF_CONTENTVIEW_IMAGEINTENSIVE, "Text" => "Resource has image intensive content", ), ), ); # assume no access match will be found $AMText = ""; # if we have a user to match if ($User->IsLoggedIn()) { # for each access match type foreach ($UserPrefMethods as $ResourceFieldName => $UserMethodName) { # if user has expressed a preference for this match type $UserPref = $User->$UserMethodName(); if ($UserPref) { # if resource field exists and is enabled $Field = $Schema->GetFieldByName($ResourceFieldName); if (($Field != NULL) && $Field->Enabled()) { # for each possible match for field $ResourceVals = $Resource->Get($ResourceFieldName); foreach ($AccessMatchMsgs[$ResourceFieldName] as $MatchInfo) { # if user indicated this preference if ($UserPref & $MatchInfo["User"]) { # if resource matches this if (in_array($MatchInfo["Resource"], $ResourceVals)) { # add text for access match $AMText .= $MatchInfo["Text"].".\n"; } } } } } } } # return access match text (if any) to caller return $AMText; } function PrintResource($Resource, $FullRecordLink, $EditOkay, $EditLink, $CumulativeRating, $AppendedRows = NULL, $DisplayUrl = TRUE, $DisplayDescription = TRUE, $DisplayExportCheckbox = FALSE, $TermsToHighlight = NULL) { global $SysConfig; global $User; $ResourceId = $Resource->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 = "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; } } # 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); $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 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 = "SPTUI--CWIS/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; } } ?>
0) { ?> title="" alt="" style="margin-left: 10px; border: 1px solid #DDD; padding: 10px; background: #F0F0F0;">
"> ResourceRatingsEnabled() && UserIsLoggedIn()) PrintFastRating( $ResourceId, $UserRating ); ?> 0)) { ?>ResourceLaunchesNewWindowEnabled()) { print " target=\"_blank\" "; } ?>>
Subject:
Posted By: Date Posted:
<?PHP print $RatingGraphicAlt; ?>
" class="RatingDiv" id="RatingLabelDiv"> Your Rating: 
One Stars Two Stars Three Stars Four Stars Five Star