Mercurial > hg > fapweb
comparison print.php @ 95:d9de08fb5b28
Work on hardcopy/votekey list printing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Oct 2013 20:29:24 +0300 |
parents | b58a36f4821e |
children | 7d9e8c82e744 |
comparison
equal
deleted
inserted
replaced
94:6edd7d623eab | 95:d9de08fb5b28 |
---|---|
3 // Printing / hardcopy output helper module | 3 // Printing / hardcopy output helper module |
4 // | 4 // |
5 $sessionType = "admin"; | 5 $sessionType = "admin"; |
6 require "mconfig.inc.php"; | 6 require "mconfig.inc.php"; |
7 require "msite.inc.php"; | 7 require "msite.inc.php"; |
8 require "mcommon.inc.php"; | |
8 require "msession.inc.php"; | 9 require "msession.inc.php"; |
9 | 10 |
11 $pageCSS = "hardcopy.css"; | |
12 | |
10 // Check if we are allowed to execute | 13 // Check if we are allowed to execute |
11 if (!stCheckHTTPS() || !stAdmSessionAuth()) | 14 if (!stCheckHTTPS() || !stAdmSessionAuth(TRUE)) |
12 { | 15 { |
13 stSetupCacheControl(); | 16 stSetupCacheControl(); |
14 | 17 |
15 stSessionEnd(SESS_ADMIN); | 18 stSessionEnd(SESS_ADMIN); |
16 | 19 |
34 { | 37 { |
35 case "email": | 38 case "email": |
36 // | 39 // |
37 // Generic e-mail data dump | 40 // Generic e-mail data dump |
38 // | 41 // |
39 if (($res = stExecSQLCond( | 42 $sql = "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC"; |
40 "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC", | 43 if (($res = stExecSQL($sql)) !== FALSE) |
41 "Dump OK.")) !== FALSE) | |
42 { | 44 { |
45 cmPrintPageHeader("E-mails"); | |
43 $out1 = array(); | 46 $out1 = array(); |
44 $out2 = array(); | 47 $out2 = array(); |
45 | 48 |
46 foreach ($res as $item) | 49 foreach ($res as $item) |
47 { | 50 { |
48 $out1[] = $item["name"]." <".$item["email"].">"; | 51 $out1[] = $item["name"]." <".$item["email"].">"; |
49 $out2[] = $item["email"]; | 52 $out2[] = $item["email"]; |
50 } | 53 } |
51 | 54 |
52 echo "<br /><hr />". | 55 echo |
53 implode(", ", $out1)."<br /><hr /><br />". | 56 implode(", ", $out1)."<br /><hr /><br />\n". |
54 implode("<br />", $out1)."<br /><hr /><br />". | 57 implode("<br />", $out1)."<br /><hr /><br />\n". |
55 implode(", ", $out2)."<br /><hr /><br />". | 58 implode(", ", $out2)."<br /><hr /><br />\n". |
56 implode("<br />", $out2)."<br /><hr />"; | 59 implode("<br />", $out2)."<br /><hr />\n"; |
57 | 60 |
61 cmPrintPageFooter(); | |
58 } | 62 } |
59 break; | 63 break; |
60 | 64 |
61 case "votekeys": | 65 case "votekeys": |
62 // | 66 // |
63 // Print out votekeys | 67 // Print out votekeys as a table |
64 // | 68 // |
65 $sql = "SELECT * FROM votekeys ORDER BY id DESC"; | 69 $sql = "SELECT * FROM votekeys ORDER BY id ASC"; |
66 if (($res = stExecSQLCond($sql, "Done.")) !== FALSE) | 70 if (($res = stExecSQL($sql)) !== FALSE) |
67 { | 71 { |
72 cmPrintPageHeader("Votekeys"); | |
73 $keyLen = stGetSetting(""); | |
74 echo "<table class=\"votekeys\">\n"; | |
75 $index = 0; | |
76 foreach ($res as $item) | |
77 { | |
78 if ($index == 0) | |
79 echo "<tr>\n"; | |
80 | |
81 printf("<td><span class=\"keyid\">%03d</span> : <span class=\"keycode\">%-".$keyLen."s</span></td>\n", | |
82 $item["id"], $item["key"]); | |
83 | |
84 if ($index++ >= 5) | |
85 { | |
86 echo "</tr>\n"; | |
87 $index = 0; | |
88 } | |
89 } | |
90 if ($index > 0) | |
91 echo "</tr>\n"; | |
92 | |
93 echo "</table>\n"; | |
94 cmPrintPageFooter(); | |
68 } | 95 } |
69 break; | 96 break; |
70 | 97 |
71 default: | 98 default: |
72 stSetStatus(404, "Not Found"); | 99 stSetStatus(404, "Not Found"); |