Location: PHPKode > projects > OpenNitro > trunk/Nitro/Modules/BackOffice/Welcome/Module.inc.php
<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Modules :: BackendSubModule :: WelcomeModule                     |
// +---------------------------------------------------------------------------+
// | Copyright (c) 2006 June Systems B.V.                                      |
// +---------------------------------------------------------------------------+
// | This source file is copyrighted by June Systems BV, the Netherlands       |
// | If you would like to use this file in your projects, please contact       |
// | hide@address.com                                                     |
// +---------------------------------------------------------------------------+
// | Authors: Jesper Avôt <hide@address.com>                        |
// +---------------------------------------------------------------------------+
//
// $Id: Module.inc.php 229 2008-04-17 09:20:31Z oli $
//

/**
 * WelcomeModule
 *
 * @author			Jesper Avôt <hide@address.com>
 * @copyright		2006 June Systems B.V.
 * @package			Modules
 * @subpackage  NitroBO
 */
 
class NitroBO_Welcome extends NitroBOSubModule {
	
	/**
	 * Define some Module things
	 */
	var $ModuleName = "NitroBO_Welcome";
	var $ModuleVersion = "1.0";
	var $ModuleAuthor = Array( "Jesper Avôt" );

	/**
	 * Does Nothing
	 */
	function NitroBO_Welcome() {}
	
	function GetObjectsDefinition()
	{
		DebugGroup( __CLASS__, __FUNCTION__, "NitroBO->Submodule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK );
		
		$this->_ModuleObjects = Array( 'Text' => Array( 
																		'Type'					=> 'HTML',
																	 	'Name'					=> 'Text',
																	 	'FunctionName'	=> 'DrawText',
																	 	'Default'				=> TRUE,
																	 	'ReportObject'	=> FALSE ) );
	
		DebugCloseGroup( DEBUG_MOD_OK );
		
		return $this->_ModuleObjects;
	}
	
	/**
	 * DrawText function
	**/
	function DrawText()
	{
		DebugGroup( __CLASS__, __FUNCTION__, 'Draw the Welcome Module', __FILE__, __LINE__, DEBUG_MOD_OK );

		$RV = GetObjectLink('BackOfficeStartPage', array(
			'Replace' => array(
				'UserCount' 	=> $this->CountMembers(),
				'ModuleCount' => $this->CountSubModules()
			)
		));

		DebugCloseGroup( DEBUG_MOD_OK );
		
		return $RV;
	}
	
	/**
	 * CountMembers function
	**/
	function CountMembers()
	{
		DebugGroup( __CLASS__, __FUNCTION__, 'CountMembers func.', __FILE__, __LINE__, DEBUG_MOD_OK );
		
		global $DB; // TODO: Remove Globals!
		
		$Query = "
			SELECT COUNT(*)
			FROM User
		";
		$NumUsers = $DB["NitroBO"]->getOne($Query);
		
		DebugCloseGroup( DEBUG_MOD_OK );
		
		return $NumUsers;
	}
	
}
?>
Return current item: OpenNitro