po/src/print.log.php

79 lines
2.4 KiB
PHP

<?php
// Copyright (C) 2006-2013 Solomon Peachy (pizza@shaftnet.org)
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
include_once "include/config.php";
include_once "include/site.php";
$database = site_prolog(PO_USER_TYPE_USER);
if (isset($_REQUEST['id'])) {
$id = $_REQUEST['id'];
pg_query($database, "begin");
$result = pg_query($database, "delete from print_results where users = $po_user[id] and identifier <= $id");
if (!$result) {
pg_query($database, "rollback");
site_push_error($strings['errors_db_insert_failed']);
} else {
pg_query($database, "commit");
}
header("Location: print.log.php");
site_epilog($database);
exit();
}
site_header($strings['print_log']);
site_navigator(1);
site_navigator_status(disp_user_string($database, $po_user['id']). " : $strings[print_log]", "");
$data = pg_query($database, "select identifier, log_data from print_results where users = $po_user[id] order by identifier limit 500");
for ($i = 0 ; $i < pg_num_rows($data) ; $i++) {
$row = pg_fetch_row($data, $i);
print "$row[1]\n";
}
print emit_import_actions($database, $po_user['id']);
print emit_print_actions($database, $po_user['id']);
if (pg_num_rows($data)) {
print "<div align=\"center\">";
print "<form name=\"photo\" method=\"post\" action=\"print.log.php\" accept-charset=\"".$strings['formats_encoding']."\">";
print "<input type=\"hidden\" name=\"id\" value=\"$row[0]\"/>\n";
print $thm_elem['button.confirm.delete'];
print "</form>";
print "</div>";
}
site_footer($database);
site_epilog($database);
exit();
// query table, orderd by sequence id
// display all entries. record max id.
// if entries > 0, display "Delete logs" button.
// if delete_logs button pressed:
?>