Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated getCollectionQuery to call out an alter for other modules to …

…update the query (specifically for the xacml module, but others could alter as well)
  • Loading branch information...
commit 21a6fd1aee9b41058084b27998576d894f6b96fd 1 parent 7c9aefc
@jmacwilliams jmacwilliams authored
Showing with 41 additions and 41 deletions.
  1. +41 −41 CollectionClass.inc
View
82 CollectionClass.inc
@@ -2,10 +2,10 @@
/**
* @file
- *
+ *
* Collection Class Class
*/
-
+
/**
* This CLASS caches the streams so once you call a getstream once it will always return
* the same stream as long as you are using the instance of this class. Cached to
@@ -34,12 +34,12 @@ class CollectionClass {
}
public static function getCollectionQuery($pid) {
- if ($query = self::getCollectionQueryFromStream($pid)) {
- return $query;
- }
- else {
- return self::getDefaultCollectionQuery($pid);
+ $query = self::getCollectionQueryFromStream($pid);
+ if (!$query) {
+ $query = self::getDefaultCollectionQuery($pid);
}
+ drupal_alter("islandora_collection_query", $query, $pid);
+ return $query;
}
protected static function getCollectionQueryFromStream($pid) {
@@ -684,17 +684,17 @@ class CollectionClass {
* An array to be passed to drupal_render, containing a pager, an unordered
* list of items, and another pager.
*/
- public static function assembleCollectionView($sparql_results) {
- $per_page = 20; //XXX: Make this configurable.
- $pager_name = 0;
- $total = count($sparql_results);
+ public static function assembleCollectionView($sparql_results) {
+ $per_page = 20; //XXX: Make this configurable.
+ $pager_name = 0;
+ $total = count($sparql_results);
$pager_page = self::hackPager($pager_name, $per_page, $total);
- $max_title_length = 60;
-
- $results = array();
- foreach (array_slice($sparql_results, $per_page * $pager_page, $per_page) as $result) {
+ $max_title_length = 60;
+
+ $results = array();
+ foreach (array_slice($sparql_results, $per_page * $pager_page, $per_page) as $result) {
$title = $result['title'];
- $truncated_title = truncate_utf8($title, $max_title_length, TRUE, TRUE, 5);
+ $truncated_title = truncate_utf8($title, $max_title_length, TRUE, TRUE, 5);
$obj_path = "fedora/repository/{$result['object']}";
//Get a thumbnail
@@ -703,28 +703,28 @@ class CollectionClass {
"$obj_path/TN");
$thumbnail = _fedora_repository_render_image($tn_path);
-
- $results[] = array(
- 'data' => l($thumbnail, $obj_path, array(
- 'html' => TRUE,
- 'attributes' => array(
- 'class' => 'results-image',
- ),
- )) . l($truncated_title, $obj_path, array('attributes' => array('class' => 'results-text'))),
- );
- }
- if (!$results) {
- drupal_set_message(t("No objects in this collection (or bad query)."));
- }
- else {
- $first = $per_page * $pager_page;
- $last = (($total - $first) > $per_page)?
- ($first + $per_page):
- $total;
- $results_range_text = t('Results @first to @last of @total', array(
- '@first' => $first + 1,
- '@last' => $last,
- '@total' => $total,
+
+ $results[] = array(
+ 'data' => l($thumbnail, $obj_path, array(
+ 'html' => TRUE,
+ 'attributes' => array(
+ 'class' => 'results-image',
+ ),
+ )) . l($truncated_title, $obj_path, array('attributes' => array('class' => 'results-text'))),
+ );
+ }
+ if (!$results) {
+ drupal_set_message(t("No objects in this collection (or bad query)."));
+ }
+ else {
+ $first = $per_page * $pager_page;
+ $last = (($total - $first) > $per_page)?
+ ($first + $per_page):
+ $total;
+ $results_range_text = t('Results @first to @last of @total', array(
+ '@first' => $first + 1,
+ '@last' => $last,
+ '@total' => $total,
));
return array(
@@ -734,15 +734,15 @@ class CollectionClass {
),
array(
'#type' => 'markup',
- '#value' => theme('item_list', $results, $result_range_text, 'ul', array(
- 'class' => 'islandora-collection-results-list',
+ '#value' => theme('item_list', $results, $result_range_text, 'ul', array(
+ 'class' => 'islandora-collection-results-list',
))
),
array(
'#type' => 'markup',
'#value' => theme('pager', array(), $per_page, $pager_name)
),
- );
+ );
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.