<?/*
Copyright (C) 2003 Media Net Link, Inc. Danville, CA 94526 USA

This file is part of AthenaRMS.

AthenaRMS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

AthenaRMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/?>
<?
  ## $results is an array of hashes (each hash has ticket information)
  ## based on the query_id provided to the script
/*
the following fields are available in $results (taken from List_Query_Tickets in lib/search_result.php:
      select t.ticket_id,
             t.status,
             p.first_name,
             p.last_name,
             p.email,
             p.company,
             t.created_date,
             t.problem_id,
             t.source_id,
             t.account_id,
             t.info1,
             t.info2,
             t.support_person_id,
             t.escalated_to_person_id,
             t.mass_queue,
             s.source,
             pt.problem_type,
             t.subject,
             t.user_person_id,
             ps.last_name as SUPPORT_LAST_NAME,
             ps.first_name as SUPPORT_FIRST_NAME,
             pe.last_name as ESCALATED_LAST_NAME,
             pe.first_name as ESCALATED_FIRST_NAME,
             p.work_phone,
             p.home_phone,
             p.pager_num,
             p.cell_phone,
             p.title
*/
?>

<table cellpadding="1" border="0" cellspacing="0" width="100%"><tr class="first"><td>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr class="first">
  <td nowrap="nowrap" class="hdr-sm">&nbsp;Date&nbsp;</td>
  <td nowrap="nowrap" class="hdr-sm">&nbsp;Ticket ID&nbsp;</td>
  <td nowrap="nowrap" class="hdr-sm">&nbsp;Subject&nbsp;</td>
  <td nowrap="nowrap" class="hdr-sm">&nbsp;First Name&nbsp;</td>
  <td nowrap="nowrap" class="hdr-sm">&nbsp;Last Name&nbsp;</td>
  <td nowrap="nowrap" class="hdr-sm">&nbsp;Status&nbsp;</td>
</tr>

<?php
  $i=0;
  foreach ($results as $rec) {
    if ($i%2 == 0) {
      $color = 'off';
      $backgr = 'off-sm';
    } else {
      $color = 'on';
      $backgr = 'on-sm';
    }
    $i++;

    print "<tr class=\"$color\">\n";

    foreach (array ('created_date') as $col) {
      if (!$rec[$col]) $rec[$col] = '&nbsp;';
      print "  <td nowrap=\"nowrap\" class=\"$backgr\">&nbsp;$rec[$col]&nbsp;</td>\n";
    }
    $query_id = $_REQUEST['query_id'];
    print "  <td class=\"$backgr\">&nbsp;<a href=\"edit_ticket?ticket_id=$rec[ticket_id]&amp;query_id=$query_id\">$rec[ticket_id]</a>&nbsp;</td>\n";
    foreach (array ('subject', 'first_name', 'last_name', 'status') as $col) {
      if (!$rec[$col]) $rec[$col] = '&nbsp;';
      print "  <td class=\"$backgr\">&nbsp;$rec[$col]&nbsp;</td>\n";
    }
    print "</tr>\n";
  }
?>

</table>
</td></tr></table>
