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("
() 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 'There are no tree fields in the metadata schema. Tree fields can be created on the Metadata Field Editor page.
$SysConfig->NumClassesPerBrowsePage() ) { print("
( )
(browse hierarchy to add or edit classifications at other levels)
$SysConfig->NumClassesPerBrowsePage() ) { print("