# HG changeset patch # User Matti Hamalainen # Date 1382117364 -10800 # Node ID d9de08fb5b28b4c52f2dfeab740db207aa804d7e # Parent 6edd7d623eab932d5b50069b1df5e7a9052a2d60 Work on hardcopy/votekey list printing. diff -r 6edd7d623eab -r d9de08fb5b28 print.php --- 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 "

". - implode(", ", $out1)."


". - implode("
", $out1)."


". - implode(", ", $out2)."


". - implode("
", $out2)."

"; - + echo + implode(", ", $out1)."


\n". + implode("
", $out1)."


\n". + implode(", ", $out2)."


\n". + implode("
", $out2)."

\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 "\n"; + $index = 0; + foreach ($res as $item) + { + if ($index == 0) + echo "\n"; + + printf("\n", + $item["id"], $item["key"]); + + if ($index++ >= 5) + { + echo "\n"; + $index = 0; + } + } + if ($index > 0) + echo "\n"; + + echo "
%03d : %-".$keyLen."s
\n"; + cmPrintPageFooter(); } break;