NumColumnsPerBrowsePage(); $MinEntriesPerColumn = 3; # determine the number of entries to put in each column $EntriesPerColumn = max( round(count($Classifications) / $NumberOfColumns), $MinEntriesPerColumn); reset($Classifications); for ($ColumnNo = 0; $ColumnNo < $NumberOfColumns; $ColumnNo++) { for ($EntryNo = 0; $EntryNo < $EntriesPerColumn; $EntryNo++) { # reached the end of results before reacing th end of a column if (($Classification = current($Classifications)) === FALSE) { break 2; } PrintClassification($Classification, $Field, $Parent, $StartLetter, $Search); next($Classifications); } print("
"); } reset($Classifications); } /** * Print a single classification entry. * @param Classification $Classification The classification to print. * @param MetadataField $Field currently in use. * @param string $StartLetter currently selected for pagination. * @param string $Search applied to these results. * @see PrintClassifications() */ function PrintClassification(Classification $Classification, $Field, $Parent, $StartLetter, $Search) { $SafeId = defaulthtmlentities($Classification->Id()); $SafeName = ($Search !== NULL) ? defaulthtmlentities($Classification->FullName()) : defaulthtmlentities($Classification->SegmentName()); $SafeResourceCount = defaulthtmlentities($Classification->FullResourceCount()); $TgtParams = ( ($Search !== NULL) ? ("&SQ=".urlencode($Search)) : "") .( ($StartLetter !== NULL) ? ("&SL=".urlencode($StartLetter)) : "") .( ($Field !== NULL) ? ("&FieldId=".$Field->Id()) : ""); $ParentParams = ( ($Parent !== NULL) ? ("&ParentId=".$Parent->Id()) : ""); ?>

() edit

Id()] = $Schema->Name() . " Schema"; } PrintOptionList("SC", $Options, $SchemaInUse->Id(), TRUE); } /** * Print an option list containing the tree fields for the schema in use. * @param MetadataSchema $SchemaInUse Metadata schema in use. * @param MetadataField $FieldInUse The metadata field to select. */ function PrintTreeFieldOptionList( MetadataSchema $SchemaInUse, MetadataField $FieldInUse=NULL) { PrintOptionList( "FieldId", $SchemaInUse->GetFieldNames(MetadataSchema::MDFTYPE_TREE), is_null($FieldInUse) ? NULL : $FieldInUse->Id(), TRUE, 1, NULL, FALSE); } /** * Print the classification breadbrumb links for the given parent classification. * @param Classification $Parent The parent classification to print the links for. * @param string $SearchQuery. * @param MetadataField $Field imvolved in the breadcrumbs. */ function PrintClassificationBreadcrumb($Parent, $SearchQuery, $Field) { # don't print anything if there isn't a parent selected if (is_null($Parent)) { return; } # get the hiearchy up to the parent classification $Hierarchy = GetClassificationHierarchy($Parent); $HierarchyStrings = array(); # transform the hiearchy into an array of classification names foreach ($Hierarchy as $Classification) { $SafeId = defaulthtmlentities($Classification->Id()); $Link = "index.php?P=EditClassifications&ParentId=".$SafeId .($SearchQuery!==NULL ? "&SQ=".urlencode($SearchQuery) : ''); $HierarchyStrings[] = '' .$Classification->SegmentName().""; } # separate each link by "--" and print them $Link = "index.php?P=EditClassifications" .($SearchQuery!==NULL ? "&SQ=".urlencode($SearchQuery) : ''); print '(x) ' ."".defaulthtmlentities($Field->Name()).": " .implode(" -- ", $HierarchyStrings); } /** * Print the URL to the page to add a classification for the given field * underneath the given parent classification. * @param MetadataField $Field The metadata field to use. * @param Classification $Parent The optional parent to use. */ function PrintAddClassificationLink( MetadataField $Field, Classification $Parent=NULL) { # -1 needs to be used to signify that the classification should be added at # the top level print "index.php?".http_build_query(array( "P" => "AddClassification", "FieldId" => $Field->Id(), "ParentId" => is_null($Parent) ? -1 : $Parent->Id())); } /** * Print pagination for the classification list split by starting letter. * @param string $SearchQuery applied to these results. * @param Classification $Parent currently selected. * @param MetadataField $Field currently in use. * @param string $StartLetter currently selected for pagination. */ function PrintPagination($SearchQuery, $Parent, $Field, $StartLetter) { global $H_ClassificationCount; global $H_ClassificationsAll; # construct parameters for jump page $Params = ( ($Parent !== NULL) ? ("&ParentId=".$Parent->Id()) : "" ) .( ($Field !== NULL) ? ( "&FieldId=".$Field->Id()) : "" ) .( ($SearchQuery !== NULL) ? ("&SQ=".urlencode($SearchQuery)) : "" ); print("Classifications starting with: "); foreach (range('A','Z') as $Letter) { if ($StartLetter == strtolower($Letter)) { print("".$Letter." "); } else if(array_key_exists(strtolower($Letter),$H_ClassificationsAll)) { print("".$Letter." "); } else { print ("".$Letter.""); } } if ($StartLetter == "XX") { print ("(Other)"); } else if(array_key_exists('XX',$H_ClassificationsAll)) { print("(Other)"); } else { print ("(Other)"); } } # ----- MAIN ----------------------------------------------------------------- global $H_Errors; if (count($H_Errors)) { print '

# Add/Edit Classifications

'; print 'Errors encountered'; print '

'; foreach ($H_Errors as $Error) { print '
- '.$Error.'
'; } print '

'; return; } $SafeSchemaId = defaulthtmlentities($H_Schema->Id()); $SafeSchemaName = defaulthtmlentities($H_Schema->Name()); ?>

# Add/Edit Classifications

Id()) : "") .($H_Field !== NULL ? ("&FieldId=".$H_Field->Id()) : "" ) ."\">X)" ." ".$H_SearchQuery.""; } ?>
Search:
"/>

There are no tree fields in the metadata schema. Tree fields can be created on the Metadata Field Editor page.

$GLOBALS["G_SysConfig"]->NumClassesPerBrowsePage() ) { print("

"); PrintPagination($H_SearchQuery, $H_Parent, $H_Field, $H_StartLetter); print("

( )

Add Classification Here

(browse hierarchy to add or edit classifications at other levels)

There are currently no classifications in this field at this level.

$SysConfig->NumClassesPerBrowsePage() ) { print("

"); print("
"); PrintPagination($H_SearchQuery, $H_Parent, $H_Field, $H_StartLetter); print("
"); } ?>