" target="_blank"> |
Search Results |
|
|
=";
$st = "<=";
if($_REQUEST['hitlist'] == "true")
{$parr = $_COOKIE; }
if($_GET['CrBy'] != "")
{$parr = $_GET; }
if($_REQUEST['hitlist'] == "" and $_GET['CrBy'] == "")
{$parr = $_POST; }
array($parr);
foreach ($parr as $var)
{
$rest = substr($var, -1);
if ($rest == '*')
{$var = substr($var, 0, -1);}
$i ++;
if(!empty($var) and $var!="Search" and key($parr)!="PHPSESSID" and $var != "--")
{
switch (key($parr))
{
case 'formSpecimenNumber':
$str = "sptoolcollection.UnitID_Specimen ".$tr." '".$var."' AND ";
$description = " Voucher ID/Specimen Number = ";
if($_POST['formSpecimenNumber']) {$value = $formSpecimenNumber; }
else {$value = $_COOKIE['formSpecimenNumber'];}
break;
case 'formBasisOfRecord':
$str = "basisofrecordspecimen.BasisOfRecord_Specimen ".$tr." '".$var."' AND ";
$description = " Basis Of Record = ";
if($_POST['formBasisOfRecord']) {$value = $formBasisOfRecord; }
else {$value = $_COOKIE['formBasisOfRecord'];}
break;
case 'formKindOfUnit':
$str = "kindofunit.KindOfUnit ".$tr." '".$var."' AND ";
$description = " Kind of Unit = ";
if($_POST['formKindOfUnit']) {$value = $formKindOfUnit; }
else {$value = $_COOKIE['formKindOfUnit'];}
break;
case 'formPrepType':
$str = "sptoolcollection.PrepType ".$lk." '%".$var."%' AND ";
$description = " Kind Of Unit/Preparation Type = ";
if($_POST['formPrepType']) {$value = $formPrepType; }
else {$value = $_COOKIE['formPrepType'];}
break;
case 'formCollectionCode':
$str = "sptoolcollection.CollectionCode_Specimen ".$tr." '".$var."' AND ";
$description = " Collection Code = ";
if($_POST['formCollectionCode']) {$value = $formCollectionCode; }
else {$value = $_COOKIE['formCollectionCode'];}
break;
case 'formInstitutionCode':
$str = "sptoolcollection.InstitutionCode_Specimen ".$tr." '".$var."' AND ";
$description = " Institution Code = ";
if($_POST['formInstitutionCode']) {$value = $formInstitutionCode; }
else {$value = $_COOKIE['formInstitutionCode'];}
break;
case 'formAccNo':
$str = "sptoolcollection.AccessionNo ".$lk." '%".$var."%' AND ";
$description = " Accession Number = ";
if($_POST['formAccNo']) {$value = $formAccNo; }
else {$value = $_COOKIE['formAccNo'];}
break;
case 'formAccName':
$str = "sptoolcollection.AccessionName ".$lk." '%".$var."%' AND ";
$description = " Accession Name = ";
if($_POST['formAccName']) {$value = $formAccName; }
else {$value = $_COOKIE['formAccName'];}
break;
case 'formPrepDate':
$str = "sptoolcollection.PrepDate ".$tr." '".$var."' AND ";
$description = " Preparation Date = ";
if($_POST['formPrepDate']) {$value = $formPrepDate; }
else {$value = $_COOKIE['formPrepDate'];}
break;
case 'formPrepStaff':
$str = "sptoolcollection.FK_PrepStaff ".$tr." '".$var."' AND ";
$description = " Preparation Staff = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_People, Name_All FROM people WHERE ID_People ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->Name_All; }
break;
case 'formPrepMaterials':
$str = "sptoolcollection.PrepMaterials ".$lk." '%".$var."%' AND ";
$description = " Preparation Materials = ";
if($_POST['formPrepMaterials']) {$value = $formPrepMaterials; }
else {$value = $_COOKIE['formPrepMaterials'];}
break;
case 'formPrepProcess':
$str = "sptoolcollection.PrepProcess ".$lk." '%".$var."%' AND ";
$description = " Preparation Process = ";
if($_POST['formPrepProcess']) {$value = $formPrepProcess; }
else {$value = $_COOKIE['formPrepProcess'];}
break;
case 'radioMM':
if($radioMM == 'Image') { $str = "sptoolmultimedia.File_Type = 'Image/Scan' AND sptoolmultimedia.File_Group = 'specimen' AND "; }
if($radioMM == 'Sound') { $str = "sptoolmultimedia.File_Type = 'Sound' AND sptoolmultimedia.File_Group = 'specimen' AND "; }
if($radioMM == 'Video') { $str = "sptoolmultimedia.File_Type = 'Video' AND sptoolmultimedia.File_Group = 'specimen' AND "; }
$description = " Specimen Multimedia = ";
if($_COOKIE['radioMM']) {$value = $radioMM;}
else {$value = $_COOKIE['radioMM'];}
break;
case 'formReference':
$str = "reference.ReferenceText ".$lk." '%".$var."%' AND ";
$description = " Voucher Reference = ";
if($_POST['formVoucherRefText']) {$value = $formVoucherRefText; }
else {$value = $_COOKIE['formVoucherRefText'];}
break;
case 'formLifeStage':
$str = "sptoolcollection.LifeStage ".$lk." '%".$var."%' AND ";
$description = " Life Stage = ";
if($_POST['formLifeStage']) {$value = $formLifeStage; }
else {$value = $_COOKIE['formLifeStage'];}
break;
case 'formLifeForm':
$str = "sptoolcollection.LifeForm ".$lk." '%".$var."%' AND ";
$description = " Life Form = ";
if($_POST['formLifeForm']) {$value = $formLifeForm; }
else {$value = $_COOKIE['formLifeForm'];}
break;
case 'formHigherTaxon1':
$str = "sptoolhighertaxon.HigherTaxon ".$tr." '".$var."' AND ";
$description = " Higher Taxon = ";
if($_POST['formHigherTaxon1']) {$value = $formHigherTaxon1;}
else {$value = $_COOKIE['formHigherTaxon1'];}
break;
case 'formTaxonName':
$str = "sptooltaxa.NameAuthorYear ".$lk." '".$var."%' AND ";
$description = " Taxon Name = ";
if($_POST['formTaxonName']) {$value = $formTaxonName;}
else {$value = $_COOKIE['formTaxonName'];}
break;
case 'formGenus1':
$str = "sptooltaxa.Genus ".$tr." '".$var."' AND ";
$description = " Genus = ";
if($_POST['formGenus1']) {$value = $formGenus1;}
else {$value = $_COOKIE['formGenus1'];}
break;
case 'formSubgenus1':
$str = "sptooltaxa.Subgenus ".$tr." '".$var."' AND ";
$description = " Subgenus = ";
if($_POST['formSubgenus1']) {$value = $formSubgenus1;}
else {$value = $_COOKIE['formSubgenus1'];}
break;
case 'formSpecificEpithet1':
$str = "sptooltaxa.SpecificEpithet ".$lk." '%".$var."%' AND ";
$description = " Specific Epithet = ";
if($_POST['formSpecificEpithet1']) {$value = $formSpecificEpithet1;}
else {$value = $_COOKIE['formSpecificEpithet1'];}
break;
case 'formRank1':
$str = "sptooltaxa.Rank ".$tr." '".$var."' AND ";
$description = " Rank = ";
if($_POST['formRank1']) {$value = $formRank1;}
else {$value = $_COOKIE['formRank1'];}
break;
case 'formInfraspecificEpithet1':
$str = "sptooltaxa.InfraspecificEpithet ".$lk." '%".$var."%' AND ";
$description = " Infaspecific Epithet = ";
if($_POST['formInfraspecificEpithet1']) {$value = $formInfraspecificEpithet1;}
else {$value = $_COOKIE['formInfraspecificEpithet1'];}
break;
case 'formAuthor1':
$str = "sptooltaxa.Author ".$lk." '%".$var."%' AND ";
$description = " Author = ";
if($_POST['formAuthor1']) {$value = $formAuthor1;}
else {$value = $_COOKIE['formAuthor1'];}
break;
case 'formAuthorYear1':
$str = "sptooltaxa.Year ".$tr." '".$var."' AND ";
$description = " Year = ";
if($_POST['formAuthorYear1']) {$value = $formAuthorYear1;}
else {$value = $_COOKIE['formAuthorYear1'];}
break;
case 'formAuthorParenth1':
$str = "sptooltaxa.AuthorParenth ".$lk." '%".$var."%' AND ";
$description = " Author(s) in parenthesis = ";
if($_POST['formAuthorParenth1']) {$value = $formAuthorParenth1;}
else {$value = $_COOKIE['formAuthorParenth1'];}
break;
case 'formAuthorYearParenth1':
$str = "sptooltaxa.YearParenth ".$tr." '".$var."' AND ";
$description = " Year in parenthesis = ";
if($_POST['formAuthorYearParenth1']) {$value = $formAuthorYearParenth1;}
else {$value = $_COOKIE['formAuthorYearParenth1'];}
break;
case 'formIdentifier1':
$str = "sptooltaxa.Identifier ".$lk." '%".$var."%' AND ";
$description = " Identified by = ";
if($_POST['formIdentifier1']) {$value = $formIdentifier1;}
else {$value = $_COOKIE['formIdentifier1'];}
break;
case 'formIdentificationDate1':
$str = "sptooltaxa.IdentificationDate ".$lk." '%".$var."%' AND ";
$description = " Identification Date = ";
if($_POST['formIdentificationDate1']) {$value = $formIdentificationDate1;}
else {$value = $_COOKIE['formIdentificationDate1'];}
break;
case 'formIdentNotes1':
$str = "sptooltaxa.IdentificationNotes ".$lk." '%".$var."%' AND ";
$description = " Identification Notes = ";
if($_POST['formIdentNotes1']) {$value = $formIdentNotes1;}
else {$value = $_COOKIE['formIdentNotes1'];}
break;
case 'formIdentType1':
$str = "sptooltaxa.KindOfIdentification ".$lk." '%".$var."%' AND ";
$description = " Identification Type = ";
if($_POST['formIdentType1']) {$value = $formIdentType1;}
else {$value = $_COOKIE['formIdentType1'];}
break;
case 'formExpedition':
$str = "sptoolcollection.ExpeditionDetails ".$lk." '%".$var."%' AND ";
$description = " Expedition = ";
if($_POST['formExpedition']) {$value = $formExpedition;}
else {$value = $_COOKIE['formExpedition'];}
break;
case 'formBiogeoRegion':
$str = "sptoolcollection.FK_BiogeographicRegion ".$tr." '".$var."' AND ";
$description = " Biogeographic Region = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_BiogeographicRegion, BiogeographicRegion FROM biogeographicregion WHERE ID_BiogeographicRegion ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->BiogeographicRegion; }
break;
case 'formCountry':
$str = "sptoolcollection.FK_Country ".$tr." '".$var."' AND ";
$description = " Country = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Country, Country FROM countryisocode WHERE ID_Country ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->Country; }
break;
case 'formContinent':
$str = "country_continent.Continent ".$tr." '".$var."' AND ";
$description = " Continent = ";
if($_POST['formContinent']) {$value = $formContinent;}
else {$value = $_COOKIE['formContinent'];}
break;
case 'formRegion':
$str = "sptoolcollection.Region ".$lk." '%".$var."%' AND ";
$description = " State/Province/Greater Area = ";
if($_POST['formRegion']) {$value = $formRegion;}
else {$value = $_COOKIE['formRegion'];}
break;
case 'formLocality':
$str = "sptoolcollection.Locality ".$lk." '%".$var."%' AND ";
$description = " Locality = ";
if($_POST['formLocality']) {$value = $formLocality;}
else {$value = $_COOKIE['formLocality'];}
break;
case 'formLocalityID':
$str = "sptoolcollection.Locality_ID ".$lk." '%".$var."%' AND ";
$description = " Locality ID/Station = ";
if($_POST['formLocalityID']) {$value = $formLocalityID;}
else {$value = $_COOKIE['formLocalityID'];}
break;
case 'formOcean':
$str = "sptoolcollection.FK_SeasAndOceans ".$tr." '".$var."' AND ";
$description = " Ocean = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_SeasAndOceans, Ocean FROM seasandoceans WHERE ID_SeasAndOceans ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->Ocean; }
break;
case 'formSea':
$str = "sptoolcollection.FK_SeasAndOceans ".$tr." '".$var."' AND ";
$description = " Sea = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_SeasAndOceans, SeasAndOceans FROM seasandoceans WHERE ID_SeasAndOceans ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->SeasAndOceans; }
break;
case 'radioMMSite':
if($radioMMSite == 'Image') { $str = "sptoolmultimedia.File_Type = 'Image/Scan' AND sptoolmultimedia.File_Group = 'site' AND "; }
if($radioMMSite == 'Sound') { $str = "sptoolmultimedia.File_Type = 'Sound' AND sptoolmultimedia.File_Group = 'site' AND "; }
if($radioMMSite == 'Video') { $str = "sptoolmultimedia.File_Type = 'Video' AND sptoolmultimedia.File_Group = 'site' AND "; }
$description = " Site Multimedia = ";
if($_COOKIE['radioMMSite']) {$value = $radioMMSite;}
else {$value = $_COOKIE['radioMMSite'];}
break;
case 'formHabitat':
$str = "sptoolcollection.Habitat ".$lk." '%".$var."%' AND ";
$description = " Habitat/Ecological aspects = ";
if($_POST['formHabitat']) {$value = $formHabitat;}
else {$value = $_COOKIE['formHabitat'];}
break;
case 'formSoilTexture':
$str = "sptoolcollection.FK_SoilTexture ".$tr." '".$var."' AND ";
$description = " Soil Texture = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_SoilTexture, SoilTexture FROM soiltexture WHERE ID_SoilTexture ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->SoilTexture; }
break;
case 'formSoilpH':
$str = "sptoolcollection.FK_SoilpH ".$tr." '".$var."' AND ";
$description = " Soil pH = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_SoilpH, SoilpH FROM soilph WHERE ID_SoilpH ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->SoilpH; }
break;
case 'formHabitatCode':
$str = "sptoolcollection.FK_HabitatCode ".$tr." '".$var."' AND ";
$description = " Habitat Code = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_HabitatCode, HabitatCode FROM habitatcode WHERE ID_HabitatCode ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->HabitatCode; }
break;
case 'formLandUseCode':
$str = "sptoolcollection.FK_LandUseCode ".$tr." '".$var."' AND ";
$description = " Land Use Code = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_LandUseCode, LandUseCode FROM landusecode WHERE ID_LandUseCode ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->LandUseCode; }
break;
case 'formSlope':
$str = "sptoolcollection.FK_Slope ".$tr." '".$var."' AND ";
$description = " Slope = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Slope, Slope FROM slope WHERE ID_Slope ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->Slope; }
break;
case 'formAspect':
$str = "sptoolcollection.FK_Aspect ".$tr." '".$var."' AND ";
$description = " Prevalent Aspect = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Aspect, Aspect FROM prevalentaspect WHERE ID_Aspect ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->Aspect; }
break;
case 'formDepthMin':
$str = "sptoolcollection.DepthMin ".$bt." '".$var."' AND ";
$description = " Depth >= ";
if($_POST['formDepthMin']) {$value = $formDepthMin;}
else {$value = $_COOKIE['formDepthMin'];}
break;
case 'formDepthMax':
$str = "sptoolcollection.DepthMax ".$st." '".$var."' AND ";
$description = " Depth >= ";
if($_POST['formDepthMax']) {$value = $formDepthMax;}
else {$value = $_COOKIE['formDepthMax'];}
break;
case 'formAltitudeMin':
$str = "sptoolcollection.AltitudeMin ".$bt." '".$var."' AND ";
$description = " Altitude >= ";
if($_COOKIE['formAltitudeMin']) {$value = $formAltitudeMin;}
else {$value = $_COOKIE['formAltitudeMin'];}
break;
case 'formDepthUnit':
$str = "sptoolcollection.DepthUnit ".$tr." '".$var."' AND ";
$description = " Depth Unit = ";
if($_COOKIE['formDepthUnit']) {$value = $formDepthUnit;}
else {$value = $_COOKIE['formDepthUnit'];}
break;
case 'formDepthAccuracy':
$str = "sptoolcollection.DepthAccuracyStatement ".$lk." '%".$var."%' AND ";
$description = " Depth Accuracy Statement = ";
if($_COOKIE['formDepthAccuracy']) {$value = $formDepthAccuracy;}
else {$value = $_COOKIE['formDepthAccuracy'];}
break;
case 'formAltitudeMax':
$str = "sptoolcollection.AltitudeMax ".$st." '".$var."' AND ";
$description = " Altitude <= ";
if($_COOKIE['formAltitudeMax']) {$value = $formAltitudeMax;}
else {$value = $_COOKIE['formAltitudeMax'];}
break;
case 'formAltitudeUnit':
$str = "sptoolcollection.AltitudeUnit ".$tr." '".$var."' AND ";
$description = " Altitude Unit = ";
if($_COOKIE['formAltitudeUnit']) {$value = $formAltitudeUnit;}
else {$value = $_COOKIE['formAltitudeUnit'];}
break;
case 'formAltitudeAccuracy':
$str = "sptoolcollection.AltitudeAccuracyStatement ".$lk." '%".$var."%' AND ";
$description = " Altitude Accuracy Statement = ";
if($_COOKIE['formAltitudeAccuracy']) {$value = $formAltitudeAccuracy;}
else {$value = $_COOKIE['formAltitudeAccuracy'];}
break;
case 'radioGeo':
if($radioGeo == 'Yes') { $str = "sptoolcollection.LatitudeMin != '' AND "; }
if($radioGeo == 'No') { $str = "(sptoolcollection.LatitudeMin = '' OR sptoolcollection.LatitudeMin IS NULL OR sptoolcollection.LatitudeMin = '0') AND "; }
$description = " Georeferenced Record = ";
if($_COOKIE['radioGeo']) {$value = $radioGeo;}
else {$value = $_COOKIE['radioGeo'];}
break;
case 'formCoordinatesAccuracy':
$str = "sptoolcollection.CoordinatesAccuracyStatement ".$lk." '%".$var."%' AND ";
$description = " Coordinates Acc. Statement = ";
if($_POST['formCoordinatesAccuracy']) {$value = $formCoordinatesAccuracy;}
else {$value = $_COOKIE['formCoordinatesAccuracy'];}
break;
case 'formErrorDistance':
$str = "sptoolcollection.CoordinatesErrorDistance ".$lk." '%".$var."%' AND ";
$description = " Error distance in m = ";
if($_POST['formErrorDistance']) {$value = $formErrorDistance;}
else {$value = $_COOKIE['formErrorDistance'];}
break;
case 'formLatMin':
$str = "sptoolcollection.LatitudeMin ".$bt." '".$var."' AND ";
$description = " Latitude >= ";
if($_POST['formLatMin']) {$value = $formLatMin;}
else {$value = $_COOKIE['formLatMin'];}
break;
case 'formLatMax':
$str = "sptoolcollection.LatitudeMax ".$st." '".$var."' AND ";
$description = " Latitude <= ";
if($_POST['formLatMax']) {$value = $formLatMax;}
else {$value = $_COOKIE['formLatMax'];}
break;
case 'formLongMin':
$str = "sptoolcollection.LongitudeMin ".$bt." '".$var."' AND ";
$description = " Longitude >= ";
if($_POST['formLongMin']) {$value = $formLongMin;}
else {$value = $_COOKIE['formLongMin'];}
break;
case 'formLongMax':
$str = "sptoolcollection.LongitudeMax ".$st." '".$var."' AND ";
$description = " Longitude <= ";
if($_COOKIE['formLongMax']) {$value = $formLongMax;}
else {$value = $_COOKIE['formLongMax'];}
break;
case 'formGeoDatum':
$str = "sptoolcollection.GeodeticDatum ".$lk." '%".$var."%' AND ";
$description = " Geodetic Datum = ";
if($_COOKIE['formGeoDatum']) {$value = $formGeoDatum;}
else {$value = $_COOKIE['formGeoDatum'];}
break;
case 'formGeoMethod':
$str = "sptoolcollection.FK_GeocodeMethod ".$tr." '".$var."' AND ";
$description = " Geocode Method = ";
$result = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Geocode, Geocode FROM geocodemethod WHERE ID_Geocode ".$tr." '".$var."'");
while($row = mysqli_fetch_object($result))
{$value = $row->Geocode; }
break;
case 'formCollector':
$str = "sptoolcollection.Collectors ".$lk." '%".$var."%' AND ";
$description = " Collector(s) = ";
if($_COOKIE['formCollector']) {$value = $formCollector;}
else {$value = $_COOKIE['formCollector'];}
break;
case 'formCollectionDateMin':
$str = "sptoolcollection.CollectionDateMin ".$bt." '".$var."' AND ";
$description = " Collection Date from = ";
if($_COOKIE['formCollectionDateMin']) {$value = $formCollectionDateMin;}
else {$value = $_COOKIE['formCollectionDateMin'];}
break;
case 'formCollectionDateMax':
$str = "sptoolcollection.CollectionDateMax ".$st." '".$var."' AND ";
$description = " Collection Date to = ";
if($_COOKIE['formCollectionDateMax']) {$value = $formCollectionDateMax;}
else {$value = $_COOKIE['formCollectionDateMax'];}
break;
case 'formCollectionYearMin':
$str = "sptoolcollection.CollectionYear ".$bt." '".$var."' AND ";
$description = " Collection Year >= ";
if($_COOKIE['formCollectionYearMin']) {$value = $formCollectionYearMin;}
else {$value = $_COOKIE['formCollectionYearMin'];}
break;
case 'formCollectionYearMax':
$str = "sptoolcollection.CollectionYear ".$st." '".$var."' AND ";
$description = " Collection Year <= ";
if($_COOKIE['formCollectionYearMax']) {$value = $formCollectionYearMax;}
else {$value = $_COOKIE['formCollectionYearMax'];}
break;
case 'formCollectorsNo':
$str = "sptoolcollection.CollectorsNo ".$lk." '%".$var."%' AND ";
$description = " Collection No = ";
if($_COOKIE['formCollectorsNo']) {$value = $formCollectorsNo;}
else {$value = $_COOKIE['formCollectorsNo'];}
break;
case 'formCollectionNotes':
$str = "sptoolcollection.CollectionNotes ".$lk." '%".$var."%' AND ";
$description = " Collection Notes = ";
if($_COOKIE['formCollectionNotes']) {$value = $formCollectionNotes;}
else {$value = $_COOKIE['formCollectionNotes'];}
break;
case 'formCollectionMethod':
$str = "sptoolcollection.CollectionMethod ".$lk." '%".$var."%' AND ";
$description = " Collection Method = ";
if($_COOKIE['formCollectionMethod']) {$value = $formCollectionMethod;}
else {$value = $_COOKIE['formCollectionMethod'];}
break;
case 'formSex':
$str = "sex.Sex ".$tr." '".$var."' AND ";
$description = " Sex = ";
if($_COOKIE['formSex']) {$value = $formSex;}
else {$value = $_COOKIE['formSex'];}
break;
case 'formType':
$str = "specimentype.SpecimenType ".$tr." '".$var."' AND ";
$description = " Type = ";
if($_COOKIE['formType']) {$value = $formType;}
else {$value = $_COOKIE['formType'];}
break;
case 'formTypeDesignation':
$str = "sptoolcollection.TypeDesignation ".$lk." '%".$var."%' AND ";
$description = " Type Designation = ";
if($_COOKIE['formTypeDesignation']) {$value = $formTypeDesignation;}
else {$value = $_COOKIE['formTypeDesignation'];}
break;
case 'radioProtect':
$str = "sptoolcollection.EscapedCoordinates ".$tr." '".$var."' AND ";
$description = " Escaped Coordinates = ";
if($_COOKIE['radioProtect']) {$value = $radioProtect;}
else {$value = $_COOKIE['radioProtect'];}
break;
case 'formBlockLoan':
if($var = 'Yes') { $var = '1'; }
else { $var = ''; }
$str = "sptoolcollection.Blocked_For_Loaning ".$tr." '".$var."' AND ";
$description = " Blocked for Loaning = ";
if($_COOKIE['formBlockLoan']) {$value = $formBlockLoan;}
else {$value = $_COOKIE['formBlockLoan'];}
break;
case 'formBlockPublish':
if($var = 'Yes') { $var = '1'; }
else { $var = ''; }
$str = "sptoolcollection.Blocked_For_Publishing ".$tr." '".$var."' AND ";
$description = " Blocked for Publishing = ";
if($_COOKIE['formBlockPublish']) {$value = $formBlockPublish;}
else {$value = $_COOKIE['formBlockPublish'];}
break;
case 'formBlockDateFrom':
if($var != "YYYY-MM-DD") {
$str = "sptoolcollection.Blocked_Until ".$bt." '".$var."' AND ";
$description = " Blocked for Loaning >= ";
if($_COOKIE['formBlockDateFrom']) {$value = $formBlockDateFrom;}
else {$value = $_COOKIE['formBlockDateFrom'];} }
break;
case 'formBlockDateTo':
if($var != "YYYY-MM-DD") {
$str = "sptoolcollection.Blocked_Until ".$st." '".$var."' AND ";
$description = " Blocked for Loaning <= ";
if($_COOKIE['formBlockDateTo']) {$value = $formBlockDateTo;}
else {$value = $_COOKIE['formBlockDateTo'];} }
break;
case 'formLoanConditions':
$str = "sptoolcollection.Loan_Conditions ".$lk." '%".$var."%' AND ";
$description = " Loan Conditions = ";
if($_COOKIE['formLoanConditions']) {$value = $formLoanConditions;}
else {$value = $_COOKIE['formLoanConditions'];}
break;
case 'formNotesInternal':
$str = "sptoolcollection.Notes_Internal ".$lk." '%".$var."%' AND ";
$description = " Internal Notes = ";
if($_COOKIE['formNotesInternal']) {$value = $formNotesInternal;}
else {$value = $_COOKIE['formNotesInternal'];}
break;
case 'formNotes':
$str = "sptoolcollection.Notes ".$lk." '%".$var."%' AND ";
$description = " General Remarks = ";
if($_COOKIE['formNotes']) {$value = $formNotes;}
else {$value = $_COOKIE['formNotes'];}
break;
case 'formCreatedBy':
$str = "sptoolcollection.Created_Who ".$tr." '".$var."' AND ";
$description = " Record Created By = ";
if($_POST['formCreatedBy']) {$value = $formCreatedBy;}
else {$value = $_COOKIE['formCreatedBy'];}
break;
case 'CrBy':
$str = "sptoolcollection.Created_Who ".$tr." '".$var."' AND ";
$description = " Record Created By = ";
$value = $_GET['CrBy'];
break;
case 'formGeneticLocus':
$str = "sptoolgeneticaccessions.GeneticLocus ".$tr." '".$var."' AND ";
$description = " Genetic Locus = ";
if($_POST['formGeneticLocus']) {$value = $formGeneticLocus;}
else {$value = $_COOKIE['formGeneticLocus'];}
break;
case 'formGenbankNumber':
$str = "sptoolgeneticaccessions.GenBankNumber ".$tr." '".$var."' AND ";
$description = " Genetic Accession Number = ";
if($_POST['formGenbankNumber']) {$value = $formGenbankNumber;}
else {$value = $_COOKIE['formGenbankNumber'];}
break;
case 'radioGenBank':
$description = " NCBI/EMBL/DDBJ Accession No/BOLD ID = ";
if($radioGenBank=="Yes" or $_COOKIE['radioGenBank']=="Yes") {
$str = 'sptoolcollection.ID_Collection '.$tr.' sptoolgeneticaccessions.FK_Collection AND sptoolgeneticaccessions.GenBankNumber '.addslashes($no).' "" AND ';
$value = "available";}
if($radioGenBank=="No" or $_COOKIE['radioGenBank']=="No") {
$str = "sptoolcollection.ID_Collection NOT IN (SELECT FK_Collection FROM sptoolgeneticaccessions) AND ";
$value = "not available";}
break;
case 'formSeries':
$str = "stratigraphy_series.Series ".$tr." '".$var."' AND ";
$description = " Series = ";
if($_POST['formSeries']) {$value = $formSeries;}
else {$value = $_COOKIE['formSeries'];}
break;
case 'formStage':
$str = "stratigraphy_stage.Stage ".$tr." '".$var."' AND ";
$description = " Stage = ";
if($_POST['formStage']) {$value = $formStage;}
else {$value = $_COOKIE['formStage'];}
break;
case 'formFossilZone':
$str = "sptoolcollection.FossilZone ".$lk." '%".$var."%' AND ";
$description = " Fossil Zone = ";
if($_POST['formFossilZone']) {$value = $formFossilZone;}
else {$value = $_COOKIE['formFossilZone'];}
break;
case 'formFormation':
$str = "sptoolcollection.Formation ".$lk." '%".$var."%' AND ";
$description = " Formation = ";
if($_POST['formFormation']) {$value = $formFormation;}
else {$value = $_COOKIE['formFormation'];}
break;
case 'formSectionDetails':
$str = "sptoolcollection.SectionDetails ".$lk." '%".$var."%' AND ";
$description = " Section Details = ";
if($_POST['formSectionDetails']) {$value = $formSectionDetails;}
else {$value = $_COOKIE['formSectionDetails'];}
break;
case 'formSpecimenDetails':
$str = "sptoolcollection.SpecimenDetails ".$lk." '%".$var."%' AND ";
$description = " Specimen Details = ";
if($_POST['formSpecimenDetails']) {$value = $formSpecimenDetails;}
else {$value = $_COOKIE['formSpecimenDetails'];}
break;
}
$where[$i] = $str;
$descriptionall[$i] = $description;
$valueall[$i] = $value;
}
next($parr);
}
if(empty($str))
{ echo ""; }
else {
foreach($where AS $a) $string .= $a;
$l=strlen ($string);
$max = $l-4;
$where_str = substr($string, 0, $max);
$wherestr = ' WHERE ' . $where_str;
if(isset($_SESSION['guest']) || $_SESSION['guest'] || !$_SESSION['loggedin'] || !isset($_SESSION['loggedin'])) {
$wherestr .= ' AND sptoolcollection.Blocked != "Yes" AND sptoolcollection.EscapedCoordinates != "Yes" and sptoolcollection.Permission != "No" ';}
if (isset($_SESSION['project']) || $_SESSION['project']) {
$wherestr .= " AND ((sptoolcollection.Created_Who != '".$log."' AND sptoolcollection.Blocked != 'Yes' and sptoolcollection.EscapedCoordinates != 'Yes' and sptoolcollection.Permission != 'No') OR sptoolcollection.Created_Who = '".$log."') "; }
mysqli_query($GLOBALS["___mysqli_ston"], "DROP TABLE IF EXISTS tmpSpToolIDs");
if($_REQUEST['sort'] == "TU" or !$_REQUEST['sort'] or $SortingSP != "") { $OrderBy = " ORDER BY sptooltaxa.NameAuthorYear "; $SortingSP = "TU"; }
if($_REQUEST['sort'] == "CU" or $SortingSP == "CU") { $OrderBy = " ORDER BY sptoolcollection.Collectors "; }
if($_REQUEST['sort'] == "CD" or $SortingSP == "CD") { $OrderBy = " ORDER BY sptoolcollection.Collectors DESC "; }
if($_REQUEST['sort'] == "DU" or $SortingSP == "DU") { $OrderBy = " ORDER BY sptoolcollection.CollectionDateMin "; }
if($_REQUEST['sort'] == "DD" or $SortingSP == "DD") { $OrderBy = " ORDER BY sptoolcollection.CollectionDateMin DESC "; }
if($_REQUEST['sort'] == "OU" or $SortingSP == "OU") { $OrderBy = " ORDER BY countryisocode.Country "; }
if($_REQUEST['sort'] == "OD" or $SortingSP == "OD") { $OrderBy = " ORDER BY countryisocode.Country DESC "; }
if($_REQUEST['sort'] == "TD" or $SortingSP == "TD") { $OrderBy = " ORDER BY sptooltaxa.NameAuthorYear DESC "; }
if($_REQUEST['sort'] == "VU" or $SortingSP == "VU") { $OrderBy = " ORDER BY sptoolcollection.UnitID_Specimen "; }
if($_REQUEST['sort'] == "VD" or $SortingSP == "VD") { $OrderBy = " ORDER BY sptoolcollection.UnitID_Specimen DESC "; }
if($_REQUEST['sort'] == "CCU" or $SortingSP == "CCU") { $OrderBy = " ORDER BY sptoolcollection.CollectionCode_Specimen "; }
if($_REQUEST['sort'] == "CCD" or $SortingSP == "CCD") { $OrderBy = " ORDER BY sptoolcollection.CollectionCode_Specimen DESC "; }
if($_REQUEST['sort'] == "ICU" or $SortingSP == "ICU") { $OrderBy = " ORDER BY sptoolcollection.InstitutionCode_Specimen "; }
if($_REQUEST['sort'] == "ICD" or $SortingSP == "ICD") { $OrderBy = " ORDER BY sptoolcollection.InstitutionCode_Specimen DESC "; }
$sqlType = "SpTool";
$sql = $sqlcreate .
$sql = "SELECT DISTINCT sptoolcollection.ID_Collection FROM sptoolcollection
LEFT JOIN sptooltaxa ON sptoolcollection.ID_Collection = sptooltaxa.FK_Collection
LEFT JOIN sptoolhighertaxon ON sptooltaxa.ID_TaxonIdentified = sptoolhighertaxon.FK_TaxonIdentified
LEFT JOIN basisofrecordspecimen ON sptoolcollection.FK_BasisOfRecord = basisofrecordspecimen.ID_BasisOfRecord_Specimen
LEFT JOIN kindofunit ON sptoolcollection.FK_KindOfUnit = kindofunit.ID_KindOfUnit
LEFT JOIN sex ON sptoolcollection.FK_Sex = sex.ID_Sex
LEFT JOIN country_continent ON sptoolcollection.FK_Country = country_continent.FK_Country
LEFT JOIN countryisocode ON sptoolcollection.FK_Country = countryisocode.ID_Country
LEFT JOIN specimentype ON sptoolcollection.FK_Type = specimentype.ID_SpecimenType
LEFT JOIN sptoolmultimedia ON sptoolcollection.ID_Collection = sptoolmultimedia.FK_Collection
LEFT JOIN sptoolreferences ON sptoolcollection.ID_Collection = sptoolreferences.FK_Collection
LEFT JOIN reference ON sptoolreferences.FK_References = reference.ID_References
LEFT JOIN sptoolgeneticaccessions ON sptoolcollection.ID_Collection = sptoolgeneticaccessions.FK_Collection
LEFT JOIN stratigraphy_series ON sptoolcollection.FK_Strat_Series = stratigraphy_series.ID_Strat_Series
LEFT JOIN stratigraphy_stage ON sptoolcollection.FK_Strat_Stage = stratigraphy_stage.ID_Strat_Stage " .
$wherestr.$OrderBy.$sqllimit;
//echo $sql;
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql) or die($sql.' '.((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)));
$sqlcount = "SELECT DISTINCT sptoolcollection.ID_Collection FROM sptoolcollection
LEFT JOIN sptooltaxa ON sptoolcollection.ID_Collection = sptooltaxa.FK_Collection
LEFT JOIN sptoolhighertaxon ON sptooltaxa.ID_TaxonIdentified = sptoolhighertaxon.FK_TaxonIdentified
LEFT JOIN basisofrecordspecimen ON sptoolcollection.FK_BasisOfRecord = basisofrecordspecimen.ID_BasisOfRecord_Specimen
LEFT JOIN kindofunit ON sptoolcollection.FK_KindOfUnit = kindofunit.ID_KindOfUnit
LEFT JOIN sex ON sptoolcollection.FK_Sex = sex.ID_Sex
LEFT JOIN country_continent ON sptoolcollection.FK_Country = country_continent.FK_Country
LEFT JOIN countryisocode ON sptoolcollection.FK_Country = countryisocode.ID_Country
LEFT JOIN specimentype ON sptoolcollection.FK_Type = specimentype.ID_SpecimenType
LEFT JOIN sptoolmultimedia ON sptoolcollection.ID_Collection = sptoolmultimedia.FK_Collection
LEFT JOIN sptoolreferences ON sptoolcollection.ID_Collection = sptoolreferences.FK_Collection
LEFT JOIN reference ON sptoolreferences.FK_References = reference.ID_References
LEFT JOIN sptoolgeneticaccessions ON sptoolcollection.ID_Collection = sptoolgeneticaccessions.FK_Collection
LEFT JOIN stratigraphy_series ON sptoolcollection.FK_Strat_Series = stratigraphy_series.ID_Strat_Series
LEFT JOIN stratigraphy_stage ON sptoolcollection.FK_Strat_Stage = stratigraphy_stage.ID_Strat_Stage " .
$wherestr;
$resultcount = mysqli_query($GLOBALS["___mysqli_ston"], $sqlcount);
$sum = mysqli_num_rows($resultcount);
} } //if($formSubmitSearch)
else
{
if($formSubmitSave)
{
include("save_updates_sptool.php");
}
mysqli_query($GLOBALS["___mysqli_ston"], "DROP TABLE IF EXISTS tmpSpToolIDs");
$sqlType = "Detail";
$ID_Collection = $_GET['ID_Collection'];
$sql = $sqlcreate .
$sql = "SELECT DISTINCT sptoolcollection.ID_Collection FROM sptoolcollection
LEFT JOIN sptooltaxa ON sptoolcollection.ID_Collection = sptooltaxa.FK_Collection
LEFT JOIN sptoolhighertaxon ON sptooltaxa.ID_TaxonIdentified = sptoolhighertaxon.FK_TaxonIdentified " .
"WHERE sptoolcollection.ID_Collection = '$ID_Collection' ";
if (isset($_SESSION['guest']) || $_SESSION['guest'] || !$_SESSION['loggedin'] || !isset($_SESSION['loggedin'])) {
$sql .= " AND sptoolcollection.Blocked != 'Yes'
AND sptoolcollection.EscapedCoordinated != 'Yes'
AND sptoolcollection.Permission != 'No' "; }
if (isset($_SESSION['project']) || $_SESSION['project']) {
$sql .= " AND ((sptoolcollection.Created_Who != '".$log."' AND sptoolcollection.Blocked != 'Yes'
AND sptoolcollection.EscapedCoordinates != 'Yes'
AND sptoolcollection.Permission != 'No') OR sptoolcollection.Created_Who = '".$log."') "; }
$sql .= $sqllimit;
}
$SpToolcount=0;
if(!empty($sql))
{
// just in case it is still here: drop tmpSpToolIDs
mysqli_query($GLOBALS["___mysqli_ston"], "DROP TABLE IF EXISTS tmpSpToolIDs");
mysqli_query($GLOBALS["___mysqli_ston"], $sql);
if(!mysqli_affected_rows($GLOBALS["___mysqli_ston"]))
{
echo "New Search. | ";
if($version != "BoBO" and (isset($_SESSION['guest']) || $_SESSION['guest'] || isset($_SESSION['project']) || $_SESSION['project'] || !$_SESSION['loggedin'] || !isset($_SESSION['loggedin']))) {
echo "Sorry, you don't have permission to see this record. | "; }
else {
echo " |
No hits found for:";
if($descriptionall != "") {
foreach($descriptionall as $index => $descriptiontest)
{ $valuetest = $valueall[$index];
echo $descriptiontest."[".$valuetest."]"; } }
else { echo " this query"; }
echo ". |
";}
} // if (!isset($_SESSION['guest']) && !$_SESSION['guest'])
else
{
$result1 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptoolcollection.UnitID_Specimen, " .
" sptoolcollection.CollectionCode_Specimen, " .
" sptoolcollection.InstitutionCode_Specimen, " .
" sptoolcollection.Collectors, " .
" sptoolcollection.CollectionDateMin, " .
" sptoolcollection.CollectionDateMax, " .
" sptoolcollection.CollectionYear, " .
" sptoolcollection.CollectorsNo, " .
" sptoolcollection.CollectionMethod, " .
" sptoolcollection.Locality_ID, " .
" sptoolcollection.ExpeditionDetails, " .
" sptoolcollection.Region, " .
" sptoolcollection.Locality, " .
" sptoolcollection.Habitat, " .
" sptoolcollection.DepthMin, " .
" sptoolcollection.DepthMax, " .
" sptoolcollection.DepthUnit, " .
" sptoolcollection.DepthMethod, " .
" sptoolcollection.DepthRaw, " .
" sptoolcollection.DepthAccuracyStatement, " .
" sptoolcollection.AltitudeMin, " .
" sptoolcollection.AltitudeMax, " .
" sptoolcollection.AltitudeUnit, " .
" sptoolcollection.AltitudeMethod, " .
" sptoolcollection.AltitudeRaw, " .
" sptoolcollection.AltitudeAccuracyStatement, " .
" sptoolcollection.LongitudeMin, " .
" sptoolcollection.LatitudeMin, " .
" sptoolcollection.LongitudeMax, " .
" sptoolcollection.LatitudeMax, " .
" sptoolcollection.LongitudeRaw, " .
" sptoolcollection.LatitudeRaw, " .
" sptoolcollection.CoordinatesAccuracyStatement, " .
" sptoolcollection.CoordinatesErrorDistance, " .
" sptoolcollection.GeodeticDatum, " .
" sptoolcollection.EscapedCoordinates, " .
" sptoolcollection.Permission, " .
" sptoolcollection.Blocked_For_Publishing, " .
" sptoolcollection.Blocked_For_Loaning, " .
" sptoolcollection.Blocked_Until, " .
" sptoolcollection.Loan_Conditions, " .
" sptoolcollection.AccessionNo, " .
" sptoolcollection.AccessionName, " .
" methods.Method AS PrepType, " .
" sptoolcollection.PrepDate, " .
" sptoolcollection.PrepMaterials, " .
" sptoolcollection.PrepProcess, " .
" PrepStaff.Name_All AS PrepStaff, " .
" AcquiredFrom.Name_All AS AcquiredFrom, " .
" sptoolcollection.LifeStage, " .
" sptoolcollection.LifeForm, " .
" sptoolcollection.TypeDesignation, " .
" sptoolcollection.Notes, " .
" sptoolcollection.Notes_Internal, " .
" sptoolcollection.CollectionNotes, " .
" sptoolcollection.SampleGroup, " .
" sptoolcollection.Created_Who, " .
" sptoolcollection.Created_When, " .
" sptoolcollection.Updated_Who, " .
" sptoolcollection.Updated_When, " .
" sptoolcollection.GUID, " .
" sptoolcollection.Created_Who, " .
" sptoolcollection.Created_When, " .
" sptoolcollection.Multimedia, " .
" sptoolcollection.Qualifier_Series, " .
" sptoolcollection.Qualifier_Stage, " .
" sptoolcollection.FossilZone, " .
" sptoolcollection.Formation, " .
" sptoolcollection.SpecimenDetails, " .
" sptoolcollection.SectionDetails, " .
" basisofrecordspecimen.BasisOfRecord_Specimen AS BasisOfRecord, " .
" kindofunit.KindOfUnit, " .
" sptoolcollection.FK_ParentID_Collection, " .
" relation.Relation, " .
" sex.Sex, " .
" slope.Slope, " .
" prevalentaspect.Aspect, " .
" geocodemethod.Geocode, " .
" biogeographicregion.BiogeographicRegion, " .
" soiltexture.SoilTexture, " .
" soilph.SoilpH, " .
" habitatcode.HabitatCode, " .
" landusecode.LandUseCode, " .
" specimentype.SpecimenType, " .
" countryisocode.Country, " .
" countryisocode.IsoCode, " .
" seasandoceans.SeasAndOceans, " .
" stratigraphy_series.Series, " .
" stratigraphy_stage.Stage " .
" FROM sptoolcollection JOIN tmpSpToolIDs " .
" LEFT JOIN basisofrecordspecimen ON sptoolcollection.FK_BasisOfRecord = basisofrecordspecimen.ID_BasisOfRecord_Specimen " .
" LEFT JOIN kindofunit ON sptoolcollection.FK_KindOfUnit = kindofunit.ID_KindOfUnit " .
" LEFT JOIN sex ON sptoolcollection.FK_Sex = sex.ID_Sex " .
" LEFT JOIN slope ON sptoolcollection.FK_Slope = slope.ID_Slope " .
" LEFT JOIN prevalentaspect ON sptoolcollection.FK_Aspect = prevalentaspect.ID_Aspect " .
" LEFT JOIN geocodemethod ON sptoolcollection.FK_GeocodeMethod = geocodemethod.ID_Geocode " .
" LEFT JOIN biogeographicregion ON sptoolcollection.FK_BiogeographicRegion = biogeographicregion.ID_BiogeographicRegion " .
" LEFT JOIN soiltexture ON sptoolcollection.FK_SoilTexture = soiltexture.ID_SoilTexture " .
" LEFT JOIN soilph ON sptoolcollection.FK_SoilpH = soilph.ID_SoilpH " .
" LEFT JOIN habitatcode ON sptoolcollection.FK_HabitatCode = habitatcode.ID_HabitatCode " .
" LEFT JOIN landusecode ON sptoolcollection.FK_LandUseCode = landusecode.ID_LandUseCode " .
" LEFT JOIN specimentype ON sptoolcollection.FK_Type = specimentype.ID_SpecimenType " .
" LEFT JOIN countryisocode ON sptoolcollection.FK_Country = countryisocode.ID_Country " .
" LEFT JOIN seasandoceans ON sptoolcollection.FK_SeasAndOceans = seasandoceans.ID_SeasAndOceans " .
" LEFT JOIN stratigraphy_series ON sptoolcollection.FK_Strat_Series = stratigraphy_series.ID_Strat_Series " .
" LEFT JOIN stratigraphy_stage ON sptoolcollection.FK_Strat_Stage = stratigraphy_stage.ID_Strat_Stage " .
" LEFT JOIN people as PrepStaff ON sptoolcollection.FK_PrepStaff = PrepStaff.ID_People " .
" LEFT JOIN people as AcquiredFrom ON sptoolcollection.FK_AcquiredFrom = AcquiredFrom.ID_People " .
" LEFT JOIN relation ON sptoolcollection.FK_RelationToParent = relation.ID_Relation " .
" LEFT JOIN methods ON sptoolcollection.FK_PrepType = methods.ID_Method " .
" WHERE sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
$resultassociations = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptoolcollection.UnitID_Specimen, " .
" sptoolcollection.CollectionCode_Specimen, " .
" sptoolcollection.InstitutionCode_Specimen, " .
" basisofrecordspecimen.BasisOfRecord_Specimen AS BasisOfRecord, " .
" kindofunit.KindOfUnit, " .
" sptoolcollection.FK_ParentID_Collection, " .
" methods.Method AS PrepType, " .
" sptoolcollection.PrepDate, " .
" relation.Relation " .
" FROM sptoolcollection JOIN tmpSpToolIDs " .
" LEFT JOIN basisofrecordspecimen ON sptoolcollection.FK_BasisOfRecord = basisofrecordspecimen.ID_BasisOfRecord_Specimen " .
" LEFT JOIN relation ON sptoolcollection.FK_RelationToParent = relation.ID_Relation " .
" LEFT JOIN kindofunit ON sptoolcollection.FK_KindOfUnit = kindofunit.ID_KindOfUnit " .
" LEFT JOIN methods ON sptoolcollection.FK_PrepType = methods.ID_Method " .
" WHERE FK_ParentID_Collection = tmpSpToolIDs.ID_Collection");
$result2 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptooltaxa.NameAuthorYear, " .
" sptooltaxa.Genus, " .
" sptooltaxa.Subgenus, " .
" sptooltaxa.SpecificEpithet, " .
" sptooltaxa.Rank, " .
" sptooltaxa.InfraspecificEpithet, " .
" sptooltaxa.AuthorParenth, " .
" sptooltaxa.YearParenth, " .
" sptooltaxa.Author, " .
" sptooltaxa.Year, " .
" sptooltaxa.KindOfIdentification, " .
" sptooltaxa.Identifier, " .
" sptooltaxa.IdentificationDate, " .
" sptooltaxa.IdentificationNotes, " .
" sptooltaxa.PreferredFlag " .
" FROM sptoolcollection, sptooltaxa, tmpSpToolIDs " .
" WHERE sptooltaxa.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptooltaxa.PreferredFlag = '1' " .
" AND sptooltaxa.Synecology IS NULL " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
while($row = mysqli_fetch_object($result2))
{
$NameAuthorYear = $row->NameAuthorYear;
$Genus = $row->Genus;
$Subgenus = $row->Subgenus;
$SpecificEpithet = $row->SpecificEpithet;
$InfraspecificEpithet = $row->InfraspecificEpithet;
$Rank = $row->Rank;
$AuthorParenth = $row->AuthorParenth;
$YearParenth = $row->YearParenth;
$Author = $row->Author;
$Year = $row->Year;
$KindOfIdentification = $row->KindOfIdentification;
$Identifier = $row->Identifier;
$IdentificationDate = $row->IdentificationDate;
$IdentificationNotes = $row->IdentificationNotes;
$PreferredFlag = "Yes";
}
$result2a = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptooltaxa.ID_TaxonIdentified, " .
" sptooltaxa.NameAuthorYear, " .
" sptooltaxa.Genus, " .
" sptooltaxa.Subgenus, " .
" sptooltaxa.SpecificEpithet, " .
" sptooltaxa.Rank, " .
" sptooltaxa.InfraspecificEpithet, " .
" sptooltaxa.AuthorParenth, " .
" sptooltaxa.YearParenth, " .
" sptooltaxa.Author, " .
" sptooltaxa.Year, " .
" sptooltaxa.KindOfIdentification, " .
" sptooltaxa.Identifier, " .
" sptooltaxa.IdentificationDate, " .
" sptooltaxa.IdentificationNotes, " .
" sptooltaxa.PreferredFlag " .
" FROM sptoolcollection, sptooltaxa, tmpSpToolIDs " .
" WHERE sptooltaxa.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptooltaxa.PreferredFlag != '1' " .
" AND sptooltaxa.Synecology IS NULL " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
$result2b = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptooltaxa.NameAuthorYear AS NameAuthorYearB, " .
" sptooltaxa.PreferredFlag AS PreferredFlagB " .
" FROM sptoolcollection, sptooltaxa, tmpSpToolIDs " .
" WHERE sptooltaxa.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptooltaxa.Synecology IS NULL " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
while($row = mysqli_fetch_object($result2b))
{if(isset($PreferredFlagB[$row->ID_Collection]))
{ $Flag = $PreferredFlagB[$row->ID_Collection];
if($Flag == 'true' or $Flag == '1') {$Preferred = " (preferred species name)";}
else {$Preferred = ""; }
}
else
{ $PreferredFlagB[$row->ID_Collection] = ""; }
if(isset($NameAuthorYearB[$row->ID_Collection]))
{ $NameAuthorYearB[$row->ID_Collection] .= "" . $Preferred . ", "; }
else
{ $NameAuthorYearB[$row->ID_Collection] = ""; }
$tmp = $row->NameAuthorYearB;
$NameAuthorYearB[$row->ID_Collection] .= $tmp;
$tmp2 = $row->PreferredFlagB;
$PreferredFlagB[$row->ID_Collection] .= $tmp2;
}
$result3 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptooltaxa.ID_TaxonIdentified, " .
" sptoolhighertaxon.HigherTaxon, " .
" sptoolhighertaxon.TaxonRank " .
" FROM sptoolcollection, sptooltaxa, sptoolhighertaxon, tmpSpToolIDs " .
" WHERE sptoolhighertaxon.FK_TaxonIdentified = sptooltaxa.ID_TaxonIdentified " .
" AND sptooltaxa.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptooltaxa.PreferredFlag = '1' " .
" AND sptoolhighertaxon.Synecology IS NULL " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
$result4 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptoolmeasurementorfact.Value, " .
" sptoolmeasurementorfact.Unit, " .
" sptoolmeasurementorfact.Parameter, " .
" sptoolmeasurementorfact.Method " .
" FROM sptoolcollection, sptoolmeasurementorfact, tmpSpToolIDs " .
" WHERE sptoolmeasurementorfact.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection " .
" AND sptoolmeasurementorfact.Rank = 'Ecology'");
$result5 = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptoolmeasurementorfact.Value, " .
" sptoolmeasurementorfact.Unit, " .
" sptoolmeasurementorfact.Parameter, " .
" sptoolmeasurementorfact.Method " .
" FROM sptoolcollection, sptoolmeasurementorfact, tmpSpToolIDs " .
" WHERE sptoolmeasurementorfact.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection " .
" AND sptoolmeasurementorfact.Rank = 'Morphology' " .
"ORDER BY sptoolmeasurementorfact.Parameter ");
$resultGenAcc = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptoolgeneticaccessions.GenBankNumber, " .
" sptoolgeneticaccessions.SampleID, " .
" sptoolgeneticaccessions.BOLD, " .
" geneticlocus.GeneticLocus " .
" FROM sptoolcollection, sptoolgeneticaccessions, geneticlocus, tmpSpToolIDs " .
" WHERE sptoolgeneticaccessions.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection " .
" AND geneticlocus.ID_GeneticLocus = sptoolgeneticaccessions.FK_GeneticLocus " .
"ORDER BY sptoolgeneticaccessions.BOLD, sptoolgeneticaccessions.GenBankNumber");
$result2Host = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptooltaxa.ID_TaxonIdentified, " .
" sptooltaxa.NameAuthorYear, " .
" sptooltaxa.Genus, " .
" sptooltaxa.Subgenus, " .
" sptooltaxa.SpecificEpithet, " .
" sptooltaxa.Rank, " .
" sptooltaxa.InfraspecificEpithet, " .
" sptooltaxa.AuthorParenth, " .
" sptooltaxa.YearParenth, " .
" sptooltaxa.Author, " .
" sptooltaxa.Year, " .
" sptooltaxa.KindOfIdentification, " .
" sptooltaxa.Identifier, " .
" sptooltaxa.IdentificationDate, " .
" sptooltaxa.IdentificationNotes, " .
" sptooltaxa.PreferredFlag " .
" FROM sptoolcollection, sptooltaxa, tmpSpToolIDs " .
" WHERE sptooltaxa.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptooltaxa.Synecology = 'host' " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
while($row = mysqli_fetch_object($result2Host))
{
$NameAuthorYearHost = $row->NameAuthorYear;
$GenusHost = $row->Genus;
$SubgenusHost = $row->Subgenus;
$SpecificEpithetHost = $row->SpecificEpithet;
$InfraspecificEpithetHost = $row->InfraspecificEpithet;
$RankHost = $row->Rank;
$AuthorParenthHost = $row->AuthorParenth;
$YearParenthHost = $row->YearParenth;
$AuthorHost = $row->Author;
$YearHost = $row->Year;
$KindOfIdentificationHost = $row->KindOfIdentification;
$IdentifierHost = $row->Identifier;
$IdentificationDateHost = $row->IdentificationDate;
$IdentificationNotesHost = $row->IdentificationNotes;
}
$result3Host = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolcollection.ID_Collection, " .
" sptooltaxa.ID_TaxonIdentified, " .
" sptoolhighertaxon.HigherTaxon, " .
" sptoolhighertaxon.TaxonRank " .
" FROM sptoolcollection, sptooltaxa, sptoolhighertaxon, tmpSpToolIDs " .
" WHERE sptoolhighertaxon.FK_TaxonIdentified = sptooltaxa.ID_TaxonIdentified " .
" AND sptooltaxa.FK_Collection = sptoolcollection.ID_Collection " .
" AND sptoolhighertaxon.Synecology = 'host' " .
" AND sptoolcollection.ID_Collection = tmpSpToolIDs.ID_Collection");
$resultAssocUnit = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolassociatedunits.FK_Collection, " .
" sptoolassociatedunits.RelationToMainUnit, " .
" sptoolassociatedunits.UnitID, " .
" sptoolassociatedunits.CollectionCode, " .
" sptoolassociatedunits.InstitutionCode, " .
" basisofrecordspecimen.BasisOfRecord_Specimen AS RecordBasis, " .
" dataset.Display, " .
" sptoolassociatedunits.Notes " .
" FROM sptoolassociatedunits JOIN tmpSpToolIDs " .
" LEFT JOIN basisofrecordspecimen ON sptoolassociatedunits.FK_BasisOfRecord = basisofrecordspecimen.ID_BasisOfRecord_Specimen " .
" LEFT JOIN dataset ON sptoolassociatedunits.FK_Dataset = dataset.ID_Dataset " .
" WHERE sptoolassociatedunits.FK_Collection = tmpSpToolIDs.ID_Collection");
$resultVoucherRef = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolreferences.ID_Reference, " .
" sptoolreferences.FK_Collection, " .
" sptoolreferences.FK_References, " .
" reference.ReferenceText, " .
" reference.ReferenceUrl, " .
" sptoolreferences.ReferenceDetail " .
" FROM sptoolreferences JOIN tmpSpToolIDs " .
" LEFT JOIN reference ON sptoolreferences.FK_References = reference.ID_References " .
" WHERE sptoolreferences.FK_Collection = tmpSpToolIDs.ID_Collection");
$resultMMSpecimen = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolmultimedia.ID_Multimedia, " .
" sptoolmultimedia.FK_Collection, " .
" sptoolmultimedia.File_Path, " .
" sptoolmultimedia.File_Type, " .
" sptoolmultimedia.File_Created_When, " .
" sptoolmultimedia.File_Created_Who, " .
" sptoolmultimedia.File_Comment, " .
" sptoolmultimedia.File_Context, " .
" sptoolmultimedia.File_Group, " .
" sptoolmultimedia.File_License " .
" FROM sptoolmultimedia JOIN tmpSpToolIDs " .
" WHERE sptoolmultimedia.File_Group = 'specimen' " .
" AND sptoolmultimedia.FK_Collection = tmpSpToolIDs.ID_Collection " .
" ORDER BY sptoolmultimedia.ID_Multimedia");
$resultMMSite = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT sptoolmultimedia.FK_Collection, " .
" sptoolmultimedia.ID_Multimedia, " .
" sptoolmultimedia.File_Path, " .
" sptoolmultimedia.File_Type, " .
" sptoolmultimedia.File_Created_When, " .
" sptoolmultimedia.File_Created_Who, " .
" sptoolmultimedia.File_Comment, " .
" sptoolmultimedia.File_Context, " .
" sptoolmultimedia.File_Group, " .
" sptoolmultimedia.File_License " .
" FROM sptoolmultimedia JOIN tmpSpToolIDs " .
" WHERE sptoolmultimedia.File_Group = 'site' " .
" AND sptoolmultimedia.FK_Collection = tmpSpToolIDs.ID_Collection " .
" ORDER BY sptoolmultimedia.ID_Multimedia");
if($sqlType=="SpTool")
{
echo "";
echo " | Taxon | ";
if($ShowUnitIDSP == "1") {
echo "Voucher ID | "; }
if($ShowCollCodeSP == "1") {
echo "Coll. Code | "; }
if($ShowInstCodeSP == "1") {
echo "Inst. Code | "; }
echo "Coll. Date | Collector(s) | Country | ";
echo " | ";
echo "
|
";
for ($i=1; $i<=$pagesum; $i++) {
$row=mysqli_fetch_array($result1);
{
$SpToolcount++;
if($SpToolcount<=$pagesize)
{
$ID = $row['ID_Collection'];
$LinkSpecimen = "sqlType=Detail&ID_Collection=".$ID;
if($_GET['page'] > 1) { $LinkSpecimen .= "&Page=".$_GET['page']; }
$number = ($page-1)*$pagesize+$i;
echo "
".build_href("query_sptool.php", $LinkSpecimen, $number).". |
".build_href("query_sptool.php", $LinkSpecimen, $NameAuthorYearB[$row['ID_Collection']])." | ";
if($ShowUnitIDSP == "1")
{ echo "".$row['UnitID_Specimen']." | "; }
if($ShowCollCodeSP == "1")
{ echo "".$row['CollectionCode_Specimen']." | "; }
if($ShowInstCodeSP == "1")
{ echo "".$row['InstitutionCode_Specimen']." | "; }
echo "".substr($row['CollectionDateMin'], 0, -9);
if($row['CollectionDateMax'] != "0000-00-00 00:00:00" and $row['CollectionDateMax'] != NULL) { echo " - ".substr($row['CollectionDateMax'], 0, -9); }
echo " | ".$row['Collectors']." |
".$row['IsoCode']." |
";
if ($row['BasisOfRecord'] == "PreservedSpecimen" or $row['BasisOfRecord'] == "MaterialSample") { echo "S "; }
if ($row['BasisOfRecord'] == "LivingSpecimen") { echo "L "; }
if ($row['BasisOfRecord'] == "HumanObservation") { echo "O "; }
if ($row['BasisOfRecord'] == "Germplasm") { echo "G "; }
if ($row['BasisOfRecord'] == "Fossil") { echo "F "; }
if ($row['LongitudeMin'] != "" and $row['LatitudeMin'] != "") { echo ""; }
if ($row['Multimedia'] == "Yes") { echo " "; }
echo " |
";
}
} }
echo "
";
}
if($sqlType=="Detail")
{
echo "