QuickBooks/Status/Report.php
public function status($user = null, $levels = array())
	{
		$Driver = $this->_driver;
		
		if (!$user)
		{
			$user = $Driver->authDefault();
		}
		
		if (!count($levels))
		{
			$levels = array(
				60 * 60 * 12 => array( QuickBooks_Status_Report::STATUS_NOTICE, 'Notice: A connection has not been made in %d days, %d hours and %d minutes.' ),  
				60 * 60 * 24 => array( QuickBooks_Status_Report::STATUS_CAUTION, 'Caution: A connection has not been made in %d days, %d hours and %d minutes.' ),
				60 * 60 * 36 => array( QuickBooks_Status_Report::STATUS_WARNING, 'Warning! A connection has not been made in %d days, %d hours and %d minutes.' ),
				60 * 60 * 48 => array( QuickBooks_Status_Report::STATUS_DANGER, 'DANGER! A connection has not been made in %d days, %d hours and %d minutes! Contact support to get this issue resolved!' ),  
				);
		}
		
		if (!isset($levels[0]))
		{
			$levels[0] = array( QuickBooks_Status_Report::STATUS_OK, 'Status is OK. Last connection made %d days, %d hours, and %d minutes ago.' );
		}
		
		if (!isset($levels[-1]))
		{
			$levels[-1] = array( QuickBooks_Status_Report::STATUS_UNKNOWN, 'Status is unknown.');
		}
		
		//print_r($levels);
		
		// Find the status from the ticket table
		$last = $Driver->authLast($user);
		if (is_array($last))
		{
			krsort($levels);
			
			$ago = time() - strtotime($last[1]);
					
			$days = floor($ago / (60 * 60 * 24));
			$hours = floor(($ago - ($days * 60 * 60 * 24)) / 60.0 / 60.0);
			$minutes = max(1, floor(($ago - ($days * 60 * 60 * 24) - ($hours * 60 * 60)) / 60.0));
			
			$retr = null;
			
			foreach ($levels as $level => $tuple)
			{
				if ($level <= 0)
				{
					continue;
				}
				
				if ($ago > $level)
				{
					$retr = $tuple;
					break;
				}
			}
			
			if (!$retr)
			{
				$retr = $levels[0];
			}
			
			$retr[1] = sprintf($retr[1], $days, $hours, $minutes);
			
			$retr[] = $last[0];
			$retr[] = $last[1];
			
			return $retr;
		}
		
		return $levels[-1];
	}
public function status($user = null, $levels = array())
	{
		$Driver = $this->_driver;
		
		if (!$user)
		{
			$user = $Driver->authDefault();
		}
		
		if (!count($levels))
		{
			$levels = array(
				60 * 60 * 12 => array( QuickBooks_Status_Report::STATUS_NOTICE, 'Notice: A connection has not been made in %d days, %d hours and %d minutes.' ),  
				60 * 60 * 24 => array( QuickBooks_Status_Report::STATUS_CAUTION, 'Caution: A connection has not been made in %d days, %d hours and %d minutes.' ),
				60 * 60 * 36 => array( QuickBooks_Status_Report::STATUS_WARNING, 'Warning! A connection has not been made in %d days, %d hours and %d minutes.' ),
				60 * 60 * 48 => array( QuickBooks_Status_Report::STATUS_DANGER, 'DANGER! A connection has not been made in %d days, %d hours and %d minutes! Contact support to get this issue resolved!' ),  
				);
		}
		
		if (!isset($levels[0]))
		{
			$levels[0] = array( QuickBooks_Status_Report::STATUS_OK, 'Status is OK. Last connection made %d days, %d hours, and %d minutes ago.' );
		}
		
		if (!isset($levels[-1]))
		{
			$levels[-1] = array( QuickBooks_Status_Report::STATUS_UNKNOWN, 'Status is unknown.');
		}
		
		//print_r($levels);
		
		// Find the status from the ticket table
		$last = $Driver->authLast($user);
		if (is_array($last))
		{
			krsort($levels);
			
			$ago = time() - strtotime($last[1]);
					
			$days = floor($ago / (60 * 60 * 24));
			$hours = floor(($ago - ($days * 60 * 60 * 24)) / 60.0 / 60.0);
			$minutes = max(1, floor(($ago - ($days * 60 * 60 * 24) - ($hours * 60 * 60)) / 60.0));
			
			$retr = null;
			
			foreach ($levels as $level => $tuple)
			{
				if ($level <= 0)
				{
					continue;
				}
				
				if ($ago > $level)
				{
					$retr = $tuple;
					break;
				}
			}
			
			if (!$retr)
			{
				$retr = $levels[0];
			}
			
			$retr[1] = sprintf($retr[1], $days, $hours, $minutes);
			
			$retr[] = $last[0];
			$retr[] = $last[1];
			
			return $retr;
		}
		
		return $levels[-1];
	}
Get information about the status of a connection to QuickBooks

The returned array will look something like this:
<pre>
Array (
[0] => danger 					// This is a constant, one of the QuickBooks_Status_Report::STATUS_* constants
[1] => ERROR: A connection has not been made in 54 days, 1 hours and 46 minutes! Contact support to get this issue resolved!
[2] => 2010-03-19 12:26:41 		// This is the last time the given user logged in
[3] => 2010-03-19 12:26:41 		// This is the last time the given user performed any action
)
</pre>

@param string $user
@param array $levels
@return array			An array of status information