Navigation Menu

Skip to content

Commit

Permalink
Merge branch '6.x' of git://github.com/Islandora/islandora into 6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-vessey committed Jun 26, 2012
2 parents efbd0da + d30efed commit 1f30a3d
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 319 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
nbproject
82 changes: 41 additions & 41 deletions CollectionClass.inc
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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)
),
);
);
}
}

Expand Down

0 comments on commit 1f30a3d

Please sign in to comment.