<?php
/* issue.php written for radtracker program
Display all the issues resolved and unresolved.
Takes as input possible sorting/filtering criteria as category/user
*/
session_register("lname");
session_register("pass");
include("pagefunctions.php");
include("checkuser.php");
$userstatus = checkuser($lname, $pass);
$message="everything";
$useext=FALSE;
if(!IsSet($cat) && (strlen($CAT)>1))
{
$catsql=" and category='$CAT'";
$useext=TRUE;
$message=$CAT;
}
if(!IsSet($con) && (strlen($CON)>1))
{
$catsql=" and contact='$CON'";
$useext=TRUE;
$message=$CON;
}
/*function gentable generates a table of issues. The variable $var1 sets whether
the resolved or unresolved issues are displayed. Anchors of the issues load the
actions.php page*/
function gentable ($var1,$catsql,$usecat)
{
global $mode;
if ($var1==0)
$varout="Unresolved Issues";
else
$varout="Resolved Issues";
global $order;
global $CAT;
global $CON;
$pCON = ereg_replace(" ", "+", $CON);
$pCAT = ereg_replace(" ", "+", $CAT);
if($order == "") $order = "Date DESC";
global $PHP_SELF;
global $connection;
$sql_command = "SELECT * FROM issue Where Resolution=$var1";
if ($usecat) $sql_command .= $catsql;
$sql_command .= " ORDER BY $order";
if ($var1 == 0) $imagesrc = "images/unres.gif";
elseif ($var1 == 1) $imagesrc = "images/res.gif";
$sql_result = mysql_query($sql_command,$connection) or die (mysql_error());
?>
<tr><Td><table width=99% align="left" border="1" cellpadding="2" cellspacing="2">
<TR>
<td align=middle><b>Details</b></td>
<td align=middle>
<b>
<?php echo $varout;?>
</b>
</td>
<td align=center>
<b><a href='<? echo "$PHP_SELF?CAT=$pCAT&CON=$pCON&order=Date DESC"?>'>Date</a></b>
</td>
<td align=center>
<b><a href='<? echo "$PHP_SELF?CAT=$pCAT&CON=$pCON&order=Severity"?>'>Severity</a></b>
</td>
<td align=center>
<b><a href='<? echo "$PHP_SELF?CAT=$pCAT&CON=$pCON&order=Category"?>'>Category</a></b>
</td>
<td align=center>
<b><a href='<? echo "$PHP_SELF?CAT=$pCAT&CON=$pCON&order=Contact"?>'>Contact</a></b>
</td>
</tr>
<?php
while ($row = mysql_fetch_array($sql_result)) {
$descrip=$row["Description"];
$mdate=$row["Date"];
$serv=$row["Severity"];
$contact=$row["Contact"];
$cat=$row["Category"];
$iuid=$row["IUID"];
echo "<TR>
<TD><font size='2'><a href=actions.php?IUID=$iuid><img src='$imagesrc' border='0'></a></font></td>
<TD><font size='2'>$descrip</font></td>
<Td width=80 align=middle><font size='2'>$mdate</font></td>
<td><font size='2'>$serv</font></td>
<td><font size='2'>$cat</font></td>
<td><font size='2'>$contact</font></td>
</tr>";
}
echo "</table></td></tr>";
}
/* Main Program */
if ($userstatus == "isvalid") {
gentop("Add a Topic");
echo "<table><TR><TD>You searched for all issues related to $message</td></tr>";
gentable(0,$catsql,$useext);
gentable(1,$catsql,$useext);
echo "</table>";
genbottom();
}
else {
global $serverhome;
header("Location: " . $serverhome . "/radtracker/login.php?from=$PHP_SELF");
}
?>