29 protected $dialogClass = NULL;
40 function __construct ($label, $description, $ldapName, $required = FALSE, $defaultValue = [], $acl =
"")
43 $this->attribute = FALSE;
46 function addPostValue ($value)
48 $this->addValue($value, NULL);
51 function delPostValue ($key)
53 $this->removeValue($key);
56 abstract function addValue (
string $dn, $attrs = NULL);
58 function searchAndRemove ($value)
60 $row = array_search($value, $this->value);
62 $this->removeValue($row);
66 protected function removeValue ($row)
68 unset($this->value[$row]);
71 abstract function getFilterBlackList ();
73 function getFilterWhiteList ()
78 function loadPostValue ()
80 parent::loadPostValue();
81 if ($this->isVisible()) {
82 $id = $this->getHtmlId();
83 if (isset($_POST[
'add'.$id.
'_dialog'])) {
84 $this->plugin->openDialog(
new $this->dialogClass($this->plugin, $this));
85 } elseif (isset($_POST[
'add'.$id]) && isset($_POST[$id]) && $this->isTemplate()) {
86 $this->addPostValue($_POST[$id]);
91 function applyPostValue ()
95 function renderButtons ()
97 $id = $this->getHtmlId();
100 if ($this->isTemplate()) {
101 $buttons .= $this->renderInputField(
103 [
'value' => $this->editingValue,
'class' =>
'subattribute']
105 $buttons .= $this->renderInputField(
109 'formnovalidate' =>
'formnovalidate',
110 'class' =>
'subattribute',
113 $dialogButtonValue = _(
'Add (dialog)');
115 $buttons .= $this->renderInputField(
116 'submit',
'add'.$id.
'_dialog',
118 'class' =>
'dialog subattribute',
119 'value' => $dialogButtonValue,
120 'formnovalidate' =>
'formnovalidate',
123 $buttons .= $this->renderInputField(
127 'formnovalidate' =>
'formnovalidate',
128 'class' =>
'subattribute',
134 public function htmlIds (): array
136 $id = $this->getHtmlId();
137 $ids = [
'add'.$id.
'_dialog',
'del'.$id,
'row'.$id];
138 if ($this->isTemplate()) {
static delButton($escape=TRUE)
Text for an delete button.
static addButton($escape=TRUE)
Text for an add button.
This class allows to handle an attribute with a popup for selection.
This class allow to handle easily a multi-valuated attribute.
__construct($label, $description, $ldapName, $required=FALSE, $defaultValue=[], $acl="")
The constructor of DialogAttribute.
__construct(string $label, string $description, string $ldapName, bool $required=FALSE, $defaultValue='', string $acl='')
The constructor of Attribute.