@ -113,13 +113,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
$hesk_settings['categories'] = array();
$hesk_settings['categories'] = array();
if (hesk_checkPermission('can_submit_any_cat', 0)) {
if (hesk_checkPermission('can_submit_any_cat', 0)) {
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC");
$res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC");
} else {
} else {
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC");
$res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC");
}
}
while ($row = hesk_dbFetchAssoc($res)) {
while ($row = hesk_dbFetchAssoc($res)) {
$hesk_settings['categories'][$row['id']] = $row['name'] ;
$hesk_settings['categories'][$row['id']] = $row;
}
}
$number_of_categories = count($hesk_settings['categories']);
$number_of_categories = count($hesk_settings['categories']);
@ -147,7 +147,7 @@ $show_quick_help = $show['show'];
< li >< a href = "admin_main.php" > <?php echo $hesk_settings [ 'hesk_title' ]; ?> </ a ></ li >
< li >< a href = "admin_main.php" > <?php echo $hesk_settings [ 'hesk_title' ]; ?> </ a ></ li >
<?php if ( $number_of_categories > 1 ) : ?>
<?php if ( $number_of_categories > 1 ) : ?>
< li >< a href = "new_ticket.php" > <?php echo $hesklang [ 'nti2' ]; ?> </ a ></ li >
< li >< a href = "new_ticket.php" > <?php echo $hesklang [ 'nti2' ]; ?> </ a ></ li >
< li class = "active" > <?php echo $hesk_settings [ 'categories' ][ $category ] ; ?> </ li >
< li class = "active" > <?php echo $hesk_settings [ 'categories' ][ $category ] ['name' ] ; ?> </ li >
<?php else : ?>
<?php else : ?>
< li class = "active" > <?php echo $hesklang [ 'nti2' ]; ?> </ li >
< li class = "active" > <?php echo $hesklang [ 'nti2' ]; ?> </ li >
<?php endif ; ?>
<?php endif ; ?>
@ -1038,9 +1038,10 @@ function print_select_category($number_of_categories) {
// Print a select box if number of categories is large
// Print a select box if number of categories is large
if ($number_of_categories > $hesk_settings['cat_show_select'])
if ($number_of_categories > $hesk_settings['cat_show_select'])
{
{
$firstDescription = null;
?>
?>
< form action = "new_ticket.php" method = "get" >
< form action = "new_ticket.php" method = "get" >
< select name = "category" id = "select_category" class = "form-control" >
< select name = "category" id = "select_category" class = "form-control" onchange = "showDescription()" >
<?php
<?php
if ($hesk_settings['select_cat'])
if ($hesk_settings['select_cat'])
{
{
@ -1048,23 +1049,45 @@ function print_select_category($number_of_categories) {
}
}
foreach ($hesk_settings['categories'] as $k=>$v)
foreach ($hesk_settings['categories'] as $k=>$v)
{
{
echo '< option value = "'.$k.'" > '.$v.'< / option > ';
if ($firstDescription === null) {
$firstDescription = $v['mfh_description'];
}
echo '< option value = "'.$k.'" data-description = "'.$v['mfh_description'].'" > '.$v['name'].'< / option > ';
}
}
?>
?>
< / select >
< / select >
<?php
$display = ' style="display: none"';
< br / >
if (!$hesk_settings['select_cat'] & & $firstDescription !== null & & trim($firstDescription) !== '') {
$display = '';
}
?>
< span id = "category-description" <?php echo $display ; ?> >
< b > <?php echo $hesklang [ 'description_colon' ]; ?> </ b >
< span > <?php echo $firstDescription ; ?> </ span >
< / span >
< br >
< div style = "text-align:center" >
< div style = "text-align:center" >
< input type = "submit" value = " <?php echo $hesklang [ 'c2c' ]; ?> " class = "btn btn-default" >
< input type = "submit" value = " <?php echo $hesklang [ 'c2c' ]; ?> " class = "btn btn-default" >
< / div >
< / div >
< / form >
< / form >
< script >
function showDescription() {
var $value = $('#select_category').find(':selected');
if ($value.data('description') !== '') {
$('#category-description').show().find('span').text($value.data('description'));
} else {
$('#category-description').hide();
}
}
< / script >
<?php
<?php
}
}
// Otherwise print quick links
// Otherwise print quick links
else
else
{
{
// echo '< li > < a href = "new_ticket.php?a=add&category='.$k.'" > » '.$v.'< / a > < / li > ';
$new_row = 1;
$new_row = 1;
foreach ($hesk_settings['categories'] as $k=>$v):
foreach ($hesk_settings['categories'] as $k=>$v):
@ -1079,7 +1102,14 @@ function print_select_category($number_of_categories) {
< div class = "panel-body" >
< div class = "panel-body" >
< div class = "row" >
< div class = "row" >
< div class = "col-xs-12" >
< div class = "col-xs-12" >
<?php echo $v ; ?>
<?php
echo $v['name'];
if ($v['mfh_description'] !== null & & trim($v['mfh_description']) !== '') {
echo ' < i class = "fa fa-info-circle" data-toggle = "popover"
title="'. $hesklang['description'] .'" data-content="' . $v['mfh_description'] . '">< / i > ';
}
?>
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >