From a0d16be879d728506ae7fffeafe041ed9983d51d Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Wed, 16 Feb 2011 14:08:03 -0400 Subject: [PATCH] Content Model can now list form names, updated islandoracm.xsd to reflex the new form structure. --- ContentModel.inc | 20 ++++++++++++++++++++ islandoracm.xsd | 14 ++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ContentModel.inc b/ContentModel.inc index 5ed33d59..8f0d1df5 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -2013,4 +2013,24 @@ class ContentModel extends XMLDatastream { } return $ret; } + + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getFormNames() { + if (!$this->validate()) { + return FALSE; + } + $xpath = new DOMXPath($this->xml); + $xpath->registerNamespace('cm', 'http://www.islandora.ca'); + $result = $xpath->query('//cm:forms/cm:form/@name'); // Select the name attribute of all forms. + for($i = 0; $i < $result->length; $i++) { + $attribute = $result->item($i); + $name = $attribute->value; + $names[$name] = $name; + } + return $names; + } } diff --git a/islandoracm.xsd b/islandoracm.xsd index 89d44f46..d199d8ee 100644 --- a/islandoracm.xsd +++ b/islandoracm.xsd @@ -344,20 +344,22 @@ - + - - - + - + + + + + +