-
Notifications
You must be signed in to change notification settings - Fork 1
/
data.php
86 lines (80 loc) · 2.48 KB
/
data.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
85
86
<?php
include(dirname(__FILE__).'/Biblio.php');
include(dirname(__FILE__).'/Charline.php');
include(dirname(__FILE__).'/Net.php');
include(dirname(__FILE__).'/Table.php');
$playcode = @$_REQUEST['play'];
$data = @$_REQUEST['data'];
$sqlite = "test.sqlite";
$pdo = new PDO('sqlite:'.$sqlite);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$play = $pdo->query("SELECT * FROM play WHERE code = ".$pdo->quote( $playcode ))->fetch();
if ($play && $data && $data == 'spline') {
header("Content-type: text/plain; charset=UTF-8");
echo "PLAY\tID\tCHARS\tTOKENS\t@who\tPERS\n";
$dist = array();
$qrole = $pdo->prepare("SELECT * FROM role WHERE play = ? ");
$qrole->execute(array($play['id']));
while ($role = $qrole->fetch()) {
$dist[$role['id']] = $role['code'];
}
$qpres = $pdo->prepare("SELECT * FROM presence WHERE configuration = ? ORDER BY sp DESC, rowid");
$qsp = $pdo->prepare("SELECT * FROM sp WHERE configuration = ? ");
$qconf = $pdo->prepare("SELECT * FROM configuration WHERE play = ? ");
$qconf->execute(array($play['id']));
while ($conf = $qconf->fetch()) {
// order pers in conf by size
$pers = array();
$qpres->execute(array($conf['id']));
$char = 65;
while ($pres = $qpres->fetch()) {
$pers[$pres['role']] = chr($char);
$char++;
}
echo $play['code'];
echo "\t";
echo "\t";
echo "\t";
echo "\t";
echo "\t";
echo "\n";
$qsp->execute(array($conf['id']));
while ($sp = $qsp->fetch()) {
echo $play['code'];
echo "\t";
echo $sp['code'];
echo "\t";
echo $sp['c'];
echo "\t";
echo $sp['w'];
echo "\t";
echo $dist[$sp['role']];
echo "\t";
echo $pers[$sp['role']];
echo "\n";
}
}
exit();
}
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" charset="utf-8" type="text/css" href="http://oeuvres.github.io/Teinte/tei2html.css"/>
<link rel="stylesheet" charset="utf-8" type="text/css" href="dramagraph.css"/>
<style>
</style>
</head>
<body id="top">
<form style="position: fixed; z-index: 3; background: rgba(255, 255, 255, 0.8); font-family: sans-serif; left:0; right: 0; top: 0; " target="_blank"> <a href=".?">◤</a>
<?php echo Dramagraph_Biblio::select( $pdo, $playcode ); ?>
<select name="data">
<option/>
<option value="spline">Ligne des répliques</option>
</select>
<input type="submit"/>
</form>
<?php
?>
</body>
</html>