From 0ca2c50681e8c7b3a5a1878a3189d252ca2ddd69 Mon Sep 17 00:00:00 2001 From: Nigel Banks Date: Mon, 28 Mar 2011 13:31:18 -0300 Subject: [PATCH] Added functions to select form names based on wether they are ingest or edit forms. --- ContentModel.inc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/ContentModel.inc b/ContentModel.inc index 4650d1ad..dd8913e2 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -2047,6 +2047,42 @@ class ContentModel extends XMLDatastream { return $names; } + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getIngestFormNames() { + if (!$this->validate()) { + return FALSE; + } + $result = $this->xpath->query('//cm:forms/cm:form[@ingest_class and @ingest_file and @ingest_module]/@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; + } + + /** + * + * @return array + * An array of form names that exist in this content model. + */ + public function getEditFormNames() { + if (!$this->validate()) { + return FALSE; + } + $result = $this->xpath->query('//cm:forms/cm:form[@edit_class and @edit_file and @edit_module]/@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; + } + /** * Removes the named form. *