Reply To: Custom Dashboard?

We're upgrading our support forum. Replies are currently closed. Please view our Documentation and FAQ using the menu above.

I got this working by adding this code to home.php:

<?php /*start ticket dashboard*/ if(class_exists('module_ticket',false)){ ?>
<?php print_heading(array('title'=>'My Ticket','type'=>'h3'));?>
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_rows tbl_fixed">
<thead>
<tr class="title">
<th style="width:8%;"><?php echo _l('Number'); ?></th>
<th style="width:28%"><?php echo _l('Subject'); ?></th>
<th style="width:16%;"><?php echo _l('Last Date/Time'); ?></th>
<th style="width:12%;"><?php echo _l('Type'); ?></th>
<th style="width:9%;"><?php echo _l('Status'); ?></th>
<!-- <th><?php echo _l(module_config::c('project_name_single','Website')); ?></th>
<?php if(!isset($_REQUEST['customer_id'])){ ?>
<th><?php echo _l('Customer'); ?></th>
<?php } ?>-->
<th style="width:10%;"><?php echo _l('Staff'); ?></th>
<th style="width:10%;"><?php echo _l('Contact'); ?></th>
<?php if(class_exists('module_faq',false) && module_config::c('ticket_show_product_list',1)){ ?>
<th style="width:10%;"><?php echo _l('Product');?></th>
<?php } ?>
<?php if(class_exists('module_envato',false)){ ?>
<th style="width:10%;"><?php echo _l('Envato');
if(module_config::c('envato_show_ticket_earning',0)){
// work out how much we have earnt from the outstanding support envatos.
echo ' ('.dollar($envato_count*.7).')';
}
?></th>
<?php } ?>
<?php if(class_exists('module_group',false) && module_config::c('ticket_enable_groups',1) && module_group::groups_enabled()){ ?>
<th width="9%"><?php echo _l('Group'); ?></th>
<?php } ?>
<?php if(module_config::c('ticket_allow_priority',0) && module_config::c('ticket_show_priority',1)){ ?>
<th width="5%"><?php _e('Priority');?></th>
<?php } ?>
<?php if(class_exists('module_extra',false)){
module_extra::print_table_header('ticket',array(
array('style'=>'width:10%')
));
}
if(module_ticket::can_edit_tickets()){
?>
<th width="3%"> </th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
$search['status_id'] = '1,2,3,5';
$search['assigned_user_id'] = module_security::get_loggedin_id();
$tickets = module_ticket::get_tickets($search,true);

while($ticket = mysql_fetch_assoc($tickets)){
?>
<tr class="<?php echo ($c++%2)?"odd":"even"; ?>">
<td class="row_action" nowrap="">
<?php echo module_ticket::link_open($ticket['ticket_id'],true,$ticket);?> (<?php echo $ticket['message_count'];?>)
</td>
<td>
<?php
// todo, pass off to envato module as a hook
$ticket['subject'] = preg_replace('#Message sent via your Den#','',$ticket['subject']);
if($ticket['priority']){

}
if($ticket['unread']){
echo '';
echo ' '._l('* '). ' ';
echo htmlspecialchars($ticket['subject']);
echo '
';
}else{
echo htmlspecialchars($ticket['subject']);
}
?>
</td>
<td>
<?php
if($ticket['last_message_timestamp']>0){
if($ticket['last_message_timestamp'] < $limit_time){
echo '<span class="important">';
}
echo print_date($ticket['last_message_timestamp'],true);
// how many days ago was this?
echo ' ';
//echo '<br>'.$seconds_into_today ."<br>".($ticket['last_message_timestamp']+1).'<br>';
if($ticket['last_message_timestamp']>=$today){
echo '<span class="success_text">';
_e('(today)');
echo '</span>';
}else{
$days = ceil(($today - $ticket['last_message_timestamp'])/86400);

_e(' (%s days)',abs($days));
}
if($ticket['last_message_timestamp'] < $limit_time){
echo '</span>';
}
}
?>
</td>
<td>
<?php echo htmlspecialchars($ticket['type']); ?>
</td>
<td>
<?php echo htmlspecialchars(module_ticket::$ticket_statuses[$ticket['status_id']]); ?>
</td>
<!-- <td>
<?php echo module_website::link_open($ticket['website_id'],true); ?>
</td>
<?php if(!isset($_REQUEST['customer_id'])){ ?>
<td>
<?php echo module_customer::link_open($ticket['customer_id'],true);?>
</td>
<?php } ?>-->
<td>
<?php echo module_user::link_open($ticket['assigned_user_id'],true); ?>
</td>
<td>
<?php echo module_user::link_open($ticket['user_id'],true); ?>
</td>
<?php if(class_exists('module_faq',false) && module_config::c('ticket_show_product_list',1)){ ?>
<td>
<?php
// find out details about this envato contact
// their username and what items they have purchased.
if($ticket['faq_product_id']){
$faq_product = module_faq::get_faq_product($ticket['faq_product_id']);
echo htmlspecialchars($faq_product['name']);
}
?>
</td>
<?php } ?>
<?php if(class_exists('module_envato',false)){ ?>
<td>
<?php
// find out details about this envato contact
// their username and what items they have purchased.
$items = module_envato::get_items_by_ticket($ticket['ticket_id']);
foreach($items as $item){
echo ''.htmlspecialchars($item['name']).' ';
}
?>
</td>
<?php } ?>
<?php if(class_exists('module_group',false) && module_config::c('ticket_enable_groups',1) && module_group::groups_enabled()){ ?>
<td><?php
// find the groups for this customer.
$groups = module_group::get_groups_search(array(
'owner_table' => 'ticket',
'owner_id' => $ticket['ticket_id'],
));
$g=array();
foreach($groups as $group){
$g[] = $group['name'];
}
echo implode(', ',$g);
?></td>
<?php } ?>
<?php
if(module_config::c('ticket_allow_priority',0) && module_config::c('ticket_show_priority',1)){ ?>
<td>
<?php echo $priorities[$ticket['priority']];?>
</td>
<?php } ?>
<?php if(class_exists('module_extra',false)){
module_extra::print_table_data('ticket',$ticket['ticket_id']);
} if(module_ticket::can_edit_tickets()){
?>
<td>
<input type="checkbox" name="bulk_operation[<?php echo $ticket['ticket_id'];?>]" value="yes">
</td>
<?php
}?>
</tr>
<?php
}
?>
</tbody>
</table>
<?php } //end ticket dashboard ?>

I’m looking for more elegant way if there is any (by utilizing hook function?)

Thanks

ngkongReply To: Custom Dashboard?