Esempio n. 1
0
<h1 class="page-header">
    <i class="fa fa-fw fa-bar-chart-o"></i>レポート
</h1>
<h4 class="bg-success"><?php 
display_message();
?>
</h4>

<table class="table table-hover">
    <thead>
        <tr>
            <th>ID</th>
            <th>商品ID</th>
            <th>注文ID</th>
            <th>商品名</th>
            <th>価格</th>
            <th>数量</th>
            <th>売上高</th>            
            <th>注文日</th>
            <th>注文時間</th>
        </tr>
    </thead>
    <tbody>
        <?php 
display_reports();
?>
    </tbody>
</table>
Esempio n. 2
0
function display_admin_page()
{
    ?>
	<div class="container">
		<div style="display: flex; justify-content: space-between;">
			<div>
				<div class="panel panel-primary">
					<div class="panel-heading">
						<div class="panel-title">Filter by</div>
					</div>
					<div class="panel-body">
						<div class="filter_block">
							<div class="filter_title">Report state</div>
							<div class="filter_lines"><a href="?filter=state&sid=0">NEW</a></div>
							<div class="filter_lines"><a href="?filter=state&sid=1">FIXED</a></div>
							<div class="filter_lines"><a href="?filter=state&sid=2">DUPLICATE</a></div>
							<div class="filter_lines"><a href="?filter=state&sid=3">INVALID</a></div>
							<div class="filter_lines"><a href="?filter=state&sid=4">WONTFIX</a></div>
							<div class="filter_lines"><a href="?filter=state&sid=-1"><b>ALL</b></a></div>	
						</div>
						<div class="filter_block">
							<div class="filter_title">Mistake type</div>
<?php 
    global $reason_names;
    foreach ($reason_names as $key => $value) {
        echo "<div class=\"filter_lines\"><a href=\"?filter=reason&rid={$key}\">{$value}</a></div>";
    }
    ?>
							<div class="filter_lines"><a href="?filter=reason&rid=-1"><b>ALL</b></a></div>
						</div>
					</div>
				</div>
			</div>
			<div style="width: 80%;">
				<div class="panel panel-default">
					<div class="panel-heading">
						<div class="panel-title">Reports
<?php 
    if ($_GET["sid"]) {
        echo '&nbsp;&nbsp;<span class="label label-success">' . get_label($_GET["filter"], $_GET["sid"]) . '</span>';
    } else {
        if ($_GET["rid"]) {
            echo '&nbsp;&nbsp;<span class="label label-success">' . get_label($_GET["filter"], $_GET["rid"]) . '</span>';
        }
    }
    ?>
						</div>
					</div>
					<div class="panel-body">
						<table class="table" id="table_reports">
							<thead>
								<tr>
									<th width="50%">Question</th>
									<th class="middle">Category</th>
									<th class="middle">Mistake</th>
									<th class="middle">Added on</th>
									<th class="middle">State</th>
								</tr>
							</thead>
							<tbody>
<?php 
    global $db;
    global $state_types;
    global $reason_exists;
    global $count_rows;
    global $current_page;
    global $COUNT_PER_PAGE;
    if ($_GET["page"] && is_numeric($_GET["page"])) {
        $current_page = intval($_GET["page"]);
    }
    if ($_GET["filter"] == "state") {
        if ($_GET["sid"] >= 0 && $_GET["sid"] <= 4) {
            list($reports, $count_rows) = $db->filter_report_state($_GET["sid"], $current_page);
            display_reports($reports);
        } else {
            list($reports, $count_rows) = $db->get_reports($current_page);
            display_reports($reports);
        }
    } else {
        if ($_GET["filter"] == "reason") {
            if ($reason_exists) {
                list($reports, $count_rows) = $db->filter_report_reason($_GET["rid"], $current_page);
                display_reports($reports);
            } else {
                list($reports, $count_rows) = $db->get_reports($current_page);
                display_reports($reports);
            }
        } else {
            list($reports, $count_rows) = $db->get_reports($current_page);
            display_reports($reports);
        }
    }
    $count_pages = ceil($count_rows / $COUNT_PER_PAGE);
    if ($count_pages == 0) {
        $count_pages = 1;
    }
    $current_page = max(1, min($count_pages, $current_page));
    ?>
							</tbody>
						</table>
					</div>
				</div>
				<center>
<?php 
    $class_previous = "";
    $class_next = "";
    if ($_GET["filter"] && $_GET["rid"]) {
        $qstring = "filter=" . htmlentities($_GET['filter']) . "&rid=" . htmlentities($_GET['rid']) . "&page=";
    } else {
        if ($_GET["filter"] && $_GET["sid"]) {
            $qstring = "filter=" . htmlentities($_GET['filter']) . "&sid=" . htmlentities($_GET['sid']) . "&page=";
        } else {
            $qstring = "page=";
        }
    }
    $href_previous = "href=\"index.php?" . $qstring . ($current_page - 1) . "\"";
    $href_next = "href=\"index.php?" . $qstring . ($current_page + 1) . "\"";
    if ($current_page == 1) {
        $class_previous = 'class="disabled"';
        $href_previous = "";
    }
    if ($current_page == $count_pages) {
        $class_next = 'class="disabled"';
        $href_next = "";
    }
    ?>
					<nav>
						<ul class="pagination">
						<li <?php 
    echo $class_previous;
    ?>
>
							<a <?php 
    echo $href_previous;
    ?>
 aria-label="Previous">
								<span aria-hidden="true">&laquo;</span>
							</a>
						</li>
<?php 
    for ($i = 1; $i <= $count_pages; $i++) {
        if ($i == $current_page) {
            echo "<li class=\"active\"><a href=\"index.php?{$qstring}{$i}\">{$i}</a></li>";
        } else {
            echo "<li><a href=\"index.php?{$qstring}{$i}\">{$i}</a></li>";
        }
    }
    ?>
						<li <?php 
    echo $class_next;
    ?>
>
							<a <?php 
    echo $href_next;
    ?>
 aria-label="Next">
								<span aria-hidden="true">&raquo;</span>
							</a>
						</li>
						</ul>
					</nav>
				</center>
			</div>
		</div>
	</div>
<?php 
}