Jump to content

Show only Open Tickets


criat

Recommended Posts

I'm trying to split Show tickets into two links:

 

  • Show open tickets (any Ticket that's not Closed)
  • Show closed tickets (Closed tickets only)

 

 

This is the code that displays all tickets:

 

{foreach key=num item=ticket from=$tickets}
       <tr>
           <td data-title="{$LANG.supportticketsdate}">{$ticket.date}</td>
           <td data-title="{$LANG.supportticketsdepartment}">{$ticket.department}</td>
           <td data-title="{$LANG.supportticketssubject}"><div align="left"><a href="viewticket.php?tid={$ticket.tid}&c={$ticket.c}"><img src="images/article.gif" alt="" border="0" /> {if $ticket.unread}<strong>{/if}#{$ticket.tid} - {$ticket.subject}{if $ticket.unread}</strong>{/if}</a></div></td>
           <td data-title="{$LANG.supportticketsstatus}">{$ticket.status}</td>
           <td data-title="{$LANG.supportticketsticketlastupdated}">{$ticket.lastreply}</td>
           <td class="last textcenter"><a href="viewticket.php?tid={$ticket.tid}&c={$ticket.c}" class="btn btn-inverse">{$LANG.supportticketsviewticket}</a></td>
       </tr>
{foreachelse}
       <tr>
           <td colspan="7" class="textcenter">{$LANG.norecordsfound}</td>
       </tr>
{/foreach}

 

Any ideas?

Thanks!

Link to comment
Share on other sites

That doesn't works well with multiple language

 

Found this though:

 

<div class="table_title opentickets" style="margin-top:20px;">
 <span class="icon"></span>
 <a class="btn btn-primary pull-right" href="submitticket.php">{$LANG.opennewticket}</a>
 <h3><strong>{$clientsstats.numactivetickets}</strong>  {$LANG.supportticketsopentickets}</h3>
</div>

<table class="table table-striped table-framed table-centered no-more-tables">
 <thead>
   <tr>
     <th><a href="supporttickets.php?orderby=date">{$LANG.supportticketsdate}</a></th>
     <th><a href="supporttickets.php?orderby=dept">{$LANG.supportticketsdepartment}</a></th>
     <th><a href="supporttickets.php?orderby=subject">{$LANG.supportticketssubject}</a></th>
     <th><a href="supporttickets.php?orderby=subject">{$LANG.supportticketsstatus}</a></th>
     <th class="headerSortdesc"><a href="supporttickets.php?orderby=lastreply">{$LANG.supportticketsticketlastupdated}</a></th>
     <th></th>
   </tr>
 </thead>
 <tbody>
 {foreach from=$tickets item=ticket}
   <tr>
     <td data-title="{$LANG.supportticketsdate}">{$ticket.date}</td>
     <td data-title="{$LANG.supportticketsdepartment}">{$ticket.department}</td>
     <td data-title="{$LANG.supportticketssubject}"><div align="left"><img src="images/article.gif" alt="Ticket" border="0" /> <a href="viewticket.php?tid={$ticket.tid}&c={$ticket.c}">{if $ticket.unread}<strong>{/if}#{$ticket.tid} - {$ticket.subject}{if $ticket.unread}</strong>{/if}</a></div></td>
     <td data-title="{$LANG.supportticketsstatus}">{$ticket.status}</td>
     <td data-title="{$LANG.supportticketsticketlastupdated}">{$ticket.lastreply}</td>
     <td class="last textcenter"><a href="viewticket.php?tid={$ticket.tid}&c={$ticket.c}" class="btn btn-inverse">{$LANG.supportticketsviewticket}</a></td>
   </tr>  
 {foreachelse}
   <tr>
     <td colspan="6" class="textcenter">{$LANG.supportticketsnoneopen}</td>
   </tr>
 {/foreach}
 </tbody>
</table>

Link to comment
Share on other sites

There's one more thing...

 

I've created a new page to display these open tickets, here's what I did:

 

The problem I think is that the page doesn't have the $ticket variable by default

 

open-tickets.php

<?php

define("CLIENTAREA",false);

require("init.php");
include("includes/functions.php");

$ca = new WHMCS_ClientArea();

$ca->setPageTitle($whmcs->get_lang('opentiketstitle'));

$ca->addToBreadCrumb('index.php',$whmcs->get_lang('globalsystemname'));
$ca->addToBreadCrumb('support-tickets.php',$whmcs->get_lang('opentiketstitle'));

$ca->initPage();

$ca->requireLogin(); // Uncomment this line to require a login to access this page


$ca->setTemplate('open-tickets');

$ca->output();

?>

 

open-tickets.tpl

<h1>{$LANG.ticketsabertostitle}</h1>



<div class="table_title opentickets" style="margin-top:20px;">
 <span class="icon"></span>
 <a class="btn btn-primary pull-right" href="submitticket.php">{$LANG.opennewticket}</a>
 <h3><strong>{$clientsstats.numactivetickets}</strong>  {$LANG.supportticketsopentickets}</h3>
</div>
<table class="table table-striped table-framed table-centered no-more-tables">
 <thead>
   <tr>
     <th><a href="supporttickets.php?orderby=date">{$LANG.supportticketsdate}</a></th>
     <th><a href="supporttickets.php?orderby=dept">{$LANG.supportticketsdepartment}</a></th>
     <th><a href="supporttickets.php?orderby=subject">{$LANG.supportticketssubject}</a></th>
     <th><a href="supporttickets.php?orderby=subject">{$LANG.supportticketsstatus}</a></th>
     <th class="headerSortdesc"><a href="supporttickets.php?orderby=lastreply">{$LANG.supportticketsticketlastupdated}</a></th>
     <th></th>
   </tr>
 </thead>
 <tbody>
 {foreach from=$tickets item=ticket}
   <tr>
     <td data-title="{$LANG.supportticketsdate}">{$ticket.date}</td>
     <td data-title="{$LANG.supportticketsdepartment}">{$ticket.department}</td>
     <td data-title="{$LANG.supportticketssubject}"><div align="left"><img src="images/article.gif" alt="Ticket" border="0" /> <a href="viewticket.php?tid={$ticket.tid}&c={$ticket.c}">{if $ticket.unread}<strong>{/if}#{$ticket.tid} - {$ticket.subject}{if $ticket.unread}</strong>{/if}</a></div></td>
     <td data-title="{$LANG.supportticketsstatus}">{$ticket.status}</td>
     <td data-title="{$LANG.supportticketsticketlastupdated}">{$ticket.lastreply}</td>
     <td class="last textcenter"><a href="viewticket.php?tid={$ticket.tid}&c={$ticket.c}" class="btn btn-inverse">{$LANG.supportticketsviewticket}</a></td>
   </tr>  
 {foreachelse}
   <tr>
     <td colspan="6" class="textcenter">{$LANG.supportticketsnoneopen}</td>
   </tr>
 {/foreach}
 </tbody>
</table>  

 

Output:

Untitled-1.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated