5 # Part of the Collection Workflow Integration System (CWIS) 6 # Copyright 2016 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu/cwis/ 15 # ---- PUBLIC INTERFACE -------------------------------------------------- 18 # ---- PROTECTED INTERFACE ----------------------------------------------- 31 if (!is_object($Schema))
36 # assemble XML file name 37 $PossibleSuffixes = array(
40 foreach ($PossibleSuffixes as $Suffix)
42 $FileName =
"plugins/".get_class($this)
43 .
"/install/MetadataSchema--" 44 .str_replace(
" ",
"", $Suffix).
".xml";
45 if (is_file($FileName))
53 throw new Exception(
"No XML file found to load metadata fields from" 54 .
" for ".$Schema->Name().
" schema.");
57 # load fields from file 58 $Result = $Schema->AddFieldsFromXmlFile($XmlFile);
61 if ($Result === FALSE)
63 # return error message(s) to caller 64 return "Error loading User metadata fields from XML: ".implode(
65 " ", $Schema->ErrorMessages(
"AddFieldsFromXmlFile"));
68 # report success to caller 82 # for each field in schema 83 foreach ($Schema->GetFields() as $FieldId => $Field)
85 # drop field if we own it 86 if ($Field->Owner() == get_class($this))
88 $Schema->DropField($FieldId);
92 # report success to caller 97 # ---- PRIVATE INTERFACE -------------------------------------------------
AddMetadataFieldsFromXml($Schema)
Load fields into metadata schema from XML file.
static Pluralize($Word)
Pluralize an English word.
Base class for all plugins.
DeleteMetadataFields($SchemaId)
Delete any metadata fields owned by plugin from specified schema.
This class extends the base Plugin class with CWIS-specific functionality.
static Singularize($Word)
Singularize an English word.