load('XSLT/Specimen/en_ABCD1.2_Summary.xslt'))
{ $xsl->load('XSLT/Specimen/en_ABCD1.2_Summary.xslt');
$TestLoad = $xsl->load('XSLT/Specimen/en_ABCD1.2_Summary.xslt'); } }
if($ID_Schema == 2) {
if($xsl->load('XSLT/Specimen/en_ABCD2.0_Summary.xslt'))
{
if($UnitID_Specimen == 'B GT 0003226') {
$xsl->load('XSLT/Specimen/en_ABCD2.0_Summary_Amorpho.xslt');
$TestLoad = $xsl->load('XSLT/Specimen/en_ABCD2.0_Summary_Amorpho.xslt');
}
else {
$xsl->load('XSLT/Specimen/en_ABCD2.0_Summary.xslt');
$TestLoad = $xsl->load('XSLT/Specimen/en_ABCD2.0_Summary.xslt'); }} }
if($ID_Schema == 3 or $ID_Schema == 6) {
if($xsl->load('XSLT/Specimen/en_DarwinCore_UnitDetail.xslt'))
{ $xsl->load('XSLT/Specimen/en_DarwinCore_UnitDetail.xslt');
$TestLoad = $xsl->load('XSLT/Specimen/en_DarwinCore_UnitDetail.xslt'); } }
if($ID_Schema == 4) {
if($xsl->load('XSLT/Specimen/en_ABCD2.05_Summary.xslt'))
{ $xsl->load('XSLT/Specimen/en_ABCD2.05_Summary.xslt');
$TestLoad = $xsl->load('XSLT/Specimen/en_ABCD2.05_Summary.xslt'); } }
$inf = parse_url($Provider);
$host = $inf['host'];
$path = $inf['path'];
if (isset($inf['query'])) $path .= '?'.$inf['query'];
if (isset($inf['port'])) $port = $inf['port'];
else $port = 80;
if($Provider)
{
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
$fp = fsockopen($host, $port, $errno, $error, 5);
if(!$fp or !$TestLoad) { echo "
Provider not available. Show data from cache.
"; }
else {
if($TestLoad) {
$processor->setParameter('', 'resourceKey', $ResourceKey);
$processor->setParameter('', 'provider', $Provider);
$processor->importStyleSheet($xsl);
$xml = new DOMDocument;
$xml->load($file1);
$Test1 = $xml->getElementsByTagName('UnitID');
$Test1a = $Test1->item(0)->nodeValue;
if($Test1a!="") {$Test = $Test1;}
$Test2 = $xml->getElementsByTagName('CatalogNumber');
$Test2a = $Test2->item(0)->nodeValue;
if($Test2a!="") {$Test = $Test2;}
$Test3 = $xml->getElementsByTagName('CatalogNumberText');
$Test3a = $Test3->item(0)->nodeValue;
if($Test3a!="") {$Test = $Test3;}
$TestUnitID = addslashes(utf8_decode($Test1->item(0)->nodeValue));
$html = $processor->transformToXML($xml);
echo utf8_decode($html); }
}
if(!$Test or !$fp) {
$result1 = mysql_query
("SELECT tablecache.ID_Cache AS ID_Cache, " .
" tablecache.ID_Dataset_Specimen AS ID_Dataset_Specimen, " .
" tablecache.UnitID_Specimen AS UnitID_Specimen, " .
" tablecache.CollectionCode_Specimen AS CollectionCode_Specimen, " .
" tablecache.InstitutionCode_Specimen AS InstitutionCode_Specimen, " .
" tablecache.Continent AS Continent, " .
" tablecache.CountryName AS CountryName, " .
" tablecache.CountryISO2 AS CountryISO2, " .
" tablecache.Collector AS Collector, " .
" tablecache.CollectionDate AS CollectionDate, " .
" tablecache.CollectorsNo AS CollectorsNo, " .
" tablecache.LocalityText AS LocalityText, " .
" tablecache.Altitude AS Altitude, " .
" tablecache.LongitudeDecimal AS LongitudeDecimal, " .
" tablecache.LatitudeDecimal AS LatitudeDecimal, " .
" tablecache.UnitID_DNA AS UnitID_DNA, " .
" tablecache.CollectionCode_DNA AS CollectionCode_DNA, " .
" tablecache.InstitutionCode_DNA AS InstitutionCode_DNA " .
" FROM tablecache" .
" WHERE tablecache.ID_Cache = $ID");
$result2 = mysql_query
("SELECT tablecachetaxonidentified.ID_Cache, " .
" tablecachetaxonidentified.NameAuthorYear AS NameAuthorYear2, " .
" tablecachetaxonidentified.PreferredFlag AS PreferredFlag " .
" FROM tablecachetaxonidentified " .
" WHERE tablecachetaxonidentified.ID_Cache = $ID");
while($row = mysql_fetch_object($result2))
{
if(isset($PreferredFlag[$row->ID_Cache]))
{ $Flag = $PreferredFlag[$row->ID_Cache];
if($Flag == 'true' or $Flag == '1') {$Preferred = "(Preferred Taxon Name)";}
else {$Preferred = ""; }
}
else
{ $PreferredFlag[$row->ID_Cache] = ""; }
if(isset($NameAuthorYear2[$row->ID_Cache]))
{ $NameAuthorYear2[$row->ID_Cache] .= " " . $Preferred . ", Other Identifications: "; }
else
{ $NameAuthorYear2[$row->ID_Cache] = ""; }
$tmp = $row->NameAuthorYear2;
$NameAuthorYear2[$row->ID_Cache] .= $tmp;
$tmp2 = $row->PreferredFlag;
$PreferredFlag[$row->ID_Cache] .= $tmp2; }
$result3 = mysql_query
("SELECT tablecache.ID_Cache, " .
" tablecachetaxonidentified.ID_TaxonIdentified, " .
" tablecachehighertaxa.HigherTaxon AS HigherTaxon2, " .
" tablecachehighertaxa.TaxonRank AS TaxonRank2 " .
" FROM tablecache, tablecachetaxonidentified, tablecachehighertaxa, tmpDnaIDs " .
" WHERE tablecachehighertaxa.ID_CacheTaxonIdentified = tablecachetaxonidentified.ID_TaxonIdentified " .
" AND tablecachetaxonidentified.ID_Cache = tablecache.ID_Cache " .
" AND tablecache.ID_Cache = $ID");
while($row = mysql_fetch_object($result3))
{
if(isset($TaxonRank2[$row->ID_Cache]))
{ $TaxonRank2[$row->ID_Cache] .= "
"; }
else { $TaxonRank2[$row->ID_Cache] = ""; }
if(isset($HigherTaxon2[$row->ID_Cache]))
{
$HigherTaxon2[$row->ID_Cache] .= "
";
}
else
{ $HigherTaxon2[$row->ID_Cache] = ""; }
$tmp = $row->HigherTaxon2;
$HigherTaxon2[$row->ID_Cache] .= $tmp;
$tmp2 = $row->TaxonRank2;
$TaxonRank2[$row->ID_Cache] .= $tmp2;
}
$result4 = mysql_query
("SELECT tablecacheimages.ID_Cache, " .
" tablecacheimages.Images " .
" FROM tablecacheimages, tmpDnaIDs " .
" WHERE tablecacheimages.ID_Cache = tmpDnaIDs.ID_Cache");
while($row = mysql_fetch_object($result4))
{
$Image = "true";
if(isset($Images[$row->ID_Cache]))
{ $ImageLink .= build_href2($row->Images,"Link") . "
"; }
else
{$ImageLink .= build_href2($row->Images,"Link") . "
"; }
}
while($row = mysql_fetch_object($result1))
{
echo "Specimen details (voucher)
";
echo '';
echo 'Unit ID: ';
echo ''.$row->UnitID_Specimen.' ';
echo 'Institution Code: ';
echo ''.$row->InstitutionCode_Specimen.' ';
echo 'Collection Code: ';
echo ''.$row->CollectionCode_Specimen.' |
';
echo 'Identification(s):
';
echo '';
echo 'Name: | ';
echo ''.$NameAuthorYear2[$row->ID_Cache].' |
';
echo 'Taxonomy: | ';
echo ''.$HigherTaxon2[$row->ID_Cache].' | '.$TaxonRank2[$row->ID_Cache].' |
';
if($Image = 'true') {
echo 'Multimedia:
';
echo ''; }
echo 'Collection:
';
echo '';
echo $row->LocalityText ? 'Locality: | ' : '',
$row->Collector ? 'Collector(s): | ' : '';
echo 'Other info: | ';
echo '',
$row->CountryName || $row->CountryISO2 ? 'Country: '.$row->CountryName.' ('.$row->CountryISO2.') ' : '',
$row->Continent ? 'Region/Continent: '.$row->Continent.' ' : '',
$row->LocalityText ? 'Locality: '.$row->LocalityText.'' : '',
$row->LongitudeDecimal || $row->LatitudeDecimal ? ' Coordinates: '.$row->LatitudeDecimal.' | '.$row->LongitudeDecimal.' | ' : '',
$row->Collector ? ''.$row->Collector.'
| ' : '',
$row->Altitude ? ' Altitude : '.$row->Altitude.' | ' : '',
'
';
#######################################Error 1###############################################################
$msg = "UnitID Specimen: ".$row->UnitID_Specimen."\n";
$msg .= "\nInstitution Code Specimen: ".$row->InstitutionCode_Specimen."\n";
$msg .= "\nCollection Code Specimen: ".$row->CollectionCode_Specimen."\n";
$msg .= "\nID Cache: ".$row->ID_Cache."\n";
if(!$Test) {
$msg .= "\nNo record found for wrapper query: \n"; }
if(!$fp) {
$msg .= "\nProvider not available: \n"; }
$msg .= "\n".$file1."\n";
trigger_error($msg, E_USER_ERROR);
#############################################################################################################
}
}
}
?>