deleteOrg($value); printf("Organization %s was deleted. ", $value) . PHP_EOL; exit(0); } } printf("Invalid Filter Given: %s", $orgFilterString) . PHP_EOL; exit(1); } $list = $orgService->listAll($orgType, array('filterList' => $filterList)); if (!$list->count) { print_r("Organization not found ") . PHP_EOL; exit(1); } $notErased = array(); foreach ($list as $org) { deleteOrg($org->id); } if (count($notErased)) { echo 'SOME ORGANIZATIONS COULD NOT BE ERASED' . PHP_EOL; foreach ($notErased as $key => $value) { printf("Organization %s reason: %s", $key, $value) . PHP_EOL; } exit(1); } } catch (Exception $e) { echo 'AN ERROR HAS OCCURRED:' . PHP_EOL; echo $e->getMessage() . PHP_EOL; echo $cli->getUsageMessage(); exit(1); } // generally speaking, this script will be run from the command line
<?php include "adminapi.php"; $id = $_GET['id']; if (!isset($_POST["id"])) { if (!isset($_GET["id"])) { return header("Location: index.php"); } } else { $rs = deleteOrg($id); if ($rs == true) { header("Location: index.php"); } } $form = findOrgById($id); $pageTitle = "Deleting Organization: {$form['name']}"; $pageInfo = ""; $submitPage = $_SERVER["REQUEST_URI"]; $submitLabel = "Delete"; include 'header.php'; ?> <body id="edit_organization" class="organizations"> <?php make_navbar('Organizations'); ?> <div id="body" class="wrap"> <h3><?php echo $pageTitle; ?> </h3> <form name="viewOrgForm" method="post" action="<?php