* @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
*/
if($formSubmitVerify and (!isset($_SESSION['guest']) && !$_SESSION['guest']))
{
$SpecimenNumber = urlencode($_POST['formSpecimenNumber']);
$InstCode = urlencode($_POST['formInstitutionCode']);
$CollCode = urlencode($_POST['formCollectionCode']);
$Taxon = urlencode($_POST['formTaxonName']);
$CollYear = urlencode($_POST['formCollectionYearMin']);
$CollNo = urlencode($_POST['formCollectorsNo']);
$NoType = $_POST['CollNoType'];
if(empty($formProviderIntern) and empty($formProviderExtern))
{
unset($formProviderIntern);
unset($formProviderExtern);
echo "Please select a Specimen Database!";}
else {
if(!empty($formProviderIntern) and !empty($formProviderExtern))
{
echo 'Please select either an "Internal" or "External" Specimen database!'; }
else
{
if(!empty($formProviderIntern))
{
$sql = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT dataset.ID_Dataset, " .
" dataset.FK_Provider, " .
" schemata.QueryPart1, " .
" schemata.QueryPart1_1, " .
" schemata.QueryPart1_2, " .
" schemata.QueryPart2, " .
" schemata.QueryPart3, " .
" schemata.QueryPart4, " .
" dataset.Digir_Resource, " .
" dataset.Digir_Source, " .
" dataset.Protocol, " .
" dataset.FK_Provider, " .
" provider.Provider, " .
" provider.FK_Schema " .
" FROM dataset " .
" LEFT JOIN provider ON dataset.FK_Provider = provider.ID_Provider " .
" LEFT JOIN schemata ON provider.FK_Schema = schemata.ID_Schema " .
" WHERE dataset.ID_Dataset = '$formProviderIntern'");
}
if(!empty($formProviderExtern))
{
$sql = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT dataset.ID_Dataset, " .
" dataset.FK_Provider, " .
" schemata.QueryPart1, " .
" schemata.QueryPart1_1, " .
" schemata.QueryPart1_2, " .
" schemata.QueryPart2, " .
" schemata.QueryPart2a, " .
" schemata.QueryPart3, " .
" schemata.QueryPart4, " .
" dataset.Digir_Resource, " .
" dataset.Digir_Source, " .
" dataset.Protocol, " .
" dataset.FK_Provider, " .
" provider.Provider, " .
" provider.FK_Schema " .
" FROM dataset " .
" LEFT JOIN provider ON dataset.FK_Provider = provider.ID_Provider " .
" LEFT JOIN schemata ON provider.FK_Schema = schemata.ID_Schema " .
" WHERE dataset.ID_Dataset = '$formProviderExtern'");
}
while($row = mysqli_fetch_object($sql))
{
/********************************************************************************************
* All parts of the query are recorded in a table *
* it depends on required provider software and data schema which one to chose *
* the connection to a single specimen data provider is defined via new_dataset.php *
*********************************************************************************************/
$ID_Dataset = $row->ID_Dataset;
$ID_Provider = $row->FK_Provider;
$Provider = $row->Provider;
$QueryPart1 = $row->QueryPart1;
$QueryPart1_1 = $row->QueryPart1_1;
$QueryPart1_2 = $row->QueryPart1_2;
$QueryPart2 = $row->QueryPart2;
$QueryPart2a = $row->QueryPart2a;
$QueryPart3 = $row->QueryPart3;
$QueryPart4 = $row->QueryPart4;
$Digir_Resource = $row->Digir_Resource;
$Digir_Source = $row->Digir_Source;
$ID_Schema = $row->FK_Schema;
$Protocol = $row->Protocol;
$FK_Provider = $row->FK_Provider;
}
$Digir_Resource1 = urlencode($Digir_Resource);
$Digir_Source1 = urlencode($Digir_Source);
if($ID_Dataset == '1' and $ID_Provider == NULL)
{
/**
* if specimen provider = Specimen Tool and its data are not yet availbae via a wrapper, calling this script
*/
include ("../sptool/show_cache_data.php"); }
if($ID_Dataset == '2')
{
/**
* if specimen provider = GBIF, calling this script (GBIF web service)
*/
include ("../input/gbif_occurrences.php");
}
else {
/**
* calling script for building query and transforming received xml data into xslt and html
*/
include ("../input/verify.php"); }
}
}
}
/**********************************************************************************************
* sometimes the user received more than one specimen record, 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) *
**********************************************************************************************/
$variable1 = $_POST['formUnitID'];
$CatalogNoText = $_POST['CatalogNoText'];
$variable2 = $_POST['formSourceInstitutionID'];
$variable3 = $_POST['formSourceID'];
$variable4 = $_POST['formProviderExtern'];
$variable5 = $_POST['formTest'];
$variable6 = $_POST['formProviderIntern'];
if($variable5 != "" and !$formSubmitVerify and !$formSubmitSave)
{
$mykey = key($variable5);
if(!empty($variable4))
{
$sql = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT dataset.ID_Dataset AS ID_Dataset, " .
" schema.QueryPart1b AS QueryPart1b, " .
" schema.QueryPart1_1 AS QueryPart1_1, " .
" schema.QueryPart1_2b AS QueryPart1_2b, " .
" schema.QueryPart2 AS QueryPart2, " .
" schema.QueryPart3 AS QueryPart3, " .
" schema.QueryPart4 AS QueryPart4, " .
" schema.QueryPart5 AS QueryPart5, " .
" provider.Provider AS Provider, " .
" dataset.Digir_Resource AS Digir_Resource, " .
" dataset.Digir_Source AS Digir_Source, " .
" provider.Provider AS Provider, " .
" provider.FK_Schema " .
" FROM dataset " .
" LEFT JOIN provider ON dataset.FK_Provider = provider.ID_Provider " .
" LEFT JOIN schemata ON provider.FK_Schema = schemata.ID_Schema " .
" WHERE dataset.ID_Dataset = '$variable4'");
}
if(!empty($variable6))
{
$sql = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT dataset.ID_Dataset AS ID_Dataset, " .
" schemata.QueryPart1b AS QueryPart1b, " .
" schemata.QueryPart1_1 AS QueryPart1_1, " .
" schemata.QueryPart1_2b AS QueryPart1_2b, " .
" schemata.QueryPart2 AS QueryPart2, " .
" schemata.QueryPart3 AS QueryPart3, " .
" schemata.QueryPart4 AS QueryPart4, " .
" schemata.QueryPart5 AS QueryPart5, " .
" provider.Provider AS Provider, " .
" dataset.Digir_Resource AS Digir_Resource, " .
" dataset.Digir_Source AS Digir_Source, " .
" provider.Provider AS Provider, " .
" provider.FK_Schema " .
" FROM dataset " .
" LEFT JOIN provider ON dataset.FK_Provider = provider.ID_Provider " .
" LEFT JOIN schemata ON provider.FK_Schema = schemata.ID_Schema " .
" WHERE dataset.ID_Dataset = '$variable6'");
}
while($row = mysqli_fetch_object($sql))
{
$ID_Dataset = $row->ID_Dataset;
$Provider = $row->Provider;
$QueryPart1b = $row->QueryPart1b;
$QueryPart1_1 = $row->QueryPart1_1;
$QueryPart1_2b = $row->QueryPart1_2b;
$QueryPart2 = $row->QueryPart2;
$QueryPart3 = $row->QueryPart3;
$QueryPart4 = $row->QueryPart4;
$QueryPart5 = $row->QueryPart5;
$Digir_Resource = $row->Digir_Resource;
$Digir_Source = $row->Digir_Source;
$ID_Schema = $row->FK_Schema;
}
$SourceUnitID = urlencode($variable1[$mykey]);
$SourceInstitutionCode = urlencode($variable2[$mykey]);
$SourceCode = urlencode($variable3[$mykey]);
$Digir_Resource1 = urlencode($Digir_Resource);
$Digir_Source1 = urlencode($Digir_Source);
if($ID_Dataset == '1')
{
/**
* if specimen provider = Specimen Tool and its data are not yet available via a wrapper, calling this script
*/
include ("../sptool/show_cache_data.php");
}
else {
/**
* calling script for transferring received xml data into html
*/
include ("../input/verify.php");
}
}
?>