echo $project->getFromDate();
    }
}
?>
" min="<?php 
echo date('Y-m-d');
?>
" max="<?php 
echo date('Y-m-d', strtotime("+{$maxStorageMonths} months"));
?>
" id="from_date" name="from_date" class="form-control" />
                    &nbsp;&nbsp; <div style="display:inline;white-space:nowrap;">removal&nbsp;<input type="date" placeholder="yyyy-mm-dd" value="<?php 
if ($_POST && $_POST['to_date']) {
    echo $_POST['to_date'];
} else {
    if ($project->getToDate()) {
        echo $project->getToDate();
    }
}
?>
" min="<?php 
echo date('Y-m-d');
?>
" max="<?php 
echo date('Y-m-d', strtotime("+{$maxStorageMonths} months"));
?>
" id="to_date" name="to_date" class="form-control" /></div>
                    <p class="alert alert-info tip-short-term-storage hide" role="alert"><span class="glyphicon glyphicon-star"></span> It's okay to store your project short term to let paint dry, give yourself a break, etc. But short term storage requests can <strong> only be extended 2 days</strong> at most. If it takes longer you'll need to submit a new storage request and leave enough time for other members to review.</p>
                    <p class="alert alert-warning tip-indoor-review hide" role="alert"><span class="glyphicon glyphicon-star"></span> We need <strong>2 days to review</strong> indoor storage requests unless it's a matter of urgency.</p>
                    <p class="alert alert-warning tip-yard-review hide" role="alert"><span class="glyphicon glyphicon-star"></span> We need <strong>7 days to review</strong> yard storage requests unless it's a matter of urgency.</p>
                    <p class="help-block">Think carefully about your date of removal as we take your commitment seriously. It helps to estimate how long your project will take then double it.</p>
require './header.php';
$cards = fRecordSet::build('Card', array('uid=' => $_GET['cardid']));
if ($cards->count() == 0) {
    fURL::redirect("/kiosk/addcard.php?cardid=" . $_GET['cardid']);
}
$card = $cards->getRecord(0);
$user = new User($card->getUserId());
$user->load();
if (isset($_POST['print'])) {
    $project = new Project($_POST['print']);
    $project->load();
    if ($project->getUserId() != $user->getId()) {
        print "Incorrect project ID";
        exit;
    }
    $data = array('storage_id' => $project->getId(), 'name' => $project->getName(), 'ownername' => $user->getFullName(), 'more_info' => $project->getDescription(), 'completion_date' => $project->getToDate()->format('Y/m/d'), 'max_extention' => "14");
    $data_string = json_encode($data);
    $ch = curl_init('http://kiosk.london.hackspace.org.uk:12345/print/dnh');
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string)));
    $result = curl_exec($ch);
    curl_close($ch);
    echo "<p>Your sticker is being printed now.</p>";
}
$projects = fRecordSet::build('Project', array('state_id!=' => array('6', '7'), 'user_id=' => $user->getId()));
?>

<?php 
if ($projects->count() > 0) {
<?php

$page = 'storagedetails_print';
$title = "Storage list";
require '../header-mini.php';
ensureMember();
$project = new Project(filter_var($_GET['id'], FILTER_SANITIZE_STRING));
$to = new DateTime($project->getToDate());
$projectUser = new User($project->getUserId());
if ($project->getState() != 'Approved') {
    echo "<p>Your Do Not Hack sticker will become available when your storage request is approved.</p>";
    exit;
}
?>
<style type="text/css">
	.print {
		max-width: 700px;
		margin-left: auto;
		margin-right: auto;
		font-family: sans-serif;
	}
	h1, h2, h3 {
		padding: 0;
		margin: 10px;
	}
	img {
		display: block;
		margin-left: auto;
		margin-right: auto;
	}
	#qrcode {