include_once "../../../../_setup.php"; include_once "../../../../classes/member.php"; include_once "../../../../classes/rank.php"; include_once "../../../../classes/consoleoption.php"; include_once "../../../../classes/rankcategory.php"; $member = new Member($mysqli); $member->select($_SESSION['btUsername']); $rankCatObj = new RankCategory($mysqli); $consoleObj = new ConsoleOption($mysqli); $cID = $consoleObj->findConsoleIDByName("Manage Rank Categories"); $consoleObj->select($cID); $_GET['cID'] = $cID; if ($member->authorizeLogin($_SESSION['btPassword'])) { $memberInfo = $member->get_info_filtered(); if ($member->hasAccess($consoleObj) && $rankCatObj->select($_POST['rID'])) { define('MEMBERRANK_ID', $memberInfo['rank_id']); $rankCatInfo = $rankCatObj->get_info_filtered(); $arrRanks = $rankCatObj->getAssociateIDs(); if (count($arrRanks) > 0) { echo "<div id='newDeleteMessage' style='display: none'><p align='center'>There are currently ranks under the rank category <b>" . $rankCatInfo['name'] . "</b>. Please change all ranks with this category before deleting it.</p></div>"; echo "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\$('#deleteMessage').dialog('close');\n\t\t\t\t\t\t\$('#newDeleteMessage').dialog({\n\t\t\t\t\t\t\n\t\t\t\t\t\t\ttitle: 'Manage Rank Categories - Delete',\n\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\tzIndex: 9999,\n\t\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\t'OK': function() {\n\t\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t</script>\n\t\t\t"; } elseif (isset($_POST['confirm']) && $_POST['confirm'] == "1") { $rankCatObj->delete(); include "main.php"; } else { echo "<p align='center'>Are you sure you want to delete the rank category <b>" . $rankCatInfo['name'] . "</b>?"; } } elseif (!$rankCatObj->select($_POST['rID'])) { echo "<p align='center'>Unable find the selected rank category. Please try again or contact the website administrator.</p>"; } }