Mit dem Formular können Sie die Publikationen verwalten. |
Journal_View; }
#######################################Error 5a###############################################################
if(!$sql1)
{ $msg = $result1."\n";
$msg .= "####Error 5a####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
$autcount=0;
$AuthorArray = explode(";", $formAuthor);
while($i = each($AuthorArray))
{
$Author = trim($i[1]);
// ist der Autor bereits bekannt?
if($Author)
{
$resulta = "SELECT ID_Author FROM tableauthors " .
"WHERE Author = '$Author'";
$sqla = mysql_query($resulta);
while($row = mysql_fetch_object($sqla))
{$ID_Author_Test = $row->ID_Author; }
#######################################Error Author-A###############################################################
if(!$sqla)
{ $msg = $resulta."\n";
$msg .= "####Error Author-A####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
if(mysql_num_rows($sqla))
{$IDAuthor[$autcount++] = mysql_result($sqla, 0, 0);}
// wenn unbekannt, insert
else
{
$resultb = "INSERT INTO tableauthors (Author, Created_Who) " .
"VALUES('$Author','$log')";
$sqlb = mysql_query($resultb);
$IDAuthor[$autcount++]=mysql_insert_id();
#######################################Error Author-B###############################################################
if(!$sqlb)
{ $msg = $resultb."\n";
$msg .= "####Error Author-B####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
}
}
}// Ende der Autorenschleife
$resultc = "DELETE FROM tablepublications_authors WHERE ID_Publications = '$formPublication'";
$sqlc = mysql_query($resultc);
#######################################Error Author-C###############################################################
if(!$sqlc)
{ $msg = $resultc."\n";
$msg .= "####Error c####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
if($sqlc)
{
#############################################################################################################
for($i=0; $i<$autcount; $i++)
{
if($i!=0) $sql .= ",";
$sql .= "($formPublication, $IDAuthor[$i])";
$resultd = "INSERT INTO tablepublications_authors (ID_Publications, ID_Author, Created_Who) " .
"VALUES ('$formPublication','$IDAuthor[$i]','$log')";
$sqld = mysql_query($resultd);
#######################################Error Author-D###############################################################
if(!$sqld)
{ $msg = $resultd."\n";
$msg .= "####Error d####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
}
}
if($sql0)
{
$result2 = "SELECT tableauthors.ID_Author, " .
"tableauthors.Author AS Author1 " .
"FROM tableauthors, tablepublications_authors " .
"WHERE tableauthors.ID_Author = tablepublications_authors.ID_Author " .
" AND tablepublications_authors.ID_Publications = '$formPublication'";
$sql2 = mysql_query($result2);
#######################################Error 7###############################################################
if(!$sql2)
{ $msg = $result2."\n";
$msg .= "####Error 7####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
while($row = mysql_fetch_object($sql2))
{
if(isset($Author1[$row->ID_Publication]))
{$Author1[$row->ID_Publications] .= ", "; }
else {$Author1[$row->IDPublications] = ""; }
$tmp = $row->Author1;
$Author1[$row->ID_Publications] .= $tmp;
}
$Paper = $Author1[$row->ID_Publications];
if(isset($formEds)) { $Paper .= " ".$formEds; }
$Paper .= " (".$formYear."): ".$formTitle;
if($formJournal) { $Paper .= " ".$Journal; }
if(!$formJournal) { $Paper .= " IN: ".$formBook." ".$formPublisher; }
if($formVolume) { $Paper .= " ".$formVolume.": "; }
if($formPages) { $Paper .= " ".$formPages."."; }
$result3 = "UPDATE tablepublications_amplifications SET Paper_Cache = '$Paper' WHERE ID_Publications = '$formPublication'";
$sql3 = mysql_query($result3);
#######################################Error 8###############################################################
if(!$sql3)
{ $msg = $result3."\n";
$msg .= "####Error 8####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
if($sql2 and $sql3)
{echo "Data have been saved!"; }
}
}
?>
Author: |
or show all datasets: >
|
Year: | |
Title: | |
Journal: |
|
Book: | |
Publisher: | |
Online version available: | /> |
|
Authors have been deleted!"; } }
if($_GET['deletejournal'] == 'true')
{ $resultdeleteb = "DELETE FROM tablejournals WHERE ID_Journal NOT IN (SELECT ID_Journal FROM tablepublications)";
$sqldeleteb = mysql_query($resultdeleteb);
if($sqldeleteb) { echo "Journals have been deleted!"; } }
$resulttesta = "SELECT DISTINCT ID_Author, Author FROM tableauthors WHERE ID_Author NOT IN (SELECT ID_Author FROM tablepublications_authors)";
$sqltesta = mysql_query($resulttesta);
$resulttestb = "SELECT DISTINCT ID_Journal, Journal_View FROM tablejournals WHERE ID_Journal NOT IN (SELECT ID_Journal FROM tablepublications)";
$sqltestb = mysql_query($resulttestb);
if(mysql_num_rows($sqltesta))
{echo "Note: For the following authors don't exist publications: ";
while($row = mysql_fetch_object($sqltesta))
{ echo "".$row->Author. "; "; }
echo "Do you want to delete this authors from database? Yes | "; }
if(mysql_num_rows($sqltestb))
{echo "Note: For the following journals don't exist publications: ";
while($row = mysql_fetch_object($sqltestb))
{ echo "".$row->Journal_View. "; "; }
echo "Do you want to delete this journals from database? Yes | "; }
?>
Please select a publication!"; }
else {
if(isset($_POST['x']))
{ $mykey = key($_POST['formPublications']);
if($mykey = $_POST['x'])
{
$IDPublication = $_POST['formPublications'][$mykey];
} } //if($_POST['x']!="")
$result = "SELECT ID_Pub_Amp FROM tablepublications_amplifications WHERE ID_Publications = '$IDPublication'";
$sql = mysql_query($result);
#######################################Error 1###############################################################
if(!$sql)
{ $msg = $result."\n";
$msg .= "####Error 1####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
$number = mysql_num_rows($sql);
if($number >= 1 and $formAction == '1')
{ echo "Publikation kann nicht gelöscht werden, da ".$number." Amplifikationen mit ihr verknüpft sind!"; }
if($number == 0 and $formAction == '1')
{ $result = "DELETE FROM tablepublications WHERE ID_Publications = '$IDPublication'";
$sql = mysql_query($result);
#######################################Error 2###############################################################
if(!$sql)
{ $msg = $result."\n";
$msg .= "####Error 2####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
else { echo "Publikation wurde gelöscht!"; }
}
if($formAction == '2')
{
$result1 = "SELECT tablepublications.ID_Publications, " .
"tablepublications.Editors, " .
"tablepublications.Year, " .
"tablepublications.Title, " .
"tablejournals.Journal_View, " .
"tablepublications.Volume, " .
"tablepublications.Pages, " .
"tablepublications.Book, " .
"tablepublications.Publisher, " .
"tablepublications.Link " .
"FROM tablepublications
LEFT JOIN tablejournals ON tablepublications.ID_Journal = tablejournals.ID_Journal " .
"WHERE tablepublications.ID_Publications = '$IDPublication'";
$sql1 = mysql_query($result1);
#######################################Error 3###############################################################
if(!$sql1)
{ $msg = $result1."\n";
$msg .= "####Error 3####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
while($row = mysql_fetch_object($sql1))
{ $Editors = $row->Editors;
$Year = $row->Year;
$Title = $row->Title;
$JournalView = $row->Journal_View;
$Volume = $row->Volume;
$Pages = $row->Pages;
$Book = $row->Book;
$Publisher = $row->Publisher;
$Link = $row->Link; }
$result2 = "SELECT tableauthors.ID_Author, " .
"tableauthors.Author " .
"FROM tableauthors, tablepublications_authors " .
"WHERE tableauthors.ID_Author = tablepublications_authors.ID_Author " .
" AND tablepublications_authors.ID_Publications = '$IDPublication'";
$sql2 = mysql_query($result2);
#######################################Error 4###############################################################
if(!$sql2)
{ $msg = $result2."\n";
$msg .= "####Error 4####";
trigger_error($msg, E_USER_ERROR); }
#############################################################################################################
while($row = mysql_fetch_object($sql2))
{
if(isset($Author[$row->ID_Publication]))
{$Author[$row->ID_Publications] .= ";"; }
else {$Author[$row->IDPublications] = ""; }
$tmp = $row->Author;
$Author[$row->ID_Publications] .= $tmp;
}
echo "";
}
}
}
if($formSubmitSearch)
{
$result = "";
$sqlcreate = "CREATE TEMPORARY TABLE tmpPublicationIDs TYPE=HEAP ";
include("date.php");
$tr = "=";
$no = "!=";
$lk = "like";
$bt = ">=";
$st = "<=";
$parr = $_POST;
array($parr);
foreach ($parr as $var)
{
$i ++;
if(!empty($var) and $var!="Search")
{
switch (key($parr))
{
case 'formAuthor':
$str = "tableauthors.ID_Author ".$tr."'".$var."' AND ";
$description = " Author = ";
$value = $formAuthor;
break;
case 'formSearchYear':
$str = "tablepublications.Year ".$lk."'%".$var."%' AND ";
$description = " Year = ";
$value = $formSearchYear;
break;
case 'formSearchTitle':
$str = "tablepublications.Title ".$lk."'%".$var."%' AND ";
$description = " Title = ";
$value = $formSearchTitle;
break;
case 'formJournal':
$str = "(tablejournals.Journal_All ".$lk."'%".$var."%' OR ";
$str .= "tablejournals.Journal_View ".$lk."'%".$var."%') AND ";
$description = " Journal = ";
$value = $formJournal;
break;
case 'formSearchBook':
$str = "tablepublications.Book ".$lk."'%".$var."%' AND ";
$description = " Book = ";
$value = $formSearchBook;
break;
case 'formSearchPublisher':
$str = "tablepublications.Publisher ".$lk."'%".$var."%' AND ";
$description = " Publisher = ";
$value = $formSearchPublisher;
break;
case 'formOnline':
$str = "tablepublications.Link ".$no."'' AND ";
$description = " Online version = ";
$value = "available";
break;
}
$where[$i] = $str;
$descriptionall[$i] = $description;
$valueall[$i] = $value;
}
next($parr);
}
if(empty($str) and !isset($formShowAll))
{ echo ""; }
if(!empty($str) and isset($formShowAll))
{ echo "Please either enter a search key or select the checkbox! | "; }
else {
foreach($where AS $a) $string .= $a;
$l=strlen ($string);
$max = $l-4;
$where_str = substr($string, 0, $max);
$wherestr = ' WHERE ' . $where_str;
$result = $sqlcreate .
$result = "SELECT DISTINCT tablepublications.ID_Publications " .
"FROM tablepublications
LEFT JOIN tablejournals ON tablepublications.ID_Journal = tablejournals.ID_Journal
LEFT JOIN tablepublications_authors ON tablepublications.ID_Publications = tablepublications_authors.ID_Publications
LEFT JOIN tableauthors ON tablepublications_authors.ID_Author = tableauthors.ID_Author";
if(!empty($str)) {$result .= $wherestr; }
$sql = mysql_query($result) or die($result.' '.mysql_error());
if(!empty($result))
{
// just in case it is still here: drop tmpPublicationIDs
mysql_query("DROP TABLE IF EXISTS tmpPublicationIDs");
mysql_query($result);
if(!mysql_affected_rows())
{echo "No hits found."; }
else {
$result1 = "SELECT tablepublications.ID_Publications, " .
"tablepublications.Year, " .
"tablepublications.Title, " .
"tablepublications.Volume, " .
"tablepublications.Pages, " .
"tablepublications.Book, " .
"tablepublications.Publisher, " .
"tablepublications.Link, " .
"tablepublications.Created_Who, " .
"tablepublications.Created_When, " .
"tablejournals.Journal_View, " .
"tablejournals.Journal_All " .
"FROM tablepublications JOIN tmpPublicationIDs
LEFT JOIN tablejournals ON tablepublications.ID_Journal = tablejournals.ID_Journal " .
"WHERE tablepublications.ID_Publications = tmpPublicationIDs.ID_Publications";
$sql1 = mysql_query($result1);
echo " | ";
echo "
| ";
echo "Action: | | ";
echo "
| ";
}
}
}
}
?>
|
|