Skip to content

Adds link to exhibits containing each item in the item browse detail #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,22 @@ function exhibit_builder_search_record_types($recordTypes)
return $recordTypes;
}

/**
* Show the Exhibits that each item is included in on the Item Browse page
*
* @param array $args An array of parameters passed by the hook
* @return void
*/
function exhibit_builder_item_detail($args)
{
$item = $args['item'];
$exhibits = get_db()->getTable('Exhibit')->findByItem($item->id);
foreach($exhibits as $exhibit)
echo('<p class="in-exhibit">Appears in Exhibit: <a href="'
.admin_url('exhibits/edit/'.$exhibit['id'])
.'">'.$exhibit['title'].'</a></p>');
}

/**
* Add exhibit title to item search filters.
*/
Expand Down
24 changes: 24 additions & 0 deletions models/Table/Exhibit.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,30 @@ public function findBySlug($slug)
return $this->fetchObject($select, array($slug));
}

/**
* Find all exhibits containing an item.
*
* @param string $slug
*/
public function findByItem($item_id)
{
if(is_object($item_id))
$item_id = $item_id->id;
$db=$this->getDb();
$select = $this->getSelect()
->join(array('ep' => $db->ExhibitPage),
'`exhibits`.id = ep.exhibit_id',
array())
->join(array('epb' => $db->ExhibitPageBlock),
'ep.id = epb.page_id',
array())
->join(array('eba' => $db->ExhibitBlockAttachment),
'epb.id = eba.block_id',
array())
->where('eba.item_id = ?');
return $this->fetchObjects($select,array($item_id));
}

/**
* Find whether an exhibit has a specific item.
*
Expand Down
2 changes: 1 addition & 1 deletion plugin.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ link="http://omeka.org/codex/Plugins/ExhibitBuilder_3.0"
support_link="http://omeka.org/forums/forum/plugins"
omeka_minimum_version="2.3"
omeka_target_version="2.3"
version="3.2.1"
version="3.2.2"
tags="exhibit, pages, presentation"
1 change: 1 addition & 0 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
add_plugin_hook('admin_items_search', 'exhibit_builder_items_search');
add_plugin_hook('public_items_search', 'exhibit_builder_items_search');
add_plugin_hook('html_purifier_form_submission', 'exhibit_builder_purify_html');
add_plugin_hook('admin_items_browse_detailed_each', 'exhibit_builder_item_detail');

add_filter('public_navigation_main', 'exhibit_builder_public_main_nav');
add_filter('admin_navigation_main', 'exhibit_builder_admin_nav');
Expand Down