We use a sort of "status" page so that people can see what tickets are open prior to opening a ticket. We accomplished this by adding some code to the site/index.php near the bottom to include another file.
<div class="clear"></div>
<br />
<hr />
Before opening a new ticket for site outages, etc. Please review the open tickets beflow to ensure that a ticket is not already open.<br />
<? include('display_open_topics.php'); ?>
</div>
<br />
before
<?require(CLIENTINC_DIR.'footer.inc.php'); ?>
and then crafted a quick and dirty file called display_open_topics.php in that same directory. Here are the contents of the file.
<?php
/*********************************************************************
display_open_topics.php
Displays a block of the last X number of open tickets.
Neil Tozier <iamtmib@gmail.com>
Copyright (c) 2010
For use with osTicket (http://www.osticket.com)
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
**********************************************************************/
//include_once('./include/settings.php');
# configure this area with your database connection information
$dbhost = 'localhost';
$dbname = 'YourDatabaseName';
$dbuser = 'YourDBUser';
$dbpass = 'YourPassword';
// The columns that you want to collect data for from the db
$columns = "name, subject, created, updated, agency, priority_id";
// The maximum amount of open tickets that you want to display.
$limit ='10';
// mysql query. The columns tha
$query = "SELECT $columns
FROM ost_ticket
WHERE status = 'open'
ORDER BY created DESC
LIMIT 0,$limit";
//mysql_connect($dbhost,$dbuser,$dbpass);
//@mysql_select_db($dbname) or die( "DB Error: Unable to select database");
$result=mysql_query($query);
$num = mysql_numrows($result);
if ($num >> 0) {
// table headers, if you add or remove columns edit this
echo "<br><table border-color=#CC9999 border=1 align=center cell-spacing=2><tr align=center style='background-color: #CC9999;'>";
echo "<td><b>Name</b></td><td><b>Site</b></td><td><b>Issue</b></td><td><b>Opened on</b></td><td><b>Last Update</b></td></tr>";
$i=0;
while ($i < $num) {
// You will need one line below for each column name that you collect and want to display.
// If you are unfamiliar with php its essentially $uniqueVariable = mysql junk ( columnName );
// Just copy one of the lines below and change the $uniqueVariable and columnName
$name = mysql_result($result,$i,"name");
$subject = mysql_result($result,$i,"subject");
$created = mysql_result($result,$i,"created");
$updated = mysql_result($result,$i,"updated");
$agency = mysql_result($result,$i,"agency");
$priority = mysql_result($result,$i,"priority_id");
// look up site/agency and display proper name
// mysql query.
$getsite = "SELECT agency FROM ost_agencies WHERE id = $agency";
$siteresult=mysql_query($getsite);
$site = mysql_result($siteresult,0,"agency");
//mysql_close();
//populate the table with data
echo "<tr align=center><td> $name </td><td> $site </td><td> $subject ($priority) </td>"
."<td> $created </td><td> $updated </td></tr>";
++$i;
}
echo "</table>";
}
else {
echo "<br><center><font color=red><b>There are no tickets open at this time.</b></font></center><br>";
}
?>
Note this will probably not work out of the box for you. We have a couple of custom fields that we use in tickets. But it should provide you with an idea of how to achieve your goal.