예제 #1
0
 * @copyright (C) 2013 Freestyle Joomla
 * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die;
require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'translate.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'support_tickets.php';
require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'support_source.php';
?>

<?php 
echo FSS_Helper::PageSubTitle("<a href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support') . "'><img src='" . JURI::root(true) . "/components/com_fss/assets/images/support/support_24.png'>&nbsp;" . JText::_("SUPPORT_TICKETS") . "</a>", false);
?>

<ul>
	<?php 
FSS_Ticket_Helper::GetStatusList();
$counts = SupportTickets::getTicketCount();
FSS_Translate_Helper::Tr(FSS_Ticket_Helper::$status_list);
foreach (FSS_Ticket_Helper::$status_list as $status) {
    if ($status->def_archive) {
        continue;
    }
    if ($status->is_closed) {
        continue;
    }
    if (!array_key_exists($status->id, $counts)) {
        continue;
    }
    if ($counts[$status->id] < 1) {
        continue;
    }
예제 #2
0
 static function GetClosedStatus()
 {
     FSS_Ticket_Helper::GetStatusList();
     $ids = array();
     foreach (FSS_Ticket_Helper::$status_list as $status) {
         if ($status->is_closed && !$status->def_archive) {
             $ids[(int) $status->id] = (int) $status->id;
         }
     }
     if (count($ids) == 0) {
         $ids[] = 0;
     }
     return $ids;
 }
예제 #3
0
 function &getTicketCount()
 {
     $user = JFactory::getUser();
     $userid = $user->get('id');
     if (empty(self::$ticket_counts)) {
         self::$ticket_counts = array();
     }
     if (array_key_exists($userid, self::$ticket_counts)) {
         $this->_counts = self::$ticket_counts[$userid];
         return $this->_counts;
     }
     $uidlist = $this->getUIDS($userid);
     $tidlist = $this->getTIDS($userid);
     $db = JFactory::getDBO();
     $query = "SELECT count( * ) AS count, ticket_status_id FROM #__fss_ticket_ticket WHERE (user_id IN (" . implode(", ", $uidlist) . ") OR id IN ( " . implode(", ", $tidlist) . ")) ";
     $query .= " AND " . SupportSource::user_list_sql();
     $query .= " GROUP BY ticket_status_id";
     $db->setQuery($query);
     $rows = $db->loadAssocList();
     $out = array();
     FSS_Ticket_Helper::GetStatusList();
     foreach (FSS_Ticket_Helper::$status_list as $status) {
         $out[$status->id] = 0;
     }
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             $out[$row['ticket_status_id']] = $row['count'];
         }
     }
     // work out counts for allopen, closed, all, archived
     $archived = FSS_Ticket_Helper::GetStatusID("def_archive");
     if (array_key_exists($archived, $out)) {
         $out['archived'] = $out[$archived];
     } else {
         $out['archived'] = 0;
     }
     $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed", true);
     $out['open'] = 0;
     foreach ($allopen as $id) {
         if (array_key_exists($id, $out)) {
             $out['open'] += $out[$id];
         }
     }
     $allclosed = FSS_Ticket_Helper::GetClosedStatus();
     $out['closed'] = 0;
     foreach ($allclosed as $id) {
         if (array_key_exists($id, $out)) {
             $out['closed'] += $out[$id];
         }
     }
     $all = FSS_Ticket_Helper::GetStatusIDs("def_archive");
     $out['all'] = 0;
     foreach ($rows as $row) {
         if ($row['ticket_status_id'] != $all) {
             $out['all'] += $row['count'];
         }
     }
     $this->_counts = $out;
     self::$ticket_counts[$userid] = $out;
     return $this->_counts;
 }
예제 #4
0
 static function &getTicketCount($foradmin = true, $current_handler_only = false)
 {
     $key = 0;
     if ($foradmin) {
         $key += 1;
     }
     if ($current_handler_only) {
         $key += 2;
     }
     if (empty(self::$counts)) {
         self::$counts = array();
     }
     if (!array_key_exists($key, self::$counts)) {
         $db = JFactory::getDBO();
         $query = "SELECT count( * ) AS count, ticket_status_id FROM #__fss_ticket_ticket as t WHERE 1 ";
         $query .= " AND " . SupportUsers::getAdminWhere();
         if ($foradmin) {
             $query .= " AND " . SupportSource::admin_list_sql();
         } else {
             $query .= " AND " . SupportSource::user_list_sql();
         }
         if ($current_handler_only) {
             $query .= " AND admin_id = " . JFactory::getUser()->id;
         }
         $query .= " GROUP BY ticket_status_id";
         $db->setQuery($query);
         $rows = $db->loadAssocList();
         $out = array();
         FSS_Ticket_Helper::GetStatusList();
         foreach (FSS_Ticket_Helper::$status_list as $status) {
             $out[$status->id] = 0;
         }
         if (count($rows) > 0) {
             foreach ($rows as $row) {
                 $out[$row['ticket_status_id']] = $row['count'];
             }
         }
         // work out counts for allopen, closed, all, archived
         $archived = FSS_Ticket_Helper::GetStatusID("def_archive");
         $out['archived'] = 0;
         if (array_key_exists($archived, $out)) {
             $out['archived'] = $out[$archived];
         }
         $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed", true);
         $out['allopen'] = 0;
         foreach ($allopen as $id) {
             if (array_key_exists($id, $out)) {
                 $out['allopen'] += $out[$id];
             }
         }
         $allclosed = FSS_Ticket_Helper::GetClosedStatus();
         $out['allclosed'] = 0;
         foreach ($allclosed as $id) {
             if (array_key_exists($id, $out)) {
                 $out['allclosed'] += $out[$id];
             }
         }
         $all = FSS_Ticket_Helper::GetStatusIDs("def_archive", true);
         $out['all'] = 0;
         foreach ($all as $id) {
             if (array_key_exists($id, $out)) {
                 $out['all'] += $out[$id];
             }
         }
         self::$counts[$key] = $out;
     }
     return self::$counts[$key];
 }
예제 #5
0
 static function getUserTicketCounts($userid, $email)
 {
     $db = JFactory::getDBO();
     if ($userid) {
         $qry = "SELECT count(*) as cnt, ticket_status_id FROM #__fss_ticket_ticket WHERE user_id = '" . FSSJ3Helper::getEscaped($db, $userid) . "' GROUP BY ticket_status_id";
     } else {
         $qry = "SELECT count(*) as cnt, ticket_status_id FROM #__fss_ticket_ticket WHERE email = '" . FSSJ3Helper::getEscaped($db, $email) . "' GROUP BY ticket_status_id";
     }
     $db->setQuery($qry);
     $rows = $db->loadObjectList();
     $out = array();
     FSS_Ticket_Helper::GetStatusList();
     $out['total'] = 0;
     if (count($rows) > 0) {
         foreach ($rows as $row) {
             $out[$row->ticket_status_id] = $row->cnt;
             $out['total'] += $row->cnt;
         }
     }
     return $out;
 }