diff --git a/inc/functions.php b/inc/functions.php
index f071534f9e..6ad56067d6 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -571,21 +571,65 @@ function make_pdf($id, $type, $out = 'browser')
$comment[] = $uploads['comment'];
}
// do we have files attached ?
- $filenb = count($real_name);
- if ($filenb > 0) {
+ if (count($real_name) > 0) {
$content .= "Attached file :
";
} else {
$content .= "Attached files :
";
}
$content .= "";
- for ($i=0; $i<$filenb;$i++) {
- $content .= "
Linked item :
";
+ } else {
+ $content .= "Linked items :
";
+ }
+ $content .= "";
+ for ($i=0; $i<$req->rowCount();$i++) {
+ // we need the url of the displayed item
+ if ($out === 'browser') {
+ $item_url = str_replace('experiments.php', 'database.php', $url);
+ } else { // call from make_zip
+ $item_url = str_replace('experiments.php', 'database.php', $url);
+ }
+ $full_item_url = $item_url."?mode=view&id=".$links_id_arr[$i];
+
+ $content .= "
elabid : ".$elabid."
"; $content .= "URL : ".$full_url."
"; } else { // ITEM diff --git a/make_zip.php b/make_zip.php index 7615e8d829..4b37877c51 100644 --- a/make_zip.php +++ b/make_zip.php @@ -107,9 +107,17 @@ $tags .= stripslashes($data['tag']).' '; } - // SQL to get filesattached - $sql = "SELECT * FROM uploads WHERE item_id = ".$id; + // SQL to get filesattached (of the right type) + $sql = "SELECT * FROM uploads WHERE item_id = :id AND type = :type"; $req = $pdo->prepare($sql); + // we could use $table instead of $type, but 'items' will be of type 'database', so we need this "if" + if ($table === 'items') { + $type = 'database'; + } else { + $type = $table; // experiments + } + $req->bindParam(':id', $id); + $req->bindParam(':type', $type); $req->execute(); $real_name = array(); $long_name = array();