As I wanted to sort the list by Department and to display only non-closed tickets by default, I completelly changed the template to something like this:
PHP Code:
<?
$my_ticketlist = (array) $this->_vars["ticketlist"];
$my_departmentlist = (array) $this->_vars["_SWIFT"]["departmentcache"];
$my_tldepartment = array ();
$my_tlticketid = array ();
$my_currentdepartmentid = NULL;
$my_rowclass = "row1";
// Filter closed tickets and prepare sort
foreach ($my_ticketlist as $key => $value) {
if ( $value["status"] != "Closed" ) {
array_push ($my_tldepartment, $my_departmentlist[$value["departmentid"]]["displayorder"]);
array_push ($my_tlticketid, $value["ticketid"]);
}
}
// Sort the ticket list by department
array_multisort ($my_tldepartment, SORT_ASC, $my_tlticketid, SORT_DESC);
// Display the sorted ticket list
foreach($my_tlticketid as $key => $value) {
$my_currentticket = $my_ticketlist[$value];
$my_staffid = $my_currentticket["ownerstaffid"];
if ( $my_currentticket["departmentid"] != $my_currentdepartmentid ) {
if ( isset($my_currentdepartmentid) ) {
// Close department list table
}
// Display department title and start list
}
// Display ticket
}
?>
The side effect is that if the client have mutiple pages of tickets with old tickets open the pagination will be strange. I didn't get as far as making the nice coloring of rows from Kayako...
More a post for development, but I hope it helps though.
Anne
N.B. That was set up in previous stable version, still works, my PHP code may not be optimal, performances not tested, also I quickly withdrew the terrible html that I need from my website because that probably doesn't help anybody...