Location: PHPKode > projects > Web Application Gateway > wagateway/admin/getGroupAppLists.php
<?

/*************************************************************************************

    COPYRIGHT NOTICE

    This copyright notice must appear at the top of all scripts which are part of
    the Web Application Gateway package.

    Copyright (C) 2001-2008 Gregory Engel
    
    All rights reserved
    
    8547 E Arapahoe Rd, #J-504
    Greenwood Village, CO  80112 USA
    hide@address.com

    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.

    The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
    A copy is included with the WAG package and is found in the text file gpl.txt

    You should have received a copy of the GNU General Public License (gpl.txt, gpl.html)
    along with the WAG distribution package; if not, the GNU General Public License can
    be found at http://www.gnu.org/copyleft/gpl.html, or by writing to:
    
    Free Software Foundation, Inc.
    59 Temple Place - Suite 330
    Boston, MA  02111-1307, USA.

    This script is part of the Web Application Gateway (WAG) Project. The WAG software
    is free, subject to 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.
    
    $Revision: 41 $
    $LastChangedDate: 2008-01-14 14:07:02 -0700 (Mon, 14 Jan 2008) $
    $LastChangedBy: gpeangel $
 
*************************************************************************************/

// Load the current collection of available applications

$ary_cur_group_apps = array();

$query = "SELECT ag_app_id FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."AppGroups WHERE ag_grp_id = ".$grp_id;
$result = mysql_query($query, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query."\n\n".mysql_errno().": ".mysql_error()));

while ($row = mysql_fetch_array($result, MYSQL_NUM))
    {
    $ary_cur_group_apps[] = $row[0];  
    }

$query = "SELECT * FROM ".$_SESSION["WAGATEWAY"]["DB_TABLE_PREFIX"]."Applications ORDER BY app_menu_title";
$result = mysql_query($query, $db_conn) or die (DBError($_SERVER["PHP_SELF"]."\n\n".$query."\n\n".mysql_errno().": ".mysql_error()));

$row_count = mysql_num_rows($result);

?>

<fieldset style="background-color: #f5f5f5;">
    <legend><b>Group Applications</b></legend>
    <table border="0" cellpadding="6" cellspacing="0">
        <tr>
            <td width="1px" valign="top">Members:</td>
            <td>
                <select class="formdata" id="lst_assigned_apps" name="lst_assigned_apps" multiple size="8" ondblclick="javascript:moveSelectedOptions($('lst_assigned_apps'), $('lst_available_apps'))" style="width: 20em;">
                <?
                
                // Assigned Applications
            
                for ($j = 0; $j < $row_count; $j++)
                    {
                    
                    $row = mysql_fetch_array($result);
                    
                    if (in_array($row["app_id"], $ary_cur_group_apps))
                        {
                        echo "<option value=".$row["app_id"].">".$row["app_menu_title"]."</option>";
                        }
                    }
                 ?>
                </select>
            </td>
            <td width="1px" valign="top">
                <table border="0" cellpadding="0" cellspacing="0" width="50px">
                    <tr>
                        <td align="right">Available:</td>
                    <tr>
                    <tr>
                        <td>&nbsp;</td>
                    <tr>
                    </tr>
                        <td align="center"><input type="button" name="left" value="&lt;&lt;" onclick="javascript:moveSelectedOptions($('lst_available_apps'), $('lst_assigned_apps'))" style="width: 50px;"></td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                    <tr>
                    </tr>
                        <td align="center"><input type="button" name="right" value="&gt;&gt;" onclick="javascript:moveSelectedOptions($('lst_assigned_apps'), $('lst_available_apps'))" style="width: 50px;"></td>
                    <tr>
                </table>
            </td>
            <td>
                <select class="formdata" id="lst_available_apps" name="lst_available_apps" multiple size="8" ondblclick="javascript:moveSelectedOptions($('lst_available_apps'), $('lst_assigned_apps'))" style="width: 20em;">
                <?
                
                // Available Applications
                
                if ($row_count > 0) {mysql_data_seek($result, 0); }
                
                for ($j = 0; $j < $row_count; $j++)
                    {
                    
                    $row = mysql_fetch_array($result);
                    
                    if (!in_array($row["app_id"], $ary_cur_group_apps))
                        {
                        echo "<option value=".$row["app_id"].">".$row["app_menu_title"]."</option>";
                        }
                    }
                ?>
                </select>
            </td>
        </tr>
    </table>
</fieldset>
Return current item: Web Application Gateway