function delete() { // load in tickets to do $ticketid = FSS_Input::getInt('ticketid'); $tickets = FSS_Input::getCmd('tickets'); $def_archive = FSS_Ticket_Helper::GetStatusID('def_archive'); if ($ticketid > 0) { $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->delete(); } } else { if ($tickets != '') { $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 100; $tickets->loadTicketsByStatus($tickets); foreach ($tickets->tickets as $ticket) { $ticket->delete(); } } } JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER']); }
static function parseRedirectType($status, $type) { $ticketid = FSS_Input::getInt('ticketid'); $ticket = new SupportTicket(); if (!$ticket->load($ticketid)) { $ticketid = 0; } if ($type == "" && $ticketid > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . FSS_Input::getInt('ticketid'), false); } $bits = explode("_", $type); // 2nd parameter of type is the status, so if current, use the status that has been passed in if ($bits[1] == "current") { $bits[1] = $status; } if (count($bits) != 2) { if ($ticketid > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . FSS_Input::getInt('ticketid'), false); } else { return FSSRoute::_('index.php?option=com_fss&view=admin_support', false); } } if ($bits[0] == "list") { return FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $bits[1], false); } if ($bits[0] == "new" || $bits[0] == "old") { // get current tickets for the current handler of a specific type JRequest::setVar('tickets', $bits[1]); $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 500; $tickets->loadTicketsByStatus($bits[1]); $oldest_time = time(); $oldest_id = -1; $newest_time = 0; $newset_id = -1; foreach ($tickets->tickets as $ticket) { $updated = strtotime($ticket->lastupdate); if ($updated > $newest_time) { $newest_time = $updated; $newset_id = $ticket->id; } if ($updated < $oldest_time) { $oldest_time = $updated; $oldest_id = $ticket->id; } } if ($bits[0] == "new" && $newset_id > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $newset_id, false); } if ($bits[0] == "old" && $oldest_id > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $oldest_id, false); } return FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $bits[1], false); } if ($ticketid > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . FSS_Input::getInt('ticketid')); } return FSSRoute::_('index.php?option=com_fss&view=admin_support', false); }