質問する
1708 次
2 に答える
0
2 つのアイデア:
a) これを行うには、選択が変更された後に各チケットの表示ステータスを切り替える JavaScript を実装します。
if ($_SESSION['staff'] >='6')
{
echo "<select name='type' id='type' onchange='typeChanged()' onpropertychange='typeChanged()'>
<option value='tab1'>Open Tickets</option>
<option value='tab2'>New Tickets</option>
<option value='tab3'>Under Review</option>
<option value='tab4'>Closed Tickets</option>
</select><BR>";
echo "Current listed support tickets: <BR><BR>";
echo "<div id="tab1" name="tabs">";
$result1 = mysql_query("SELECT * FROM support WHERE status = 'New Ticket' OR 'Under Review'");
while ($row1 = mysql_fetch_array($result1))
{
$ticket1 = $row1['TicketID'];
$user1 = $row1['name'];
echo "Ticket ID: " . $row1['TicketID'] . "<BR>" . $row1['type'] . "<BR>Subject: " . $row1['subject'] . "<BR>Ticket Status: " . $row1['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket1' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user1' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
echo "</div>";
echo "<div id="tab2" name="tabs">";
$result2 = mysql_query("SELECT * FROM support WHERE status = 'New Ticket'");
while ($row2 = mysql_fetch_array($result2))
{
$ticket2 = $row2['TicketID'];
$user2 = $row2['name'];
echo "Ticket ID: " . $row2['TicketID'] . "<BR>" . $row2['type'] . "<BR>Subject: " . $row2['subject'] . "<BR>Ticket Status: " . $row2['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket2' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user2' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
echo "</div>";
echo "<div id="tab3" name="tabs">";
$result3 = mysql_query("SELECT * FROM support WHERE status = 'New Ticket'");
while ($row3 = mysql_fetch_array($result3))
{
$ticket3 = $row3['TicketID'];
$user3 = $row3['name'];
echo "Ticket ID: " . $row3['TicketID'] . "<BR>" . $row3['type'] . "<BR>Subject: " . $row3['subject'] . "<BR>Ticket Status: " . $row3['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket3' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user3' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
echo "</div>";
echo "<div id="tab4" name="tabs">";
$result4 = mysql_query("SELECT * FROM support WHERE status = 'Closed'");
while ($row4 = mysql_fetch_array($result4))
{
$ticket4 = $row4['TicketID'];
$user4 = $row4['name'];
echo "Ticket ID: " . $row4['TicketID'] . "<BR>" . $row4['type'] . "<BR>Subject: " . $row4['subject'] . "<BR>Ticket Status: " . $row4['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket4' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user4' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
echo "</div>";
echo "Click <A href='overview_page.php'>HERE</A> to return to the overview page.<BR>";
echo "Click <A href='uitlogen_user.php'>HERE</A> to logout!<BR>";
}else
{
echo "You need to be an GM or Admin to view this page!<BR>";
echo "Click <A href='uitlogen_user.php'>HERE</A> to login!";
}
?>
<script type="text/javascript">
function typeChanged()
{
var chosen = document.getElementById('type').value;
var tabs = document.getElementsByName('tabs');
for (var i in tabs)
{
tabs[i].style.display = 'none';
}
document.getElementById(chosen).style.display = 'block';
}
</script>
b) いくつかの url パラメータを使用してこのページにリダイレクトし、どのチケットが選択されているかを示し、対応するチケットを表示します。
<?PHP
session_start();
include('connection.php');
if ($_SESSION['staff'] >='6')
{
$chosen = isset($_GET['chosen']) ? $_GET['chosen'] : 'tab1';
echo "<select name='type' id='type' onchange='typeChanged()' onpropertychange='typeChanged()'>
<option value='tab1'>Open Tickets</option>
<option value='tab2'>New Tickets</option>
<option value='tab3'>Under Review</option>
<option value='tab4'>Closed Tickets</option>
</select><BR>";
echo "Current listed support tickets: <BR><BR>";
if ($chosen == 'tab1')
{
$result1 = mysql_query("SELECT * FROM support WHERE status = 'New Ticket' OR 'Under Review'");
while ($row1 = mysql_fetch_array($result1))
{
$ticket1 = $row1['TicketID'];
$user1 = $row1['name'];
echo "Ticket ID: " . $row1['TicketID'] . "<BR>" . $row1['type'] . "<BR>Subject: " . $row1['subject'] . "<BR>Ticket Status: " . $row1['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket1' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user1' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
}
if ($chosen == 'tab2')
{
$result2 = mysql_query("SELECT * FROM support WHERE status = 'New Ticket'");
while ($row2 = mysql_fetch_array($result2))
{
$ticket2 = $row2['TicketID'];
$user2 = $row2['name'];
echo "Ticket ID: " . $row2['TicketID'] . "<BR>" . $row2['type'] . "<BR>Subject: " . $row2['subject'] . "<BR>Ticket Status: " . $row2['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket2' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user2' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
}
if ($chosen == 'tab3')
{
$result3 = mysql_query("SELECT * FROM support WHERE status = 'New Ticket'");
while ($row3 = mysql_fetch_array($result3))
{
$ticket3 = $row3['TicketID'];
$user3 = $row3['name'];
echo "Ticket ID: " . $row3['TicketID'] . "<BR>" . $row3['type'] . "<BR>Subject: " . $row3['subject'] . "<BR>Ticket Status: " . $row3['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket3' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user3' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
}
if ($chosen == 'tab4')
{
$result4 = mysql_query("SELECT * FROM support WHERE status = 'Closed'");
while ($row4 = mysql_fetch_array($result4))
{
$ticket4 = $row4['TicketID'];
$user4 = $row4['name'];
echo "Ticket ID: " . $row4['TicketID'] . "<BR>" . $row4['type'] . "<BR>Subject: " . $row4['subject'] . "<BR>Ticket Status: " . $row4['status'] . "<BR>";
echo "<form action='detail_ticket.php?t=$ticket4' method='post' name='detail_t' id='detail_t'><input type='submit' name='detail_b' id='detail_b' value='View Ticket!'></form>";
echo "<form action='reply_ticket.php?r=$user4' method='post' name='r_ticket' id='r_ticket'><input type='submit' name='reply_b' id='reply_b' value='Reply on Ticket!'></form>";
}
}
echo "Click <A href='overview_page.php'>HERE</A> to return to the overview page.<BR>";
echo "Click <A href='uitlogen_user.php'>HERE</A> to logout!<BR>";
}else
{
echo "You need to be an GM or Admin to view this page!<BR>";
echo "Click <A href='uitlogen_user.php'>HERE</A> to login!";
}
?>
<script type="text/javascript">
function typeChanged()
{
var chosen = document.getElementById('type').value;
window.location.href = 'FILENAME.php?chosen=' + chosen;
}
</script>
于 2013-06-06T15:49:32.440 に答える