Page 1 of 2
Adding categories to the main administration page
Posted: Tue Mar 21, 2006 3:02 am
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!
Posted: Tue Mar 21, 2006 3:34 am
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>
Posted: Thu Aug 03, 2006 5:28 pm
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?
Posted: Thu Aug 03, 2006 6:01 pm
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"> </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.
Posted: Tue Sep 26, 2006 9:41 pm
by jakkrith
Thank you very much to cbromley for your addon script. It work on my site too.
Posted: Wed Dec 13, 2006 8:06 pm
by Sandi3d
Thank you very much! I've added this feature also.
Adding categories to the main administration page
Posted: Tue May 29, 2007 11:26 pm
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
Posted: Mon Mar 23, 2009 6:48 pm
by peanutmsn
How would I modify this to work in version 2.0?
Posted: Tue Mar 24, 2009 12:38 pm
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.
Posted: Tue Nov 24, 2009 5:36 pm
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.
Posted: Wed Nov 25, 2009 1:42 pm
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.
change specific category color
Posted: Wed Dec 16, 2009 11:10 am
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
Posted: Tue Dec 29, 2009 12:06 pm
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?
Posted: Thu Dec 31, 2009 12:37 pm
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.
Posted: Fri Jan 08, 2010 12:07 am
by conepr09
Did you added the code I mentioned in my previous post on the print_tickets.inc.php page?