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