|
|
|
@ -32,8 +32,9 @@ class Book
|
|
|
|
|
{
|
|
|
|
|
$content = $this->getContents();
|
|
|
|
|
if ($task == "delete") {
|
|
|
|
|
$parsed = json_decode(file_get_contents("php://input"), true);
|
|
|
|
|
$body = find($content, ["uuid" => $parsed["id"]]);
|
|
|
|
|
//$parsed = json_decode(file_get_contents("php://input"), true);
|
|
|
|
|
//$body = find($content, ["uuid" => $parsed["id"]]);
|
|
|
|
|
$body = $request->getParsedBody();
|
|
|
|
|
} else {
|
|
|
|
|
$body = $request->getParsedBody();
|
|
|
|
|
}
|
|
|
|
@ -93,13 +94,9 @@ class Book
|
|
|
|
|
|
|
|
|
|
if ($task == "delete") {
|
|
|
|
|
$deleted = "true";
|
|
|
|
|
$body["menu"] ? ($body["menu"] = "true") : ($body["menu"] = "false");
|
|
|
|
|
$body["published"]
|
|
|
|
|
? ($body["published"] = "true")
|
|
|
|
|
: ($body["published"] = "false");
|
|
|
|
|
$body["featured"]
|
|
|
|
|
? ($body["featured"] = "true")
|
|
|
|
|
: ($body["featured"] = "false");
|
|
|
|
|
$body["menu"] = "false";
|
|
|
|
|
$body["published"] = "false";
|
|
|
|
|
$body["featured"] = "false";
|
|
|
|
|
} else {
|
|
|
|
|
$deleted = isset($page["deleted"]) ? $page["deleted"] : "false";
|
|
|
|
|
}
|
|
|
|
@ -195,7 +192,10 @@ class Book
|
|
|
|
|
return $item["deleted"] == true;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$all = $content;
|
|
|
|
|
//$all = $content;
|
|
|
|
|
$all = filter($content, function ($item) {
|
|
|
|
|
return $item["deleted"] == false;
|
|
|
|
|
});
|
|
|
|
|
$filter = isset($sort) ? $sort : "all";
|
|
|
|
|
switch ($filter) {
|
|
|
|
|
case "published":
|
|
|
|
@ -205,7 +205,7 @@ class Book
|
|
|
|
|
$filtered = $deleted;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$filtered = $content;
|
|
|
|
|
$filtered = $all;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$numOfPages = ceil(count($filtered) / ($limit + 1));
|
|
|
|
|