Adding categories to the main administration page

Everything related to Hesk - helpdesk software

Moderator: mkoch227

DavidM
Posts: 2
Joined: Tue Mar 21, 2006 2:58 am

Adding categories to the main administration page

Post by DavidM »

Hi,

I'm trying to get the Main administraion page (print_tickets.inc.php) to display the category name for each ticket.
I'm guessing I need to query the category database for the full name, but am unsure of where / how to do it.

Any help appreciated!
DavidM
Posts: 2
Joined: Tue Mar 21, 2006 2:58 am

Post by DavidM »

think i got it....

while ($ticket=hesk_dbFetchAssoc($result))
{

//added category
$sql = "SELECT * FROM `hesk_categories` WHERE `id`=$ticket[category] LIMIT 1";
$newresult = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
$newcategory = hesk_dbFetchAssoc($newresult);
// done

put this in the table.

<td class="$color">$newcategory[name]</td>
cbromley
Posts: 7
Joined: Wed Aug 02, 2006 9:31 pm

Post by cbromley »

I am looking to do the same thing. Unfortunately, this doesn't tell me exactly where to put the proper pieces of code.. can someone point that out to me?
cbromley
Posts: 7
Joined: Wed Aug 02, 2006 9:31 pm

Post by cbromley »

Ok. Some trial and error on my own found what I needed to do. He does tell you where, to a degree.. but I'll reiterate it here...

If you want to add the category to the table that is displayed when you log in as Admin/Staff, then make the following changes.

In the print_tickets.inc.php file (in the INC directory) add the part in red:

<?php
while ($ticket=hesk_dbFetchAssoc($result))
{
if ($i) {$color="admin_gray"; $i=0;}
else {$color="admin_white"; $i=1;}

if ($ticket['status']) {$ticket['status']="<font class=\"open\">$hesklang[open]</font>";}
else {$ticket['status']="<font class=\"resolved\">$hesklang[close]</font>";}

if ($ticket['priority']==1) {$ticket['priority']="<font class=\"important\">$hesklang[high]</font>";}
elseif ($ticket['priority']==2) {$ticket['priority']="<font class=\"medium\">$hesklang[medium]</font>";}
else {$ticket['priority']=$hesklang['low'];}

$ticket['dt']=hesk_formatDate($ticket['dt']);

//added category
$sql = "SELECT * FROM `hesk_categories` WHERE `id`=$ticket[category] LIMIT 1";
$newresult = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]");
$newcategory = hesk_dbFetchAssoc($newresult);
// done



// list($date,$hour) = explode(' ',$ticket[dt]);

Also, in the same file, add the following (in red):

<tr>
<td class="$color" align="center"><input type="checkbox" name="id[]" value="$ticket[id]"></td>
<td class="$color"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[trackid]</a></td>
<td class="$color" align="center">$ticket[dt]</td>
<td class="$color">$ticket[name]</td>
<td class="$color"><a href="admin_ticket.php?track=$ticket[trackid]&Refresh=$random">$ticket[subject]</a></td>
<td class="$color" align="center">$ticket[status]</td>
<td class="$color" align="center">$ticket[priority]</td>
<td class="$color">$newcategory[name]</td>
</tr>

This will add the category to the end of the table. You will notice that it doesn't have a title header, though, so, I did the following in the same file (in red):

<tr>
<td class="admin_white">&nbsp;</td>
<td class="admin_white"><a href="show_tickets.php?<?php echo $query; ?>trackid"><?php echo $hesklang['trackID']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>dt"><?php echo $hesklang['timestamp']; ?></a></td>
<td class="admin_white"><a href="show_tickets.php?<?php echo $query; ?>name"><?php echo $hesklang['name']; ?></a></td>
<td class="admin_white"><a href="show_tickets.php?<?php echo $query; ?>subject"><?php echo $hesklang['subject']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>status"><?php echo $hesklang['status']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<?php echo $query; ?>priority"><?php echo $hesklang['priority']; ?></a></td>
<td class="admin_white" align="center"><a href="show_tickets.php?<php echo $query; ?>category"><?php echo Category; ?></a></td>
</tr>

This makes the CATEGORY a header, as well as makes it clickable, though, it doesn't truly sort on the category. That is what I will be working on next, but it was set up to pass the query along like all of the other sortable headers, so I imagine this won't be a difficult addition to make.
jakkrith
Posts: 1
Joined: Tue Sep 26, 2006 9:32 pm

Post by jakkrith »

Thank you very much to cbromley for your addon script. It work on my site too.
Sandi3d
Posts: 5
Joined: Wed Dec 13, 2006 7:04 pm

Post by Sandi3d »

Thank you very much! I've added this feature also.
ricksaul
Posts: 11
Joined: Sun May 27, 2007 1:02 am

Adding categories to the main administration page

Post by ricksaul »

Hi,

I have modded my admin page to add categories and it works very well. Have you got the sorting issue resolved as yet??

regards Rick Saul
peanutmsn
Posts: 2
Joined: Tue May 29, 2007 2:50 am

Post by peanutmsn »

How would I modify this to work in version 2.0?
MPH2008
Posts: 33
Joined: Thu Sep 04, 2008 12:58 pm

Post by MPH2008 »

peanutmsn wrote:How would I modify this to work in version 2.0?
I am also interested in this feature for V2.0 - we had it working for the previous version, however it seems trickier to implement at first glance.
brubakes
Posts: 6
Joined: Tue Nov 24, 2009 4:24 pm

Post by brubakes »

peanutmsn wrote:How would I modify this to work in version 2.0?
BTT for the same question. I've seen talk of this in other threads, but nothing for version 2.1.
conepr09
Posts: 8
Joined: Wed Nov 25, 2009 1:09 pm

Post by conepr09 »

Hi,

I made some modifications to what cbromley posted (thanks!!) and I was able to get this working on version 2.1:

On print_tickets.inc.php do the following:

add this code to show the category column in the administration page (around line 237):

<th class="admin_white" style="text-align:center; white-space:nowrap;"><a href="show_tickets.php?<?php echo $query; ?>category"><?php echo $hesklang['category']; ?></a></th>

Sorting Issue:

To be able to sort by category add the following code (around line 288):

$hesklang['category'] = hesk_dbFetchAssoc($newresult);

I hope this helps.
fanta
Posts: 16
Joined: Wed Dec 16, 2009 11:00 am

change specific category color

Post by fanta »

Hello,
This is a great mod. very useful, thanks!

How can I set a different color to a specific category in the table?
I tried wrapping the category name with <font color="red">New category</font> but that just printed out the font tag as well.

Thanks for any suggestion.
using v2
basile
Posts: 7
Joined: Sun Jan 25, 2009 10:56 am

Post by basile »

conepr09 wrote:Hi,

I made some modifications to what cbromley posted (thanks!!) and I was able to get this working on version 2.1:

On print_tickets.inc.php do the following:

add this code to show the category column in the administration page (around line 237):

<th class="admin_white" style="text-align:center; white-space:nowrap;"><a href="show_tickets.php?<?php echo $query; ?>category"><?php echo $hesklang['category']; ?></a></th>

Sorting Issue:

To be able to sort by category add the following code (around line 288):

$hesklang['category'] = hesk_dbFetchAssoc($newresult);

I hope this helps.
Using version 2.1
but does not work the mod.
Why?
SillPeter
Posts: 4
Joined: Sat Dec 12, 2009 11:47 am

Post by SillPeter »

basile wrote:
conepr09 wrote:Hi,

I made some modifications to what cbromley posted (thanks!!) and I was able to get this working on version 2.1:

On print_tickets.inc.php do the following:

add this code to show the category column in the administration page (around line 237):

<th class="admin_white" style="text-align:center; white-space:nowrap;"><a href="show_tickets.php?<?php echo $query; ?>category"><?php echo $hesklang['category']; ?></a></th>

Sorting Issue:

To be able to sort by category add the following code (around line 288):

$hesklang['category'] = hesk_dbFetchAssoc($newresult);

I hope this helps.
Using version 2.1
but does not work the mod.
Why?
Same for me. Couldnt get it to work either, which is a shame.. Would really come in handy.
conepr09
Posts: 8
Joined: Wed Nov 25, 2009 1:09 pm

Post by conepr09 »

Did you added the code I mentioned in my previous post on the print_tickets.inc.php page?
Post Reply