From e0be6600e49ebeee6f878e36e67d0e616ce38769 Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Wed, 19 Jan 2011 16:01:38 -0400 Subject: [PATCH] Moved collection rendering into the content model. --- CollectionClass.inc | 4 ++-- ContentModel.inc | 4 ++-- ObjectHelper.inc | 6 +++--- fedora_repository.module | 9 +++++++-- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/CollectionClass.inc b/CollectionClass.inc index 142fd765..b86d9b20 100644 --- a/CollectionClass.inc +++ b/CollectionClass.inc @@ -397,7 +397,7 @@ class CollectionClass { return TRUE; } - function showFieldSets() { + function showFieldSets($page_number) { global $base_url; @@ -413,7 +413,7 @@ class CollectionClass { - $html = $objectHelper->renderCollection($results, $this->pid ); + $html = $objectHelper->renderCollection($results, $this->pid, NULL, NULL, $page_number ); diff --git a/ContentModel.inc b/ContentModel.inc index 5ed33d59..a28c7ff9 100644 --- a/ContentModel.inc +++ b/ContentModel.inc @@ -1437,7 +1437,7 @@ class ContentModel extends XMLDatastream { * @param string $pid * @return string $output */ - public function displayExtraFieldset($pid) { + public function displayExtraFieldset($pid, $page_number) { $output = ''; if ($this->validate()) { $datastreams = $this->xml->getElementsByTagName('datastreams'); @@ -1467,7 +1467,7 @@ class ContentModel extends XMLDatastream { self::$errors[] = 'Execute Form Handler: method \''. $className .'->'. $methodName .'\' does not exist.'; } else { - $output .= $class->$methodName(); + $output .= $class->$methodName($page_number); } } } diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 6b6c9dec..73a25deb 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -844,7 +844,7 @@ class ObjectHelper { $objectListOut = theme('fieldset', $object_list_fieldset); - $output .= $objectListOut . '
'; + $output = $objectListOut . '
'; return $output; } @@ -854,7 +854,7 @@ class ObjectHelper { * gets a list of datastreams and related function that we should use to show datastreams in their own fieldsets * from the content model associated with the object */ - function createExtraFieldsets($pid, $contentModel) { + function createExtraFieldsets($pid, $contentModel, $page_number) { //$models = $collectionHelper->getContentModels($collectionPid, FALSE); // possible problem in below if the collection policy has multiple content models //with different pids but same dsid we could get wrong one, low probability and functionality @@ -865,7 +865,7 @@ class ObjectHelper { $output = ''; module_load_include('inc', 'fedora_repository', 'ContentModel'); if (($cm = ContentModel :: loadFromModel($contentModel)) !== FALSE && $cm->validate()) { - $output .= $cm->displayExtraFieldset($pid); + $output .= $cm->displayExtraFieldset($pid, $page_number); } return $output; } diff --git a/fedora_repository.module b/fedora_repository.module index c67ca207..ac612ac9 100644 --- a/fedora_repository.module +++ b/fedora_repository.module @@ -808,9 +808,14 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU $offset = $limit * $pageNumber; - $results = $collectionClass->getRelatedObjects($pid, $limit, $offset, NULL); //updated so we can do paging in query not in xslt + //$results = $collectionClass->getRelatedObjects($pid, $limit, $offset, NULL); //updated so we can do paging in query not in xslt //$results = $collectionClass->getRelatedItems($pid, NULL); - $content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber); + $content_models = $objectHelper->get_content_models_list($pid); + foreach ($content_models as $content_model) { + $content .= $objectHelper->createExtraFieldsets($pid, $content_model, $pageNumber); + } + //$content .= $objectHelper + //$content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber); //the below is for islandlives we should be able to do this in the xslt though //$css=$path.'/stylesheets/container-large.css'; //drupal_add_css($css);