<?php

#############################################################################
#           			                   Site@School
# Site@School is a website management system designed for primary schools.
#
# About Site@School:
# Comissioned by: City District 'de Baarsjes', Amsterdam, Netherlands
# Original idea, coding (version 1.0) and design : Mark de Haan (mark@starwave.nl)
# Ideas, improvements, expansions (version 1.1 - 2.4): Fred Stuurman 
# Current coder & maintainer: Fred Stuurman (fc.stuurman@hccnet.nl)
############################################################################
# con_personal.inc.php: last changed 17/07/2006 2.4.03                                        
#                       by Fred Stuurman (fc.stuurman@hccnet.nl)
#$Id: con_personal.inc.php,v 1.1 2006/10/03 08:33:55 fstuurman Exp $
############################################################################
#                        LICENSE INFORMATION
# Copyright (C) 2002 - 2006 Municipality of Amsterdam, City District
#  'de Baarsjes', Amsterdam, the Netherlands.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
# USA.
##############################################################################
if (!defined('IN_SAS'))
{
	die("Hacking attempt");
}
include ("interface/header.inc.php");
include ("interface/menubar.inc.php");
include ("interface/menustart.inc.php");
include ("interface/menuend.inc.php");
include ("interface/pagestart.inc.php");

print "<span class=\"heading\">" . $sas_lang['personalsettings'] . "<br></span>";
print "<br><span class=text>";
print "<FORM METHOD=\"POST\" NAME=\"form\" ACTION=\"index.php?option=configuration&save=personal\">";

$query = "SELECT name, email, username, password, editor, highvisibility  FROM $table_users WHERE id = '$userid'";
$result = mysql_query($query) or die_script($query, mysql_error());
$fullname = mysql_result($result, 0, 0);
$email = mysql_result($result, 0, 1);
$username = mysql_result($result, 0, 2);
$password = mysql_result($result, 0, 3);
$editor = mysql_result($result, 0, 4);
$highvisibility = mysql_result($result, 0, 5);
unset ($query);
unset ($result);

// full name input field
print $sas_lang['fullname'] . "<br>
      <input tabindex=\"1\" type=\"text\" name=\"fullname\" size=\"40\" value=\"$fullname\" class=\"textfield\">
      &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['fullname_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";

// e-mail address input field
print $sas_lang['email'] . "<br>
      <input tabindex=\"2\" type=\"text\" name=\"email\" size=\"40\" value=\"$email\" class=\"textfield\">
      &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['email_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";

// username input field
print $sas_lang['username'] . "<br>
      <input tabindex=\"3\" type=\"text\" name=\"username\" size=\"20\" value=\"$username\" class=\"textfield\">
      &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['username_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";

// password input field
if ($sas_config[use_encryption] == 1) //passwords are encrypted
{
	print $sas_lang['password'] . "<br>
	      <input tabindex=\"4\" type=\"password\" name=\"password\" size=\"20\" value=\"********\" class=\"textfield\">
	      &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['password_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";
}
else
{
	print $sas_lang['password'] . "<br>
	      <input tabindex=\"4\" type=\"password\" name=\"password\" size=\"20\" value=\"$password\" class=\"textfield\">
	      &nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['password_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";
}

// Editor selection field
print $sas_lang['editor'] . "<br><select size=\"1\" name=\"neweditor\">\n";

$query = "SELECT id, name FROM $table_editors";
$result = mysql_query($query) or die_script($query, mysql_error());
while ($editor_list = mysql_fetch_array($result))
{
	if ($editor_list[0] == $_SESSION['editor'])
	{
		print "<option selected value=\"$editor_list[0]\">$editor_list[1]</option>\n";
	}
	else
	{
		print "<option value=\"$editor_list[0]\">$editor_list[1]</option>\n";
	}
}

print "</select>&nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['editor_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";

// Visual mode selection field
print $sas_lang['high_visibility'] . "<br>";
print $sas_lang['yes'];
if ($highvisibility == "1")
{
	print "<input type=\"radio\" value=\"1\" name=\"newhighvisibility\" checked>";
	print "&nbsp;&nbsp;&nbsp; " . $sas_lang['no'];
	print "<input type=\"radio\" name=\"newhighvisibility\" value=\"0\">";
}
else
{
	print "<input type=\"radio\" value=\"1\" name=\"newhighvisibility\">";
	print "&nbsp;&nbsp;&nbsp; " . $sas_lang['no'];
	print "<input type=\"radio\" name=\"newhighvisibility\" value=\"0\" checked>";
}

print "&nbsp;<img src=graphics/help.gif ONMOUSEOVER=\"popup('" . $sas_lang['high_visibility_tip'] . "','CCDAEC')\"; ONMOUSEOUT=\"kill()\"><p>";

print "\n<br><input type=\"button\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['cancel'] . "\" name=\"backbutton\" 
		onClick=\"javascript:parent.location='index.php?option=configuration';\" class=\"backbutton\">";
print "&nbsp;<input type=\"submit\" value=\"&nbsp;&nbsp;&nbsp;" . $sas_lang['save'] . "\" name=\"savebutton\" class=\"savebutton\">";
print "</form><span>";

include ("interface/pageend.inc.php");
include ("interface/footer.inc.php");
?>