Location: PHPKode > projects > OpenNitro > trunk/Nitro/Modules/BackOffice/Object/Module.inc.php
<?php
//
// +---------------------------------------------------------------------------+
// | Nitro :: Modules :: NitroBOSubModule :: Object                            |
// +---------------------------------------------------------------------------+
// | 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 Listing classes
 */
require_once "Nitro/Libraries/Form.inc.php";
require_once "Nitro/Libraries/Listing.inc.php";

/**
 * Object
 *
 * @author			Jesper Avôt <hide@address.com>
 * @copyright		2006 June Systems B.V.
 * @package			Modules
 * @subpackage  NitroBO
 */
class NitroBO_Object extends NitroBOSubModule {	
	/**
	 * Define some Module things
	 */
	var $ModuleName = "NitroBO_Object";
	var $ModuleVersion = "1.0";
	var $ModuleAuthor = Array("Jesper Avôt");
	var $Versions = 1;
	
	/**
	 * Does Nothing
	 */
	function NitroBO_Object() { }
	
	/**
	 * 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), 
				'ObjectID' 					=> Array('SessionVariable' => FALSE, 'FormVariable' => 'ObjectID',				'Default' => NULL), 
				'ModuleID' 					=> Array('SessionVariable' => FALSE, 'FormVariable' => 'ModuleID',				'Default' => NULL), 
				'AddObject'	 				=> Array('SessionVariable' => FALSE, 'FormVariable' => 'AddObject',				'Default' => NULL), 
				'Name'		 					=> Array('SessionVariable' => FALSE, 'FormVariable' => 'Name',						'Default' => NULL), 
				'IDString' 					=> Array('SessionVariable' => FALSE, 'FormVariable' => 'IDString',				'Default' => NULL),
				'SystemIDString' 		=> Array('SessionVariable' => FALSE, 'FormVariable' => 'SystemIDString',	'Default' => NULL),
				'AllowView' 				=> Array('SessionVariable' => FALSE, 'FormVariable' => 'AllowView',				'Default' => NULL),
				'DefaultSettings' 	=> Array('SessionVariable' => FALSE, 'FormVariable' => 'DefaultSettings',	'Default' => NULL),
				'ObjectSettings' 		=> Array('SessionVariable' => FALSE, 'FormVariable' => 'ObjectSettings',	'Default' => NULL),
				'AddVer'						=> Array('SessionVariable' => FALSE, 'FormVariable' => 'AddVer',					'Default' => NULL), 
				'Lang'							=> Array('SessionVariable' => FALSE, 'FormVariable' => 'Lang',						'Default' => NULL), 
				'Ver'								=> Array('SessionVariable' => FALSE, 'FormVariable' => 'Ver',							'Default' => NULL), 
				'RemoveVersion'			=> Array('SessionVariable' => FALSE, 'FormVariable' => 'RemoveVersion',		'Default' => NULL), 
				'CloseTab' 					=> Array('SessionVariable' => FALSE, 'FormVariable' => 'CloseTab',				'Default' => NULL), 
				'ModFilter' 				=> Array('SessionVariable' => FALSE, 'FormVariable' => 'ModFilter/',			'Default' => NULL), 
				'Start'							=> Array('SessionVariable' => FALSE, 'FormVariable' => 'Start',						'Default' => 0) 
			);
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $this->_ModuleSettings;
	}
	
	/**
	 * GetSettingsDefinition function
	 *
	 * Which Settings are allowed in this Module for XML Requests?
	 */
	function GetXMLDefinition()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		if (!isset($this->_XMLDefinition)) {
			$this->_XMLDefinition = Array(
				'DeleteObject' 	=> Array('Type' 				=> "HTML", 
																 'Name' 				=> "Delete Object", 
																 'DivID' 				=> "UserField", 
																 'FunctionName' => "DeleteObject"), 
				'EditObject' 	 	=> Array('Type' 				=> "HTML", 
														 		 'Name' 				=> "Edit Object", 
														 		 'DivID' 				=> "EditField", 
														 		 'FunctionName' => "EditObject"), 
				'SaveObject' 		=> Array('Type' 				=> "HTML", 
														 		 'Name' 				=> "Save Object", 
														 		 'DivID'			 	=> "ErrorDiv", 
														 		 'FunctionName' => "SaveObject"), 
				'GetModuleOptions' => Array('Type' 					=> "HTML", 
															 		  'Name' 					=> "Get Object Options", 
															 		  'DivID' 				=> "UserField", 
															 		  'FunctionName' 	=> "GetModuleOptions"), 
				'Version' 			=> Array('Type' => "HTML", 
																 'Name' => "Add Object Version", 
																 'DivID' => "UserField", 
																 'FunctionName' => "addVersion"), 
				'FilterMod' 		=> Array('Type' 				=> "HTML", 
														 		 'Name' 				=> "Filter Object List", 
														 		 'DivID' 				=> "UserField", 
														 		 'FunctionName' => "ShowObjectsList"), 
				'ObjectList' 		=> Array('Type' 				=> "HTML", 
														 		 'Name' 				=> "Module List", 
														 		 'DivID' 				=> "UserField", 
														 		 'FunctionName' => "ShowObjectsList")
			);
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $this->_XMLDefinition;
	}
	
	/**
	 * 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;
	}

	/**
	 * Draw function
	 */
	function Draw()
	{ 
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$RV = $this->CreateTabInterface(Language('Object Management'), $this->ShowObjectsList(TRUE));
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * DeleteObject function
	 */
	function DeleteObject()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$ObjectID = (int)$this->GetSetting('ObjectID');
		$Transaction = new Transaction($this->DB, $this->Sess->UserID, TRUE);
		$Transaction->addData('Object', 
													Array('ObjectID' => $ObjectID), 
													Array('ObjectID' => $ObjectID), 
													'DELETE');
		$Transaction->addData('ObjectData', 
													Array('ObjectID' => $ObjectID), 
													Array('ObjectID' => $ObjectID), 
													'DELETE');

		$RV = Array("UserField" => ($Transaction->Commit() !== FALSE) ? $this->ShowObjectsList() : "");
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * GetModuleOptions function
	 */
	function GetModuleOptions($MID = FALSE, $OID = FALSE, $Settings = FALSE)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$RV = Array();
		$ObjectID = (int)($this->GetSetting('ObjectID') ? $this->GetSetting('ObjectID') : $OID);
		$ModuleID = (int)($this->GetSetting('ModuleID') ? $this->GetSetting('ModuleID') : $MID);
		 
		 //changed widget template to  new one
		 $this->WidgetTemplateID = "file:" . NITRO_PATH . "Defaults/Templates/BackOffice/widget.tpl";
		
		
		$ModuleName = $this->DB->getOne("SELECT 
																			 Class 
																		 FROM 
																		 	 `Module` 
																		 WHERE 
																		 	 ModuleID = " . $ModuleID);
		$Settings = $Settings !== FALSE ? $Settings : "";
							

		if ($ModuleName && $ModuleID) {
			if ($ModuleID != "-") {
				$ModOptions = $this->_GetModuleOptions($ModuleID, $ObjectID, ($Settings["DefaultSettings"] ? $Settings["DefaultSettings"] : ""));
				$ModDataOptions = $this->_GetModuleDataOptions($ModuleID, $ObjectID, ($Settings["ObjectData"] ? $Settings["ObjectData"] : ""));
					
				if (is_array($ModOptions) && count(array_values($ModOptions))) {
					$FormGroup = new FormGroup("ModuleOptions_" . $ObjectID, "", $ModuleName . " Options");
					
					$Widget = new NitroTemplate(($ModOptions["Template"] ? $ModOptions["Template"] : $this->WidgetTemplateID));
					$Widget->ClearAll();
					
					foreach ($ModOptions AS $OName => $OString) {
						if ($OName != "Template" && $OName != "OptionNames") {
							$FormGroup->AddOptionString($OName, $OString);
						}
					}
					$DrawResult = $FormGroup->Draw($Widget);
				 
					$RV["OptionsDiv_" . $ObjectID] = $DrawResult['Controls'];
				} else {
					$RV["OptionsDiv_" . $ObjectID] = "";
				}
				
				if (is_array($ModDataOptions) && count(array_values($ModDataOptions))) {
					if ($this->GetSetting('AddVer')) {
						$Lang = $this->GetSetting('Lang');
						$Vers = $this->GetSetting('Ver');
						
						$ModDataOptions[$Lang][$Vers] = $this->_newVersion($ModuleID, $Lang, $Vers);
					}
					
					$FormGroup = new FormGroup("ModuleDataOptions_" . $ObjectID, "", $ModuleName . " Data Options");
					
					$Widget = new NitroTemplate(($ModDataOptions["Template"] ? $ModDataOptions["Template"] : $this->WidgetTemplateID));
					$Widget->ClearAll();
					
					$tabJscript = "";
					$LanguageTab = new FormTab("Language_" . $ObjectID);
					
					if (is_array($this->AllowedLanguages) && count($this->AllowedLanguages)) {
						$tabJscript.= "if(!theTabs['Language_" . $ObjectID . "']) theTabs['Language_" . $ObjectID . "'] = new Array();";
						
						foreach ($this->AllowedLanguages AS $LangCode => $LangName) {
							$this->EditLanguageTab($LanguageTab, $tabJscript, $ModuleID, $ObjectID, $LangCode, $ModDataOptions, $Settings);
						}
					}
					
					$FormGroup->AddOption($LanguageTab);

					$DrawResult = $FormGroup->Draw($Widget);
				
					$RV["OptionsDataDiv_" . $ObjectID] = $DrawResult['Controls'];
				} else {
					$RV["OptionsDataDiv_" . $ObjectID] = "";
				}
			} else {
				$RV["OptionsDiv_" . $ObjectID] = "";
				$RV["OptionsDataDiv_" . $ObjectID] = "";
			}
		} else {
			$RV["OptionsDiv_" . $ObjectID] = "";
			$RV["OptionsDataDiv_" . $ObjectID] = "";
		}
		
		$RV['JSCRIPT:()'] = $tabJscript;
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * Draw a Language tab and contents with the given options
	 *
	 * object	$LanguageTab	LanguageVersion tab to draw into
	 * string	$tabJscript	String to append and Javascript added by this function
	 * int	$ObjectID	ID of object being editted
	 * string	$LangCode	Language code
	 * array	$ModDataOptions	 ???
	 */
	function EditLanguageTab(&$LanguageTab, &$tabJscript, $ModuleID, $ObjectID, $LangCode, $ModDataOptions, $Settings)
	{
		$LangName = $this->AllowedLanguages[$LangCode];
		$tabJscript.= "theTabs['Language_" . $ObjectID . "']['" . $LangCode . "'] = '" . $LangName . "';";
		$LanguageTab->AddTab($LangName, $LangCode);
		$LanguageVersionTab = new FormTab($LangCode . "Version_" . $ObjectID);
		$tabJscript.= "if(!theTabs['" . $LangCode . "Version_" . $ObjectID . "']) theTabs['" . $LangCode . "Version_" . $ObjectID . "'] = new Array();";
		
		if (is_array($ModDataOptions[$LangCode])) {
			foreach ($ModDataOptions[$LangCode] AS $Ver => $Content) {	
				$this->EditLanguageVersionTab($LanguageVersionTab, $tabJscript, $ModuleID, $ObjectID, $LangCode, $Ver, $Content, $Settings);
				if ($Content['Published'] OR ereg('NEW', $Settings['ObjectData'][$LangCode][$Ver]['ObjectID'])) $LanguageVersionTab->SetSelectedTab($LangCode.$Ver); // Set last published tab selected
			}
		}
		
		if (!$this->GetSetting('AddObject')) {
			$LanguageVersionTab->AddAction(Language('Add Version'), "#","", "ModuleXMLRequest('Version', GetXMLURL('Language_" . $ObjectID . "_TAB_" . $LangCode . "') + '&AddVer=1&ModuleID=" . $ModuleID . "&Ver=" . (count($ModDataOptions[$LangCode]) + 1) . "&Lang=" . $LangCode . "&ObjectID=" . $ObjectID . "'); return false;");
		}
		
		$LanguageTab->AddOption($LanguageVersionTab);
	}

	/**
	 * Draw a Language Version tab and contents with the given options
	 *
	 * object	$LanguageVersionTab	LanguageVersion tab to draw into
	 * string	$tabJscript	String to append and Javascript added by this function
	 * int	$ObjectID	ID of object being editted
	 * string	$LangCode	Language code being editted/added
	 * int	$Ver	Version being editted/added
	 * array	$Content	 ???
	 */
	function EditLanguageVersionTab(&$LanguageVersionTab, &$tabJscript, $ModuleID, $ObjectID, $LangCode, $Ver, $Content, $Settings)
	{
		$tabJscript.= "theTabs['" . $LangCode . "Version_" . $ObjectID . "']['" . $LangCode . $Ver . "'] = '" . $LangCode . $Ver . "';";
		$LanguageVersionTab->AddTab( "v" . $Ver, $LangCode . $Ver);
		$LanguageVersionTab->AddOptionString("ObjectSettings[". $LangCode . "][" . $Ver . "][ModuleID]", "HIDDEN/VALUE=" . $ModuleID);
		$LanguageVersionTab->AddOptionString("ObjectSettings[". $LangCode . "][" . $Ver . "][Title]", "TEXT/VALUE=" . urlencode($Settings["ObjectData"][$LangCode][$Ver]["Title"]) . "/LABLE=" . Language('Title') . "/STYLE=width: 250px;");
		
		foreach ($Content AS $OName => $OString) {
			if ($OName != "Template" && $OName != "OptionNames") {
				$LanguageVersionTab->AddOptionString($OName, $OString);								
			}
		}
		
		$LanguageVersionTab->AddOptionString("ObjectSettings[". $LangCode . "][" . $Ver . "][Published]", "CHECKBOX/LABLE=" . Language('Published') . "/VALUE=1:" . Language('Yes') . "/SELECTED=" . $Settings["ObjectData"][$LangCode][$Ver]["Published"] . "");
		$LanguageVersionTab->AddOptionString("ObjectSettings[". $LangCode . "][" . $Ver . "][VisibleFrom]", "TEXT/VALUE=" . urlencode($Settings["ObjectData"][$LangCode][$Ver]["VisibleFrom"]) . "/LABLE=" . Language('Visible From') . "/STYLE=width: 250px;");
		$LanguageVersionTab->AddOptionString("ObjectSettings[". $LangCode . "][" . $Ver . "][VisibleTill]", "TEXT/VALUE=" . urlencode($Settings["ObjectData"][$LangCode][$Ver]["VisibleTill"]) . "/LABLE=" . Language('Visible Till') . "/STYLE=width: 250px;");
		
		/*
		$DeleteBTN = urlencode("<input type='button' onclick=\"ModuleXMLRequest('Version', GetXMLURL('EditPageForm_" . $this->GetSetting('ObjectID') . "') + '&Ver=" . $Ver . "&Lang=" . $LangCode . "&ObjectID=" . $ObjectID . "&RemoveVersion=1'); return false;\" value='" . Language('Delete Version') . "' />");
		if ($LangCode == "Default" && $Ver > 1) {
			$LanguageVersionTab->AddOptionString("DeleteBTN", "HTML/LABLE= /VALUE=" . $DeleteBTN);
		} else if ($LangCode != "Default" && $Ver == count($ModDataOptions[$LangCode]) && !$this->GetSetting('AddObject')) {
			$LanguageVersionTab->AddOptionString("DeleteBTN", "HTML/LABLE= /VALUE=" . $DeleteBTN);
		}
		*/
	}

	/**
	 * _GetModuleOptions function
	 */
	function _GetModuleOptions($ModuleID, $ObjectID, $Settings)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$RV = Array();
		$ModuleInfo = $this->DB->getRow("SELECT 
																			 Class, 
																			 File 
																		 FROM 
																		 	 `Module` 
																		 WHERE 
																		 	 ModuleID = " . $ModuleID);
		
		if ($ModuleInfo) {
			if (include_once $ModuleInfo["File"]) {
				$module = new $ModuleInfo["Class"](0, $Settings);
				if (is_callable(array($module,"GetModuleConfiguration")) && is_array($Configuration = call_user_func(array($module,"GetModuleConfiguration"), $this->SubModulesDir))) {
					foreach($Configuration AS $OptionName => $OptionString) {
						if ($OptionName != "Template" && $OptionName != "OptionNames") {
							if (ereg("\[\]$", $OptionName)) {
								$OName = "DefaultSettings[" . substr($OptionName, 0, strpos($OptionName, "[")) . "][]";
							} else {
								$OName = "DefaultSettings[" . $OptionName . "]";
							}
							
							if (!strpos($OptionString, "LABLE") && !strpos($OptionString, "LABEL")) $OptionString.= "/LABLE=" . $OptionName;
							
							if (strtoupper(substr($OptionString, 0, 4)) == 'TEXT') {
								$OString = $OptionString . "/VALUE=" . ($Settings[$OptionName] ? urlencode($Settings[$OptionName]) : "");
							} else {
								$OString = $OptionString . "/SELECTED=" . ($Settings[$OptionName] ? urlencode($Settings[$OptionName]) : "");
							}
						} else {
							$OName = $OptionName;
							$OString = $OptionString;
						}
						
						$RV[$OName] = $OString;
					}
				}
			}
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * _GetModuleDataOptions function
	 */
	function _GetModuleDataOptions($ModuleID, $ObjectID, $Settings)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$RV = Array();
		$ModuleInfo = $this->DB->getRow("SELECT 
																				File, 
																				Class 
																		 FROM
																				`Module` 
																		 WHERE
																				ModuleID = " . (int)$ModuleID);
		
		if ($ModuleInfo) {
			if (include_once $ModuleInfo["File"]) {
				if (is_callable(array($ModuleInfo["Class"],"GetModuleDataConfiguration")) && is_array($Configuration = call_user_func(array($ModuleInfo["Class"],"GetModuleDataConfiguration"), $this->SubModulesDir))) {
					foreach ($this->AllowedLanguages AS $LangCode => $LangName) {					
						if ($Settings[$LangCode]) {
							$RV[$LangCode] = Array();
							
							// TODO Build in Submodule Runtimesettings support by adding the defined settings as 2nd parameter to constructor of module
							
							foreach ($Settings[$LangCode] AS $Version => $Row) {
								foreach ($Configuration AS $OptionName => $OptionString) {
									if ($OptionName != "Template" && $OptionName != "OptionNames") {
										/**
										 * TODO: Fix the Preview.
										 */
										if (eregi("^PREVIEW\/", $OptionString)) {
											eval('$theModule = new ' . $ModuleInfo["Class"] . '(' . $ObjectID . ');');
											$PreviewParameters = Array();
											$paramsA = explode("/", $OptionString);
											
											foreach ($paramsA AS $params) {
												$tmp = explode("=", $params);
												$PreviewParameters[strtoupper($tmp[0])] = $tmp[1];
											}
											
											$ObjectSettings = $this->GetObjectSettings($ObjectID, $LangCode, $Version);
											$theModule->SetModuleSettings($ObjectSettings);
											$_GET['TAG'] = $PreviewParameters["TAG"];
											$ModulePreview = $theModule->Draw();
											
											$OName = "Preview";
											$OString = "HTML/VALUE=" . urlencode($ModulePreview);
										} else {
											if (ereg( "\[\]$", $OptionName)) {
												$OName = "ObjectSettings[" . $LangCode . "][" . $Version . "][Settings][" . substr($OptionName, 0, strpos($OptionName,"[")) . "][]";
											} else {
												$OName = "ObjectSettings[" . $LangCode . "][" . $Version . "][Settings][" . $OptionName . "]";
											}
											
											if (!strstr($OptionString, "LABLE") && !strstr($OptionString, "LABEL")) $OptionString.= "/LABLE=" . $OptionName;
											
											if ($Configuration["OptionNames"]) {
												if (array_key_exists($OptionName, $Configuration["OptionNames"])) {
													$SetName = str_replace( $OptionName, $Configuration["OptionNames"][$OptionName], $OptionName);
												} else {
													$SetName = $OptionName;
												}
											} else {
												$SetName = $OptionName;
											}
											
											if (strtoupper(substr($OptionString, 0, 4)) == 'TEXT') {
												$OString = $OptionString . ($Row["Settings"][$SetName] ? "/VALUE=" . urlencode($Row["Settings"][$SetName]) : "");
											} else {
												$OString = $OptionString . ($Row["Settings"][$SetName] ? "/SELECTED=" . urlencode($Row["Settings"][$SetName]) : "");
											}
										}
									} else {
										$OName = $OptionName;
										$OString = $OptionString;
									}
										
									$RV[$LangCode][$Version][$OName] = $OString;
								}
							}
						}
					}
					
					if (!count(array_values($RV))) {
						foreach ($this->AllowedLanguages AS $LangCode => $LangName) {
							foreach ($Configuration AS $OptionName => $OptionString) {
								if ($OptionName != "Template" && $OptionName != "OptionNames") {
									if (ereg( "\[\]$", $OptionName)) {
										$OName = "ObjectSettings[" . $LangCode . "][1][Settings][" . substr($OptionName, 0, strpos($OptionName,"[")) . "][]";
									} else {
										$OName = "ObjectSettings[" . $LangCode . "][1][Settings][" . $OptionName . "]";
									}
									
									if (!strstr($OptionString, "LABLE") && !strstr($OptionString, "LABEL")) $OptionString.= "/LABLE=" . $OptionName;
									
									$OString = $OptionString;
								} else {
									$OName = $OptionName;
									$OString = $OptionString;
								}
									
								$RV[$LangCode][1][$OName] = $OString;
							}
						}
					}
				}
			}
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * _newVersion function
	 */
	function _newVersion($ModuleID, $LangCode, $Version)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$RV = Array();
		$ModuleInfo = $this->DB->getRow("SELECT 
																				File, 
																				Class 
																		 FROM
																				`Module` 
																		 WHERE
																				ModuleID = " . (int)$ModuleID);
		
		if ($ModuleInfo) {
			if (include_once $ModuleInfo["File"]) {
				if (is_callable(array($ModuleInfo["Class"],"GetModuleDataConfiguration")) && is_array($Configuration = call_user_func(array($ModuleInfo["Class"],"GetModuleDataConfiguration"), $this->SubModulesDir))) {
					foreach ($Configuration AS $OptionName => $OptionString) {
						if ($OptionName != "Template" && $OptionName != "OptionNames") {
							if (ereg( "\[\]$", $OptionName)) {
								$OName = "ObjectSettings[" . $LangCode . "][" . $Version . "][Settings][" . substr($OptionName, 0, strpos($OptionName,"[")) . "][]";
							} else {
								$OName = "ObjectSettings[" . $LangCode . "][" . $Version . "][Settings][" . $OptionName . "]";
							}
							
							if (!strstr($OptionString, "LABLE") && !strstr($OptionString, "LABEL")) $OptionString.= "/LABLE=" . $OptionName;
							
							if ($Configuration["OptionNames"]) {
								if (array_key_exists($OptionName, $Configuration["OptionNames"])) {
									$SetName = str_replace( $OptionName, $Configuration["OptionNames"][$OptionName], $OptionName);
								} else {
									$SetName = $OptionName;
								}
							} else {
								$SetName = $OptionName;
							}
							
							if (strtoupper(substr($OptionString, 0, 4)) == 'TEXT') {
								$OString = $OptionString . ($Row["Settings"][$SetName] ? "/VALUE=" . urlencode($Row["Settings"][$SetName]) : "");
							} else {
								$OString = $OptionString . ($Row["Settings"][$SetName] ? "/SELECTED=" . urlencode($Row["Settings"][$SetName]) : "");
							}
						} else {
							$OName = $OptionName;
							$OString = $OptionString;
						}
							
						$RV[$OName] = $OString;
					}
				}
			}
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * GetModuleSettings function
	 */
	function GetObjectSettings($ObjectID, $LanguageCode, $Version)
	{
		$Query = "SELECT
								O.DefaultSettings, 
								OD.Settings
							FROM 
								Object AS O 
							LEFT 
							JOIN 
								ObjectData AS OD 
							ON 
								OD.ObjectID = O.ObjectID 
							AND 
								(OD.Language = " . NitroPrepareDB($LanguageCode) . " OR OD.Language = '')
							AND 
								OD.Version = " . (int)$Version . "
							WHERE 
								O.ObjectID = " . (int)$ObjectID;
								
		$Data = $this->DB->getRow($Query);
		
		$Data["DefaultSettings"] = unserialize($Data["DefaultSettings"]);
		$Data["Settings"] = unserialize($Data["Settings"]);
		
		if (!is_array($Data["DefaultSettings"])) $Data["DefaultSettings"] = Array();
		if (!is_array($Data["Settings"])) $Data["Settings"] = Array();
		
		$RV = array_merge($Data["DefaultSettings"], $Data["Settings"]);
		
		return $RV;
	}
	
	/**
	 * EditObject function
	 */
	function EditObject()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$ObjectID = (int)($this->GetSetting('ObjectID') ? $this->GetSetting('ObjectID') : 0);
		
		if ($this->GetSetting('AddObject')) {
			$data = Array("Name" => "", "AllowView" => "0", "IDString" => "", "SystemIDString" => "", "ModuleID" => "", "ObjectData" => Array());
			$formadd = TRUE;
			
			$Name = "Add New Object";
		} else {  
			$ObjectData = Array();
			$data = Array();
			$data["ObjectData"] = Array();
			$Query = "SELECT 
									O.IDString, 
									O.SystemIDString, 
									O.ModuleID, 
									O.Name, 
									O.AllowView, 
									O.DefaultSettings, 
									OD.Language, 
									OD.Version, 
									OD.Title, 
									OD.Settings, 
									OD.Published, 
									OD.VisibleFrom, 
									OD.VisibleTill 
								FROM 
									Object AS O 
								LEFT 
								JOIN 
									ObjectData AS OD 
								ON 
									OD.ObjectID = O.ObjectID 
								WHERE 
									O.ObjectID = " . (int)$ObjectID;
			$Result = $this->DB->query($Query);
			
			while ($Row = $Result->FetchArray()) {
				if (!count($ObjectData)) {
					$ObjectData["IDString"] = $Row["IDString"];
					$ObjectData["SystemIDString"] = $Row["SystemIDString"];
					$ObjectData["ModuleID"] = $Row["ModuleID"];
					$ObjectData["Name"] = $Row["Name"];
					$ObjectData["AllowView"] = $Row["AllowView"];
					$ObjectData["DefaultSettings"] = unserialize($Row["DefaultSettings"]);
				}
				
				if($Row["Language"] == "") $Row["Language"] = "Default";
				
				$data["ObjectData"][$Row["Language"]][$Row["Version"]]["Title"] = $Row["Title"];
				$data["ObjectData"][$Row["Language"]][$Row["Version"]]["Settings"] = unserialize($Row["Settings"]);
				$data["ObjectData"][$Row["Language"]][$Row["Version"]]["Published"] = $Row["Published"];
				$data["ObjectData"][$Row["Language"]][$Row["Version"]]["VisibleFrom"] = $Row["VisibleFrom"];
				$data["ObjectData"][$Row["Language"]][$Row["Version"]]["VisibleTill"] = $Row["VisibleTill"];
				
			}
			
			$data = array_merge($ObjectData, $data);
			
			$Result->Free();
			$formadd = FALSE;
			$Name = $data["Name"];
		}
				
		$FormName = "EditObjectForm_" . ($this->GetSetting('ObjectID') ? $this->GetSetting('ObjectID') : 'NEW'.NitroCreateRandomString(4));
		$Form = new Form($FormName, "/?P=" . $this->GetSetting('P'), "POST", "application/x-www-form-urlencoded");
		$Form->HideButtons();
		$Form->AddOptionString("P", "HIDDEN/VALUE=" . $this->GetSetting('P'));
		$Form->AddOptionString("ObjectID", "HIDDEN/VALUE=" . $this->GetSetting('ObjectID'));
		
		if ($formadd == TRUE) {
			$Form->AddOptionString("AddObject", "HIDDEN/VALUE=1");
		}
		
		$Form->AddOptionString("ErrorDiv_" . $ObjectID, "DIV/LABLE= ");
		$Form->AddOptionString("Name", "TEXT/VALUE=" . $data["Name"] . "/LABLE=" . Language('Name') . "/STYLE=width: 250px;");
		$Form->AddOptionString("AllowView", "RADIO/VALUES=1:" . Language('Yes') . ",0:" . Language('No') . "/SELECTED=" . $data["AllowView"] . "/LABLE=" . Language('Allow View') . "");
		$Form->AddOptionString("IDString", "TEXT/VALUE=" . $data["IDString"] . "/LABLE=" . Language('IDString') . "/STYLE=width: 250px;");
		$Form->AddOptionString("SystemIDString", "TEXT/VALUE=" . $data["SystemIDString"] . "/LABLE=" . Language('System ID String') . "/STYLE=width: 250px;");


		if ($formadd == TRUE || !$data["ModuleID"]) {		
			$Form->AddOptionString("ModuleID", "SELECT/VALUES=-:-- Select an Object --/DB=NitroBO:Module:ModuleID:IDString/SELECTED=" . $data["ModuleID"] . "/LABLE=" . Language('Select Module') .  "/STYLE=width: 250px;/ONCHANGE=" . urlencode("ModuleXMLRequest('GetModuleOptions', '&ObjectID=" . $ObjectID . "&AddObject=" . ($formadd == TRUE ? "1" : "0") . "&ModuleID=' + this.options[this.selectedIndex].value); return false;"));		
		} else {			
			$Options = $this->GetModuleOptions($data["ModuleID"], $ObjectID, $data);
			
			if (is_array($Options) && count(array_values($Options))) {
				$ModuleOptions = $Options["OptionsDiv_" . $ObjectID];
				$ModuleDataOptions = $Options["OptionsDataDiv_" . $ObjectID];
				$TabScript = $Options["JSCRIPT:()"];
			} else {
				$ModuleOptions = "";
				$ModuleDataOptions = "";
				$TabScript = "";
			}
			
			$Form->AddOptionString("ModuleID", "HIDDEN/VALUE=" . $data['ModuleID']);
		}
		
		$Form->AddOptionString("OptionsDiv_" . $ObjectID, "DIV/LABLE= /VALUE=" . urlencode($ModuleOptions));
		$Form->AddOptionString("OptionsDataDiv_" . $ObjectID, "DIV/LABLE=__FALSE/VALUE=" . urlencode($ModuleDataOptions));

		$Custom = urlencode("<input type='button' onclick=\"ModuleXMLRequest('SaveObject', GetXMLURL('" . $FormName."')); return false;\" value='" . Language('Save') . "' />");
		$Custom.= urlencode("<input type='button' onclick=\"tinyMCE.triggerSave(); ModuleXMLRequest('SaveObject', GetXMLURL('" . $FormName . "') + '&CloseTab=1'); return false;\" value='" . Language('Save and Close') . "' />");
		$Custom.= urlencode("<input type='button' onclick=\"DeletePageTab('" . $ObjectID . "'); return false;\" value='" . Language('Cancel') . "' />");

		$Form->AddOptionString("Temp", "HTML/LABLE= /VALUE=" . $Custom);
		$Form -> SetTemplateIDs("file:" . NITRO_PATH . "Defaults/Templates/BackOffice/form.tpl", "file:" . NITRO_PATH . "Defaults/Templates/BackOffice/widget.tpl");
		$RV = $Form->Draw();

		DebugCloseGroup(DEBUG_MOD_OK);
		
		return Array("JSCRIPT:()" => $TabScript . ($this->GetSetting('AddVer') || $this->GetSetting('RemoveVersion') ? "UpdatePageTab('" . $ObjectID . "', 'Content', '" . rawurlencode($RV) . "');" : "AddPageTab('" . $ObjectID . "', '" . rawurlencode($RV) . "', '" . rawurlencode($Name) . "');"));
	}
	
	/**
	 * addVersion function
	 *
	 * @return mixed Output of the EditMenu function.
	 */
	function addVersion()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);

		$WidgetTemplate = new NitroTemplate('file:' . NITRO_PATH . "Defaults/Templates/BackOffice/widget.tpl");

		$ModuleID		= $this->GetSetting('ModuleID');
		$ObjectID		= $this->GetSetting('ObjectID');
		$LangCode	= $this->GetSetting('Lang');

		$LanguageTab = new FormTab("Language_" . $ObjectID);
		$tabJscript = '';
		
		// Get ObjectData from POST and add new empty version
		$ObjectSettings = $this->GetSetting('ObjectSettings');
		$NewVersion = count($ObjectSettings[$LangCode]) + 1;
		$ObjectSettings[$LangCode][$NewVersion] = Array('ObjectID' => 'NEW-'.$ObjectID.'-'.$LangCode.'-'.$NewVersion);
		$ModDataOptions = $this->_GetModuleDataOptions($ModuleID, $ObjectID, $ObjectSettings);

		$this->EditLanguageTab($LanguageTab, $tabJscript, $ModuleID, $ObjectID, $LangCode, $ModDataOptions, Array('ObjectData' => $ObjectSettings));
		// There is only 1 widget on this tab, the version tab widget !
		$LanguageTabRV = $LanguageTab->Options[$LangCode][0]->Draw($WidgetTemplate);
		
		$tabJscript.= 'initHTMLEditors("Language_' . $ObjectID . '_TAB_' . $LangCode . '");';

		DebugCloseGroup(DEBUG_MOD_OK);
		return array('JSCRIPT:()' => $tabJscript, 'Language_' . $ObjectID . '_TAB_' . $LangCode => $LanguageTabRV['Controls']);
	}
	
	/**
	 * RemoveVersion function
	 */
	function RemoveVersion($ObjectID, $Version, $Lang)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$Transaction = new Transaction($this->DB, $this->Sess->UserID, TRUE);
		$Transaction->addData(' ', 
							  Array("ObjectID" => (int)$ObjectID, 
							  		"Version" => (int)$Version, 
							  		"Language" => ($Lang == "Default" ? "" : $Lang)), 
							  Array("ObjectID" => (int)$ObjectID, 
							  		"Version" => (int)$Version, 
							  		"Language" => ($Lang == "Default" ? "" : $Lang)), 
							  "DELETE");
				  
		$RV = ($Transaction->Commit() !== FALSE) ? TRUE : FALSE;
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * SaveVersions function
	 *
	 * @param int $ObjectID The current ObjectID
	 * @param array $Langs Array with the data to save.
	 * @return boolean (TRUE/FALSE)
	 */
	function SaveVersions($ObjectID, $Langs, $Add = FALSE)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		$Transaction = new Transaction($this->DB, $this->Sess->UserID, TRUE);
		
		if (is_array($Langs)) {
			foreach ($Langs AS $Lang => $Versions) {
				if (is_array($Versions)) {
					foreach ($Versions AS $Version => $Data) {
						if (is_array($Data)) {
							$Data['ObjectID'] = (int)$ObjectID;
							$Data['Language'] = ($Lang == "Default") ? "" : $Lang;
							$Data['Version'] = (int)$Version;
							if ($Data['VisibleFrom'] == "") $Data['VisibleFrom'] = NULL;
							if ($Data['VisibleTill'] == "") $Data['VisibleTill'] = NULL;
							
							$ModuleInfo = $this->DB->getRow("
								SELECT 
									Class, 
									File 
								FROM 
									`Module` 
								WHERE 
									ModuleID = " . $Data['ModuleID']."
							");
		
							if ($ModuleInfo) {
								if (include_once $ModuleInfo["File"]) {
									if (is_callable(array($ModuleInfo["Class"],"SaveModuleDataConfiguration"))) {
										$Data['Settings'] = call_user_func(array($ModuleInfo["Class"],"SaveModuleDataConfiguration"), $Data['Settings']);
									}
								}
							}
							
							$Data['Settings'] = serialize($Data['Settings']);
							unset($Data['ModuleID']);
							
							if ($Add !== FALSE) {
								if ($Data['Title'] != "") {
									$Transaction->addData('ObjectData', $Data);
								}
							} else {
								$Transaction->addData('ObjectData', $Data);
							}
						}
					}
				}
			}
		}
		
		$RV = ($Transaction->Commit() !== FALSE) ? TRUE : FALSE;
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * SaveObject function
	 */
	function SaveObject()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);

		$ObjectID = (int)$this->GetSetting('ObjectID');

		if (!strlen($this->GetSetting('Name'))) {					
			$RV = Array("ErrorDiv_" . $ObjectID => $this->PrePareMSG(Array("Error", "Please fill in an Name.", TRUE), $ObjectID));
		} else {
			$RV = $this->_SaveObjectInfo();
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	/**
	 * _SaveModuleInfo function (private)
	**/
	function _SaveObjectInfo()
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);
		
		if (!$this->GetSetting('IDString') || ($this->GetSetting('IDString') && $this->GetSetting('IDString') == "")) {
			$IDString = NitroCreateRandomString(20);
			while ($this->DB->getOne("SELECT ObjectID FROM `Object` WHERE IDString LIKE " . NitroPrepareDB($IDString))) $IDString = NitroCreateRandomString(20);
		} else {
			$IDString = $this->GetSetting('IDString');
		}
		
		$DefaultSettings = $this->GetSetting('DefaultSettings');
		$ModuleInfo = $this->DB->getRow("SELECT 
																			 Class, 
																			 File 
																		 FROM 
																		 	 `Module` 
																		 WHERE 
																		 	 ModuleID = " . (int)$this->GetSetting('ModuleID'));
		
		if ($ModuleInfo) {
			if (include_once $ModuleInfo["File"]) {
				if (is_callable(array($ModuleInfo["Class"],"SaveModuleConfiguration"))) {
					$DefaultSettings = call_user_func(array($ModuleInfo["Class"],"SaveModuleConfiguration"), $DefaultSettings);
				}
			}
		}
		
		$Transaction = new Transaction($this->DB, $this->Sess->UserID, TRUE);
		$ID = $Transaction->addData('Object', 
																Array('Name' => $this->GetSetting('Name'), 
																		  'IDString' => $IDString, 
																	  	 'SystemIDString' => $this->GetSetting('SystemIDString'),
																		  'ModuleID' => (int)$this->GetSetting('ModuleID'), 
																		  'AllowView' => (int)$this->GetSetting('AllowView'),
																		  'DefaultSettings' => ($this->GetSetting('DefaultSettings') ? serialize($this->GetSetting('DefaultSettings')) : NULL),
																		  'ObjectID' => (int)$this->GetSetting('ObjectID')));
		$Commit = $Transaction->Commit();
		
		if ($this->GetSetting('AddObject')) {
			$newObjectID = (int)$this->DB->getOne("SELECT 
																							 ObjectID 
																						 FROM 
																							 Object 
																						 ORDER 
																						 BY 
																							 ObjectID 
																						 DESC 
																						 LIMIT 
																							 1");
		} else {
			$newObjectID = (int)$this->GetSetting('ObjectID');
		}
		
		$ResultID = $newObjectID;
		
		// Save the VersionSettings
		$this->SaveVersions($ResultID, $this->GetSetting('ObjectSettings'), ($this->GetSetting('AddObject') ? TRUE : FALSE));
		
		if ($Commit !== FALSE) {
			$RV = Array("NoError", Language('Object Saved'), TRUE);
		} else {
			$RV = Array("Error", Language('Object could not be Saved'));
		}
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		if ($this->GetSetting('AddObject')) {
			return Array( "JSCRIPT:()" => ($this->GetSetting('CloseTab') ? "" : "ModuleXMLRequest('EditObject', '&ObjectID=" . $ResultID . "'); ") . "DeletePageTab('0', true);", "UserField" => $this->ShowObjectsList());
		} else {
			return Array( "UserField" => $this->ShowObjectsList(), (!$this->GetSetting('CloseTab') ? "ErrorDiv_" . $ResultID : "") => $this->PrePareMSG($RV, $ResultID), "JSCRIPT:()" => ($this->GetSetting('CloseTab') ? "DeletePageTab('" . $ResultID . "', true);" : "UpdatePageTab('" . $ResultID . "', 'DisplayName', '" . $this->GetSetting('Name') . "');"));
		}
	}
	
	/**
	 * ShowObjectsList function
	 */
	function ShowObjectsList($inDiv = FALSE)
	{
		DebugGroup(__CLASS__, __FUNCTION__, "NitroBO->SubModule->" . $this->ModuleName . "->" . __FUNCTION__, __FILE__, __LINE__, DEBUG_MOD_OK);

		$addimg = "<img src=\"./GetObject.php?NitroDefault=Images/Add.gif\" width=\"16\" height=\"16\" alt\"Add\" border=\"0\" />";
		$editimg = "<img src=\"./GetObject.php?NitroDefault=Images/Edit.gif\" width=\"16\" height=\"16\" alt\"Edit\" border=\"0\" />";
		$deleteimg = "<img src=\"./GetObject.php?NitroDefault=Images/Delete.gif\" width=\"16\" height=\"16\" alt\"Delete\" border=\"0\" />";
		
		$Start = Array(TRUE, (strlen($this->GetSetting('Start')) && $this->GetSetting('Start') !== 0 ? $this->GetSetting('Start') : 0));
		$Filter = Array(TRUE, (strlen($this->GetSetting('ModFilter')) && $this->GetSetting('ModFilter') !== 0 ? $this->GetSetting('ModFilter') : FALSE));

		$List = new Listing2("", "Object_" . $this->GetSetting('P'), ($inDiv !== FALSE ? "UserField" : FALSE), $Start, $Filter, "Objects_");
		$List->EnableRowHighlighting = TRUE;
		$List->AddListAction($addimg, "#", "ModuleXMLRequest('EditObject', '&AddObject=1'); return false;", "", Language('Add Module'));
		$List->AddColumn(Language('Name'), "Name");
		$List->AddColumn(Language('IDString'), "IDString");
		$List->AddColumn(Language('Module IDString'), "Module_IDString");
		$List->AddAction("Edit", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
		$List->AddAction("Delete", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
		
		$List->SetColumnWidth("200px", "Module_IDString");
		
		$Query = "SELECT 
								SQL_CALC_FOUND_ROWS 
								O.ObjectID AS ObjectID, 
								O.IDString AS IDString, 
								O.Name AS Name, 
								O.ModuleID AS ModuleID, 
								M.IDString AS Module_IDString 
							FROM `Object` AS O 
							LEFT JOIN `Module` AS M 
							ON 
								O.ModuleID = M.ModuleID 
								" . ($List->Filter['Name'] || $List->Filter['IDString'] || $List->Filter['Module_IDString'] ? "WHERE " : "") . "
								" . ($List->Filter['Name'] ? "O.Name LIKE " . NitroPrepareDB("%" . $List->Filter['Name'] . "%") . " " : "") . "
								" . ($List->Filter['Name'] && $List->Filter['IDString'] ? "AND " : "") . ($List->Filter['IDString'] ? "O.IDString LIKE " . NitroPrepareDB("%" . $List->Filter['IDString'] . "%") . " " : "") . "
								" . (($List->Filter['Name'] || $List->Filter['IDString']) && $List->Filter['Module_IDString'] ? "AND " : "") . ($List->Filter['Module_IDString'] ? "M.IDString LIKE " . NitroPrepareDB( "%" . $List->Filter['Module_IDString'] . "%" ) . " " : "") . "
							ORDER BY 
								ObjectID 
							" . ($List->usePages !== FALSE ? "LIMIT " . (int)$List->Start . ", " . (int)$List->maxPerPage : "");
								
		$Result = $this->DB->query($Query);
		
		$List->allPages = $this->DB->getOne("SELECT FOUND_ROWS()");
		$List->onChange = "ObjectList";

		if ($Result->numRows()) {
			while ($Data = $Result->fetchArray()) {
				$ListRow = new ListingRow2();
				$ListRow->AddData("Name", $Data["Name"]);
				$ListRow->AddData("IDString", $Data["IDString"]);
				$ListRow->AddData("Module_IDString", $Data["Module_IDString"]);
				$ListRow->SetAction("Edit", $editimg, "#", "ModuleXMLRequest('EditObject', '&ObjectID=" . $Data["ObjectID"] . "');", FALSE, TRUE, Language('Edit') . space() . $Data["Name"]);
				$ListRow->SetAction("Delete", $deleteimg, "#", "if(confirm('Item is going to be removed, are you sure?')) ModuleXMLRequest('DeleteObject', '&ObjectID=" . $Data["ObjectID"] . "'); return false;", FALSE, TRUE, Language('Delete') . space() . $Data["Name"]);
				
				$List->AddListRow($ListRow);
				
				unset($ListRow);
			}
		}
		
		$Result->free();
		$List-> SetTemplate("file:" . NITRO_PATH . "Defaults/Templates/BackOffice/Listing.tpl");
		$RV = $List->Draw();
		
		DebugCloseGroup(DEBUG_MOD_OK);
		
		return $RV;
	}
	
	function UpdateObjectPagesEditedOn($ObjectID = FALSE)
	{
		if ($ObjectID !== FALSE) {
			$Query = "";
		}
	}
}
?>
Return current item: OpenNitro