Location: PHPKode > projects > Terra-Terra, A Virtual Operating System > terra-terra.0.0.5/workareas/User/TTconfiguration.php
<?php
/****m*
 * NAME
 *  TTconfiguration.php --- Workarea of the TT User application
 *
 * DESCRIPTION
 *  Define a workarea where the user can change his/her configuration
 *
 * USAGE
 *  This page contains no HTML Header and Body tags, since
 *  it *has* to be displayed as an embedded area.
 *
 * AUTHOR
 *  Oscar van Eijk, Oveas Functionality Provider
 *
 * COPYRIGHT
 *  (c) 2003-2005 by Oscar van Eijk/Oveas Functionality Provider 
 ***/
/*
 * This module is part of Terra-Terra, the Virtual Operating System
 * http://terra-terra.com
 * ------------------------------------------------------------------------
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License,
 * or any later version.
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * ------------------------------------------------------------------------
 * $Id: TTconfiguration.php,v 1.3 2005/11/14 20:21:10 tt_oscar Exp $ 
 */

if (!defined ('TT_MASTER_PROCESS')) {
	if (function_exists ('version_compare')) {
		$__TTroot = $_COOKIE['TTroot'];
	} else {
		$__TTroot = $HTTP_COOKIE_VARS['TTroot'];
	}
	require_once ($__TTroot . '/kernel/TTinit.pinc');
}

function TT_USER_language_options () {
	global $TT_db;
	global $TT_workspace;

	$TT_db->query =  'SELECT  code '
			. ',       description '
			. 'FROM    ' . $TT_db->db_prefix . 'languages '
			. "WHERE   active = 'Y' "
			;
	$__languages = $TT_db->read (DBHANDLE_DATA);
	if ($TT_db->severity() == TT_ERROR) {
		TT_signal ($TT_db);
	}

	if ($TT_db->status == DBHANDLE_NODATA) {
		$TT_db->reset();
		return;
	}
	foreach ($__languages as $__lang) {
		echo ('            <option value="' . $__lang[0] . '"');
		if ($__lang[0] == $TT_workspace->language) {
			echo ('  selected');
		}
		echo ('> ' . $__lang[1] . " </option>\n");
	}
}

function TT_USER_theme_options () {
	global $TT_db;
	global $TT_workspace;
	global $TT_session;

	$TT_db->query =  'SELECT  code '
			. ',       description '
			. 'FROM    ' . $TT_db->db_prefix . 'themes '
			. 'WHERE   gid in (0 '
			;
	foreach ($TT_session->gids as $__gid) {
		$TT_db->query .= ", $__gid ";
	}		
	$TT_db->query .= ") ";
	$__themes = $TT_db->read (DBHANDLE_DATA);
	if ($TT_db->severity() == TT_ERROR) {
		TT_signal ($TT_db);
	}

	if ($TT_db->status == DBHANDLE_NODATA) {
		$TT_db->reset();
		return;
	}
	foreach ($__themes as $__theme) {
		echo ('            <option value="' . $__theme[0] . '"');
		if ($__theme[0] == $TT_workspace->theme) {
			echo ('  selected');
		}
		echo ('> ' . $__theme[1] . " </option>\n");
	}
}

echo (TT_header());
?>

<form id="TTConfigForm" action="<?php echo ($TT['env_server']['PHP_SELF']); ?>" method="POST" onSubmit="GetWorkAreaAttributes(this);">
<?php echo (TT_applicname_field ()); ?>

<input type="hidden" name="TTform_action" value="save_config">
<input type="hidden" name="TTarea_data" value="">

<table>
	<tbody>
	<!--
	  -- ##### TODO #####
	  -- "Language" and "Theme" should be prompts
	  -->
	<tr>
		<td>Language:</td>
		<td><select name="TTlanguage"><?php echo ($TT_workspace->language_options ()); ?></select></td>
	</tr>
	<tr>
		<td>Theme:</td>
		<td><select name="TTtheme"><?php  echo ($TT_workspace->theme_options ());?></select></td>
	</tr>
	<tr>
		<!--
		  -- ##### TODO #####
		  -- Make the 'checked' attribute below configurable
		  -->
		<td colspan="2"><input type="checkbox" checked name="TTsave_area"> Save area settings</td>
	</tr>
	<tr>
		<td colspan="2" align="center"><?php echo (TT_form_close ($TT_workspace->get_prompt('SAVE'))); ?></td>
	</tr>
	</tbody>
</table>
</form>

<?php
echo (TT_footer($__metatag));
?>
Return current item: Terra-Terra, A Virtual Operating System