Location: PHPKode > projects > ConPortal > conportal/user_edit.php
<?php
/*
 *  ConPortal - Pomona College ITS scheduling appplication
 *  Copyright (C) 2005-2006  Pomona College
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of version 2 of the GNU General Public License
 *  as published by the Free Software Foundation.
 *
 *  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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
require_once('standard.php');

// If no user is set, go to the admin display_users form...
if (!isset($_GET['user']) || !intval($_GET['user'])) {
    header("Location: " . BASE_URL . "display_users.php");
    exit;
}

xhtml_header_privileged('Make Changes', 'manage_users');

$info   = getUserDetails($_GET['user']);
$groups = getPrimaryGroups();
$supers = sortUsersByName(getAllUserDetails()); /* FIXME. This is wrong. It should be just
                            * supers+full-time staff+god. Also, we should
                            * be storing the PID of the supervisor...not
                            * the name.
                            */
$seniority = getSeniorityLevels();

$manage_perms = checkPerm($_SESSION, 'manage_perms');

?>
<form method='post' action='redirects/user_edit.php' id='modUser'><div>
  <input type='hidden' name='pid' value='<?= $info['pid'] ?>' />
  <p>Editing <?= $info['name'] ?>'s information:</p>
  <label for='user'>Username:</label>
    <input type='text' name='user' id='user' size='20'
           value='<?= $info['username'] ?>' />
  <br /><label for='first'>First</label>
    <input type='text' name='first' id='first' size='20'
           value='<?= $info['first'] ?>' />
  <br /><label for='last'>Last</label>
    <input type='text' name='last' id='last' size='20'
           value='<?= $info['last'] ?>' />
  <br /><label for='primary_group'>Con. Group:</label>
<?
    if ($manage_perms) {
        echo "  <select name='primary_group' id='primary_group'>\n";
    } else {
        echo "  <select name='primary_group' id='primary_group' disabled='disabled' />\n";
    }
    foreach ($groups as $g) {
        $i = getGroupDetails($g);
        if (isset($info['primary_group']) && $info['primary_group'] == $g)
            echo "\n    <option value='$g' selected='selected'>".
                 $i['description']."</option>";
        else
            echo "\n    <option value='$g'>" . $i['description']."</option>";
    }
?>
  </select>
  <br /><label for='phone'>Phone:</label>
    <input type='text' name='phone' id='phone' size='10'
           value='<?= $info['phone'] ?>' />
<?php
	if(BUCKNELL_OPTIONS == TRUE)
	{ 
		echo "<br /><label for='cell'>Cell Phone:</label>
    			<input type='text' name='cell' id='cell' size='10'
           		value='" .  $info['cell'] ."' />";
	}
?>
  <br /><label for='sn'>Screen Name:</label>
    <input type='text' name='sn' id='sn' size='20'
           value='<?= $info['screen_name'] ?>' />
  <br /><label for='super'>Supervisor:</label>
    <select name='super' id='super'><?
    foreach ($supers as $s) {
        if (isset($info['supervisor']) && $s['name'] == $info['supervisor'])
            echo "\n    <option value='".$s['name']."' selected='selected'>".
                 $s['name']."</option>";
        else
            echo "\n    <option value='".$s['name']."'>".$s['name']."</option>";
    }
?>  
</select>
<br /><label for='seniority'>Seniority:</label>
    <select name='seniority' id='seniority'><?
    foreach ($seniority as $s) {
        if (isset($info['seniority']) && $s['pid'] == $info['seniority'])
            echo "\n    <option value='".$s['pid']."' selected='selected'>".
                 $s['description']."</option>";
        else
            echo "\n    <option value='".$s['pid']."'>".$s['description']."</option>";
    }
?>  
</select>
    
  <br /><input type="submit" value="Modify..." />
</div></form>

<? xhtml_footer() ?>
Return current item: ConPortal