Adding categories to the main administration page
Moderator: mkoch227
Adding categories to the main administration page
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!
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!
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>
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>
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.
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.
Adding categories to the main administration page
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
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
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.
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
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
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
Using version 2.1conepr09 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.
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.basile wrote:Using version 2.1conepr09 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.
but does not work the mod.
Why?