blob: 29aaa5551cd190d5018943db2dd51bdc6394d24a [file]
<?php
/*******************************************************************************
* Copyright (c) 2006 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nathan Gervais (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
#*****************************************************************************
#
# member_management.php
#
# Author: Nathan Gervais
# Date: Feb 6th, 2007
#
# Description:
# Management page for members, displays a list of members, allows for adds, edits , removals.
#****************************************************************************
include('scripts/common.php');
include('scripts/header.php');
if ($_POST['submit'])
{
$orgID = $_POST['orgID'];
$productName = $_POST['productName'];
$productURL = $_POST['productURL'];
$productDesc = $_POST['description'];
$query = "INSERT INTO OrganizationProducts VALUES ('', $orgID, '$productName', '$productDesc', '$productURL' )";
//echo $query;
mysql_query($query);
echo "Product Added Successfully!<br/>";
}
$_input_id = $_GET['id'] ? $_GET['id'] : $_POST['orgID'];
$query = "SELECT name1 FROM organizations WHERE organization_id = $_input_id";
$result = mysql_query($query);
$resultData = mysql_fetch_array($result);
$orgName = $resultData['name1'];
?>
<h2>Products for <?=$orgName;?></h2>
<table style="border: 1px solid #000;" cellspacing=0 cellpadding=1>
<tr class="header">
<td width="75">Product ID</td>
<td width="250">Product Name</td>
<td width="75">Edit</td>
<td width="75">Remove</td>
</tr>
<?
$productQuery = "SELECT ProductID, name FROM OrganizationProducts WHERE OrganizationId = $_input_id ORDER by ProductID";
$productResult = mysql_query($productQuery);
while ($productIterator = mysql_fetch_array($productResult))
{
$productID = $productIterator['ProductID'];
$productName = $productIterator['name'];
?>
<tr onMouseOver="this.style.background='#CDE3FB';" onMouseOut="this.style.background='#FFFFFF';">
<td><?=$productID;?></td>
<td><?=$productName;?></td>
<td><a href="edit_product.php?id=<?=$productID;?>">Edit</a></td>
<td><a href="remove_product.php?id=<?=$productID;?>">Remove</a></td>
</tr>
<? } ?>
</table>
<br/>
<h3>Add a Product to <?=$orgName;?></h3>
<form action="<?=$_SERVER['PHP_SELF'];?>" method="POST">
<input type="hidden" name="orgID" value="<?=$_input_id;?>"/>
<table>
<tr>
<td>Product Name:</td>
<td><input type="text" name="productName" size="80"/></td>
</tr>
<tr>
<td>Product URL:</td>
<td><input type="text" name="productURL" size="80"/></td>
</tr>
<tr>
<td>Description:</td>
<td><textarea name="description" rows="10" cols="60"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Add Product"/></td>
</tr>
</table>
</form>
<? include('scripts/footer.php');
?>