function showCompound() { $dsid = 'COMPOUND'; $path = drupal_get_path('module', 'Fedora_Repository'); require_once drupal_get_path('module', 'Fedora_Repository') . '/ObjectHelper.php'; require_once drupal_get_path('module', 'Fedora_Repository') . '/CollectionClass.php'; $collectionHelper = new CollectionClass(); $xmlstr = $collectionHelper->getStream($this->pid, "COMPOUND"); html_entity_decode($xmlstr); if ($xmlstr == null || strlen($xmlstr) < 5) { return " "; } try { $proc = new XsltProcessor(); } catch (Exception $e) { drupal_set_message(t($e->getMessage()), 'error'); return " "; } $xsl = new DomDocument(); $xsl->load($path . '/mnpl/xsl/compound.xsl'); $input = new DomDocument(); $input->loadXML(trim($xmlstr)); $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($input); $content = $newdom->saveXML(); // get parent pid and build link $pid = $this->pid; $itqlquery = 'select $object from <#ri> where <info:fedora/' . $pid . '><fedora-rels-ext:isPartOf> $object '; $relatedItems = $collectionHelper->getRelatedItems($this->pid, $itqlquery); $sxe = new SimpleXMLElement($relatedItems); $nmspace = $sxe->getNamespaces(true); $regspace = $sxe->registerXPathNamespace('ri', implode($nmspace)); // begin fractions $flabel = '<h4>Parent Specimen Record for This Compound</h4><p>'; $link = implode($sxe->xpath('//@uri')); $link = substr($link, 12); global $base_url; $plink .= '<a href =' . $base_url . '/fedora/repository/' . $link . '>Parent Specimen</a><br>'; if (user_access('edit fedora meta data')) { $editcomp = '<a href =' . $base_url . '/fedora/repository/editmetadata/' . $pid . '/' . $dsid . '>Edit This Compound</a><br>'; } else { $editcomp = ''; } // display other compounds for this parent $itqlQuery = 'select $object $title from <#ri> where $object <fedora-model:label> $title and $object <fedora-rels-ext:isPartOf> <info:fedora/' . $link . '> and $object <fedora-model:state> <info:fedora/fedora-system:def/model#Active> order by $title'; $relatedItems = $collectionHelper->getRelatedItems($this->pid, $itqlQuery); $sxe = new SimpleXMLElement($relatedItems); $nmspace = $sxe->getNamespaces(true); $regspace = $sxe->registerXPathNamespace('ri', implode($nmspace)); // begin display compounds global $base_url; $altcomp = '<h4> Other Compounds For Parent Sepcimen</h4><div>'; if (stristr(implode($sxe->xpath('//ri:title')), 'compound')) { foreach ($sxe->xpath('//@uri') as $link2) { if (strstr($link2, 'compound')) { $pidlink = substr($link2, 12); if ($pidlink != $pid) { $compound .= '<a href = "' . $base_url . '/fedora/repository/' . $pidlink . '">' . substr($link2, 30) . '</a><br>'; } } } } if ($compound == NULL) { $compound = "<div>No other Compounds present for this Specimen</div>"; } $collection_fieldset = array('#title' => t('MNPL Compound Record'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#value' => $content . $editcomp . $flabel . $plink . $altcomp . $compound); return theme('fieldset', $collection_fieldset); }
function showRomeo($collapsed = false) { $path = drupal_get_path('module', 'Fedora_Repository'); module_load_include('php', 'Fedora_Repository', 'CollectionClass'); $collectionHelper = new CollectionClass(); //$returnValue['title']="Description"; $xmlstr = $collectionHelper->getStream($this->pid, "ROMEO", 0); if ($xmlstr == null || strlen($xmlstr) < 5) { return " "; } try { $proc = new XsltProcessor(); } catch (Exception $e) { drupal_set_message(t($e->getMessage()), 'error'); return; } $xsl = new DomDocument(); $xsl->load($path . '/xsl/romeo.xsl'); $input = new DomDocument(); $input->loadXML(trim($xmlstr)); $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($input); $content = $newdom->saveXML(); $collection_fieldset = array('#title' => t('Romeo'), '#collapsible' => TRUE, '#collapsed' => $collapsed, '#value' => $content); return theme('fieldset', $collection_fieldset); }