Browse Source

Undo making a couple functions static and fix merge error.

pull/99/head
Adam Vessey 13 years ago
parent
commit
8cebf38560
  1. 19
      CollectionClass.inc
  2. 3
      ObjectHelper.inc

19
CollectionClass.inc

@ -54,6 +54,7 @@ class CollectionClass {
return FALSE; return FALSE;
} }
} }
static function _get_default_collection_query($pid) { static function _get_default_collection_query($pid) {
return 'select $object $title $content from <#ri> return 'select $object $title $content from <#ri>
where ($object <fedora-model:label> $title where ($object <fedora-model:label> $title
@ -78,8 +79,8 @@ class CollectionClass {
* @param type $itqlquery * @param type $itqlquery
* @return type * @return type
*/ */
static function getRelatedObjects($pid, $limit, $offset, $itqlquery=NULL) { function getRelatedObjects($pid, $limit, $offset, $itqlquery=NULL) {
return self::getRelatedItems($pid, $itqlquery, $limit, $offset); return $this->getRelatedItems($pid, $itqlquery, $limit, $offset);
} }
/** /**
@ -92,7 +93,7 @@ class CollectionClass {
* @param $pid string * @param $pid string
* A string containing a PID which may be substituted into the query, * A string containing a PID which may be substituted into the query,
* in place of the %parent_collection% placeholder. * in place of the %parent_collection% placeholder.
* @param $itqlquery string * @param $query_string string
* An optional iTQL query. * An optional iTQL query.
* @param $limit int * @param $limit int
* An optional integer to limit the number of results returned. * An optional integer to limit the number of results returned.
@ -102,15 +103,13 @@ class CollectionClass {
* @return string * @return string
* Sparql XML results from the resource index. * Sparql XML results from the resource index.
*/ */
static function getRelatedItems($pid, $query_string = NULL, $limit = NULL, $offset = NULL) { function getRelatedItems($pid, $query_string = NULL, $limit = NULL, $offset = NULL) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid)) { if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid)) {
drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error'); drupal_set_message(t("You do not have access to Fedora objects within the attempted namespace or access to Fedora denied."), 'error');
return ' '; return ' ';
} }
$objectHelper = new ObjectHelper();
if ($query_string === NULL) { if ($query_string === NULL) {
$query_string = self::get_collection_query($pid); $query_string = self::get_collection_query($pid);
@ -593,10 +592,8 @@ class CollectionClass {
* @return string * @return string
*/ */
function getIngestInterface() { function getIngestInterface() {
global $base_url;
$objectHelper = new ObjectHelper();
module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy'); module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy');
$collectionPolicyExists = $objectHelper->getMimeType($this->pid, CollectionPolicy::getDefaultDSID()); $collectionPolicyExists = $this->collectionObject->getMimeType($this->pid, CollectionPolicy::getDefaultDSID());
if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) { if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) {
if (!empty($collectionPolicyExists)) { if (!empty($collectionPolicyExists)) {
$allow = TRUE; $allow = TRUE;
@ -656,9 +653,8 @@ class CollectionClass {
$path = drupal_get_path('module', 'fedora_repository'); $path = drupal_get_path('module', 'fedora_repository');
global $base_url; global $base_url;
$collection_pid = $pid; //we will be changing the pid later maybe $collection_pid = $pid; //we will be changing the pid later maybe
$objectHelper = new ObjectHelper();
$parsedContent = NULL; $parsedContent = NULL;
$contentModels = $objectHelper->get_content_models_list($pid); $contentModels = $this->collectionObject->get_content_models_list($pid);
$isCollection = FALSE; $isCollection = FALSE;
//if this is a collection object store the $pid in the session as it will come in handy //if this is a collection object store the $pid in the session as it will come in handy
//after a purge or ingest to return to the correct collection. //after a purge or ingest to return to the correct collection.
@ -674,7 +670,6 @@ class CollectionClass {
$objectList = ''; $objectList = '';
if (isset($content) && $content != FALSE) { if (isset($content) && $content != FALSE) {
if (!$xslContent) { //Didn't find an XSLT. if (!$xslContent) { //Didn't find an XSLT.
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$intermediate_results = ObjectHelper::parse_sparql_results($content); $intermediate_results = ObjectHelper::parse_sparql_results($content);
unset($content); unset($content);

3
ObjectHelper.inc

@ -778,6 +778,7 @@ class ObjectHelper {
function get_parent_objects($pid) { function get_parent_objects($pid) {
$query_string = self::_parent_query(); $query_string = self::_parent_query();
module_load_include('inc', 'fedora_repository', 'CollectionClass'); module_load_include('inc', 'fedora_repository', 'CollectionClass');
$collection_class = new CollectionClass($pid);
$objects = CollectionClass::getRelatedItems($pid, $query_string); $objects = CollectionClass::getRelatedItems($pid, $query_string);
return $objects; return $objects;
} }
@ -1043,7 +1044,7 @@ class ObjectHelper {
$attrs = $element->attributes(); $attrs = $element->attributes();
if (!empty($attrs['uri'])) { if (!empty($attrs['uri'])) {
$val = self::_pid_uri_to_bare_pid((string)$attrs['uri']); $val = self::pid_uri_to_bare_pid((string)$attrs['uri']);
} }
else { else {
$val = (string)$element; $val = (string)$element;

Loading…
Cancel
Save