<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Modules :: 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: Site.inc.php 229 2008-04-17 09:20:31Z oli $
//
/**
* This file contains the Nitro Site selection Module
*
* @author Siggi Oskarsson
* @copyright June Systems BV, 2006
* @version $Revision: 1.4 $
* @package Modules
*/
/**
* Include Form controls and Template classes
*/
require_once "Nitro/Template.inc.php";
require_once "Nitro/Libraries/Form.inc.php";
/**
* SiteSelection
*
* @author Jesper Avôt <hide@address.com>
* @copyright 2006 June Systems B.V.
* @package Modules
*/
class NitroModuleSite extends NitroModule {
/**
* SiteSelection Constructor
*/
function NitroModuleSite()
{
DebugGroup(__CLASS__, __FUNCTION__, 'Site Selection Module Constructor', __FILE__, __LINE__, DEBUG_MOD_OK);
parent::NitroModule(); /*Retrieve parent stuff*/
DebugCloseGroup(DEBUG_MOD_OK);
}
/**
* GetModuleRunTimeConfiguration function
*
* @return array Array for the form libraries.
*/
function GetModuleRuntimeConfiguration()
{
return Array(
"FormTemplateID" => "SELECT/DB=NitroBO:Template:TemplateID:Name",
"WidgetsTemplateID" => "SELECT/DB=NitroBO:Template:TemplateID:Name"
);
}
/**
* PreProcess function
*/
function PreProcess()
{
DebugGroup(__CLASS__, __FUNCTION__, "SiteSelection->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
if (array_key_exists('User', $_POST)) {
foreach($_POST['User'] AS $Key => $Value) {
$this->Sess->User[$Key] = $Value;
}
$_SESSION['User'] = $this->Sess->User;
// Redirect to same page, with no extra options !
Header('Location: '.NitroGetConfig('Settings/PageURL').$_GET['P']);
exit;
}
DebugCloseGroup(DEBUG_MOD_OK);
}
/**
* Draw function
*/
function Draw($RunTimeSettings = FALSE)
{
DebugGroup(__CLASS__, __FUNCTION__, "SiteSelection->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
$IniFiles = "";
foreach($this->Conf["NitroBOConfigs"] AS $Key => $Name) $IniFiles.= (',' . urlencode($Key) . ':' . urlencode(str_replace('_', ' ', $Key)));
$FormTemplateID = isset($RunTimeSettings['FormTemplateID']) ? $RunTimeSettings['FormTemplateID'] : GetNitroTemplateID('Form');
$WidgetsTemplateID = isset($RunTimeSettings['WidgetsTemplateID']) ? $RunTimeSettings['WidgetsTemplateID'] : GetNitroTemplateID('Widgets');
$Form = new Form("Site", "", "POST");
$Form->SetTemplateIDs($FormTemplateID, $WidgetsTemplateID);
$Form->AddOptionString("User[NitroBOConfigID]", "SELECT/LABEL=__FALSE/AUTO=1/VALUES=0:-- Select --{$IniFiles}/SELECTED=" . $this->Sess->User['NitroBOConfigID'] . "/STYLE=width: 120px;");
$Form->AddButton("", Array("Type" => "HIDDEN"));
$RV = $Form->Draw();
DebugCloseGroup(DEBUG_MOD_OK);
return $RV;
}
}
?>