diff --git a/include/simpleplugin/class_Attribute.inc b/include/simpleplugin/class_Attribute.inc index 2629af7923ea5d33a08511f2454dab2698ac65ce..77e938a538b89cbfa13d2f6f99d35a9ceee58dba 100644 --- a/include/simpleplugin/class_Attribute.inc +++ b/include/simpleplugin/class_Attribute.inc @@ -894,4 +894,25 @@ class DisplayAttribute extends DisplayLDAPAttribute $this->setInLdap(FALSE); } } -?> + +/*! \brief This class allow to display a link to an object which dn is stored in the attribute + */ +class ObjectLinkAttribute extends DisplayLDAPAttribute +{ + protected $type; + + function __construct ($label, $description, $ldapName, $required, $type, $defaultValue = "", $acl = "") + { + parent::__construct ($label, $description, $ldapName, $required, $defaultValue, $acl); + $this->type = $type; + } + + function renderFormInput () + { + try { + return objects::link($this->value, $this->type); + } catch (NonExistingLdapNodeException $e) { + return '<a><img src="geticon.php?context=status&icon=dialog-warning&size=16" alt="warning" class="center"/> '.sprintf(_('Invalid: %s'), $this->value).'</a>'; + } + } +}