-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnonconstituents-tags.php
55 lines (47 loc) · 1.72 KB
/
nonconstituents-tags.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
<?php
include('functions.php');
include('connect_mysql.php');
include('functions.display.php');
// Comment out to avoid errors, etc. if not in debug mode.
$debug = isset($_GET['debug']);
$debugExtra = "";
if(!$debug)
define('SUPPRESS_OUTPUT', true);
else
$debugExtra = "&debug=true";
?><!DOCTYPE html>
<html>
<?php head('reports', 'Reports: Nonconstituents by Type'); ?>
<body>
<?php nav('reports', 'nonconstituents-tags'); ?>
<div class="container" id='container'>
<?php
$links = $db->get_results('select basic.entry, basic.id, basic.content, basic.text, basic.href, tags.name, tags_xref.tid from (select * from (select lc.entry, lc.id, date, text, href, content, constituency from link_constituency as lc
left join links as l on (lc.entry = l.entry and lc.id = l.id)
join entries as e on (e.id = l.entry)
order by date desc) as t group by entry, id having constituency = "not_constituent") as basic
join tags_xref on (basic.entry = tags_xref.entry and basic.id = tags_xref.id)
join tags on (tags.id = tags_xref.tid and tags.constituency_specific = "not_constituent")
order by tags_xref.tid');
?>
<?php if (is_array($links)):
$type = 0;
foreach ($links as $link):
if ( $type != $link->tid ) {
if ( $type )
echo "</ol>"; // close the last list
$type = $link->tid;
echo "<h2>" . esc_html($link->name) . "</h2>";
echo "<ol>";
}
$text = formatDisplayEntry(wp_kses_data($link->content), $link->text, str_replace('&', '&', $link->href));
?>
<li><a href='display.php?entry=<?php echo (int) $link->entry; ?>&id=<?php echo (int) $link->id; ?>'>#<?php echo (int) $link->entry; ?>:<?php echo (int) $link->id; ?></a>: <?php echo $text; ?></li>
<?php
endforeach;
if ( $type )
echo '</ol>';
endif; ?>
</div><!--/container-->
</body>
</html>