Browse Source

added a wrapper template for collection objects

pull/120/merge
Paul Pound 13 years ago
parent
commit
dbadd0ce5a
  1. 1
      islandora.module
  2. 4
      islandora_basic_collection/islandora-basic-collection-grid.tpl.php
  3. 32
      islandora_basic_collection/islandora-basic-collection-wrapper.tpl.php
  4. 2
      islandora_basic_collection/islandora-basic-collection.tpl.php
  5. 37
      islandora_basic_collection/islandora_basic_collection.module

1
islandora.module

@ -516,6 +516,7 @@ function islandora_view_object($object_id = NULL) {
drupal_set_message(t('there was an error loading the view for islandora object %s', array('%s' => $object_id)), 'error');
return "";
}
arsort($arr);
drupal_alter('islandora_display',$arr);
$output = "";
foreach ($arr as $key => $value) {

4
islandora_basic_collection/islandora-basic-collection-grid.tpl.php

@ -21,17 +21,15 @@
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php drupal_set_title('grid_view'); ?>
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<?php print($variables['pager']); ?>
<?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object <?php print $value['class']; ?>">
<dt class="islandora-basic-collection-thumb"><?php print $value['thumb_link']; ?></dt>
<dd class="islandora-basic-collection-caption"><?php print $value['title_link']; ?></dd>
</dl>
<?php endforeach; ?>
<?php print($variables['pager']); ?>
</div>
</div>

32
islandora_basic_collection/islandora-basic-collection-wrapper.tpl.php

@ -0,0 +1,32 @@
<?php
/*
* islandora-basic-collection-wrapper.tpl.php
*
*
*
* This file is part of Islandora.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program. If not, see <http ://www.gnu.org/licenses/>.
*/
?>
<?php drupal_set_title($islandora_object->label); ?>
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<?php print($collection_pager); ?>
<?php print ($collection_content); ?>
<?php print($collection_pager); ?>
</div>
</div>

2
islandora_basic_collection/islandora-basic-collection.tpl.php

@ -25,13 +25,11 @@
<div class="islandora-basic-collection-wrapper">
<div class="islandora-basic-collection clearfix">
<?php print($variables['pager']); ?>
<?php foreach($associated_objects_array as $key => $value): ?>
<dl class="islandora-basic-collection-object <?php print $value['class']; ?>">
<dt class="islandora-basic-collection-thumb"><?php print $value['thumb_link']; ?></dt>
<dd class="islandora-basic-collection-caption"><?php print $value['title_link']; ?></dd>
</dl>
<?php endforeach; ?>
<?php print($variables['pager']); ?>
</div>
</div>

37
islandora_basic_collection/islandora_basic_collection.module

@ -199,6 +199,10 @@ function islandora_basic_collection_theme($existing, $type, $theme, $path) {
'islandora_basic_collection_grid' => array(
'template' => 'islandora-basic-collection-grid',
'pattern' => 'islandora_basic_collection_grid__',
'variables' => array('islandora_object' => NULL, 'collection_results' => NULL),
),
'islandora_basic_collection_wrapper' => array(
'template' => 'islandora-basic-collection-wrapper',
'variables' => array('islandora_object' => NULL),
),
'islandora_basic_collection_management_form_table' => array(
@ -241,13 +245,7 @@ function islandora_basic_collection_islandora_view_object($object, $user) {
$models = $object->models;
foreach ($object->models as $model) {
if (isset($cmodel_list[$model][ISLANDORA_VIEW_HOOK]) && $cmodel_list[$model][ISLANDORA_VIEW_HOOK] == TRUE) {
$display = (empty($_GET['display'])) ? 'list' : $_GET['display'];
if ($display == 'grid') {
$output = theme('islandora_basic_collection_grid', array('islandora_object' => $object));
}
else {
$output = theme('islandora_basic_collection', array('islandora_object' => $object));
}
$output = theme('islandora_basic_collection_wrapper', array('islandora_object' => $object,));
return array('Collection View' => $output);
}
}
@ -263,6 +261,24 @@ function islandora_basic_collection_preprocess_islandora_basic_collection_grid(&
islandora_basic_collection_preprocess_islandora_basic_collection($variables);
}
function islandora_basic_collection_preprocess_islandora_basic_collection_wrapper(&$variables) {
$page_number = (empty($_GET['page'])) ? 0 : $_GET['page'];
$page_size = (empty($_GET['pagesize'])) ? variable_get('islandora_basic_collection_page_size', '10') : $_GET['pagesize'];
$islandora_object = $variables['islandora_object'];
$results = islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size);
$total_count = count($results);
pager_default_initialize($total_count, $page_size);
$variables['collection_pager'] = theme('pager', array('quantity' => $total_count));
$display = (empty($_GET['display'])) ? 'list' : $_GET['display'];
if ($display == 'grid') {
$collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results));
}
else {
$collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results));
}
$variables['collection_content'] = $collection_content;
}
/**
*
* @global type $base_url
@ -284,12 +300,8 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
}
$page_number = (empty($_GET['page'])) ? 0 : $_GET['page'];
$page_size = (empty($_GET['pagesize'])) ? variable_get('islandora_basic_collection_page_size', '10') : $_GET['pagesize'];
$results = islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size);
$results = $variables['collection_results'];//islandora_basic_collection_get_objects($islandora_object, $page_number, $page_size);
$total_count = count($results);
pager_default_initialize($total_count, $page_size);
$pager = theme('pager', array('quantity' => $total_count));
$variables['pager'] = $pager;
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label;
$variables['theme_hook_suggestions'][] = 'islandora_basic_collection__' . str_replace(':', '_', $islandora_object->id);
@ -335,6 +347,7 @@ function islandora_basic_collection_preprocess_islandora_basic_collection(&$vari
$thumbnail_img = '<img src="' . $base_path . $object_url . '/datastream/TN/view"' . '/>';
}
else {
//TODO: change this default image url
$thumbnail_img = '<img src="http://codesprint-centos.islandora.ca/islandora/object/islandora%3A52/datastream/TN"' . '/>';
}
$associated_objects_array[$pid]['thumbnail'] = $thumbnail_img;

Loading…
Cancel
Save