improve view management:
- we can pass a negative view index, in this case we count from the end of the list of view
- before creating/changing the view representation, we remove the previous one and reinitialize the node visibility
- each time we save a view, it creates a new one at the end of the list
- "restore" view loads the last view of the list
<?php
require_once(realpath(dirname(__FILE__) . "/../resources/config.php"));
require_once(LIBRARY_PATH . "/renkanFunctions.php");
if(isset($_REQUEST['renkanId'])) {
$renkanId = $_REQUEST['renkanId'];
}
else {
header("HTTP/1.0 400 Bad Request");
echo("Missing 'renkanId' parameter");
return;
}
if ($_SERVER['REQUEST_METHOD'] === 'PUT' || $_SERVER['REQUEST_METHOD'] === 'POST') {
$json = file_get_contents('php://input');
saveRenkan($renkanId, $json);
}
else {
getRenkan($renkanId);
}