This repository has been archived by the owner on Mar 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
listNoHiskiLinks.php
84 lines (69 loc) · 2.81 KB
/
listNoHiskiLinks.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fi" lang="fi">
<head>
<?php session_start(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Taapeli - puuttuvat Hiski-linkit</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<?php
include 'inc/checkUserid.php';
include "inc/start.php";
include 'libs/models/GedDateParser.php';
include "inc/dbconnect.php";
/*
* -- Content page starts here -->
*/
echo '<h1>Henkilöt, joilla ei ole Hiski-linkkiä</h1>
<p>Lisää Hiski-linkki klikkaamalla henkilön id:tä<p>';
$query_string = "MATCH (n:Person:" . $userid . ")-[:HAS_NAME]-(m)
OPTIONAL MATCH (n)-[r:HISKI_LINK]->() WITH n,r,m
WHERE r IS NULL RETURN n,m ORDER BY m.last_name, m.first_name";
$query = new Everyman\Neo4j\Cypher\Query($sukudb, $query_string);
$result = $query->getResultSet();
$id = [];
foreach ($result as $row)
{
$id[] = $row[0]->getProperty('id');
$first_name[] = $row[1]->getProperty('first_name');
$last_name[] = $row[1]->getProperty('last_name');
$later_names[] = $row[1]->getProperty('later_names');
}
for ($i=0; $i<sizeof($id); $i++) {
$query_string = "MATCH (n:Person:" . $userid . ")-[:BIRTH]->(b) "
. "WHERE n.id='" . $id[$i] . "' RETURN b";
$query = new Everyman\Neo4j\Cypher\Query($sukudb, $query_string);
$result = $query->getResultSet();
foreach ($result as $row)
{
$birth_date[] = $row[0]->getProperty('birth_date');
}
$query_string = "MATCH (n:Person:" . $userid . ")-[:BIRTH]->(b)-[:BIRTH_PLACE]->(p) "
. "WHERE n.id='" . $id[$i] . "' RETURN p";
$query = new Everyman\Neo4j\Cypher\Query($sukudb, $query_string);
$result = $query->getResultSet();
foreach ($result as $row)
{
$birth_place[] = $row[0]->getProperty('name');
}
}
echo '<table class="tulos">';
echo '<tr><th>Id<th>Etunimet<th>Sukunimi<th>Myöh. sukunimi<th>Syntymäaika
<th>Syntymäpaikka</tr>';
for ($i=0; $i<sizeof($id); $i++) {
echo "<tr><td><a href='readIndividData.php?id=" .
$id[$i] . "'>" . $id[$i] .
"</a></td><td>" . $first_name[$i] .
"</td><td> " . $last_name[$i] .
"</td><td> " . (isset($later_names[$i]) ? $later_names[$i] : '') .
"</td><td> " . (isset($birth_date[$i]) ?
GedDateParser::toDisplay($birth_date[$i]) : '') .
"</td><td> " . (isset($birth_place[$i]) ? $birth_place[$i] : '') .
"</td></tr>";
}
echo "</table><p> </p>";
/*
* --- End of content page ---
*/
include "inc/stop.php";