FusionDirectory
class_selectManagement.inc
1 <?php
2 /*
3  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
4 
5  Copyright (C) 2017-2019 FusionDirectory
6 
7  This program is free software; you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or
10  (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21 
26 {
27  protected $skipCpHandler = TRUE;
28  public static $skipSnapshots = TRUE;
29 
30  protected $multiSelect = TRUE;
31  public $blackList;
32  public $whiteList;
33 
34  /* Default columns */
35  public static $columns = [
36  ['ObjectTypeColumn', []],
37  ['LinkColumn', ['attributes' => 'nameAttr', 'label' => 'Name']],
38  ['LinkColumn', ['attributes' => 'description', 'label' => 'Description']],
39  ];
40 
41  function __construct (
42  $objectTypes = FALSE,
43  bool $multiSelect = TRUE,
44  array $neededAttrs = [],
45  array $blackList = [],
46  array $whiteList = [],
47  array $filterElementDefinitions = [
48  ['TabFilterElement', []],
49  ])
50  {
51  $this->neededAttrs = $neededAttrs;
52  $this->multiSelect = $multiSelect;
53  $this->blackList = $blackList;
54  $this->whiteList = $whiteList;
55  parent::__construct($objectTypes, $filterElementDefinitions);
56  }
57 
58  protected function setUpListing ()
59  {
60  $this->listing = new managementListing($this, TRUE, $this->multiSelect);
61  }
62 
63  protected function setUpHeadline ()
64  {
65  $this->headline = _('Please select the desired entries');
66  }
67 
68  protected function configureActions ()
69  {
70  $this->registerAction(new HiddenAction('configure', 'configureDialog'));
71  }
72 
73  function renderList (): string
74  {
75  $list = parent::renderList();
76 
77  $smarty = get_smarty();
78  $smarty->assign('MULTISELECT', $this->multiSelect);
79 
80  return $list.$smarty->fetch(get_template_path('management/select-footer.tpl'));
81  }
82 
86  protected function getHeader (): string
87  {
88  return '';
89  }
90 }
get_template_path($filename='', $plugin=FALSE, $path='')
Return themed path for specified base file.
Definition: functions.inc:174
registerAction(Action $action)
Register an action to show in the action menu and/or the action column.
& get_smarty()
Get global smarty object.
Definition: functions.inc:324
This class handles the entries list for a management instance.
Management class for selection dialogs.
Action hidden from both column and menu.
getHeader()
Let header handling to parent.
Management base class.