outsource check for open support-tickets to init.php so that themes may display the info wherever they want

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-10-19 18:47:02 +02:00
parent 993d5114e3
commit 729b52cf0a
3 changed files with 34 additions and 24 deletions

View File

@@ -148,18 +148,6 @@ if($page == 'overview')
$cron_last_runs = getCronjobsLastRun();
$outstanding_tasks = getOutstandingTasks();
$opentickets = 0;
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"');
$awaitingtickets = $opentickets['count'];
$awaitingtickets_text = '';
if($opentickets > 0)
{
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
if(function_exists('sys_getloadavg'))
{
$loadArray = sys_getloadavg();

View File

@@ -60,18 +60,6 @@ if ($page == 'overview') {
$userinfo['traffic'] = round($userinfo['traffic'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo['traffic_used'] = round($userinfo['traffic_used'] / (1024 * 1024), $settings['panel']['decimal_places']);
$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_accounts email_forwarders email_quota email_autoresponder ftps tickets subdomains aps_packages');
$opentickets = 0;
$opentickets = $db->query_first('SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `customerid` = "' . $userinfo['customerid'] . '"
AND `answerto` = "0"
AND (`status` = "0" OR `status` = "2")
AND `lastreplier`="1"');
$awaitingtickets = $opentickets['count'];
$awaitingtickets_text = '';
if ($opentickets > 0) {
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
eval("echo \"" . getTemplate('index/index') . "\";");
} elseif ($page == 'change_password') {

View File

@@ -431,6 +431,40 @@ if (AREA == 'admin' || AREA == 'customer') {
unset($navigation_data);
}
/**
* header information about open tickets (only if used)
*/
if ($settings['ticket']['enabled'] == '1') {
$awaitingtickets = 0;
$awaitingtickets_text = '';
$opentickets = 0;
if (AREA == 'admin' && isset($userinfo['adminid'])) {
$opentickets = $db->query_first('
SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "1")
AND `lastreplier`="0" AND `adminid` = "' . $userinfo['adminid'] . '"
');
$awaitingtickets = $opentickets['count'];
if ($opentickets > 0) {
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="admin_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
}
elseif (AREA == 'customer' && isset($userinfo['customerid'])) {
$opentickets = $db->query_first('
SELECT COUNT(`id`) as `count` FROM `' . TABLE_PANEL_TICKETS . '`
WHERE `answerto` = "0" AND (`status` = "0" OR `status` = "2")
AND `lastreplier`="1" AND `customerid` = "' . $userinfo['customerid'] . '"
');
$awaitingtickets = $opentickets['count'];
if ($opentickets > 0) {
$awaitingtickets_text = strtr($lng['ticket']['awaitingticketreply'], array('%s' => '<a href="customer_tickets.php?page=tickets&amp;s=' . $s . '">' . $opentickets['count'] . '</a>'));
}
}
}
$webfont = str_replace('+', ' ', $settings['panel']['webfont']);
eval("\$header = \"" . getTemplate('header', '1') . "\";");