forked from Islandora/islandora_solution_pack_book
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alan Stanley
committed
Jul 18, 2011
1 parent
efdd693
commit 84bdf6b
Showing
27 changed files
with
6,660 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<?php | ||
// $Id$ | ||
|
||
/* | ||
* @file image_rotator_tagger_block.inc | ||
*/ | ||
|
||
|
||
function get_random_image() { | ||
module_load_include('inc', 'fedora_repository', 'CollectionClass'); | ||
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); | ||
$itqlquery = 'select $object $title from <#ri> | ||
where $object <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/ilives:figures> | ||
and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active> | ||
and $object <dc:title> $title'; | ||
$collection = new CollectionClass('ilives:figures'); | ||
$results = $collection->getRelatedItems('ilives:figures', $itqlquery); | ||
//drupal_set_message($results); | ||
|
||
|
||
if (empty($results)) { | ||
return NULL; | ||
} | ||
$resultsdoc = new DomDocument(); | ||
$resultsdoc->loadXML($results); | ||
|
||
$resultslist = $resultsdoc->getElementsByTagName('result'); | ||
if ( $resultslist->length == 0 ) { | ||
return NULL; | ||
} | ||
//return htmlentities(substr($results, 0, 1000)); | ||
$randresult = $resultslist->item( rand()%$resultslist->length ); | ||
if (empty($randresult)) { | ||
return NULL; | ||
} | ||
$objs = $randresult->getElementsByTagName('object'); | ||
$obj = $objs->item(0); | ||
$pid = substr( $obj->getAttribute('uri'), 12); | ||
$titles = $randresult->getElementsByTagName('title'); | ||
$title = $titles->item(0); | ||
|
||
return array('pid' => $pid, | ||
//'title' => $randresult->textContent); | ||
'title' => $title->nodeValue); | ||
|
||
} | ||
|
||
|
||
function _fedora_image_rotator_tagger_block_content() { | ||
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); | ||
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); | ||
|
||
global $base_url; | ||
if (!empty($_POST['pid'])) { | ||
$image_item = new Fedora_Item($_POST['pid']); | ||
$result['pid'] = $_POST['pid']; | ||
$result['title'] = $image_item->objectProfile->objLabel; | ||
} | ||
elseif (empty($_POST) && !empty($_SESSION['fedora_tagged_image']['pid'])) { | ||
$image_item = new Fedora_Item($_SESSION['fedora_tagged_image']['pid']); | ||
$result['pid'] = $_SESSION['fedora_tagged_image']['pid']; | ||
$result['title'] = $image_item->objectProfile->objLabel; | ||
unset($_SESSION['fedora_tagged_image']); | ||
} | ||
else { | ||
$result = get_random_image(); | ||
|
||
$image_item = new Fedora_Item($result['pid']); | ||
} | ||
if (!empty ($result)) { | ||
return '<p>' | ||
. l( '<img src="'. $base_url . '/fedora/imageapi/'. $result['pid'] . '/JPG?op=scale&height=500&width=300" />', 'fedora/repository/'. $result['pid'], array('html' => TRUE, 'alias' => TRUE)) | ||
.'<p>This image is from '. l($result['title'], 'fedora/ilives_book_viewer/'. substr($image_item->pid, 0, strrpos($image_item->pid, '-')), array('html' => TRUE, 'alias' => TRUE)) . '.' | ||
. drupal_get_form('fedora_repository_image_tagging_form', $result['pid']) . '</p>'; | ||
} | ||
else { | ||
return ''; | ||
} | ||
} | ||
|
||
|
||
/* | ||
function fedora_ilives_preprocess_page(&$variables) { | ||
drupal_add_js(drupal_get_path('module', 'fedora_ilives').'/fedora_ilives_ajax.js', 'theme'); | ||
return TRUE; | ||
}*/ | ||
|
||
class ShowILivesStreamsInFieldSets { | ||
|
||
private $pid =NULL; | ||
|
||
function ShowILivesStreamsInFieldSets($pid) { | ||
//drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | ||
$this->pid=$pid; | ||
} | ||
|
||
function showJPG() { | ||
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form'); | ||
global $base_url; | ||
$collection_fieldset = array( | ||
'#collapsible' => FALSE, | ||
'#value' => '<a href="' . $base_url . '/fedora/repository/' . $this->pid . '/JPG/"><img src="' . $base_url . '/fedora/repository/' . $this->pid . '/JPG/JPG.jpg' . '" /></a>', | ||
); | ||
return theme('fieldset', $collection_fieldset) | ||
. drupal_get_form('fedora_repository_image_tagging_form', $this->pid); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
; $Id$ | ||
name = Islandora Book | ||
description = Provides book interface | ||
package = Fedora Repository | ||
dependencies[] = fedora_repository | ||
version = 6.1dev | ||
core = 6.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
// $Id$ | ||
|
||
/* | ||
* @file islandora_book.install | ||
*/ | ||
|
||
/** | ||
* Implementation of hook_enable() | ||
*/ | ||
function islandora_book_enable() { | ||
|
||
} |
Oops, something went wrong.