Mercurial > hg > fapweb
changeset 95:d9de08fb5b28
Work on hardcopy/votekey list printing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 18 Oct 2013 20:29:24 +0300 |
parents | 6edd7d623eab |
children | 9959a8075aad |
files | print.php |
diffstat | 1 files changed, 40 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/print.php Fri Oct 18 20:28:58 2013 +0300 +++ b/print.php Fri Oct 18 20:29:24 2013 +0300 @@ -5,10 +5,13 @@ $sessionType = "admin"; require "mconfig.inc.php"; require "msite.inc.php"; +require "mcommon.inc.php"; require "msession.inc.php"; +$pageCSS = "hardcopy.css"; + // Check if we are allowed to execute -if (!stCheckHTTPS() || !stAdmSessionAuth()) +if (!stCheckHTTPS() || !stAdmSessionAuth(TRUE)) { stSetupCacheControl(); @@ -36,10 +39,10 @@ // // Generic e-mail data dump // - if (($res = stExecSQLCond( - "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC", - "Dump OK.")) !== FALSE) + $sql = "SELECT * FROM attendees WHERE email NOT NULL AND email != '' ORDER BY regtime DESC"; + if (($res = stExecSQL($sql)) !== FALSE) { + cmPrintPageHeader("E-mails"); $out1 = array(); $out2 = array(); @@ -49,22 +52,46 @@ $out2[] = $item["email"]; } - echo "<br /><hr />". - implode(", ", $out1)."<br /><hr /><br />". - implode("<br />", $out1)."<br /><hr /><br />". - implode(", ", $out2)."<br /><hr /><br />". - implode("<br />", $out2)."<br /><hr />"; - + echo + implode(", ", $out1)."<br /><hr /><br />\n". + implode("<br />", $out1)."<br /><hr /><br />\n". + implode(", ", $out2)."<br /><hr /><br />\n". + implode("<br />", $out2)."<br /><hr />\n"; + + cmPrintPageFooter(); } break; case "votekeys": // - // Print out votekeys + // Print out votekeys as a table // - $sql = "SELECT * FROM votekeys ORDER BY id DESC"; - if (($res = stExecSQLCond($sql, "Done.")) !== FALSE) + $sql = "SELECT * FROM votekeys ORDER BY id ASC"; + if (($res = stExecSQL($sql)) !== FALSE) { + cmPrintPageHeader("Votekeys"); + $keyLen = stGetSetting(""); + echo "<table class=\"votekeys\">\n"; + $index = 0; + foreach ($res as $item) + { + if ($index == 0) + echo "<tr>\n"; + + printf("<td><span class=\"keyid\">%03d</span> : <span class=\"keycode\">%-".$keyLen."s</span></td>\n", + $item["id"], $item["key"]); + + if ($index++ >= 5) + { + echo "</tr>\n"; + $index = 0; + } + } + if ($index > 0) + echo "</tr>\n"; + + echo "</table>\n"; + cmPrintPageFooter(); } break;