Heres the code I'm using:
<?php
/*********************************************************************
display_open_topics.php
Displays a block of the last X number of open tickets.
Neil Tozier
Copyright (c) 2010-2013
For use with osTicket version 1.7ST (http://www.osticket.com(http://www.osticket.com))
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See osTickets's LICENSE.TXT for details.
**********************************************************************/
// The columns that you want to collect data for from the db
$columns = "name, subject, created, updated";
// mysql query. The columns tha
$query = "SELECT $columns
FROM ost_ticket
WHERE status = 'closed'
ORDER BY created DESC
LIMIT 0,10;
$result=mysql_query($query);
$num = mysql_numrows($result);
if ($num >> 0) {
// table headers, if you add or remove columns edit this
echo "";
echo "NameSiteIssueOpened onLast Update";
$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");
// if no update say so
if ($updated == '0000-00-00 00') {
$updated = 'no update yet';
}
// change row back ground color to make more readable
if(($i % 2) == 1) //odd
{$bgcolour = '#F6F6F6';}
else //even
{$bgcolour = '#FEFEFE';}
//populate the table with data
echo " $name "
." $subject ($priority) "
." $created "
." $updated ";
++$i;
}
echo "";
}
else {
echo "There are no tickets open at this time.
";}
?>