Projet

Général

Profil

Télécharger (4,81 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / status_captiveportal_voucher_rolls.php @ 0cb60645

1
<?php
2
/*
3
	Copyright (C) 2007 Marcel Wiget <mwiget@mac.com>.
4
	All rights reserved.
5

    
6
	Redistribution and use in source and binary forms, with or without
7
	modification, are permitted provided that the following conditions are met:
8

    
9
	1. Redistributions of source code must retain the above copyright notice,
10
	   this list of conditions and the following disclaimer.
11

    
12
	2. Redistributions in binary form must reproduce the above copyright
13
	   notice, this list of conditions and the following disclaimer in the
14
	   documentation and/or other materials provided with the distribution.
15

    
16
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
17
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
18
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
	POSSIBILITY OF SUCH DAMAGE.
26
*/
27
/*
28
	pfSense_MODULE:	captiveportal
29
*/
30

    
31
##|+PRIV
32
##|*IDENT=page-status-captiveportal-voucher-rolls
33
##|*NAME=Status: Captive portal Voucher Rolls page
34
##|*DESCR=Allow access to the 'Status: Captive portal Voucher Rolls' page.
35
##|*MATCH=status_captiveportal_voucher_rolls.php*
36
##|-PRIV
37

    
38
require("guiconfig.inc");
39
require("functions.inc");
40
require_once("filter.inc");
41
require("shaper.inc");
42
require("captiveportal.inc");
43
require_once("voucher.inc");
44

    
45
$cpzone = $_GET['zone'];
46
if (isset($_POST['zone']))
47
	$cpzone = $_POST['zone'];
48

    
49
if (empty($cpzone)) {
50
	header("Location: services_captiveportal_zones.php");
51
	exit;
52
}
53

    
54
if (!is_array($config['captiveportal']))
55
	$config['captiveportal'] = array();
56
$a_cp =& $config['captiveportal'];
57
$pgtitle = array(gettext("Status"), gettext("Captive portal"), gettext("Voucher Rolls"), $a_cp[$cpzone]['zone']);
58
$shortcut_section = "captiveportal-vouchers";
59

    
60
if (!is_array($config['voucher'][$cpzone]['roll'])) {
61
	$config['voucher'][$cpzone]['roll'] = array();
62
}
63
$a_roll = &$config['voucher'][$cpzone]['roll'];
64

    
65
include("head.inc");
66
?>
67
<body>
68
<?php include("fbegin.inc"); ?>
69

    
70
<form action="status_captiveportal_voucher_rolls.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
71
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="tab pane">
72
	<tr>
73
		<td class="tabnavtbl">
74
		<?php
75
			$tab_array = array();
76
			$tab_array[] = array(gettext("Active Users"), false, "status_captiveportal.php?zone={$cpzone}");
77
			$tab_array[] = array(gettext("Active Vouchers"), false, "status_captiveportal_vouchers.php?zone={$cpzone}");
78
			$tab_array[] = array(gettext("Voucher Rolls"), true, "status_captiveportal_voucher_rolls.php?zone={$cpzone}");
79
			$tab_array[] = array(gettext("Test Vouchers"), false, "status_captiveportal_test.php?zone={$cpzone}");
80
			$tab_array[] = array(gettext("Expire Vouchers"), false, "status_captiveportal_expire.php?zone={$cpzone}");
81
			display_top_tabs($tab_array);
82
		?>
83
		</td>
84
	</tr>
85
	<tr>
86
		<td class="tabcont">
87
			<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="content pane">
88
				<tr>
89
					<td class="listhdrr"><?=gettext("Roll#"); ?></td>
90
					<td class="listhdrr"><?=gettext("Minutes/Ticket"); ?></td>
91
					<td class="listhdrr"><?=gettext("# of Tickets"); ?></td>
92
					<td class="listhdrr"><?=gettext("Comment"); ?></td>
93
					<td class="listhdrr"><?=gettext("used"); ?></td>
94
					<td class="listhdrr"><?=gettext("active"); ?></td>
95
					<td class="listhdr"><?=gettext("ready"); ?></td>
96
				</tr>
97
				<?php
98
					$voucherlck = lock("vouche{$cpzone}r");
99
					$i = 0; foreach($a_roll as $rollent):
100
					$used = voucher_used_count($rollent['number']);
101
					$active = count(voucher_read_active_db($rollent['number']),$rollent['minutes']);
102
					$ready = $rollent['count'] - $used;
103
					/* used also count active vouchers, remove them */
104
					$used = $used - $active;
105
				?>
106
				<tr>
107
					<td class="listlr">
108
						<?=htmlspecialchars($rollent['number']); ?>&nbsp;
109
					</td>
110
					<td class="listr">
111
						<?=htmlspecialchars($rollent['minutes']);?>&nbsp;
112
					</td>
113
					<td class="listr">
114
						<?=htmlspecialchars($rollent['count']);?>&nbsp;
115
					</td>
116
					<td class="listr">
117
						<?=htmlspecialchars($rollent['comment']); ?>&nbsp;
118
					</td>
119
					<td class="listr">
120
						<?=htmlspecialchars($used); ?>&nbsp;
121
					</td>
122
					<td class="listr">
123
						<?=htmlspecialchars($active); ?>&nbsp;
124
					</td>
125
					<td class="listr">
126
						<?=htmlspecialchars($ready); ?>&nbsp;
127
					</td>
128
				</tr>
129
				<?php $i++; endforeach; unlock($voucherlck); ?>
130
			</table>
131
		</td>
132
	</tr>
133
</table>
134
</form>
135
<?php include("fend.inc"); ?>
136
</body>
137
</html>
(181-181/254)