Conditional Relabeling of Metadata Element Names

I'm working with Omeka 2.0.4. I want to relabel a couple of metadata element names for public display. One is part of DC core and the other is part of qualified DC. For example, I want to relabel creator as scrapbook compiler. I modified ../common/record-metadata.php in my themes directory as described elsewhere in the forum. It worked well and did exactly what I wanted. The problem is that I would like to make this relabeling conditional on the collection i.e. I only want to do renames for a specific collection. I have no idea how to get access to the collection name from inside record-metadata.php. I naively tried $collection but that's not defined. I appreciate your help.

You can dig up the collection an item is in with this in record-metadata.php:

<?php
$item = get_current_record('items');
$collection_id = $item->collection_id; ?>

Then you can branch around whether it's the right collection id and go from there.

Thanks for your response. This worked wonderfully for displaying metadata for an item but failed miserably when displaying metadata for a collection. If the following call is made while showing a collection, what is returned?

get_current_record('items')

Or how do I detect that a collection is being processed and branch around the call? Thanks.

Ah, I think I misunderstood what you were aiming for.

It'll very similar:

<?php
$collection = get_current_record('collections');

echo $collection->id; ?>

Update -- I just realized that the above will also cause an error on pages that are not about collections.

I think this'll address the error:

<?php 

if(has_loop_records('collections')) {
    $collection = get_current_record('collections');

    echo $collection->id;
}
?>

You want to do the same check for items:

if(has_loop_records('items')){
....
}

Thanks for all of the pointers.! I finally achieved what I want with the following code. It's seems overly complicated but at least it works.

<?php $item = get_current_record('items',false); ?>

<?php if ($item) { // we're processing an item
$collection_id = $item->collection_id; // get collection id
}
else
{ // processing a collection
$collection = get_current_record('collections');
$collection_id = $collection->id; // get collection id
}
if ($collection_id == 1) {
$edit_names = true; // edit element names for scrapbooks
}
else {
$edit_names = false; // if not a scrapbook, do no editing
}
?>