From 7993ad2fdee8e80137ba14f614f3ea47256aa99c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Sat, 15 Nov 2014 23:32:38 +0100 Subject: [PATCH] FilterEditor: add a couple of link generators remove/add/strip/cancel --- library/Icinga/Web/Widget/FilterEditor.php | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/library/Icinga/Web/Widget/FilterEditor.php b/library/Icinga/Web/Widget/FilterEditor.php index 69ab4de56..709b20cf9 100644 --- a/library/Icinga/Web/Widget/FilterEditor.php +++ b/library/Icinga/Web/Widget/FilterEditor.php @@ -149,6 +149,58 @@ class FilterEditor extends AbstractWidget return $this; } + protected function removeLink(Filter $filter) + { + return $this->view()->qlink( + '', + $this->url()->with('removeFilter', $filter->getId()), + null, + array( + 'title' => t('Click to remove this part of your filter'), + 'class' => 'icon-cancel' + ) + ); + } + + protected function addLink(Filter $filter) + { + return $this->view()->qlink( + '', + $this->url()->with('addFilter', $filter->getId()), + null, + array( + 'title' => t('Click to add another filter'), + 'class' => 'icon-plus' + ) + ); + } + + protected function stripLink(Filter $filter) + { + return $this->view()->qlink( + '', + $this->url()->with('stripFilter', $filter->getId()), + null, + array( + 'title' => t('Strip this filter'), + 'class' => 'icon-minus' + ) + ); + } + + protected function cancelLink() + { + return $this->view()->qlink( + '', + $this->url()->without('addFilter'), + null, + array( + 'title' => t('Cancel this operation'), + 'class' => 'icon-cancel' + ) + ); + } + protected function renderFilter($filter, $level = 0) { $html = '';