Commit d6e4c9ba authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(management) Add support for fixed filter elements

Useful for selection classes mainly, for instance PhoneNumberAttribute
 dialog will now only list phones with a non-empty phone number.
This will also be useful for samba.

issue #5965
parent 182fb355
{foreach from=$INPUTS key="key" item="input"}
<label title="{$input.desc|escape}">
{if isset($input.icon)}
<img src="{$input.icon|escape}" alt=""/>
This code is part of FusionDirectory (
Copyright (C) 2018-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
class FixedFilterElement extends FilterElement
protected $filter;
public function __construct (managementFilter $parent, string $filter)
$this->filter = $filter;
public function render (): string
$inputs = [
'name' => $this->filter,
'desc' => $this->filter,
$smarty = get_smarty();
$smarty->assign('NAME', _('Fixed'));
$smarty->assign('INPUTS', $inputs);
return $smarty->fetch(get_template_path('management/filter-element-fixed.tpl'));
public function getFilters (string $type, array &$filters): bool
$filters[] = $this->filter;
return FALSE;
......@@ -30,6 +30,12 @@ class phoneSelect extends selectManagement
['LinkColumn', ['attributes' => 'nameAttr', 'label' => 'Name']],
['LinkColumn', ['attributes' => 'telephoneNumber', 'label' => 'Number']],
protected function setUpFilter ()
$this->filter->addElement(new FixedFilterElement($this->filter, '(telephoneNumber=*)'));
......@@ -141,12 +147,24 @@ class PhoneNumberButtonAttribute extends PhoneNumberAttribute
function handleDialogResult ($dn, array $attrs)
function handleDialogResult ($dn, $entry)
if (isset($attrs['telephoneNumber'][0])) {
if (isset($entry['telephoneNumber'][0])) {
} elseif (isset($entry['telephoneNumber'])) {
} else {
function getFilterBlackList ()
return [];
function getFilterWhiteList ()
return [];
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment