Commit ab19cc61 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(management) Add support for Unix Timestamp column

Used in alias plugin

issue #5135
parent 6fd809e2
......@@ -29,15 +29,20 @@ class LinkColumn extends Column
if ($value == '') {
return ' ';
} else {
if ($this->parent->parent instanceof selectManagement) {
if ($this->parent->getMultiSelect()) {
return '<label title="'.$entry->dn.'" for="listing_selected_'.$entry->row.'">'.htmlentities($value, ENT_COMPAT, 'UTF-8').'</label>';
} else {
return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$entry->getPid().'&amp;act=listing_select_'.$entry->row.'&amp;add_finish=1" title="'.$entry->dn.'">'.htmlentities($value, ENT_COMPAT, 'UTF-8').'</a>';
}
return $this->renderLink($entry, htmlentities($value, ENT_COMPAT, 'UTF-8'));
}
}
protected function renderLink(ListingEntry $entry, $htmlValue)
{
if ($this->parent->parent instanceof selectManagement) {
if ($this->parent->getMultiSelect()) {
return '<label title="'.$entry->dn.'" for="listing_selected_'.$entry->row.'">'.$htmlValue.'</label>';
} else {
return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$entry->getPid().'&amp;act=listing_edit_'.$entry->row.'" title="'.$entry->dn.'">'.htmlentities($value, ENT_COMPAT, 'UTF-8').'</a>';
return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$entry->getPid().'&amp;act=listing_select_'.$entry->row.'&amp;add_finish=1" title="'.$entry->dn.'">'.$htmlValue.'</a>';
}
} else {
return '<a href="?plug='.$_GET['plug'].'&amp;PID='.$entry->getPid().'&amp;act=listing_edit_'.$entry->row.'" title="'.$entry->dn.'">'.$htmlValue.'</a>';
}
}
}
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2018-2019 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*!
* \brief Column rendering unix timestamp
*/
class UnixTimestampColumn extends LinkColumn
{
protected $type = 'integer';
function renderCell(ListingEntry $entry)
{
$value = $this->getAttributeValue($entry);
if ($value != '') {
$dateObject = DateTime::createFromFormat('U', $value, new DateTimeZone('UTC'));
if (is_object($dateObject)) {
return $this->renderLink($entry, $dateObject->format('d.m.Y'));
}
}
return '&nbsp;';
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment