/
sim.php
45 lines (39 loc) · 1 KB
/
sim.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
##########################################################
# Testeley - Testing the Mendeley API
#
# Script: sim.php
#
# Shows the contents of the similarity table in the
# local database.
#
# HS 2011-07-06
##########################################################
require_once('config.inc.php');
require_once('functions.inc.php');
require_once('LitDb.php');
$db = new LitDb(DB_PATH);
$sims = $db->get_all_sim();
if(isset($_GET['format']) && $_GET['format'] == "tsv") {
header('Content-type: text/plain');
//header('Content-Disposition: attachment; filename="edges.txt"');
foreach($sims as $s) {
echo $s[0]."\t".$s[1]."\n";
}
} else {
html_header();
link_home();
if(count($sims) > 0) {
echo '<h3>Similarity relations in local database: '.count($sims).'</h3>';
foreach($sims as $s) {
$u1 = $s[0];
$u2 = $s[1];
echo "<a href='details.php?uuid={$u1}'>{$u1}</a> -> <a href='details.php?uuid={$u2}'>{$u2}</a>";
echo '<br />';
}
} else {
echo 'No records found.';
}
html_footer();
}
?>