<?php

include "../LoadClass.php";
/**
 * Created by PhpStorm.
 * User: User
 * Date: 1/14/2016
 * Time: 10:46 AM
 */
// Get sensor board id
$sb_id = $_POST['sensor_board'];
// Remove sensor board
$sensorBoardController = new SensorBoardController();
$sensorBoardController->removeSensorBoardByiId($sb_id);
header('Location: ../edit_sensor_board.php');
                <div class="row">
                    <div class="col-lg-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>Remove a sensor board<small> from an available location </small></h5>
                            </div>
                            <div class="ibox-content">

                                <form method="post" action="php/DeleteSensorBoard.php" class="form-horizontal">

                                    <div class="form-group"><label class="col-sm-2 control-label">Select Board</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="sensor_board">
                                                <option disabled selected>- Select a sensor board -</option>
                                                <?php 
$sensorBoardController = new SensorBoardController();
$sensorBoards = $sensorBoardController->selectAll();
foreach ($sensorBoards as $sensorBoard) {
    $locationController = new LocationController();
    $loc = $locationController->getLocationByID($sensorBoard->getLocationId());
    echo '<option value="' . $sensorBoard->getIdsensorBoard() . '">' . 'Board ' . $sensorBoard->getIdsensorBoard() . ' - ' . $loc->getLocationName() . ', ' . $loc->getLocationCity() . ' (' . $loc->getLatitude() . ', ' . $loc->getLongitude() . ')' . '</option>';
}
?>

                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <a class="btn btn-white" type="submit">Cancel</a>
<?php

include "../LoadClass.php";
/**
 * Created by PhpStorm.
 * User: Roshan
 * Date: 12/17/2015
 * Time: 12:22 AM
 */
$sensor_board = $_POST['sensor_board'];
$sensor_type = $_POST['sensor_type'];
$manufactured_date = $_POST['manufactured_date'];
$formatted_date = date("Y-m-d", strtotime($manufactured_date));
$sensorController = new SensorController();
$sensor = new Sensor('', $sensor_board, $formatted_date, $sensor_type, '1');
$sensorController->insert($sensor);
$sensorBoardController = new SensorBoardController();
$sensorBoard = $sensorBoardController->selectByID($sensor_board);
$sensorBoard->getNoOfSensors($sensorBoard->getNoOfSensors() + 1);
$sensorBoardController->update($sensorBoard);
header('Location: ../device_add.php');
                            </div>
                            <div class="ibox-content">

                                <form method="post" action="php/DeleteSensor.php" class="form-horizontal">

                                    <div class="form-group"><label class="col-sm-2 control-label">Select Board</label>
                                        <div class="col-sm-10">
                                            <select class="form-control m-b" name="sensor">
                                                <option disabled selected>- Select a sensor -</option>
                                                <?php 
$sensorController = new SensorController();
$sensors = $sensorController->selectAll();
foreach ($sensors as $sensor) {
    $sensorTypeController = new SensorTypeController();
    $sensor_type = $sensorTypeController->selectByID($sensor->getSensorType());
    $sensorBoardController = new SensorBoardController();
    $sensorBoard = $sensorBoardController->selectByID($sensor->getSensorBoardId());
    $locationController = new LocationController();
    $loc = $locationController->getLocationByID($sensorBoard->getLocationId());
    echo '<option value="' . $sensor->getIdsensor() . '">' . 'Sensor ' . $sensor->getIdsensor() . ' - ' . $sensor_type->getTypeName() . ' sensor of board ' . $sensor->getSensorBoardId() . ' at ' . $loc->getLocationName() . ', ' . $loc->getLocationCity() . ' (' . $loc->getLatitude() . ', ' . $loc->getLongitude() . ')' . '</option>';
}
?>

                                            </select>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-4 col-sm-offset-2">
                                            <a class="btn btn-white" type="submit">Cancel</a>
                                            <input type="submit" class="btn btn-primary" value="Delete">
<?php

include "../LoadClass.php";
/**
 * Created by PhpStorm.
 * User: Roshan
 * Date: 12/16/2015
 * Time: 11:41 PM
 */
$location = $_POST['location'];
$manufacturer = $_POST['manufacturer'];
$sensorBoard = new SensorBoard('', '', $manufacturer, $location);
$sensorBoardController = new SensorBoardController();
$sensorBoardController->insert($sensorBoard);
header('Location: ../board_add.php');