diff --git a/include/management/columns/class_LinkColumn.inc b/include/management/columns/class_LinkColumn.inc index c6847b434f9640ade350c2cb83ebb134f02f3dc1..2fb06be0de9fb4c7ce15a8d3fba375051f311b23 100644 --- a/include/management/columns/class_LinkColumn.inc +++ b/include/management/columns/class_LinkColumn.inc @@ -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'].'&PID='.$entry->getPid().'&act=listing_select_'.$entry->row.'&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'].'&PID='.$entry->getPid().'&act=listing_edit_'.$entry->row.'" title="'.$entry->dn.'">'.htmlentities($value, ENT_COMPAT, 'UTF-8').'</a>'; + return '<a href="?plug='.$_GET['plug'].'&PID='.$entry->getPid().'&act=listing_select_'.$entry->row.'&add_finish=1" title="'.$entry->dn.'">'.$htmlValue.'</a>'; } + } else { + return '<a href="?plug='.$_GET['plug'].'&PID='.$entry->getPid().'&act=listing_edit_'.$entry->row.'" title="'.$entry->dn.'">'.$htmlValue.'</a>'; } } } diff --git a/include/management/columns/class_UnixTimestampColumn.inc b/include/management/columns/class_UnixTimestampColumn.inc new file mode 100644 index 0000000000000000000000000000000000000000..63e911fb498e50c9b117b88844f181db0b752c1f --- /dev/null +++ b/include/management/columns/class_UnixTimestampColumn.inc @@ -0,0 +1,39 @@ +<?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 ' '; + } +}