<?
include($DOCUMENT_ROOT.'/helpdesk/include/database.php');
include($DOCUMENT_ROOT.'/helpdesk/include/new_user.php');
session_start();
if ($valid != "yes") {
header("Location: /helpdesk/login.php");
exit;
}
$head = "Madify Call Status";
$bttm_menu = " <a class=bttm_menu href='/helpdesk/scripts/main_adminmenu.php'>Main Menu</a> |
<a class=bttm_menu href='/helpdesk/scripts/admin/admin_menu.php'>Prefs Menu</a> |
<a class=bttm_menu href='/helpdesk/logout.php'>Log Out</a> |
";
if ($submit_new) {
if ($stat_get_name_new) {
$sql = "INSERT INTO log_status (status_id, status_name) VALUES ('','$stat_get_name_new')";
//echo $sql;
$result = mysql_query($sql,$conn);
} else {
$warning .= "<td class=warning>** Cannot add to system - No data in the field";
}
}
if ($remove_sub) {
if ($remove) {
$sql = "DELETE FROM log_status WHERE status_id='$remove'"; //drop the whole line with id of ....
$result = mysql_query($sql,$conn);
//echo $sql;
} else {
$warning .= "<td class=warning>** You did not select a field to delete.";
}
}
//echo "<br>One status name: $stat_get_name1";
if ($submit) {
//echo "<br>Submit pressed";
//echo "<br>Stat Count: $stat_count";
for ($i = $stat_count;$i>'0';$i--) {
if ($stat_get_name[$i]) {
$temp = mysql_query("UPDATE log_status SET status_name = '$stat_get_name[$i]' WHERE status_id = '$hidden[$i]'",$conn);
} else {
$warning = "<td class=warning>** Changes NOT saved. Please ensure all fields have data entered";
}
}
if (!$warning) { $warning = "<td class=success>** Changes successfully saved"; }
}
$head = "Configure Status Names";
$stat_count = '0';
$sql = "SELECT * FROM log_status";
$result = mysql_query($sql,$conn);
while ($row = mysql_fetch_array($result)) {
$stat_id = $row['status_id'];
$stat_name = $row['status_name'];
if (!$stat_count) {
$stat_count = '1';
} else {
$stat_count++;
}
//$stat_name = addslashes($stat_name2);
//echo $stat_name;
$table .= "<tr class=standard_2><td nowrap class=redtext>Status No. $stat_count<td> - <td><input type=text name=stat_get_name[$stat_count] value=\"$stat_name\" size=30><td><input type=radio name=remove value='$stat_id'><input type=hidden name=hidden[$stat_count] value='$stat_id'>";
}
$table .= "<tr class=standard_2><td nowrap class=redtext>New Status<td> - <td><input type=text name=stat_get_name_new size=30><td><input type=submit name=submit_new value='Add'>";
$bottom = "
<h1>Configure Status Names</h1>
Here you may add extra fields or rename existing fields to suit your requirements. The names added here will be displayed on the Add a Request screen.<br><br>
To remove a field, click a radio button next to the field you wish to remove and then press the 'Remove Field' button below.
<br>
<br>
<form method=get action='$phpself'>
<table>
$table
<input type=hidden name=stat_count value='$stat_count'>
<tr><td colspan=2><br><input type=submit name=submit value='Save Changes'><td><br><input type=submit name=remove_sub value='Remove Field'>
</table>
</form>
";
include($DOCUMENT_ROOT.'/helpdesk/include/template.inc.php');
?>