'required|db images.imageid', 'imagetype' => 'required|db images.imagetype' ]; $ret = $this->validateInput($fields); if (!$ret) { $this->setResponse(new CControllerResponseFatal()); } return $ret; } protected function checkPermissions() { if (!$this->checkAccess(CRoleHelper::UI_ADMINISTRATION_GENERAL)) { return false; } $images = API::Image()->get(['imageids' => $this->getInput('imageid')]); if (!$images) { return false; } $this->image = $images[0]; return true; } protected function doAction() { $result = API::Image()->delete([$this->image['imageid']]); if ($result) { $response = new CControllerResponseRedirect( (new CUrl('zabbix.php')) ->setArgument('action', 'image.list') ->setArgument('imagetype', $this->getInput('imagetype')) ); CMessageHelper::setSuccessTitle(_('Image deleted')); } else { $response = new CControllerResponseRedirect( (new CUrl('zabbix.php')) ->setArgument('action', 'image.edit') ->setArgument('imageid', $this->getInput('imageid')) ); CMessageHelper::setErrorTitle(_('Cannot delete image')); } $this->setResponse($response); } }