<?php 
    # $Id: user_EDIT.php,v 1.2 2007/01/08 12:51:13 jarda Exp $

    /* A page for editing of a user account
    */

    require_once('structuredPage.inc.php');

    
    class PageClass extends EditUserAccountsStructuredPage
    {

        function checkEnvironment()
        {
            if (!$_POST['userId'])
                return False;

            return True;
        }

        function getTitle()
        {
            return 'User account edit';
        }


        function printContents()
        {
            $db = connect();

            $query = "SELECT * FROM bDBUser WHERE id = $_POST[userId]";

            $recordSet = $db->Execute($query);

            $row = $recordSet->FetchRow();

            echo "<form action=\"user_CHANGE.php\" method=\"post\">";

            echo "<input type=\"hidden\" name=\"userId\" value=\"$_POST[userId]\">";
            
            echo "<table>\n";

            echo "<tr><td>Login:</td><td>$row[login]</td></tr>\n";
            
            echo "<tr><td>Password:</td><td><input type=\"password\" name=\"password\"></td></tr>\n";
            
            echo "<tr><td>Can edit database:</td><td><input type=\"checkbox\" name=\"canEditDB\"";
            if ($row['caneditdatabase'])
                echo " checked";
            echo "></td></tr>\n";
            
            echo "<tr><td>Can edit user accounts:</td><td><input type=\"checkbox\" name=\"canEditUserAccounts\"";
            if ($row['canedituseraccounts'])
                echo " checked";
            echo "></td></tr>\n";
            
            echo "<tr><td>Can change own password:</td><td><input type=\"checkbox\" name=\"canChangeOwnPassword\"";
            if ($row['canchangeownpassword'])
                echo " checked";
            echo "></td></tr>\n";
            
            echo "</table>\n";
            echo "<br>\n";
            echo "<input type=\"submit\" value=\"OK\" name=\"OK\"><input type=\"submit\" value=\"Cancel\" name=\"Cancel\">\n";
        }
    }

    launchPage();
    
    # vim:enc=iso8859-2:fenc=iso8859-2:
?>
