29 public function __construct ($origin,
string $dn = NULL,
int $operation = NULL,
string $ldapError =
'',
int $code = 0, Throwable $previous = NULL)
32 $this->operation = $operation;
34 parent::__construct($origin,
htmlescape($ldapError), $code, $previous);
37 public function toArray (): array
39 $array = parent::toArray();
41 $typemap = [1 =>
'read',
'add',
'modify',
'delete',
'search',
'authentication'];
43 $array[
'dn'] = $this->dn;
44 if (isset($this->operation)) {
45 $array[
'operation'] = $typemap[$this->operation];
47 $array[
'errno'] = $this->getCode();
52 public function computeMsgDialogParameters (): array
56 if (isset($this->object->dn)) {
60 if (isset($this->tab) && isset($this->tab->parent->by_name[get_class($this->tab)])) {
61 $html .=
htmlescape($this->tab->parent->by_name[get_class($this->tab)].
' > ');
64 if (isset($this->attribute)) {
65 $label = $this->attribute->getLabel();
67 $html .=
'<i>'.htmlescape($this->attribute->getLdapName()).
'</i>';
73 $html .=
'<br/><br/>';
76 $typemap = [1 => _(
'read operation'), _(
'add operation'), _(
'modify operation'),
77 _(
'delete operation'), _(
'search operation'), _(
'authentication')];
79 if (isset($this->operation)) {
80 $html .=
htmlescape(sprintf(_(
'LDAP %s failed!'), $typemap[$this->operation]));
82 $html .=
htmlescape(_(
'LDAP operation failed!'));
85 if (!empty($this->dn)) {
86 $html .=
'<br/><br/><i>'.htmlescape(_(
'Object:')).
'</i> '.
htmlescape($this->dn);
89 $html .=
'<br/><br/><i>'.htmlescape(_(
'Error:')).
'</i> '.$this->htmlMessage;
91 return [_(
'LDAP error'), $html, LDAP_ERROR, FusionDirectoryError::formatTrace($this)];
htmlescape(string $str)
Escape string for HTML output.
Error returned by any method of SimplePlugin.
Error returned by an LDAP operation called from SimplePlugin.