Source for file verify.php
Documentation is available at verify.php
* Getting data from original specimen data provider
* @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
* @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1
* @license http://www.mozilla.org/MPL/ MPL
/********************************************************************************************
* increasing time for trying to connect to provider *
*********************************************************************************************/
$processor =
new XSLTProcessor;
/********************************************************************************************
* loading xstl stylesheet, depending on required schema *
*********************************************************************************************/
$xsl->load('../input/XSLT/en_ABCD1.2_Summary.xslt');
$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');
$xsl->load('../input/XSLT/en_ABCD2.05_Summary.xslt');
/********************************************************************************************
* parsing the provider url and checking availability *
*********************************************************************************************/
if (isset
($inf['query'])) $path .=
'?'.
$inf['query'];
if (isset
($inf['port'])) $port =
$inf['port'];
$fp =
@fsockopen($host, $port, $errno, $error, 5);
if(!$fp or !$host) { echo
"<span class='error'>Connection to provider failed! ";
if($_GET['ID_DNA'] !=
"") { $ProviderCheck =
true; echo
"Show data from cache.</span>"; }
else { echo
"Please contact your administrator.</span>"; } }
if(!fopen($Provider,"r")) { echo
"<span class='error'>Provider url incorrect! ";
if($_GET['ID_DNA'] !=
"") { $ProviderCheck =
true; echo
"Show data from cache.</span>"; }
else { echo
"Please contact your administrator.</span>"; } }
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 ==
"") {
/************************************************************************************************
* $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";
$CatNoText =
$xml->getElementsByTagName('CatalogNumberText');
if($CatNoText->item(0)->nodeValue ==
$SpecimenNumber) {
$processor->setParameter('', 'formSpecimenNumber', $formSpecimenNumber);
$processor->importStyleSheet($xsl);
$xml1 =
new DOMDocument('1.0', 'UTF-8');
$html =
$processor->transformToXML($xml1);
if($CatNoText->item(0)->nodeValue !=
$SpecimenNumber) {
$processor->setParameter('', 'formSpecimenNumber', $formSpecimenNumber);
$processor->importStyleSheet($xsl);
$xml2 =
new DOMDocument('1.0', 'UTF-8');
$html =
$processor->transformToXML($xml2);
$file =
$Provider.
$QueryPart1.
$Digir_Resource1.
$QueryPart1_1.
$Digir_Source1.
$QueryPart1_2.
$SpecimenNumber.
$QueryPart2;
$processor->setParameter('', 'searchform', '');
$processor->setParameter('', 'formSpecimenNumber', $formSpecimenNumber);
$processor->importStyleSheet($xsl);
$xml3 =
new DOMDocument('1.0', 'UTF-8');
$html =
$processor->transformToXML($xml3);
} //if($searchform != "true" and $variable5 == "")
if($searchform !=
"true" and $variable5 !=
"") {
/**********************************************************************************************
* 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;
$file =
$Provider.
$QueryPart1b.
$Digir_Resource1.
$QueryPart1_1.
$Digir_Source1.
$QueryPart1_2b.
$SourceUnitID.
$QueryPart3.
$SourceInstitutionCode.
$QueryPart4.
$SourceCode.
$QueryPart5; }
$processor->importStyleSheet($xsl);
$processor->setParameter('', 'searchform', '');
$xml =
new DOMDocument('1.0', 'UTF-8');
$html =
$processor->transformToXML($xml);
} // 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;
$file =
$Provider.
$QueryPart1b.
$Digir_Resource1.
$QueryPart1_1.
$Digir_Source1.
$QueryPart1_2b.
$SourceUnitID.
$QueryPart3.
$SourceInstitutionCode.
$QueryPart4.
$SourceCode.
$QueryPart5;
$processor->importStyleSheet($xsl);
$processor->setParameter('', 'searchform', 'searchform');
$xml3 =
new DOMDocument('1.0', 'UTF-8');
$html =
$processor->transformToXML($xml3);
} //if($searchform == "true")
} //if(fopen($Provider,"r"))
Documentation generated on Tue, 29 Nov 2011 10:45:20 +0100 by phpDocumentor 1.4.3