mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-30 17:24:18 +02:00
parent
24b14184be
commit
34a0179103
@ -97,6 +97,16 @@ class IcingaMultiEditForm extends DirectorObjectForm
|
||||
*/
|
||||
protected function onRequest()
|
||||
{
|
||||
if ($this->hasBeenSent()) {
|
||||
$this->handlePost();
|
||||
}
|
||||
}
|
||||
|
||||
protected function handlePost()
|
||||
{
|
||||
if ($this->shouldBeDeleted()) {
|
||||
$this->deleteObjects();
|
||||
}
|
||||
}
|
||||
|
||||
protected function setSubmittedMultiValue($key, $value)
|
||||
@ -277,4 +287,23 @@ class IcingaMultiEditForm extends DirectorObjectForm
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
protected function deleteObjects()
|
||||
{
|
||||
$msg = sprintf(
|
||||
'%d objects of type "%s" have been removed',
|
||||
count($this->objects),
|
||||
$this->translate($this->object->getShortTableName())
|
||||
);
|
||||
|
||||
foreach ($this->objects as $object) {
|
||||
$object->delete();
|
||||
}
|
||||
|
||||
if ($this->listUrl) {
|
||||
$this->setSuccessUrl($this->listUrl);
|
||||
}
|
||||
|
||||
$this->redirectOnSuccess($msg);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user