<?php include "../../../classes/Database.php"; include "../../../classes/Connection.php"; include_once "../../../includes/bootstrap.php"; include "../../../classes/Client.php"; include "../../../classes/AdminAction.php"; include "../../../includes/security.funcs.inc"; include_once "../../../includes/Pagination.php"; //delete photo if (isset($_REQUEST['delete'])) { Client::deleteClient($_REQUEST['delete']); $updates = 'Delete clients content'; AdminAction::addAdminAction($_SESSION['admin_name'], $updates); } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/core3.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/modules.css" /> </head>
$next = $pid + 1; echo " <a href='?page=" . $_GET['page'] . '&action=' . $_GET['action'] . '&do=' . $_GET['do'] . "&page-id={$next}'>></a> "; echo " "; echo " <a href='?page=" . $_GET['page'] . '&action=' . $_GET['action'] . '&do=' . $_GET['do'] . "&page-id={$lastPage}'>>></a>"; } echo ' </div>'; } else { echo '<p class="notification red">There were no clients found.</p>'; } } } elseif ($_GET['do'] == "delete-client") { $websiteProperty = new WebsiteProperty(); echo '<p>On this page you can delete clients.</p>'; if (!empty($_GET['delete']) && is_numeric($_GET['delete'])) { if ($client->checkValueExists("id", $_GET['delete'])) { if ($client->deleteClient($_GET['delete'])) { echo '<p class="notification green">You have successfully deleted a client.</p>'; $log->addLog($_SESSION['loggedIn']['id'], "Deleted a client."); } } else { echo '<p class="notification red">There was no such client found with this ID.</p>'; } } echo ' <table width="100%"> <tr> <th>ID</th> <th>First Name</th> <th>Nickname</th> <th>Valid</th> <th>Date Added</th>
function test_deleteClient() { $stylist_name = "Jen Dontknow"; $id = null; $test_stylist = new Stylist($stylist_name, $id); $test_stylist->save(); $stylist_name2 = "John Doknow"; $test_stylist2 = new Stylist($stylist_name2, $id); $test_stylist2->save(); $test_client = new Client("Jeff Student", $id, "*****@*****.**", $test_stylist->getId()); $test_client->save(); $test_client2 = new Client("Jeff Developer", $id, "*****@*****.**", $test_stylist2->getId()); $test_client2->save(); $test_client->deleteClient(); $this->assertEquals([$test_client2], Client::getAll()); }