Minor schema cosmetic code fixes, more Attribute implementation from old pla, start of LDAP DN view/edit

This commit is contained in:
2023-03-02 09:54:30 +11:00
parent 491f04cd5d
commit 64d1a09db4
15 changed files with 234 additions and 99 deletions

View File

@@ -9,20 +9,33 @@ use App\Classes\LDAP\Attribute\Binary;
*/
final class JpegPhoto extends Binary
{
public function __construct(string $name,array $values)
{
parent::__construct($name,$values);
$this->internal = FALSE;
}
public function __toString(): string
{
$result = '';
// We'll use finfo to try and figure out what type of image is stored
$f = new \finfo;
$result = '<table class="table table-borderless p-0 m-0"><tr>';
foreach ($this->values as $value) {
switch ($x=$f->buffer($value,FILEINFO_MIME_TYPE)) {
case 'image/jpeg':
default:
$result .= sprintf('<img class="jpegphoto" src="data:%s;base64, %s" />',$x,base64_encode($value));
$result .= sprintf('<td><img class="jpegphoto" src="data:%s;base64, %s" />%s</td>',
$x,
base64_encode($value),
$this->deletable ? sprintf('<br><span class="btn btn-sm btn-danger"><i class="fas fa-trash-alt"></i> %s</span>',__('Delete')) : '');
}
}
$result .= '</tr></table>';
return $result;
}
}