Jump to content

  • twitter
  • youtube
  • googleplus
  • facebook
  • rss
  • newsletter


Contact Us System - Message Count on Board Index


  • Please log in to reply
No replies to this topic

#1 JimD

JimD

    Advanced Member

  • Customers
  • 59 posts
  • Gender:Male
  • Location:Staffordshire, UK
  • Interests:anything!
  • IP.Board Version:IPB 3.1.x
  • First Name:Jim

Posted 25 August 2011 - 11:50 AM

Hi Michael,

I would love to see a message count, such as the 'reports' count on the board index to indicate new messages.

Better still, the other Michael has the 'queued' modification - http://community.inv...9-queued-items/

It would require you to modify his queueditems.php file and place into your mod.

I've sat and tried to work it out myself, but I don't have a chance.

I can't see a reason why the file cannot be displayed on here as the mod is free and this file to open for other mod authors to use... this one is the one used for Nexus, which has a support ticket count.

I can see what sections I need to delete and change, but not sure where to pull the code from for your Contact Us mod.

<?php

/**
 * Product Title:   	 Queued Items
 * Product Version:   	 1.2.0
 * Author:   			 Michael McCune
 * Website:   			 Invision Focus
 * Website URL:   		 http://invisionfocus.com/
 * Email:   			 michael.mccune@gmail.com
 */

class nexusQueuedItems
{
	protected $registry;
	protected $DB;
	protected $settings;
	protected $request;
	protected $lang;
	protected $member;
	protected $memberData;
	protected $cache;
	protected $caches;
	
	public function __construct( ipsRegistry $registry )
	{
   	 /* Make registry objects */
   	 $this->registry   =  $registry;
   	 $this->DB	 	=  $this->registry->DB();
   	 $this->settings   =& $this->registry->fetchSettings();
   	 $this->request	=& $this->registry->fetchRequest();
   	 $this->lang   	=  $this->registry->getClass('class_localization');
   	 $this->member 	=  $this->registry->member();
   	 $this->memberData =& $this->registry->member()->fetchMemberData();
   	 $this->cache  	=  $this->registry->cache();
   	 $this->caches 	=& $this->registry->cache()->fetchCaches();
	}
	
	public function fetchCaches()
	{
   	 /* INIT */
   	 $_caches = array();
   	 
   	 $_caches[] = 'support_statuses';
   	 
   	 /* Return */
   	 return $_caches;
	}
	
	public function fetchOutput()
	{
   	 /* INIT */
   	 $queued  = array();
   	 $_output = array();
   	 $where   = array();
   	 
   	 /* Everything's in the Admin CP, so only show it if they have access */
   	 if ( $this->memberData['g_access_cp'] )
   	 {
   		 /* Require our Nexus lib */
   		 require_once( IPSLib::getAppDir('nexus') . '/sources/support.php' );
   		 
   		 /* Transactions on hold */
   		 $query = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) AS cnt', 'from' => 'nexus_transactions', 'where' => "t_status='hold'" ) );
   		 if ( $query['cnt'] ) { $queued['nexus_hold_trans'] = $query['cnt']; }
   		 
   		 /* Pending orders */
   		 $query = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) AS cnt', 'from' => 'nexus_ship_orders', 'where' => "o_status='pend'" ) );
   		 if ( $query['cnt'] ) { $queued['nexus_pend_orders'] = $query['cnt']; }
   		 
   		 /* Payouts */
   		 $query = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) AS cnt', 'from' => 'nexus_payouts' ) );
   		 if ( $query['cnt'] ) { $queued['nexus_payouts'] = $query['cnt']; }
   		 
   		 /* Open support requests */
   		 $departments = supportRequest::checkSupportStaff( $this->memberData['member_id'] );
   		 if ( !empty( $departments ) )
   		 {
   			 if ( $departments['dpts'] != '*' )
   			 {
   				 $where[] = "r_department IN({$departments['dpts']})";
   			 }
   			 
   			 $statuses = $this->caches['support_statuses'];
   			 
   			 if ( !empty( $statuses['open'] ) )
   			 {
   				 $where[] = 'r_status IN(' . implode( ',', $statuses['open'] ) . ')';
   				 $query = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) AS cnt', 'from' => 'nexus_support_requests', 'where' => implode( ' AND ', $where ) ) );
   				 if ( $query['cnt'] ) { $queued['nexus_open_support'] = $query['cnt']; }
   			 }
   		 }
   	 }
   	 
   	 /* Found any queued items? */
   	 if ( count( $queued ) )
   	 {
   		 foreach ( $queued as $type => $count )
   		 {
   			 $_output[ $type ] = array( 'count' => $count, 'lang' => $this->lang->words['queued_items_'.$type], 'base' => 'none' );
   			 
   			 /* Format the URL */
   			 switch ( $type )
   			 {
   				 case 'nexus_hold_trans':
   					 $_output[ $type ]['url'] = "{$this->settings['_admin_link']}?app=nexus&amp;module=payments&amp;section=transactions&amp;pend=1";
   				 break;
   				 
   				 case 'nexus_pend_orders':
   					 $_output[ $type ]['url'] = "{$this->settings['_admin_link']}?app=nexus&amp;module=payments&amp;section=shiporders&amp;pend=1";
   				 break;
   				 
   				 case 'nexus_payouts':
   					 $_output[ $type ]['url'] = "{$this->settings['_admin_link']}?app=nexus&amp;module=payments&amp;section=payouts&amp;pend=1";
   				 break;
   				 
   				 case 'nexus_open_support':
   					 $_output[ $type ]['url'] = "{$this->settings['_admin_link']}?app=nexus&amp;module=tickets&amp;section=list";
   				 break;
   			 }
   		 }
   	 }
   	 
   	 /* Return */
   	 return $_output;
	}
}


Is this something you could consider?

Regards

Jim




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users