function AddGroupToPeopleCart($iGroupID) { //Get all the members of this group $sSQL = "SELECT p2g2r_per_ID FROM person2group2role_p2g2r " . "WHERE p2g2r_grp_ID = " . $iGroupID; $rsGroupMembers = RunQuery($sSQL); //Loop through the recordset while ($aRow = mysql_fetch_array($rsGroupMembers)) { extract($aRow); //Add each person to the cart AddToPeopleCart($p2g2r_per_ID); } }
unset($_SESSION['aPeopleCart']); $sGlobalMessage = gettext("Your cart has been successfully emptied."); } if (isset($_POST["BulkAddToCart"])) { $aItemsToProcess = explode(",", $_POST["BulkAddToCart"]); if (isset($_POST["AndToCartSubmit"])) { if (isset($_SESSION['aPeopleCart'])) { $_SESSION['aPeopleCart'] = array_intersect($_SESSION['aPeopleCart'], $aItemsToProcess); } } elseif (isset($_POST["NotToCartSubmit"])) { if (isset($_SESSION['aPeopleCart'])) { $_SESSION['aPeopleCart'] = array_diff($_SESSION['aPeopleCart'], $aItemsToProcess); } } else { for ($iCount = 0; $iCount < count($aItemsToProcess); $iCount++) { AddToPeopleCart(str_replace(",", "", $aItemsToProcess[$iCount])); } $sGlobalMessage = $iCount . " " . gettext("item(s) added to the Cart."); } } // // Some very basic functions that all scripts use // // Convert a relative URL into an absolute URL and redirect the browser there. function Redirect($sRelativeURL) { global $sRootPath; if (!$_SESSION['bSecureServer']) { $sProtocol = "http://"; if ($_SESSION['iServerPort'] != 80) { $sPort = ":" . $_SESSION['iServerPort'];
if (isset($_GET["Number"])) { $sRedirect .= "Number=" . $_GET["Number"] . "&"; } if (isset($_GET["Result_Set"])) { $sRedirect .= "Result_Set=" . $_GET["Result_Set"] . "&"; } if (isset($_GET["PersonProperties"])) { $sRedirect .= "PersonProperties=" . $_GET["PersonProperties"] . "&"; } $sRedirect = mb_substr($sRedirect, 0, -5); // Chop off last & // If AddToCart submit button was used, run the query, add people to cart, and view cart if (isset($_GET["AddAllToCart"])) { $rsPersons = RunQuery($sSQL); while ($aRow = mysql_fetch_row($rsPersons)) { AddToPeopleCart($aRow[0]); } } elseif (isset($_GET["IntersectCart"])) { $rsPersons = RunQuery($sSQL); while ($aRow = mysql_fetch_row($rsPersons)) { $aItemsToProcess[] = $aRow[0]; } if (isset($_SESSION['aPeopleCart'])) { $_SESSION['aPeopleCart'] = array_intersect($_SESSION['aPeopleCart'], $aItemsToProcess); } } elseif (isset($_GET["RemoveFromCart"])) { $rsPersons = RunQuery($sSQL); while ($aRow = mysql_fetch_row($rsPersons)) { $aItemsToProcess[] = $aRow[0]; } if (isset($_SESSION['aPeopleCart'])) {
require 'Include/Config.php'; require 'Include/Functions.php'; //Set the page title $sPageTitle = gettext('Group View'); //Get the GroupID out of the querystring $iGroupID = FilterInput($_GET['GroupID'], 'int'); //Do they want to add this group to their cart? if (array_key_exists('Action', $_GET) and $_GET['Action'] == 'AddGroupToCart') { //Get all the members of this group $sSQL = 'SELECT per_ID FROM person_per, person2group2role_p2g2r WHERE per_ID = p2g2r_per_ID AND p2g2r_grp_ID = ' . $iGroupID; $rsGroupMembers = RunQuery($sSQL); //Loop through the recordset while ($aRow = mysql_fetch_array($rsGroupMembers)) { extract($aRow); //Add each person to the cart AddToPeopleCart($per_ID); } } //Get the data on this group $sSQL = 'SELECT * FROM group_grp WHERE grp_ID = ' . $iGroupID; $aGroupData = mysql_fetch_array(RunQuery($sSQL)); extract($aGroupData); //Look up the default role name $sSQL = "SELECT lst_OptionName FROM list_lst WHERE lst_ID = {$grp_RoleListID} AND lst_OptionID = " . $grp_DefaultRole; $aDefaultRole = mysql_fetch_array(RunQuery($sSQL)); $sDefaultRole = $aDefaultRole[0]; //Get the count of members $sSQL = 'SELECT COUNT(*) AS iTotalMembers FROM person2group2role_p2g2r WHERE p2g2r_grp_ID = ' . $iGroupID; $rsTotalMembers = mysql_fetch_array(RunQuery($sSQL)); extract($rsTotalMembers); //Get the group's type name