Browse Source

added view switching to collection templates

pull/122/merge
Paul Pound 13 years ago
parent
commit
f5cd1015ec
  1. 1
      islandora_basic_collection/theme/islandora-basic-collection-wrapper.tpl.php
  2. 13
      islandora_basic_collection/theme/islandora_basic_collection.theme.inc

1
islandora_basic_collection/theme/islandora-basic-collection-wrapper.tpl.php

@ -25,6 +25,7 @@
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<?php print ($switch_view_link) ?>
<?php print($collection_pager); ?>
<?php print ($collection_content); ?>
<?php print($collection_pager); ?>

13
islandora_basic_collection/theme/islandora_basic_collection.theme.inc

@ -18,12 +18,25 @@ function islandora_basic_collection_preprocess_islandora_basic_collection_wrappe
pager_default_initialize($total_count, $page_size);
$variables['collection_pager'] = theme('pager', array('quantity' => 10));
$display = (empty($_GET['display'])) ? 'list' : $_GET['display'];
$link_text = (empty($_GET['display'])) ? 'grid' : $_GET['display'];
$query_params = drupal_get_query_parameters($_GET);
if ($display == 'grid') {
$query_params['display'] = 'list';
$link_text = 'list view';
$link_class = 'islandora-view-default';
$collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results));
}
else {
$query_params['display'] = 'grid';
$link_text = 'grid view';
$link_class = 'islandora-view-grid';
$collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results));
}
global $base_url;
$link = l($link_text, $base_url . '/islandora/object/' . $islandora_object->id, array('attributes' => array('class' => $link_class),
'query' => $query_params));
$variables['switch_view_link'] = $link;
$variables['collection_content'] = $collection_content;
}

Loading…
Cancel
Save