FusionDirectory
 All Data Structures Files Functions Variables
class_FlagsAttribute.inc
1 <?php
2 /*
3  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
4  Copyright (C) 2012-2016 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 
25 {
26  protected $flags;
27 
34  function __construct ($ldapName, $flags, $acl = "")
35  {
36  parent::__construct('', '', $ldapName, FALSE, '', $acl);
37  $this->setVisible(FALSE);
38  $this->flags = $flags;
39  }
40 
41  function setParent (&$plugin)
42  {
43  parent::setParent($plugin);
44  if (is_object($this->plugin)) {
45  foreach ($this->flags as $attr) {
46  $this->plugin->attributesAccess[$attr]->setInLdap(FALSE);
47  }
48  }
49  }
50 
51  function setValue ($value)
52  {
53  parent::setValue($value);
54  if (is_object($this->plugin)) {
55  foreach ($this->flags as $attr) {
56  $trueValue = $this->plugin->attributesAccess[$attr]->trueValue;
57  $this->plugin->attributesAccess[$attr]->setValue(preg_match("/$trueValue/", $this->value));
58  }
59  }
60  }
61 
62  function getValue()
63  {
64  $value = '[';
65  if (is_object($this->plugin)) {
66  foreach ($this->flags as $attr) {
67  $value .= $this->plugin->attributesAccess[$attr]->computeLdapValue();
68  }
69  }
70  $value .= ']';
71  return $value;
72  }
73 }
__construct($ldapName, $flags, $acl="")
The constructor of IntAttribute.
This class allow to handle an attribute that stores flags based on other BooleanAttributes.
This class allow to handle easily a String LDAP attribute.