public function deleteAction()
{
if ($this->getParam("type") == "childs") {
$parentAsset = Asset::getById($this->getParam("id"));
$list = new Asset\Listing();
$list->setCondition("path LIKE '" . $parentAsset->getRealFullPath() . "/%'");
$list->setLimit(intval($this->getParam("amount")));
$list->setOrderKey("LENGTH(path)", false);
$list->setOrder("DESC");
$assets = $list->load();
$deletedItems = [];
foreach ($assets as $asset) {
$deletedItems[] = $asset->getRealFullPath();
if ($asset->isAllowed("delete")) {
$asset->delete();
}
}
$this->_helper->json(["success" => true, "deleted" => $deletedItems]);
} elseif ($this->getParam("id")) {
$asset = Asset::getById($this->getParam("id"));
if ($asset->isAllowed("delete")) {
$asset->delete();
$this->_helper->json(["success" => true]);
}
}
$this->_helper->json(["success" => false, "message" => "missing_permission"]);
}