コード例 #1
0
<?php

/**
 * @file
 * Template file to style output.
 */
$parent_obj = islandora_get_parents_from_rels_ext($object);
$collection_pids = array();
if (isset($viewer)) {
    ?>
  <div id="book-viewer">
    <?php 
    print $viewer;
    ?>
  </div>
<?php 
}
?>
<!-- @todo Add table of metadata values -->
<script type="text/javascript">
<!--
  var _gaq = _gaq || [];
  _gaq.push(['_setCustomVar', 1, 'PID', '<?php 
print $object->id;
?>
', 3]);
  _gaq.push(['_setCustomVar', 3, 'Title', '<?php 
print $object->label;
?>
', 3]);
  ga('set', 'dimension1', '<?php 
コード例 #2
0
/**
 * Implements hook_preprocess_islandora_large_image()
 *
 * Adds the $variables['dental_info'] to display the 
 * specialized dental tags on the View tab
 */
function UofM_2_preprocess_islandora_large_image(&$variables)
{
    module_load_include('inc', 'islandora', 'includes/utilities');
    // To get the islandora function
    $object = $variables['islandora_object'];
    $mods_text = $object->repository->api->a->getDatastreamDissemination($object->id, 'MODS');
    if ($mods_text) {
        $xslt_processor = new XSLTProcessor();
        $xsl = new DOMDocument();
        $file = drupal_get_path('theme', 'UofM_2') . '/xsl/UofM_2_mods_dental.xsl';
        $xsl->load($file);
        $input = new DOMDocument();
        $did_load = $input->loadXML($mods_text);
        if ($did_load) {
            global $base_url;
            $xslt_processor->importStylesheet($xsl);
            $param_array = array('islandoraUrl' => $base_url, 'PID' => $object->id);
            $xslt_processor->setParameter('', $param_array);
            $mods_transformed = $xslt_processor->transformToXml($input);
            if (strlen($mods_transformed) > 0) {
                drupal_add_js(drupal_get_path('theme', 'UofM_2') . '/js/dental.js', 'file');
                $variables['dental_info'] = $mods_transformed;
            }
        }
    }
    $object_id = $object->id;
    if (!$variables['parent_collections'] || is_array($variables['parent_collections']) && count($variables['parent_collections']) == 0) {
        $parent_collections = islandora_get_parents_from_rels_ext($object);
        if (is_array($parent_collections) && count($parent_collections) == 0) {
            $part = $object->relationships->get(FEDORA_RELS_EXT_URI, variable_get('islandora_compound_object_relationship', 'isConstituentOf'));
            if (is_array($part) && count($part) > 0) {
                $new_id = $part[0]['object']['value'];
                $new_object = islandora_object_load($new_id);
                if ($new_object instanceof AbstractObject) {
                    $variables['parent_collections'] = islandora_get_parents_from_rels_ext($new_object);
                }
            }
        }
    }
}