GetFieldByName($FieldTypesOrFieldName));
}
else
{
$Fields = $Schema->GetFields($FieldTypesOrFieldName);
}
# set up a counter for the loop
$Counter = 0;
foreach ($Fields as $CurrentField)
{
# if limit field is marked to be used in Advanced Search
if ($CurrentField->Enabled() && $CurrentField->IncludeInAdvancedSearch()
&& ($G_User->HasPriv($CurrentField->ViewingPrivileges())
|| $G_User->HasPriv($CurrentField->EditingPrivileges()) ))
{
if (($CurrentField->Type() & (MetadataSchema::MDFTYPE_OPTION | MetadataSchema::MDFTYPE_FLAG | MetadataSchema::MDFTYPE_USER)) ||
$CurrentField->Name() == "Cumulative Rating")
{
# print entry and increment counter
if ($Counter) { print(", "); }
print("".strtolower($CurrentField->GetDisplayName())."");
$Counter++;
}
}
if (is_numeric($ListLength) && $Counter >= $ListLength)
{
print(", and more");
break;
}
}
}
# print a search limit form entry
function PrintSearchLimitFormEntry($LimitName, $LimitType)
{
if ($LimitType & (MetadataSchema::MDFTYPE_OPTION | MetadataSchema::MDFTYPE_FLAG | MetadataSchema::MDFTYPE_USER | MetadataSchema::MDFTYPE_TREE))
{
$ListLength = ($LimitType == MetadataSchema::MDFTYPE_FLAG) ? 1 : 6;
?>
0)
{
# pull out the fields that can show in advanced searches
$FieldList = ListFieldsHavingTextForms();
# iterate over the search groups
foreach ($G_SearchGroups as $GName => $GValue)
{
# get fields names for this search group
$GroupFields = array_keys($GValue["SearchStrings"]);
# searches call it a "XXXKeywordXXX", when it's a keyword
if (($Key = array_search("XXXKeywordXXX", $GroupFields)) !== FALSE)
$GroupFields[$Key] = "Keyword";
# add fields allowed in searches to our list
foreach (array_intersect($GroupFields, $FieldList) as $Val)
$DefaultValues []= $Val;
}
}
# add in defaults, if there weren't already any fields selected
foreach (array("Keyword", "Description", "Title", "Subject",
"Creator", "Publisher", "Url") as $Val)
{
if (!in_array($Val, $DefaultValues))
$DefaultValues []= $Val;
}
}
$DefaultValue = "";
# if the form field index maps to a default value
if (array_key_exists($FormFieldIndex, $DefaultValues))
{
$DefaultValue = $DefaultValues[$FormFieldIndex];
}
?>
IsLoggedIn() && $G_User->HasPriv(PRIV_RESOURCEADMIN))
? 4 : 2;
}
if (isset($G_SearchGroups))
{
return max(count(SavedSearch::TranslateSearchGroupsToSearchFieldNames(
$G_SearchGroups)), $Default);
}
// Check to see if we've got saved search selections to use
elseif ($G_User->IsLoggedIn())
{
$SSData = $G_User->Get("SearchSelections");
if (!is_null($SSData))
{
$SearchSelections = unserialize($SSData);
return max(count($SearchSelections), $Default);
}
}
return $Default;
}
function DisplayOptionEntry($Value, $Label)
{
?>