Files
kupshop/bundles/KupShop/AdminBundle/AdminBlocksTrait.php
2025-08-02 16:30:27 +02:00

43 lines
1.4 KiB
PHP

<?php
namespace KupShop\AdminBundle;
trait AdminBlocksTrait
{
public function handleDeleteHistory()
{
if ($deleteId = getVal('delete')) {
if ($this->blocksHistory->deleteBlocksHistory((int) $deleteId)) {
unset($_GET['delete']);
$this->returnOK('Verze stránky byla úspěšně smazána.');
} else {
$this->returnError('Při mazání verze stránky došlo k chybě, zkuste to znovu.');
}
}
}
public function handleRename()
{
if (($historyId = getVal('rename')) && ($name = getVal('name'))) {
if ($this->blocksHistory->setBlocksHistoryName($name, $historyId)) {
unset($_GET['rename'], $_GET['name']);
$this->returnOK('Verze stránky byla úspěšně pojmenována.');
} else {
$this->returnError('Při pojmenování verze stránky došlo k chybě, zkuste to znovu.');
}
}
}
public function handleRevert()
{
if ($revertId = getVal('revert')) {
if ($this->blocksHistory->revertBlocksHistory((int) $revertId)) {
unset($_GET['revert'], $_GET['flap'], $_REQUEST['flap']);
$this->returnOK('Verze stránky byla úspěšně obnovena.');
} else {
$this->returnError('Při obnovení verze stránky došlo k chybě, zkuste to znovu.');
}
}
}
}