function showCritter() { $dsid = 'CRITTER'; $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'; $objectHelper = new ObjectHelper(); $collectionHelper = new CollectionClass(); $xmlstr = $collectionHelper->getStream($this->pid, "CRITTER"); 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/critter.xsl'); $input = new DomDocument(); $input->loadXML(trim($xmlstr)); $xsl = $proc->importStylesheet($xsl); $newdom = $proc->transformToDoc($input); $content = $newdom->saveXML(); $pid = $this->pid; session_start(); $_SESSION['pid'] = $pid; // set labid as session variable to build identifier in add fraction, etc $cxl = new SimpleXMLElement($xmlstr); $labid = implode($cxl->xpath('//critters:lab_id')); $_SESSION['labid'] = $labid; $itqlQuery = 'select $object $title from <#ri> where $object <fedora-model:label> $title and $object <fedora-rels-ext:isPartOf> <info:fedora/' . $pid . '> 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 fractions global $base_url; if (user_access('edit fedora meta data')) { $editspec = '<a href =' . $base_url . '/fedora/repository/editmetadata/' . $pid . '/' . $dsid . '>Edit This Specimen</a><br>'; } else { $editspec = ''; } if (user_access('ingest new fedora objects')) { $flabel = '<h4>Fractions — <a href="' . $base_url . '/fedora/ingestObject/vre:mnpl-fractions/MNPL%20Fraction%20Collection/mnpl-fractionCModel">Add Fraction</a></h4>'; } else { $flabel = '<h4>Fractions</h4>'; } if (stristr(implode($sxe->xpath('//ri:title')), 'fraction')) { $fraction .= '<table width="100%" cellpadding="2"><tr><td>Identifier</td><td>Weight</td><td>PTP1B</td><td>HCT116</td><td>HELA</td><td>PC3</td><td>ARE</td><td>Antiproliferative</td></tr>'; foreach ($sxe->xpath('//@uri') as $link) { if (strstr($link, 'fraction')) { $link = substr($link, 12); $fraction .= '<tr>'; $fraction .= '<td><a href = "' . $base_url . '/fedora/repository/' . $link . '">' . substr($link, 18) . '</a></td>'; $fraction .= $this->show_fraction_details($link); $fraction .= '</tr>'; } } $fraction .= '</table>'; } else { $fraction = "<div>No Fractions present for this Specimen</div>"; } // return compounds $clabel = '<br /><h4>Compounds'; if (user_access('ingest new fedora objects')) { $clabel .= ' — <a href="' . $base_url . '/fedora/ingestObject/vre:mnpl-compounds">Add Compound</a></h4>'; } if (stristr(implode($sxe->xpath('//ri:title')), 'compound')) { // if(in_array('COMPOUND',$sxe->xpath('//ri:contentmod'))){ $compound .= '<table width="100%" cellpadding="2"><tr><td>Identifier</td><td>Weight</td><td>PTP1B</td><td>HCT116</td><td>HELA</td><td>PC3</td><td>ARE</td><td>Antiproliferative</td></tr>'; foreach ($sxe->xpath('//@uri') as $link) { if (strstr($link, 'compound')) { $link = substr($link, 12); $compound .= '<tr>'; $compound .= '<td><a href = "' . $base_url . '/fedora/repository/' . $link . '">' . substr($link, 18) . '</a></td>'; $compound .= $this->show_compound_details($link); $compound .= '</tr>'; } } $compound .= '</table>'; } else { $compound = "<div>No Compounds present for this Specimen</div>"; } $datastream_list = $objectHelper->get_datastreams_list_asSimpleXML($this->pid); $thumbs = '<div><p>'; $thumbs .= '<a href="' . $base_url . '/fedora/repository/' . $pid . '/OBJ" target="_blank"><img src="' . $base_url . '/fedora/imageapi/' . $pid . '/OBJ?op=scale&height=100" /></a> '; foreach ($datastream_list as $datastream) { foreach ($datastream as $datastreamValue) { $test = substr($datastreamValue->ID, 0, 5); if ($test == 'IMAGE') { $thumbs .= '<a href="' . $base_url . '/fedora/repository/' . $pid . '/' . $datastreamValue->ID . '" target="_blank"><img src="' . $base_url . '/fedora/imageapi/' . $pid . '/' . $datastreamValue->ID . '?op=scale&height=100" /></a> '; } } } $thumbs .= '</p></div><br />'; $collection_fieldset = array('#title' => t('MNPL Critter Record'), '#collapsible' => TRUE, '#collapsed' => FALSE, '#value' => $thumbs . $content . $editspec . $flabel . $fraction . $clabel . $compound); return theme('fieldset', $collection_fieldset); }