Location: PHPKode > projects > OpenNitro > trunk/Nitro/Modules/BackOffice/Site/Module.inc.php
<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Modules :: NitroBOSubModule :: SiteSelection                     |
// +---------------------------------------------------------------------------+
// | 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 $
//

/**
 * Include Form controls and Template classes
 */
require_once "Nitro/Template.inc.php";
require_once "Nitro/Libraries/Form.inc.php";

/**
 * Country
 *
 * @author			Jesper Avôt <hide@address.com>
 * @copyright		2006 June Systems B.V.
 * @package			Modules
 * @subpackage  NitroBO
 */
class NitroBO_Site extends NitroBOSubModule {	
	/**
	 * Define some Module things
	 */
	var $ModuleName = "NitroBO_Site";
	var $ModuleVersion = "1.0";
	var $ModuleAuthor = Array("Jesper Avôt");
	
	/**
	 * Does Nothing
	 */
	function NitroBO_Site() { }
	
	/**
	 * GetSettingsDefinition function
	 *
	 * Which Settings are allowed in this Module?
	 */
	function GetSettingsDefinition()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		if (!isset($this->_ModuleSettings)) {
			$this->_ModuleSettings = Array(
				'P'			 					=> Array('SessionVariable' => FALSE, 'FormVariable' => 'P', 							'Default' => NULL), 
				'User' 						=> Array('SessionVariable' => FALSE, 'FormVariable' => 'User',						'Default' => NULL) 
			);
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $this->_ModuleSettings;
	}
	
	/**
	 * GetObjectsDefinition function
	 *
	 * Which Objects are allowed ?
	 */
	function GetObjectsDefinition()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$this->_ModuleObjects = Array(
			'Draw' => Array('Type'					=> 'HTML',
											'Name'					=> 'Text',
											'FunctionName'	=> 'Draw',
											'Default'				=> TRUE)
		);
	
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $this->_ModuleObjects;
	}
	
	/**
	 * PreProcess function
	 */
	function PreProcess()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		if (is_array($this->GetSetting('User'))) {
			foreach($this->GetSetting('User') AS $Key => $Value) {
				$this->Sess->User[$Key] = $Value;
			}
		} elseif ($this->GetSession('User')) {
			$this->Sess->User = $this->GetSession('User');
		}
		
		$this->SetSession('User', $this->Sess->User);
		
		$RV = TRUE;
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}

	/**
	 * Draw function
	 */
	function Draw()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$IniFiles = "";
		
		foreach($this->Conf["NitroBOConfigs"] AS $Key => $Name) {
			$IniFiles.= (',' . urlencode($Key) . ':' . urlencode(str_replace('_', ' ', $Key)));
		}
		
		$Form = new Form("Site", "", "POST");
		$Form->SetTemplateIDs(GetNitroTemplateID('Form'), GetNitroTemplateID('Widgets'));
		$Form->AddOptionString("User[NitroBOConfigID]", "SELECT/AUTO=1/LABEL=Site/VALUES=0:-- Select --{$IniFiles}/SELECTED=" . $this->Sess->User['NitroBOConfigID'] . "/STYLE=width: 120");
		$Form->AddButton("", Array("Type" => "HIDDEN"));
		
		$RV = $Form->Draw();
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
}
?>
Return current item: OpenNitro