diff --git a/admin/admin_settings.php b/admin/admin_settings.php
index 7d3f1d22..0203eb6a 100644
--- a/admin/admin_settings.php
+++ b/admin/admin_settings.php
@@ -552,6 +552,14 @@ if (defined('HESK_DEMO')) {
+
+
+
+
+
+
+
@@ -1970,6 +1978,85 @@ if (defined('HESK_DEMO')) {
+
+
+
+
+
+
+
+
1 ORDER BY `cat_order`");
+$categories = [];
+while ($row = hesk_dbFetchAssoc($rs)) {
+ if (!$_SESSION['isadmin'] && !in_array($row['id'], $_SESSION['categories'])) {
+ continue;
+ }
+
+ $row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000' : 'background: ' . $row['color'];
+ $categories[] = $row;
+}
+
+/* Print header */
+require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
+
+/* Print main manage users page */
+require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'month',
+ 1 => 'agendaWeek',
+ 2 => 'agendaDay',
+ );
+ echo $view_array[$_SESSION['default_calendar_view']];
+ ?>
+
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
- $tmp = $i ? 'White' : 'Blue';
- $style = 'class="option' . $tmp . 'OFF" onmouseover="this.className=\'option' . $tmp . 'ON\'" onmouseout="this.className=\'option' . $tmp . 'OFF\'"';
- $i = $i ? 0 : 1;
+ ';
- } else {
- $remove_code = ' ';
- }
-
- /* Is category private or public? */
- if ($mycat['type']) {
- $type_code = '';
- } else {
- $type_code = '';
- }
-
- /* Is auto assign enabled? */
- if ($hesk_settings['autoassign']) {
- if ($mycat['autoassign']) {
- $autoassign_code = '';
- } else {
- $autoassign_code = '';
+ $res = hesk_dbQuery('SELECT COUNT(*) AS `cnt`, `category` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` GROUP BY `category`');
+ while ($tmp = hesk_dbFetchAssoc($res)) {
+ $tickets_all[$tmp['category']] = $tmp['cnt'];
+ $tickets_total += $tmp['cnt'];
}
- } else {
- $autoassign_code = '';
- }
- echo '
-
- ' . $mycat['id'] . ' |
- ' . $mycat['name'] . ' |
+ /* Get list of categories */
+ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `" . $orderBy . "` ASC");
+ $usersRes = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `isadmin` = '0' ORDER BY `name` ASC");
+ $users = array();
+ while ($userRow = hesk_dbFetchAssoc($usersRes)) {
+ array_push($users, $userRow);
+ }
+
+ $i = 1;
+ $j = 0;
+ $num = hesk_dbNumRows($res);
+
+ $usage = array(
+ 0 => '
+ ',
+ 1 => '',
+ 2 => ' '
+ );
+
+ while ($mycat = hesk_dbFetchAssoc($res)) {
+ $j++;
+
+ if (isset($_SESSION['selcat2']) && $mycat['id'] == $_SESSION['selcat2']) {
+ $color = 'admin_green';
+ unset($_SESSION['selcat2']);
+ } else {
+ $color = $i ? 'admin_white' : 'admin_gray';
+ }
+
+ $tmp = $i ? 'White' : 'Blue';
+ $style = '';
+ if ($mycat['color'] == null) {
+ $style .= 'color: black; border: solid 1px #000';
+ } else {
+ $style .= 'background: ' . $mycat['color'];
+ }
+ $i = $i ? 0 : 1;
+
+ /* Number of tickets and graph width */
+ $all = isset($tickets_all[$mycat['id']]) ? $tickets_all[$mycat['id']] : 0;
+ $width_all = 0;
+ if ($tickets_total && $all) {
+ $width_all = round(($all / $tickets_total) * 100);
+ }
+
+ /* Deleting category with ID 1 (default category) is not allowed */
+ if ($mycat['id'] == 1) {
+ $remove_code = '
';
+ } else {
+ $remove_code = ' ';
+ }
+
+ /* Is category private or public? */
+ if ($mycat['type']) {
+ $type_code = '';
+ } else {
+ $type_code = '';
+ }
+
+ /* Is auto assign enabled? */
+ if ($hesk_settings['autoassign']) {
+ if ($mycat['autoassign']) {
+ $autoassign_code = '';
+ } else {
+ $autoassign_code = '';
+ }
+ } else {
+ $autoassign_code = '';
+ }
+
+ echo '
+
+ ' . $mycat['id'] . ' |
+ ' . $mycat['name'] . ' |
' . $priorities[$mycat['priority']]['formatted'] . ' |
' . $all . ' |
-
-
- 40% Complete (success)
+
+
+ 40% Complete (success)
+
-
|
- ' . output_user_dropdown($mycat['id'], $mycat['manager'], $users) . ' |
+ ' . $usage[$mycat['usage']] . ' |
+ ' . get_manager($mycat['manager'], $users) . ' |
' . $autoassign_code . '
' . $type_code . ' ';
- if ($orderBy != 'name' && $num > 1) {
- if ($j == 1) {
- echo ' ';
- } elseif ($j == $num) {
- echo ' ';
- } else {
- echo '
+ if ($orderBy != 'name' && $num > 1) {
+ if ($j == 1) {
+ echo ' ';
+ } elseif ($j == $num) {
+ echo ' ';
+ } else {
+ echo '
';
- }
- }
-
- echo $remove_code . ' |
+ }
+ }
+ echo '';
+ echo $remove_code . '
';
- } // End while
+ } // End while
- ?>
-
+ ?>
+
+
+
+
+
+
' . stripslashes($catname) . '', $_SERVER['PHP_SELF'], 'SUCCESS');
+ hesk_process_messages(sprintf($hesklang['category_updated'], stripslashes($catname)), $_SERVER['PHP_SELF'], 'SUCCESS');
} // End rename_cat()
@@ -708,59 +777,42 @@ function toggle_type()
} // End toggle_type()
-function output_user_dropdown($catId, $selectId, $userArray)
+function output_user_dropdown($userArray)
{
global $hesklang;
if (!hesk_checkPermission('can_set_manager', 0)) {
foreach ($userArray as $user) {
if ($user['id'] == $selectId) {
- return '
' . $user['name'] . '
';
+ return '
' . $user['name'] . '
';
}
}
- return '
' . $hesklang['no_manager'] . '
';
+ return '
' . $hesklang['no_manager'] . '
';
} else {
- $dropdownMarkup = '