<title>Hampshire Library Laptop Availability</title> <link rel="stylesheet" href="https://cdn.rawgit.com/twbs/bootstrap/v4-dev/dist/css/bootstrap.css"> <link rel="stylesheet" href="../css/local.css"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> <link href='https://fonts.googleapis.com/css?family=Libre+Baskerville' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'> </head> <body> <div class="header"> <h1>Hampshire College Library</h1> <h3>Laptop Computer Status</h3> </div> <div class="container-fluid" style="margin: auto;"> <div class="row main"> <?php if ($user->getEquipment('HA') == false) { ?> <h4 style="text-align: center;">No Equipment set. Add some in the admin</h4> <?php } else { ?> <?php foreach ($user->getEquipment('HA') as $item) { ?> <div class="col-xs-12 col-sm-6 col-md-4 item_load" data-sort="<?php echo $item["sort_order"]; ?> "> <div class="card card-block com" id="record<?php echo $item["id"];
<?php require_once dirname(__FILE__) . '/../Application/initialize.php'; $user = new User(); switch ($_GET['action']) { case 'getRecords': $location = $_GET["loc"]; $set = $user->getEquipment($location); $results = array(); if ($set !== false) { foreach ($set as $item) { $local = '../images/' . $item["id"] . '.jpg'; if (file_exists($local)) { $image = '<i class="fa fa-check-circle-o text-success"></i>'; } else { $image = '<i class="fa fa-times-circle-o text-danger"></i>'; } $results[] = array('id' => $item["id"], 'title' => $item["title"], 'owner' => $item["owner"], 'sort' => $item["sort_order"], 'results' => 'true', 'image' => $image); } } else { $results[] = array('loc' => $location, 'result' => 'false'); } header('Content-Type: application/json; charset=utf-8'); echo json_encode($results, true); break; case 'updateRecords': $update = $user->updateEquipment($_POST); $results = array('id' => $_POST["id"], 'loc' => $_POST["owner"]); header('Content-Type: application/json; charset=utf-8'); echo json_encode($results, true); break;