FusionDirectory
class_GenericSelectManagementDialog.inc
1 <?php
2 /*
3  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
4  Copyright (C) 2012-2020 FusionDirectory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 
24 {
25  protected $dialogClass = 'selectManagement';
26 
27  public function __construct ($simplePlugin, $attribute)
28  {
29  $this->attribute = $attribute;
30  $this->dialog = new $this->dialogClass(...$this->attribute->getSelectManagementParameters());
31  }
32 
33  protected function handleFinish ()
34  {
35  $result = $this->dialog->detectPostActions();
36  if (isset($result['targets'])) {
37  if ($this->dialog instanceof selectManagement) {
38  $headpage = $this->dialog->listing;
39  } else {
40  $headpage = $this->dialog->getHeadpage();
41  }
42  foreach ($result['targets'] as $dn) {
43  $entry = $headpage->getEntry($dn);
44 
45  $this->attribute->addValue($dn, $entry);
46  }
47  }
48  unset($this->dialog);
49  }
50 }
Generic dialog for selection using a selectManagement class.
Management class for selection dialogs.
Generic dialog base class.