DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL and SQLite; also available for Wordpress.

Welcome! Log In Create A New Profile

Advanced

export data from details table

Posted by VipersGarden 
export data from details table
April 13, 2014 05:33AM
Hello,

first I have to admit that I'm very happy with DADABIK.
I have versions installed 3.2 and 4.6 online.
I know these are very old ones, but enough for what I'm using for (I have a stand alone passwort system on the server installed).

But here are my questions now:
I would like to make my data available for ZOTERO.
zotero uses meta-data from the head of the file.
Here the source text of the test file:
<head>
<title>Unbenanntes Dokument</title>
    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"; />
	<META NAME="DC.Type.articleType" CONTENT="Text.Serial.Journal">
	<meta name="citation_authors" content="Alcock, A. & F. Finn"/>
	<meta name="DC.Date" scheme="ISO8601" content="1896"/>
	<meta name="DC.Title" content="An account of the reptilia collected by Dr. F.P. Maynard, Captain A.H. McMahon, C.I.E. and the members of the Afgan - Baluch - Boundary Commission of 1896."/>
    <meta name="citation_journal_title" content="J. Asiat. Soc. Bengal 65: 550-566"/>
	<meta name="DC.description.abstract" content="The reptiles mentioned in this paper were collected by the members of the Afghan - Baluch Boundary Commission in the early part of the present year in the course of the demarcation of the boundary line between Baluchistan and Afghanistan. They include several extremely rare and two new species of lizards and two new snakes - Lytorhynchus and a viper which forms the type of a new genus.
The nature of the country in which they were collected is briefly described in the following introdactory note by Dr, F. P. Maynard, I.M.S., who has also contributed field notes on the habits, colouration, etc., of the several species.
All Dr. Maynards notes are enclosed between square brackets."/>
	<meta name="DC.format" content="application/pdf"/>
	<meta name="citation_pdf_url" content="http://vipersgarden.at/PDF_files/PDF-001.pdf"/>;
</head>
<body>
<h3>Details of record: 0001
</h3>
<hr>
<table width="99%" border="1" cellspacing="5" cellpadding="5">
<tr><td>Author: </td><td>Alcock, A. & F. Finn</td></tr>
<td>Year of publication: </td><td>1896</td></tr>
<td>Title:</td><td>An account of the reptilia collected by Dr. F.P. Maynard, Captain A.H. McMahon, C.I.E. and the members of the Afgan - Baluch - Boundary Commission of 1896.</td></tr>
<td>Journal:</td><td>J. Asiat. Soc. Bengal 65: 550-566</td></tr>
<td>Abstract:</td><td>The reptiles mentioned in this paper were collected by the members of the Afghan - Baluch Boundary Commission in the early part of the present year in the course of the demarcation of the boundary line between Baluchistan and Afghanistan. They include several extremely rare and two new species of lizards and two new snakes - Lytorhynchus and a viper which forms the type of a new genus.
The nature of the country in which they were collected is briefly described in the following introdactory note by Dr, F. P. Maynard, I.M.S., who has also contributed field notes on the habits, colouration, etc., of the several species.
All Dr. Maynards notes are enclosed between square brackets.</td></tr>
<td>Size in KB:</td><td>2699</td></tr>
<td>PDF to download:</td><td><a href  = "../PDF_files/PDF-001.pdf"target="_blank">PDF</a></td></tr>
</table>
</body>
</html>
For this, I wrote this php-code
	$query = "SELECT * FROM pdf_lit WHERE PDF_Nr='0001'";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result))
{ ?>
<head>
<title>Unbenanntes Dokument</title>
    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"; />
	<META NAME="DC.Type.articleType" CONTENT="Text.Serial.Journal">
	<meta name="citation_authors" content="<?PHP echo $line[Autor];?>"/>
	<meta name="DC.Date" scheme="ISO8601" content="<?PHP echo $line[year];?>"/>
	<meta name="DC.Title" content="<?PHP echo $line[Titel];?>"/>
    <meta name="citation_journal_title" content="<?PHP echo $line[Journal];?>"/>
	<meta name="DC.description.abstract" content="<?php if(!empty($line['abstract'])) {echo $line['abstract'];} else {echo "no abstract/summary available";}?>"/>
	<meta name="DC.format" content="application/pdf"/>
	<meta name="citation_pdf_url" content="http://vipersgarden.at/PDF_files/<?php echo $line[upload]; ?>"/>
</head>
<body>
<h3>Details of record: 0001
</h3>
<hr>
<table width="99%" border="1" cellspacing="5" cellpadding="5">
<tr><td>Author: </td><td><?PHP echo $line[Autor];?></td></tr>
<td>Year of publication: </td><td><?PHP echo $line[year];?></td></tr>
<td>Title:</td><td><?PHP echo $line[Titel];?></td></tr>
<td>Journal:</td><td><?PHP echo $line[Journal];?></td></tr>
<td>Abstract:</td><td><?php if(!empty($line['abstract'])) {echo $line['abstract'];} else {echo "no abstract/summary available";}?></td></tr>
<td>Size in KB:</td><td><?PHP echo $line;?></td></tr>
<td>PDF to download:</td><td><a href  = "../PDF_files/<?php echo $line[upload]; ?>"target="_blank"><?php if(!empty($line[upload])) {echo "PDF";} else {echo "";}?></a></td></tr>
</table>
<?php
}
mysql_free_result($result);
?>
</body>
</html>
So DADABIK only changes the table, my solution would be to open a new file with these data.
a) where I have to put the link from the details symbol in the main page?
b) whats the name of the array containing the data of the details?

view the test page (without layout)
If you dont have zotero, there is a symbol in the browser adress line (red arrow).

and the data are stored within zotero


Thanks for help!
Mario

Mario Schweiger
http://www.vipersgarden.at
Re: export data from details table
April 13, 2014 06:23AM
Hello,

I have found now the code to replace the link from the dadabik main table, symbol details to my "test file"
In business_logic I replaced (around line 3007)
			if ($enable_details == "1"){ // display the details icon
				$results_table .= "<a class=\"onlyscreen\" target=\"_".$edit_target_window."\" href=\"".$dadabik_main_file."?table_name=".urlencode($table_name)."&function=details&where_field=".urlencode($where_field)."&where_value=".urlencode($where_value)."\"><img border=\"0\" src=\"".$details_icon."\" alt=\"".$submit_buttons_ar["details"]."\" title=\"".$submit_buttons_ar["details"]."\"></a>";
			} // end if
with this
			if ($enable_details == "1"){ // display the details icon
				$results_table .= "<a href=../../test_zotero001b.php><img border=\"0\" src=\"".$details_icon."\" alt=\"".$submit_buttons_ar["details"]."\" title=\"".$submit_buttons_ar["details"]."\"></a>";
			} // end if
Works great!
What I now still need is the array, storing all the details for the details table.
Any help would be very much appreciated!
Mario
Thanks
Re: export data from details table
April 13, 2014 10:04AM
Hello,

I'VE GOT IT !!!
I changes in business:logic, around line 3007
from:
			if ($enable_details == "1"){ // display the details icon
				$results_table .= "<a class=\"onlyscreen\" target=\"_".$edit_target_window."\" href=\"".$dadabik_main_file."?table_name=".urlencode($table_name)."&function=details&where_field=".urlencode($where_field)."&where_value=".urlencode($where_value)."\"><img border=\"0\" src=\"".$details_icon."\" alt=\"".$submit_buttons_ar["details"]."\" title=\"".$submit_buttons_ar["details"]."\"></a>";
			} // end if
to:
			if ($enable_details == "1"){ // display the details icon
			$eintrag =urlencode($where_value);
				$results_table .= "<a href=details_page.php?PDF_Nr=$eintrag><img border=\"0\" src=\"".$details_icon."\" alt=\"".$submit_buttons_ar["details"]."\" title=\"".$submit_buttons_ar["details"]."\"></a>";
			} // end if
and the new built details page (this demo still without layout)
    mysql_select_db($mysqldb, $connection) or die("Konnte die Datenbank nicht waehlen.");
	$eintrag = $_GET['PDF_Nr']; <! not working in this demo >
	$query = "SELECT * FROM pdf_lit WHERE PDF_Nr='5843'";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result))

{ ?>
<head>
<title>Unbenanntes Dokument</title>
    <link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"; />
	<META NAME="DC.Type.articleType" CONTENT="Text.Serial.Journal">
	<meta name="citation_authors" content="<?PHP echo $line[Autor];?>"/>
	<meta name="DC.Date" scheme="ISO8601" content="<?PHP echo $line[year];?>"/>
	<meta name="DC.Title" content="<?PHP echo $line[Titel];?>"/>
    <meta name="citation_journal_title" content="<?PHP echo $line[Journal];?>"/>
	<meta name="DC.description.abstract" content="<?php if(!empty($line['abstract'])) {echo $line['abstract'];} else {echo "no abstract/summary available";}?>"/>
	<meta name="DC.format" content="application/pdf"/>
	<meta name="citation_pdf_url" content="http://vipersgarden.at/PDF_files/<?php echo $line[upload]; ?>"/>
</head>

<body>
<h3>Details of record: <?PHP echo $eintrag;?>5843 <! variable not working here, number manual entry for demo only! >
</h3>
<hr>
<table width="99%" border="1" cellspacing="5" cellpadding="5">
<tr><td>Author: </td><td><?PHP echo $line[Autor];?></td></tr>
<td>Year of publication: </td><td><?PHP echo $line[year];?></td></tr>
<td>Title:</td><td><?PHP echo $line[Titel];?></td></tr>
<td>Journal:</td><td><?PHP echo $line[Journal];?></td></tr>
<td>Abstract:</td><td><?php if(!empty($line['abstract'])) {echo $line['abstract'];} else {echo "no abstract/summary available";}?></td></tr>
<td>Size in KB:</td><td><?PHP echo $line;?></td></tr>
<td>PDF to download:</td><td><a href  = "../PDF_files/<?php echo $line[upload]; ?>"target="_blank"><?php if(!empty($line[upload])) {echo "PDF";} else {echo "";}?></a></td></tr>
</table>
<?php
}
mysql_free_result($result);
?>
</body>
</html>
Maybe not the best solution, but works perfect.
Unfortunately the DB is password protected, so here the unformatted demo
check it out

Mario
Sorry, only registered users may post in this forum.

Click here to login