* @author Gabriele Droege, DNA Bank Network * @version 2.0 * @package Input * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org
The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ /******************************************************************************************** * increasing time for trying to connect to provider * *********************************************************************************************/ set_time_limit(1000); $processor = new XSLTProcessor; $xsl = new DOMDocument; /******************************************************************************************** * loading xstl stylesheet, depending on required schema * *********************************************************************************************/ if($ID_Schema == 1) { $xsl->load('../input/XSLT/en_ABCD1.2_Summary.xslt'); } if($ID_Schema == 2 OR $ID_Schema == 7) { $xsl->load('../input/XSLT/en_ABCD2.0_Summary.xslt'); } if($ID_Schema == 3 OR $ID_Schema == 6) { $xsl->load('../input/XSLT/en_DarwinCore_UnitDetail.xslt'); } if($ID_Schema == 4) { $xsl->load('../input/XSLT/en_ABCD2.05_Summary.xslt'); } if($Protocol != "BIOCASE" and $FK_Provider == "") { if($SourceUnitID != "") { $SpecimenNumber = $SourceUnitID; } else { $SpecimenNumber = $SpecimenNumber; } if($SourceInstitutionCode != "") { $InstCode = $SourceInstitutionCode; } else { $InstCode = $InstCode; } if($SourceCode != "") { $CollCode = $SourceCode; } else {$SourceCode = $SourceCode; } include("../input/gbif_occurrences.php"); } /******************************************************************************************** * parsing the provider url and checking availability * *********************************************************************************************/ $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 !$host) { echo "Connection to provider failed! "; if($_GET['ID_DNA'] != "") { $ProviderCheck == true; echo "Show data from cache."; } else { echo "Please contact your administrator."; } } if($fp and $host) { if(!fopen($Provider,"r")) { echo "Provider url incorrect! "; if($_GET['ID_DNA'] != "") { $ProviderCheck == true; echo "Show data from cache."; } else { echo "Please contact your administrator."; } } if(fopen($Provider,"r")) { /******************************************************************************************** * $searchform != "true" means system currently uses the input form and not the edit form * * $variable5 see line 145 * *********************************************************************************************/ if($searchform != "true" and $variable5 == "" and $_GET['sqlType'] != "Detail") { if($ID_Schema == 3) { /************************************************************************************************ * $ID_Schema == 3 means source is a DiGIR provider (see also tableschema * * DiGIR makes use of DarwinCore data schema which has two elements for a UnitID/CatalogueNumber * * CatalogueNumber and CatalogueNumberText, both or only one of them can be filled with content * * if CatalogueNumberText != '' -> use this one; if not use the other * *************************************************************************************************/ $file1 = $Provider.$QueryPart1.$Digir_Resource1.$QueryPart1_1.$Digir_Source1."%3C%2Fdestination%3E%0A%09%09%3Ctype%3Esearch%3C%2Ftype%3E%0A%09%09%3C%2Fheader%3E%0A%09%09%3Csearch%3E%0A%09%09%3Cfilter%3E+%3Cequals%3E+%3Cdarwin%3ACatalogNumberText%3E".$SpecimenNumber."%3C%2Fdarwin%3ACatalogNumberText%3E+%3C%2Fequals%3E+%3C%2Ffilter%3E%0A%09%09%3Crecords++start%3D%220%22+limit%3D%2210%22%3E%0A%09%09%3Cstructure+schemaLocation%3D%22http%3A%2F%2Fsearch.biocase.org%2Feurope%2Fstatic%2FdarwinObis.xsd%22%2F%3E%0A%09%09%3C%2Frecords%3E%0A%09%09%3Ccount%3Efalse%3C%2Fcount%3E%0A%09%09%3C%2Fsearch%3E%0A%09%09%3C%2Frequest%3E"; $file2 = $Provider.$QueryPart1.$Digir_Resource1.$QueryPart1_1.$Digir_Source1."%3C%2Fdestination%3E%0A%09%09%3Ctype%3Esearch%3C%2Ftype%3E%0A%09%09%3C%2Fheader%3E%0A%09%09%3Csearch%3E%0A%09%09%3Cfilter%3E+%3Cequals%3E+%3Cdarwin%3ACatalogNumber%3E".$SpecimenNumber."%3C%2Fdarwin%3ACatalogNumber%3E+%3C%2Fequals%3E+%3C%2Ffilter%3E%0A%09%09%3Crecords++start%3D%220%22+limit%3D%2210%22%3E%0A%09%09%3Cstructure+schemaLocation%3D%22http%3A%2F%2Fsearch.biocase.org%2Feurope%2Fstatic%2FdarwinObis.xsd%22%2F%3E%0A%09%09%3C%2Frecords%3E%0A%09%09%3Ccount%3Efalse%3C%2Fcount%3E%0A%09%09%3C%2Fsearch%3E%0A%09%09%3C%2Frequest%3E"; $xml = new DOMDocument; $xml->load($file1); $CatNoText = $xml->getElementsByTagName('CatalogNumberText'); if($CatNoText->item(0)->nodeValue == $SpecimenNumber) { $processor->setParameter('', 'formSpecimenNumber', $formSpecimenNumber); $processor->importStyleSheet($xsl); $xml1 = new DOMDocument('1.0', 'UTF-8'); $xml1->load($file1); $html = $processor->transformToXML($xml1); echo $html; } if($CatNoText->item(0)->nodeValue != $SpecimenNumber) { $processor->setParameter('', 'formSpecimenNumber', $formSpecimenNumber); $processor->importStyleSheet($xsl); $xml2 = new DOMDocument('1.0', 'UTF-8'); $xml2->load($file2); $html = $processor->transformToXML($xml2); echo $html; } } if($ID_Schema != 3) { //$file = $Provider."&query=".urlencode($QueryPart1.$formSpecimenNumber.$QueryPart2); if($SpecimenNumber == "" and $SourceUnitID == "") $SpecimenNumber = "*"; if($SpecimenNumber != "") $SpecimenNumber = $SpecimenNumber; if($SourceUnitID != "") $SpecimenNumber = $SourceUnitID; if($SourceInstitutionCode != "") $InstCode = $SourceInstitutionCode; if($SourceCode != "") $CollCode = $SourceCode; $filter = '
search
http://www.tdwg.org/schemas/abcd/2.06 http://www.tdwg.org/schemas/abcd/2.06 '; if($InstCode != "") { $filter .= ""; } if($CollCode != "") { $filter .= ""; } if($Taxon != "") { $filter .= ""; } if($CollNo != "") { $filter .= ""; } if($CollYear != "") { $filter .= ""; } $file = $Provider."&query=".urlencode($filter.''); $file .= $SpecimenNumber; $file .= urlencode(''); if($InstCode != "") { $file .= urlencode(''); $file .= $InstCode; $file .= urlencode(''); } if($CollCode != "") { $file .= urlencode(''); $file .= $CollCode; $file .= urlencode(''); } if($Taxon != "") { $file .= urlencode(''); $file .= $Taxon; $file .= urlencode(''); } if($CollNo != "") { $file .= urlencode(''); $file .= $CollNo; $file .= urlencode(''); } if($CollYear != "") { $file .= urlencode(''); $file .= $CollYear; $file .= urlencode(''); } $file .= urlencode('false
'); //$file = $Provider.$QueryPart1.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2.$SpecimenNumber.$QueryPart2; //echo $file; $processor->setParameter('', 'searchform', ''); $processor->setParameter('', 'formSpecimenNumber', $formSpecimenNumber); $processor->importStyleSheet($xsl); $xml3 = new DOMDocument('1.0', 'UTF-8'); $xml3->load($file); $html = $processor->transformToXML($xml3); echo $html; } } //if($searchform = "true" and $variable5 == "") if($searchform != "true" and ($variable5 != "" or $_GET['sqlType'] == "Detail")) { /********************************************************************************************** * sometimes the user received more than one specimen record (by using *), than he/she has * * to select one; to be sure that during query process the right one is called some further * * help form elements are filled with content and are checked here * * this parameters are filled during the xslt transformation (see scripts in folder XSLT) * **********************************************************************************************/ if($ID_Schema == 3 and $CatalogNoText == "True") { $file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."CatalogNumberText%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumberText".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; } if($ID_Schema == 3 and $CatalogNoText != "True") { $file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."Cata logNumber%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumber".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; } else { $file = $Provider."&query=".urlencode('
search
http://www.tdwg.org/schemas/abcd/2.06 http://www.tdwg.org/schemas/abcd/2.06 '); $file .= $SourceUnitID; $file .= urlencode(''); $file .= $SourceInstitutionCode; $file .= urlencode(''); $file .= $SourceCode; $file .= urlencode('false
'); } //echo $file; $processor->importStyleSheet($xsl); $processor->setParameter('', 'searchform', ''); $xml = new DOMDocument('1.0', 'UTF-8'); $xml->load($file); $html = $processor->transformToXML($xml); echo $html; } // if($searchform != "true" and $variable5 != "") { /************************************************************************************************ * $searchform == "true" means system currently uses the edit/search form and not the input form * ************************************************************************************************/ if($searchform == "true") { if($ID_Schema == 3 and $CatalogNoText == "True") { $file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."CatalogNumberText%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumberText".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; } if($ID_Schema == 3 and $CatalogNoText != "True") { $file = $Provider.$QueryPart1b.$Digir_Resource1.$QueryPart1_1.$Digir_Source1.$QueryPart1_2b."Cata logNumber%3E".$SourceUnitID."%3C%2Fdarwin%3ACatalogNumber".$QueryPart3.$SourceInstitutionCode.$QueryPart4.$SourceCode.$QueryPart5; } if($ID_Schema == 2) { $file = $Provider."&query=".urlencode('
search
http://www.tdwg.org/schemas/abcd/2.06 http://www.tdwg.org/schemas/abcd/2.06 '); $file .= $SourceUnitID; $file .= urlencode(''); $file .= $SourceInstitutionCode; $file .= urlencode(''); $file .= $SourceCode; $file .= urlencode('false
'); //echo $file; $processor->importStyleSheet($xsl); $processor->setParameter('', 'searchform', 'searchform'); $xml3 = new DOMDocument('1.0', 'UTF-8'); $xml3->load($file); $dom = new DOMDocument(); $dom->Load($file); include ("Save_ABCD2.06.php"); $html = $processor->transformToXML($xml3); echo $html; } } //if($searchform == "true") } //if(fopen($Provider,"r")) } } if($FK_Provider == "") { include("../input/Save_GBIF.php"); } ?>