array('value' => 3, 'text' => $hesklang['low'], 'formatted' => $hesklang['low']),
2 => array('value' => 2, 'text' => $hesklang['medium'], 'formatted' => '' . $hesklang['medium'] . ''),
1 => array('value' => 1, 'text' => $hesklang['high'], 'formatted' => '' . $hesklang['high'] . ''),
0 => array('value' => 0, 'text' => $hesklang['critical'], 'formatted' => '' . $hesklang['critical'] . ''),
);
/* What should we do? */
if ($action = hesk_REQUEST('a')) {
if ($action == 'linkcode') {
generate_link_code();
} elseif (defined('HESK_DEMO')) {
hesk_process_messages($hesklang['ddemo'], 'manage_categories.php', 'NOTICE');
} elseif ($action == 'new') {
new_cat();
} elseif ($action == 'remove') {
remove();
} elseif ($action == 'order') {
order_cat();
} elseif ($action == 'autoassign') {
toggle_autoassign();
} elseif ($action == 'type') {
toggle_type();
} elseif ($action == 'edit') {
update_category();
}
}
$modsForHesk_settings = mfh_getSettings();
/* 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');
?>
' . $mycat['name'] . '';
}
?>
|
|
|
|
|
|
|
|
'
',
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 . ' |
|
' . $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 '
';
}
}
echo '';
echo $remove_code . ' |
';
} // End while
?>
' . $hesklang['cpric'] . '
';
}
else
{
?>
3) {
$_SESSION['cat_priority'] = 3;
}
/* Category name */
$catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php');
$color = hesk_POST('color', null);
$color = str_replace('#', '', $color);
$color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL';
$usage = hesk_POST('usage', 0);
/* Do we already have a category with this name? */
$res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1");
if (hesk_dbNumRows($res) != 0) {
$_SESSION['catname'] = $catname;
hesk_process_messages($hesklang['cndupl'], 'manage_categories.php');
}
/* Get the latest cat_order */
$res = hesk_dbQuery("SELECT `cat_order` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ORDER BY `cat_order` DESC LIMIT 1");
$row = hesk_dbFetchRow($res);
$my_order = $row[0] + 10;
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`, `color`, `usage`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', {$color}, " . intval($usage) . ")");
hesk_cleanSessionVars('catname');
hesk_cleanSessionVars('cat_autoassign');
hesk_cleanSessionVars('cat_type');
hesk_cleanSessionVars('cat_priority');
$_SESSION['selcat2'] = hesk_dbInsertID();
hesk_process_messages(sprintf($hesklang['cat_name_added'], '' . $user['name'] . '
' . $hesklang['no_manager'] . '