" target="_blank"> |
Add New Dataset |
|
| |
With this tool you can administer all different datasets related to your DNA or tissue samples.
Below the green box you can see all records found in the database. It is not possible to delete entries here. To do so please ask your administrator for assistance.
After finishing your entries please close this window and reload (F5) the input or search mask to get the updated list from database. |
| Sorry, as a guest you don't have permission for entering new data! If you want to search for existing DNA data please use the Search function! | "; }
else {
if($formSubmitSave)
{
if(empty($formDisplay))
{ unset($formDisplay); }
if($formDisplay=="")
{ echo "Please complete 'Display'"; }
if($formProtocol == "BIOCASE" and $formProvider == "")
{ echo "Please add BioCASE Access Point";
$TestProtocol = "false"; }
if($formDisplay!="" and $TestProtocol != "false")
{
$result= mysqli_query($GLOBALS["___mysqli_ston"], "SELECT ID_Dataset, Display FROM dataset " .
"WHERE Display = '$formDisplay'");
if(mysqli_num_rows($result))
{
echo "Dataset already exists!";
}
else
{
$NewDisplay = addslashes($formDisplay);
$NewInternExtern = addslashes($formInternExtern);
$NewInstitutionCode = addslashes($formInstitutionCode);
$NewDatasetKey = addslashes($formDatasetKey);
$NewProtocol = addslashes($formProtocol);
$NewProvider = addslashes($formProvider);
$sql = "INSERT INTO dataset (Display, FK_Provider, Internal_External, DatasetKey_GBIF, Protocol, InstitutionCode, Created_Who)" .
"VALUES ('$NewDisplay',NULL,'$NewInternExtern','$NewDatasetKey','$NewProtocol','$NewInstitutionCode','$log')";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql);
$ID_Dataset = ((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
if($NewProvider != "" and $NewProtocol == "BIOCASE")
{
$file = $NewProvider;
$dom = new DOMDocument();
$dom->Load($file);
$Schema = $dom->getElementsByTagName('SupportedSchemas');
foreach ($Schema as $Schema) { $ABCD = $Schema->getAttribute('namespace');
if($ABCD == "http://www.tdwg.org/schemas/abcd/2.06") { $FK_Schema = "'2'"; }
else { $FK_Schema = NULL; }
$sqlprovider = "INSERT INTO provider (Provider, FK_Schema, Created_Who) VALUES ('$Endpoint',$FK_Schema,'$log')";
$resultprovider = mysqli_query($GLOBALS["___mysqli_ston"], $sqlprovider);
$IDProvider=((is_null($___mysqli_res = mysqli_insert_id($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res); }
$sqlupdate = "UPDATE dataset SET FK_Provider = '$IDProvider' WHERE ID_Dataset = '$ID_Dataset'";
$resultupdate = mysqli_query($GLOBALS["___mysqli_ston"], $sqlupdate);
}
#######################################Error 1###############################################################
if(!$result)
{ $msg = $sql."\n";
$msg .= "####Error 1####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
else {
include("../config/DataSaved.php"); }
}
}
}//if ($formSubmitSave)
if($formSubmitUpdate)
{
$NewDisplay = addslashes($formDisplay);
$NewInternExtern = addslashes($formInternExtern);
$NewInstitutionCode = addslashes($formInstitutionCode);
$NewDatasetKey = addslashes($formDatasetKey);
$NewProtocol = addslashes($formProtocol);
$NewProvider = addslashes($formProvider);
$ID_Dataset = $_POST['ID_Dataset'];
$Current_Date = date('Y-m-d H:i:s');
$sqlcheck = "SELECT FK_Provider FROM dataset where ID_Dataset = '$ID_Dataset'";
$resultcheck = mysqli_query($GLOBALS["___mysqli_ston"], $sqlcheck);
if($resultcheck) {
$sql = "UPDATE dataset, provider SET dataset.Display = '$NewDisplay', dataset.Internal_External = '$NewInternExtern',
dataset.InstitutionCode = '$NewInstitutionCode', dataset.Protocol = '$NewProtocol', dataset.DatasetKey_GBIF = '$NewDatasetKey',
dataset.Updated_Who = '$log', dataset.Updated_When = '$Current_Date',
provider.Updated_Who = '$log', provider.Updated_When = '$Current_Date',
provider.Provider = '$NewProvider'
WHERE dataset.ID_Dataset = '$ID_Dataset'";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql); }
else {
$sql = "UPDATE dataset SET Display = '$NewDisplay', Internal_External = '$NewInternExtern', InstitutionCode = '$NewInstitutionCode',
Protocol = '$NewProtocol', DatasetKey_GBI = '$NewDatasetKey', Updated_Who = '$log', Updated_When = '$Current_Date'";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $sql); }
#######################################Error 2###############################################################
if(!$result)
{ $msg = $result."\n";
$msg .= "####Error 2####";
$msg .= $sql;
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
/**
* calling Error message
*/
include ("../config/Errorreport.php"); }
#############################################################################################################
else {
include("../config/ChangesAccepted.php"); }
} //if ($formSubmitUpdate)
?>
";
if($num_rows > 0) {
echo " |
|
";
echo"Display | Provider | Internal/External | Created | | ";
while ($row = mysqli_fetch_object($result))
{
echo "".$row->Display." | ".build_href1($row->Provider, $row->Provider)." | ";
if($row->Internal_External == 1) { echo "Internal | ";}
else { echo "External | ";}
echo "".$row->Created_Who." (".$row->Created_When.") | |
";
echo "
|
";
}
}
else { echo "No entries found. |
"; }
((mysqli_free_result($result) || (is_object($result) && (get_class($result) == "mysqli_result"))) ? true : false);
?>