Location: PHPKode > projects > O - OpenSource GroupWare > osgw/admin/edit_group.php
<?php
/**************************************************************************
   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.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/

include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");

include($here. "/class.admin.php");
$admin = new admin;
echo $layout->page_header;
echo $>layout->service_header($text['service_name'] .' - '. $text['manage_group_account'], $admin->nav_buttons());

if($_POST['update_group'])
{

	if(!$groups->update_group($_POST))
	{
		echo "Update Failed";
	} else {
		echo "Updated Group Access Rights";
	}
}

$sql = "SELECT * FROM o_groups WHERE group_id='{$_GET['manage_group']}'";

$db->query($sql);
$db->fetch_results();
$owner = $db->record['owner'];
$created = $db->record['created'];
$gid = $db->record['group_id'];
$name = $db->record['group_name'];
?>
<form action="<?php echo $_SERVER['PHP_SELF']. "?manage_group={$_GET['manage_group']}"?>" method="post">
<table border="0" cellspacing="0" align="center">
<tr>
<td class="input_header">GID:</td>
<td><input type="text" name="gid" value="<?php echo $gid?>" readOnly></td>

<td class="input_header" width="50"><?php echo $text['users']?></td>
<td rowspan="5">

<?php

//This needs to be fixed. Horribly done What was I thinking
	$sql = "SELECT user_id, username FROM o_users WHERE user_id != '1'";
	$db->query($sql);
	$i = 0;
	while($db->fetch_results())
	{
		$db_users[$i]['username'] = $db->record['username'];
		$db_users[$i]['user_id'] = $db->record['user_id'];
		$i++;
	}



	echo "<select name=\"users[]\" multiple size=\"8\">\n";
	$i = 0;
	while($i <= count($db_users))
	{
		$sql = "SELECT user_id FROM o_group_access WHERE user_id='". $db_users[$i]['user_id'] ."' AND group_id='$gid'";
		$db->query($sql);

		echo "<option value=\"". $db_users[$i]['user_id'] ."\"";
		if($db->num_rows == 1)
		{
			echo " selected=\"selected\"";
		}
		
		echo ">". $db_users[$i]['username'] ."</option>\n";
		$i++;
	}
	
	echo "</select>\n";
?>


</td>

</tr>
<tr>
<td class="input_header"><?php echo $text['group_name']?>: </td>
<td><input type="text" name="name" value="<?php echo $name?>" readOnly></td>
</tr>
<tr>
<td class="input_header">Owner: </td>
<td>
<select name="owner">
<?php
	$sql = "SELECT user_id, username FROM o_users";
	$db->query($sql);
	while($db->fetch_results())
	{
		if($db->record['user_id'] != 1)
		{
			echo "<option value=\"". $db->record['user_id'] ."\"";
			if($db->record['user_id'] == $owner)
			{
				echo " selected=\"selected\"";
			}

			echo ">". $db->record['username'] ."</option>";

		}
	}
?>
<select>
<input type="text" name="owner" value="<?php echo $owner?>"></td>
</tr>
<tr>
<td class="input_header">Date Created: </td>
<td><?php echo date($date->long_date, $created)?></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

<tr>
<td><input type="submit" class="button1" name="update_group" value="<?php echo $text['update_group']?>"></td>
<td><input type="submit" class="button1" name="cancel" value="<?php echo $text['cancel']?>">

</tr>
</table>

</form>
Return current item: O - OpenSource GroupWare